Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2010-04-11 19:49:57 +0000
committerfbecker2010-04-11 19:49:57 +0000
commit91f5a311a05552b28fba0cb1f1a80c1383a2f743 (patch)
tree3acbb4d0928ebbe3871683d7eba82123a7d7ae14 /org.eclipse.mylyn.tasks.core
parent21b5fddc2d986a59d2c751b17fa632729def2637 (diff)
downloadorg.eclipse.mylyn.tasks-91f5a311a05552b28fba0cb1f1a80c1383a2f743.tar.gz
org.eclipse.mylyn.tasks-91f5a311a05552b28fba0cb1f1a80c1383a2f743.tar.xz
org.eclipse.mylyn.tasks-91f5a311a05552b28fba0cb1f1a80c1383a2f743.zip
ASSIGNED - bug 282211: create Webservice API
https://bugs.eclipse.org/bugs/show_bug.cgi?id=282211 revert see comment#11
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseHttpMethodInterceptor.java26
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXMLRPCTransportFactory.java284
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXmlRpcClient.java36
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXmlRpcClientRequest.java36
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXmlRpcClientRequestImpl.java34
6 files changed, 2 insertions, 420 deletions
diff --git a/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF
index 8083e94a6..b9018cbd8 100644
--- a/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF
@@ -9,8 +9,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.net,
org.eclipse.equinox.security,
org.eclipse.mylyn.commons.core;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.mylyn.commons.net;bundle-version="[3.0.0,4.0.0)",
- org.apache.xmlrpc;bundle-version="[3.0.0,4.0.0)"
+ org.eclipse.mylyn.commons.net;bundle-version="[3.0.0,4.0.0)"
Export-Package: org.eclipse.mylyn.internal.provisional.tasks.core;x-internal:=true,
org.eclipse.mylyn.internal.tasks.core;x-friends:="org.eclipse.mylyn.tasks.ui,org.eclipse.mylyn.tasks.bugs",
org.eclipse.mylyn.internal.tasks.core.data;x-friends:="org.eclipse.mylyn.tasks.ui,org.eclipse.mylyn.tasks.bugs",
@@ -18,6 +17,5 @@ Export-Package: org.eclipse.mylyn.internal.provisional.tasks.core;x-internal:=tr
org.eclipse.mylyn.internal.tasks.core.sync;x-friends:="org.eclipse.mylyn.tasks.ui,org.eclipse.mylyn.tasks.bugs",
org.eclipse.mylyn.tasks.core,
org.eclipse.mylyn.tasks.core.data,
- org.eclipse.mylyn.tasks.core.sync,
- org.eclipse.mylyn.tasks.core.service
+ org.eclipse.mylyn.tasks.core.sync
Bundle-Localization: plugin
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseHttpMethodInterceptor.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseHttpMethodInterceptor.java
deleted file mode 100644
index ac0282547..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseHttpMethodInterceptor.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Frank Becker and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Frank Becker - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.core.service;
-
-import org.apache.commons.httpclient.HttpMethod;
-
-/**
- * @author Frank Becker
- * @author Steffen Pingel
- */
-public interface BaseHttpMethodInterceptor {
-
- public abstract void processRequest(HttpMethod method);
-
- public abstract void processResponse(HttpMethod method);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXMLRPCTransportFactory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXMLRPCTransportFactory.java
deleted file mode 100644
index 436865817..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXMLRPCTransportFactory.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Frank Becker and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Frank Becker - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.core.service;
-
-import java.io.BufferedOutputStream;
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HostConfiguration;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.HttpVersion;
-import org.apache.commons.httpclient.auth.AuthScheme;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.RequestEntity;
-import org.apache.xmlrpc.XmlRpcException;
-import org.apache.xmlrpc.XmlRpcRequest;
-import org.apache.xmlrpc.client.XmlRpcClient;
-import org.apache.xmlrpc.client.XmlRpcClientException;
-import org.apache.xmlrpc.client.XmlRpcHttpClientConfig;
-import org.apache.xmlrpc.client.XmlRpcHttpTransport;
-import org.apache.xmlrpc.client.XmlRpcTransport;
-import org.apache.xmlrpc.client.XmlRpcTransportFactory;
-import org.apache.xmlrpc.common.XmlRpcStreamRequestConfig;
-import org.apache.xmlrpc.util.HttpUtil;
-import org.apache.xmlrpc.util.XmlRpcIOException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.mylyn.commons.net.AbstractWebLocation;
-import org.eclipse.mylyn.commons.net.WebUtil;
-import org.xml.sax.SAXException;
-
-/**
- * @author Frank Becker
- * @author Steffen Pingel
- */
-public class BaseXMLRPCTransportFactory implements XmlRpcTransportFactory {
- /**
- * A transport that uses the Apache HttpClient library.
- */
- public static class BaseHttpClientTransport extends XmlRpcHttpTransport {
-
- private final HttpClient httpClient;
-
- private final AbstractWebLocation location;
-
- private PostMethod method;
-
- private int contentLength = -1;
-
- private XmlRpcHttpClientConfig config;
-
- private IProgressMonitor monitor;
-
- private HostConfiguration hostConfiguration;
-
- private final BaseHttpMethodInterceptor interceptor;
-
- public BaseHttpClientTransport(XmlRpcClient client, HttpClient httpClient, AbstractWebLocation location,
- BaseHttpMethodInterceptor interceptor) {
- super(client, ""); //$NON-NLS-1$
- this.httpClient = httpClient;
- this.location = location;
- this.interceptor = interceptor;
- }
-
- @Override
- protected void close() throws XmlRpcClientException {
- method.releaseConnection();
- }
-
- public int getContentLength() {
- return contentLength;
- }
-
- @Override
- protected InputStream getInputStream() throws XmlRpcException {
- int responseCode = method.getStatusCode();
- if (responseCode != java.net.HttpURLConnection.HTTP_OK) {
- BaseHttpException e = new BaseHttpException(responseCode);
- if (responseCode == HttpStatus.SC_UNAUTHORIZED) {
- e.setAuthScheme(method.getHostAuthState().getAuthScheme());
- }
- throw e;
- }
-
- try {
- return method.getResponseBodyAsStream();
- } catch (HttpException e) {
- throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e); //$NON-NLS-1$
- } catch (IOException e) {
- throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e); //$NON-NLS-1$
- }
- }
-
- @Override
- protected String getUserAgent() {
- return WebUtil.getUserAgent(""); //$NON-NLS-1$
- }
-
- @Override
- protected void initHttpHeaders(XmlRpcRequest request) throws XmlRpcClientException {
- config = (XmlRpcHttpClientConfig) request.getConfig();
-
- if (request instanceof BaseXmlRpcClientRequestImpl) {
- BaseXmlRpcClientRequestImpl repositoryRequest = (BaseXmlRpcClientRequestImpl) request;
- monitor = repositoryRequest.getProgressMonitor();
- } else {
- monitor = null;
- }
-
- String url = config.getServerURL().toString();
- hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor);
- method = new PostMethod(WebUtil.getRequestPath(url));
-
- super.initHttpHeaders(request);
-
- if (config.getConnectionTimeout() != 0) {
- httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(config.getConnectionTimeout());
- }
-
- if (config.getReplyTimeout() != 0) {
- httpClient.getHttpConnectionManager().getParams().setSoTimeout(config.getConnectionTimeout());
- }
-
- method.getParams().setVersion(HttpVersion.HTTP_1_1);
-
- if (interceptor != null) {
- interceptor.processRequest(method);
- }
- }
-
- @Override
- protected boolean isResponseGzipCompressed(XmlRpcStreamRequestConfig config) {
- Header header = method.getResponseHeader("Content-Encoding"); //$NON-NLS-1$
- return header != null && HttpUtil.isUsingGzipEncoding(header.getValue());
- }
-
- @Override
- protected void setContentLength(int contentLength) {
- this.contentLength = contentLength;
- }
-
- @Override
- protected void setCredentials(XmlRpcHttpClientConfig config) throws XmlRpcClientException {
- // handled by TracXmlRpcClient
- }
-
- @Override
- protected void setRequestHeader(String header, String value) {
- method.setRequestHeader(new Header(header, value));
- }
-
- @Override
- protected void writeRequest(final ReqWriter writer) throws XmlRpcException {
- method.setRequestEntity(new RequestEntity() {
- public long getContentLength() {
- return BaseHttpClientTransport.this.getContentLength();
- }
-
- public String getContentType() {
- return "text/xml"; //$NON-NLS-1$
- }
-
- public boolean isRepeatable() {
- return getContentLength() != -1;
- }
-
- public void writeRequest(OutputStream pOut) throws IOException {
- try {
- /* Make sure, that the socket is not closed by replacing it with our
- * own BufferedOutputStream.
- */
- OutputStream ostream;
- if (isUsingByteArrayOutput(config)) {
- // No need to buffer the output.
- ostream = new FilterOutputStream(pOut) {
- @Override
- public void close() throws IOException {
- flush();
- }
- };
- } else {
- ostream = new BufferedOutputStream(pOut) {
- @Override
- public void close() throws IOException {
- flush();
- }
- };
- }
- writer.write(ostream);
- } catch (XmlRpcException e) {
- throw new XmlRpcIOException(e);
- } catch (SAXException e) {
- throw new XmlRpcIOException(e);
- }
- }
- });
-
- try {
- WebUtil.execute(httpClient, hostConfiguration, method, monitor);
- if (interceptor != null) {
- interceptor.processResponse(method);
- }
- } catch (XmlRpcIOException e) {
- Throwable t = e.getLinkedException();
- if (t instanceof XmlRpcException) {
- throw (XmlRpcException) t;
- } else {
- throw new XmlRpcException("Unexpected exception: " + t.getMessage(), t); //$NON-NLS-1$
- }
- } catch (IOException e) {
- throw new XmlRpcException("I/O error while communicating with HTTP server: " + e.getMessage(), e); //$NON-NLS-1$
- }
- }
-
- }
-
- public static class BaseHttpException extends XmlRpcException {
-
- private static final long serialVersionUID = -6088919818534852787L;
-
- private AuthScheme authScheme;
-
- public BaseHttpException(int responseCode) {
- super(responseCode, "HTTP Error " + responseCode); //$NON-NLS-1$
- }
-
- public AuthScheme getAuthScheme() {
- return authScheme;
- }
-
- public void setAuthScheme(AuthScheme authScheme) {
- this.authScheme = authScheme;
- }
-
- }
-
- private final XmlRpcClient xmlRpcClient;
-
- private AbstractWebLocation location;
-
- private final HttpClient httpClient;
-
- private BaseHttpMethodInterceptor interceptor;
-
- public BaseXMLRPCTransportFactory(XmlRpcClient xmlRpcClient, HttpClient httpClient) {
- this.xmlRpcClient = xmlRpcClient;
- this.httpClient = httpClient;
- }
-
- public AbstractWebLocation getLocation() {
- return location;
- }
-
- public XmlRpcTransport getTransport() {
- return new BaseHttpClientTransport(xmlRpcClient, httpClient, location, interceptor);
- }
-
- public void setLocation(AbstractWebLocation location) {
- this.location = location;
- }
-
- public BaseHttpMethodInterceptor getInterceptor() {
- return interceptor;
- }
-
- public void setInterceptor(BaseHttpMethodInterceptor interceptor) {
- this.interceptor = interceptor;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXmlRpcClient.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXmlRpcClient.java
deleted file mode 100644
index 2ba50cce5..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXmlRpcClient.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Frank Becker and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Frank Becker - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.core.service;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.xmlrpc.client.XmlRpcClient;
-import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * @author Frank Becker
- * @author Steffen Pingel
- */
-public class BaseXmlRpcClient {
- protected XmlRpcClientConfigImpl xmlConfig;
-
- protected XmlRpcClient xmlrpc;
-
- protected HttpClient httpClient;
-
- protected final TaskRepository repository;
-
- public BaseXmlRpcClient(TaskRepository repository) {
- this.repository = repository;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXmlRpcClientRequest.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXmlRpcClientRequest.java
deleted file mode 100644
index 332778554..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXmlRpcClientRequest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Frank Becker and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Frank Becker - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.core.service;
-
-import org.apache.xmlrpc.XmlRpcRequestConfig;
-import org.apache.xmlrpc.client.XmlRpcClientRequestImpl;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * @author Frank Becker
- * @author Steffen Pingel
- */
-public class BaseXmlRpcClientRequest extends XmlRpcClientRequestImpl {
-
- private final IProgressMonitor progressMonitor;
-
- public BaseXmlRpcClientRequest(XmlRpcRequestConfig config, String methodName, Object[] params,
- IProgressMonitor monitor) {
- super(config, methodName, params);
- this.progressMonitor = monitor;
- }
-
- public IProgressMonitor getProgressMonitor() {
- return progressMonitor;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXmlRpcClientRequestImpl.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXmlRpcClientRequestImpl.java
deleted file mode 100644
index 6ae639a3c..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/service/BaseXmlRpcClientRequestImpl.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Frank Becker and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Frank Becker - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.core.service;
-
-import org.apache.xmlrpc.XmlRpcRequestConfig;
-import org.apache.xmlrpc.client.XmlRpcClientRequestImpl;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * @author Frank Becker
- * @author Steffen Pingel
- */
-public class BaseXmlRpcClientRequestImpl extends XmlRpcClientRequestImpl {
- private final IProgressMonitor progressMonitor;
-
- public BaseXmlRpcClientRequestImpl(XmlRpcRequestConfig config, String methodName, Object[] params,
- IProgressMonitor monitor) {
- super(config, methodName, params);
- this.progressMonitor = monitor;
- }
-
- public IProgressMonitor getProgressMonitor() {
- return progressMonitor;
- }
-}

Back to the top