Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2013-11-30 07:23:13 -0500
committerGerrit Code Review @ Eclipse.org2013-12-07 03:02:40 -0500
commit947cc7a1ba512a936de135b93386f4bb08ef2bac (patch)
treed2c7df6c73e06a6ce12a56b0c34de92308356028
parent52cc6462290ecb44881e74dbe816b550cd89f447 (diff)
downloadorg.eclipse.mylyn.tasks-947cc7a1ba512a936de135b93386f4bb08ef2bac.tar.gz
org.eclipse.mylyn.tasks-947cc7a1ba512a936de135b93386f4bb08ef2bac.tar.xz
org.eclipse.mylyn.tasks-947cc7a1ba512a936de135b93386f4bb08ef2bac.zip
414360: create minimal core (creation of validate and version requests)
Change-Id: Ia2bf76c6081e44f55dbfdfc2257494d0531808a7 https://bugs.eclipse.org/bugs/show_bug.cgi?id=414360
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/META-INF/MANIFEST.MF11
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestAuthenticatedGetRequest.java88
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestClient.java40
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConnector.java120
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestCore.java (renamed from connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestCorePlugin.java)6
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestException.java32
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestHttpClient.java37
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestRequest.java117
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestRequestGetVersion.java40
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestResourceNotFoundException.java32
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestStatus.java32
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskDataHandler.java59
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskSchema.java39
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestUnauthenticatedGetRequest.java25
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestValidateRequest.java44
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestVersion.java146
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/response/data/BugzillaRestErrorResponse.java45
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/response/data/BugzillaRestLoginToken.java35
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/response/data/BugzillaRestVersionResponse.java25
19 files changed, 968 insertions, 5 deletions
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/META-INF/MANIFEST.MF b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/META-INF/MANIFEST.MF
index 1179777e7..fcacbf720 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/META-INF/MANIFEST.MF
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/META-INF/MANIFEST.MF
@@ -4,9 +4,14 @@ Bundle-Name: org.eclipse.mylyn.bugzilla.rest.core
Bundle-SymbolicName: org.eclipse.mylyn.bugzilla.rest.core;singleton:=true
Bundle-Version: 1.0.0.qualifier
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.mylyn.tasks.core;bundle-version="[3.11.0,4.0.0)",
- org.eclipse.mylyn.commons.core;bundle-version="[3.11.0,4.0.0)"
+ org.eclipse.mylyn.tasks.core,
+ org.eclipse.mylyn.commons.core,
+ org.eclipse.mylyn.commons.repositories.core,
+ org.eclipse.mylyn.commons.repositories.http.core,
+ org.apache.httpcomponents.httpclient,
+ org.apache.httpcomponents.httpcore,
+ com.google.gson;bundle-version="2.1.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.mylyn.internal.bugzilla.rest.core;x-friends:="org.eclipse.mylyn.bugzilla.rest.ui"
+Export-Package: org.eclipse.mylyn.internal.bugzilla.rest.core;x-friends:="org.eclipse.mylyn.bugzilla.rest.ui,org.eclipse.mylyn.bugzilla.rest.core.tests,org.eclipse.mylyn.bugzilla.rest.ui.tests"
Bundle-Vendor: Eclipse Mylyn
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestAuthenticatedGetRequest.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestAuthenticatedGetRequest.java
new file mode 100644
index 000000000..77b8fac90
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestAuthenticatedGetRequest.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.text.MessageFormat;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.eclipse.mylyn.commons.core.operations.IOperationMonitor;
+import org.eclipse.mylyn.commons.repositories.core.auth.AuthenticationException;
+import org.eclipse.mylyn.commons.repositories.core.auth.AuthenticationRequest;
+import org.eclipse.mylyn.commons.repositories.core.auth.AuthenticationType;
+import org.eclipse.mylyn.commons.repositories.core.auth.UserCredentials;
+import org.eclipse.mylyn.commons.repositories.http.core.CommonHttpResponse;
+import org.eclipse.mylyn.commons.repositories.http.core.HttpUtil;
+import org.eclipse.mylyn.internal.bugzilla.rest.core.response.data.BugzillaRestLoginToken;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+
+public abstract class BugzillaRestAuthenticatedGetRequest<T> extends BugzillaRestRequest<T> {
+
+ public BugzillaRestAuthenticatedGetRequest(BugzillaRestHttpClient client) {
+ super(client);
+ }
+
+ @Override
+ protected void authenticate(IOperationMonitor monitor) throws IOException {
+ UserCredentials credentials = getClient().getLocation().getCredentials(AuthenticationType.REPOSITORY);
+ if (credentials == null) {
+ throw new IllegalStateException("Authentication requested without valid credentials");
+ }
+ HttpRequestBase request = new HttpGet(baseUrl()
+ + MessageFormat.format("/login?login={0}&password={1}", new Object[] { credentials.getUserName(),
+ credentials.getPassword() }));
+ request.setHeader(CONTENT_TYPE, TEXT_XML_CHARSET_UTF_8);
+ request.setHeader(ACCEPT, APPLICATION_JSON);
+ HttpResponse response = getClient().execute(request, monitor);
+ try {
+ if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
+ getClient().setAuthenticated(false);
+ throw new AuthenticationException("Authentication failed",
+ new AuthenticationRequest<AuthenticationType<UserCredentials>>(getClient().getLocation(),
+ AuthenticationType.REPOSITORY));
+ } else {
+ TypeToken<BugzillaRestLoginToken> type = new TypeToken<BugzillaRestLoginToken>() {
+ };
+ InputStream is = response.getEntity().getContent();
+ InputStreamReader in = new InputStreamReader(is);
+ BugzillaRestLoginToken loginToken = new Gson().fromJson(in, type.getType());
+ ((BugzillaRestHttpClient) getClient()).setLoginToken(loginToken);
+ getClient().setAuthenticated(true);
+ }
+ } finally {
+ HttpUtil.release(request, response, monitor);
+ }
+ }
+
+ @Override
+ protected HttpRequestBase createHttpRequestBase() {
+ HttpRequestBase request = new HttpGet(baseUrl() + getUrlSuffix());
+ request.setHeader(CONTENT_TYPE, TEXT_XML_CHARSET_UTF_8);
+ request.setHeader(ACCEPT, APPLICATION_JSON);
+ return request;
+ }
+
+ @Override
+ protected T execute(IOperationMonitor monitor) throws IOException, BugzillaRestException {
+ HttpRequestBase request = createHttpRequestBase();
+ CommonHttpResponse response = execute(request, monitor);
+ return processAndRelease(response, monitor);
+ }
+
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestClient.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestClient.java
new file mode 100644
index 000000000..6b0c70c8c
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestClient.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.mylyn.commons.core.operations.IOperationMonitor;
+import org.eclipse.mylyn.commons.repositories.core.RepositoryLocation;
+import org.eclipse.mylyn.internal.bugzilla.rest.core.response.data.BugzillaRestErrorResponse;
+
+public class BugzillaRestClient {
+
+ private final BugzillaRestHttpClient client;
+
+ public BugzillaRestClient(RepositoryLocation location) {
+ client = new BugzillaRestHttpClient(location);
+ }
+
+ public BugzillaRestHttpClient getClient() {
+ return client;
+ }
+
+ public BugzillaRestVersion getVersion(IOperationMonitor monitor) throws BugzillaRestException {
+ return new BugzillaRestRequestGetVersion(client).run(monitor);
+ }
+
+ public boolean validate(IOperationMonitor monitor) throws BugzillaRestException {
+ BugzillaRestErrorResponse validateResponse = new BugzillaRestValidateRequest(client).run(monitor);
+ return validateResponse.isError() && validateResponse.getCode() == 32614;
+ }
+
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConnector.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConnector.java
new file mode 100644
index 000000000..da2fde3be
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConnector.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.mylyn.commons.repositories.core.RepositoryLocation;
+import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
+import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
+import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
+import org.eclipse.mylyn.tasks.core.data.TaskData;
+import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
+import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession;
+
+public class BugzillaRestConnector extends AbstractRepositoryConnector {
+ private static BugzillaRestConnector INSTANCE;
+
+ public static BugzillaRestConnector getDefault() {
+ return INSTANCE;
+ }
+
+ public BugzillaRestConnector() {
+ super();
+ INSTANCE = this;
+ }
+
+ @Override
+ public boolean canCreateNewTask(TaskRepository repository) {
+ return true;
+ }
+
+ @Override
+ public boolean canCreateTaskFromKey(TaskRepository repository) {
+ // ignore
+ return false;
+ }
+
+ @Override
+ public String getConnectorKind() {
+ return BugzillaRestCore.CONNECTOR_KIND;
+ }
+
+ @Override
+ public String getLabel() {
+ return "Bugzilla 5.0 or later with REST";
+ }
+
+ @Override
+ public String getRepositoryUrlFromTaskUrl(String taskUrl) {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public TaskData getTaskData(TaskRepository repository, String taskIdOrKey, IProgressMonitor monitor)
+ throws CoreException {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public String getTaskIdFromTaskUrl(String taskUrl) {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public String getTaskUrl(String repositoryUrl, String taskIdOrKey) {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public boolean hasTaskChanged(TaskRepository taskRepository, ITask task, TaskData taskData) {
+ // ignore
+ return false;
+ }
+
+ @Override
+ public IStatus performQuery(TaskRepository repository, IRepositoryQuery query, TaskDataCollector collector,
+ ISynchronizationSession session, IProgressMonitor monitor) {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public void updateRepositoryConfiguration(TaskRepository taskRepository, IProgressMonitor monitor)
+ throws CoreException {
+ // ignore
+
+ }
+
+ @Override
+ public void updateTaskFromTaskData(TaskRepository taskRepository, ITask task, TaskData taskData) {
+ // ignore
+
+ }
+
+ @Override
+ public AbstractTaskDataHandler getTaskDataHandler() {
+ return new BugzillaRestTaskDataHandler();
+ }
+
+ public BugzillaRestClient createClient(TaskRepository repository) {
+ BugzillaRestClient client = new BugzillaRestClient(new RepositoryLocation(repository.getProperties()));
+ return client;
+ }
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestCorePlugin.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestCore.java
index 8d6c57dcd..f67efae33 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestCorePlugin.java
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestCore.java
@@ -11,7 +11,9 @@
package org.eclipse.mylyn.internal.bugzilla.rest.core;
-
-public class BugzillaRestCorePlugin {
+public class BugzillaRestCore {
public static final String CONNECTOR_KIND = "org.eclipse.mylyn.bugzilla.rest"; //$NON-NLS-1$
+
+ public static final String ID_PLUGIN = "org.eclipse.mylyn.bugzilla.rest.core"; //$NON-NLS-1$
+
}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestException.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestException.java
new file mode 100644
index 000000000..4b2cd8834
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestException.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core;
+
+public class BugzillaRestException extends Exception {
+
+ private static final long serialVersionUID = 8562748379734170980L;
+
+ public BugzillaRestException() {
+ }
+
+ public BugzillaRestException(String message) {
+ super(message);
+ }
+
+ public BugzillaRestException(Throwable cause) {
+ super(cause.getMessage(), cause);
+ }
+
+ public BugzillaRestException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestHttpClient.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestHttpClient.java
new file mode 100644
index 000000000..0e497f9dd
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestHttpClient.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core;
+
+import org.eclipse.mylyn.commons.repositories.core.RepositoryLocation;
+import org.eclipse.mylyn.commons.repositories.http.core.CommonHttpClient;
+import org.eclipse.mylyn.internal.bugzilla.rest.core.response.data.BugzillaRestLoginToken;
+
+public class BugzillaRestHttpClient extends CommonHttpClient {
+ private BugzillaRestLoginToken loginToken = null;
+
+ public BugzillaRestHttpClient(RepositoryLocation location) {
+ super(location);
+ }
+
+ public BugzillaRestLoginToken getLoginToken() {
+ return loginToken;
+ }
+
+ public void setLoginToken(BugzillaRestLoginToken loginToken) {
+ this.loginToken = loginToken;
+ }
+
+ @Override
+ public boolean needsAuthentication() {
+ return ((loginToken == null) || super.needsAuthentication());
+ }
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestRequest.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestRequest.java
new file mode 100644
index 000000000..424a92584
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestRequest.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.eclipse.mylyn.commons.core.operations.IOperationMonitor;
+import org.eclipse.mylyn.commons.repositories.core.auth.AuthenticationException;
+import org.eclipse.mylyn.commons.repositories.core.auth.AuthenticationRequest;
+import org.eclipse.mylyn.commons.repositories.core.auth.AuthenticationType;
+import org.eclipse.mylyn.commons.repositories.core.auth.UserCredentials;
+import org.eclipse.mylyn.commons.repositories.http.core.CommonHttpOperation;
+import org.eclipse.mylyn.commons.repositories.http.core.CommonHttpResponse;
+import org.eclipse.mylyn.commons.repositories.http.core.HttpUtil;
+import org.eclipse.osgi.util.NLS;
+
+public abstract class BugzillaRestRequest<T> extends CommonHttpOperation<T> {
+ protected static final String ACCEPT = "Accept"; //$NON-NLS-1$
+
+ protected static final String CONTENT_TYPE = "Content-Type"; //$NON-NLS-1$
+
+ protected static final String APPLICATION_JSON = "application/json"; //$NON-NLS-1$
+
+ protected static final String TEXT_XML_CHARSET_UTF_8 = "text/xml; charset=UTF-8"; //$NON-NLS-1$
+
+ public BugzillaRestRequest(BugzillaRestHttpClient client) {
+ super(client);
+ }
+
+ protected abstract T execute(IOperationMonitor monitor) throws IOException, BugzillaRestException;
+
+ protected abstract T parseFromJson(InputStreamReader in);
+
+ protected abstract HttpRequestBase createHttpRequestBase();
+
+ protected String baseUrl() {
+ String url = getClient().getLocation().getUrl();
+ if (!url.endsWith("/rest.cgi")) {
+ url += "/rest.cgi";
+ }
+ return url;
+ }
+
+ protected String getUrlSuffix() {
+ return "";
+ }
+
+ public T run(IOperationMonitor monitor) throws BugzillaRestException {
+ try {
+ return execute(monitor);
+ } catch (IOException e) {
+ throw new BugzillaRestException(e);
+ }
+ }
+
+ protected T doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException,
+ BugzillaRestException {
+ InputStream is = response.getResponseEntityAsStream();
+ InputStreamReader in = new InputStreamReader(is);
+ return parseFromJson(in);
+ }
+
+ protected void doValidate(CommonHttpResponse response, IOperationMonitor monitor) throws IOException,
+ BugzillaRestException {
+ validate(response, HttpStatus.SC_OK, monitor);
+ }
+
+ protected void validate(CommonHttpResponse response, int expected, IOperationMonitor monitor)
+ throws BugzillaRestException {
+ int statusCode = response.getStatusCode();
+ if (statusCode != expected) {
+ if (statusCode == HttpStatus.SC_NOT_FOUND) {
+ throw new BugzillaRestResourceNotFoundException(NLS.bind("Requested resource ''{0}'' does not exist",
+ response.getRequestPath()));
+ }
+ throw new BugzillaRestException(NLS.bind("Unexpected response from Bugzilla REST server for ''{0}'': {1}",
+ response.getRequestPath(), HttpUtil.getStatusText(statusCode)));
+ }
+ }
+
+ protected T processAndRelease(CommonHttpResponse response, IOperationMonitor monitor) throws IOException,
+ BugzillaRestException {
+ try {
+ doValidate(response, monitor);
+ return doProcess(response, monitor);
+ } finally {
+ response.release();
+ }
+ }
+
+ @Override
+ protected void validate(HttpResponse response, IOperationMonitor monitor) throws AuthenticationException {
+ super.validate(response, monitor);
+
+ int statusCode = response.getStatusLine().getStatusCode();
+ if (statusCode == HttpStatus.SC_FORBIDDEN) {
+ AuthenticationRequest<AuthenticationType<UserCredentials>> request = new AuthenticationRequest<AuthenticationType<UserCredentials>>(
+ getClient().getLocation(), AuthenticationType.REPOSITORY);
+ throw new AuthenticationException(HttpUtil.getStatusText(statusCode), request, true);
+ }
+ }
+
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestRequestGetVersion.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestRequestGetVersion.java
new file mode 100644
index 000000000..ce7fa08b3
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestRequestGetVersion.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core;
+
+import java.io.InputStreamReader;
+
+import org.eclipse.mylyn.internal.bugzilla.rest.core.response.data.BugzillaRestVersionResponse;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+
+public class BugzillaRestRequestGetVersion extends BugzillaRestUnauthenticatedGetRequest<BugzillaRestVersion> {
+
+ public BugzillaRestRequestGetVersion(BugzillaRestHttpClient client) {
+ super(client);
+ }
+
+ @Override
+ protected String getUrlSuffix() {
+ return "/version"; //$NON-NLS-1$
+ }
+
+ @Override
+ protected BugzillaRestVersion parseFromJson(InputStreamReader in) {
+ TypeToken<BugzillaRestVersionResponse> type = new TypeToken<BugzillaRestVersionResponse>() {
+ };
+ BugzillaRestVersionResponse versionResponse = new Gson().fromJson(in, type.getType());
+ return new BugzillaRestVersion(versionResponse.getVersion());
+ }
+
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestResourceNotFoundException.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestResourceNotFoundException.java
new file mode 100644
index 000000000..cbd908485
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestResourceNotFoundException.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core;
+
+public class BugzillaRestResourceNotFoundException extends BugzillaRestException {
+
+ private static final long serialVersionUID = 5227546210820677763L;
+
+ public BugzillaRestResourceNotFoundException() {
+ }
+
+ public BugzillaRestResourceNotFoundException(String message) {
+ super(message);
+ }
+
+ public BugzillaRestResourceNotFoundException(Throwable cause) {
+ super(cause);
+ }
+
+ public BugzillaRestResourceNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestStatus.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestStatus.java
new file mode 100644
index 000000000..fa08e04f8
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestStatus.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core;
+
+import org.eclipse.core.runtime.Status;
+
+public class BugzillaRestStatus extends Status {
+ int httpStatusCode;
+
+ public BugzillaRestStatus(int severity, String pluginId, int code, String message) {
+ super(severity, pluginId, code, message, null);
+ httpStatusCode = 0;
+ }
+
+ public int getHttpStatusCode() {
+ return httpStatusCode;
+ }
+
+ public void setHttpStatusCode(int httpStatusCode) {
+ this.httpStatusCode = httpStatusCode;
+ }
+
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskDataHandler.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskDataHandler.java
new file mode 100644
index 000000000..276ce4779
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskDataHandler.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core;
+
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.mylyn.tasks.core.ITaskMapping;
+import org.eclipse.mylyn.tasks.core.RepositoryResponse;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
+import org.eclipse.mylyn.tasks.core.data.TaskData;
+
+public class BugzillaRestTaskDataHandler extends AbstractTaskDataHandler {
+
+ public BugzillaRestTaskDataHandler() {
+ // ignore
+ }
+
+ @Override
+ public RepositoryResponse postTaskData(TaskRepository repository, TaskData taskData,
+ Set<TaskAttribute> oldAttributes, IProgressMonitor monitor) throws CoreException {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public boolean initializeTaskData(TaskRepository repository, TaskData data, ITaskMapping initializationData,
+ IProgressMonitor monitor) throws CoreException {
+ // Note: setting current version to latest assumes the data arriving
+ // here is either for a new task or is
+ // fresh from the repository (not locally stored data that may not have
+ // been migrated).
+ data.setVersion("0"); //$NON-NLS-1$
+ BugzillaRestTaskSchema.getDefault().initialize(data);
+ if (initializationData != null) {
+ BugzillaRestConnector.getDefault().getTaskMapping(data).merge(initializationData);
+ }
+ return true;
+ }
+
+ @Override
+ public TaskAttributeMapper getAttributeMapper(TaskRepository repository) {
+ return new TaskAttributeMapper(repository);
+ }
+
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskSchema.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskSchema.java
new file mode 100644
index 000000000..b620c141d
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskSchema.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core;
+
+import org.eclipse.mylyn.tasks.core.data.AbstractTaskSchema;
+import org.eclipse.mylyn.tasks.core.data.DefaultTaskSchema;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+
+public class BugzillaRestTaskSchema extends AbstractTaskSchema {
+
+ private static final BugzillaRestTaskSchema instance = new BugzillaRestTaskSchema();
+
+ public static BugzillaRestTaskSchema getDefault() {
+ return instance;
+ }
+
+ private final DefaultTaskSchema parent = DefaultTaskSchema.getInstance();
+
+ public final Field DESCRIPTION = inheritFrom(parent.DESCRIPTION).create();
+
+ public final Field SUMMARY = inheritFrom(parent.SUMMARY).create();
+
+ public final Field NEW_COMMENT = inheritFrom(parent.NEW_COMMENT).create();
+
+ public final Field COMPONENT = inheritFrom(parent.COMPONENT).create();
+
+ public final Field DUMMYATTRIBUTE = createField("task.bugzilla.dummy.attribute", "Dummy Attribute", //$NON-NLS-1$ //$NON-NLS-2$
+ TaskAttribute.TYPE_SHORT_TEXT, Flag.ATTRIBUTE);
+
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestUnauthenticatedGetRequest.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestUnauthenticatedGetRequest.java
new file mode 100644
index 000000000..3c3213b52
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestUnauthenticatedGetRequest.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core;
+
+public abstract class BugzillaRestUnauthenticatedGetRequest<T> extends BugzillaRestAuthenticatedGetRequest<T> {
+
+ public BugzillaRestUnauthenticatedGetRequest(BugzillaRestHttpClient client) {
+ super(client);
+ }
+
+ @Override
+ protected boolean needsAuthentication() {
+ return false;
+ }
+
+} \ No newline at end of file
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestValidateRequest.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestValidateRequest.java
new file mode 100644
index 000000000..f0a0d0d1d
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestValidateRequest.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.http.HttpStatus;
+import org.eclipse.mylyn.commons.core.operations.IOperationMonitor;
+import org.eclipse.mylyn.commons.repositories.http.core.CommonHttpResponse;
+import org.eclipse.mylyn.internal.bugzilla.rest.core.response.data.BugzillaRestErrorResponse;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+
+public class BugzillaRestValidateRequest extends BugzillaRestAuthenticatedGetRequest<BugzillaRestErrorResponse> {
+
+ public BugzillaRestValidateRequest(BugzillaRestHttpClient client) {
+ super(client);
+ }
+
+ @Override
+ protected void doValidate(CommonHttpResponse response, IOperationMonitor monitor) throws IOException,
+ BugzillaRestException {
+ validate(response, HttpStatus.SC_BAD_REQUEST, monitor);
+ }
+
+ @Override
+ protected BugzillaRestErrorResponse parseFromJson(InputStreamReader in) {
+ TypeToken<BugzillaRestErrorResponse> type = new TypeToken<BugzillaRestErrorResponse>() {
+ };
+ return new Gson().fromJson(in, type.getType());
+ }
+
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestVersion.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestVersion.java
new file mode 100644
index 000000000..b1ab0fb41
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestVersion.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.bugzilla.rest.core;
+
+import java.io.Serializable;
+
+/**
+ * @author Frank Becker
+ */
+public class BugzillaRestVersion implements Comparable<BugzillaRestVersion>, Serializable {
+
+ private static final long serialVersionUID = 2027987556171301044L;
+
+ public final static BugzillaRestVersion MIN_VERSION = new BugzillaRestVersion("4.5.1+"); //$NON-NLS-1$
+
+ public final static BugzillaRestVersion BUGZILLA_4_5_1 = new BugzillaRestVersion("4.5.1+"); //$NON-NLS-1$
+
+ public final static BugzillaRestVersion BUGZILLA_5_0 = new BugzillaRestVersion("5.0"); //$NON-NLS-1$
+
+ public final static BugzillaRestVersion MAX_VERSION = BUGZILLA_5_0;
+
+ private final int major;
+
+ private final int minor;
+
+ private int micro;
+
+ private final boolean rc;
+
+ private final boolean plus;
+
+ public BugzillaRestVersion(String version) {
+ String[] segments;
+ if (version == null) {
+ segments = new String[0];
+ rc = false;
+ plus = false;
+ } else {
+ version = version.toUpperCase();
+ rc = version.contains("RC"); //$NON-NLS-1$
+ plus = version.contains("+"); //$NON-NLS-1$
+ if (plus) {
+ version = version.replace("+", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ segments = rc ? version.split("(\\.|([R][C]))") : version.split("\\."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ major = segments.length > 0 ? parse(segments[0]) : 0;
+ minor = segments.length > 1 ? parse(segments[1]) : 0;
+ micro = segments.length > 2 ? parse(segments[2]) : 0;
+ if (rc) {
+ micro -= 100;
+ }
+ }
+
+ private int parse(String segment) {
+ try {
+ return segment.length() == 0 ? 0 : Integer.parseInt(getVersion(segment));
+ } catch (NumberFormatException ex) {
+ return 0;
+ }
+ }
+
+ private String getVersion(String segment) {
+ int n = segment.indexOf('-');
+ return n == -1 ? segment : segment.substring(0, n);
+ }
+
+ public boolean isSmallerOrEquals(BugzillaRestVersion v) {
+ return compareTo(v) <= 0;
+ }
+
+ public boolean isSmaller(BugzillaRestVersion v) {
+ return compareTo(v) < 0;
+ }
+
+ public int compareTo(BugzillaRestVersion v) {
+ if (major < v.major) {
+ return -1;
+ } else if (major > v.major) {
+ return 1;
+ }
+
+ if (minor < v.minor) {
+ return -1;
+ } else if (minor > v.minor) {
+ return 1;
+ }
+
+ if (micro < v.micro) {
+ return -1;
+ } else if (micro > v.micro) {
+ return 1;
+ }
+
+ if (plus != v.plus) {
+ if (plus) {
+ return 1;
+ } else {
+ return -1;
+ }
+ }
+
+ return 0;
+ }
+
+ public int compareMajorMinorOnly(BugzillaRestVersion v) {
+ if (major < v.major) {
+ return -1;
+ } else if (major > v.major) {
+ return 1;
+ }
+
+ if (minor < v.minor) {
+ return -1;
+ } else if (minor > v.minor) {
+ return 1;
+ }
+ return 0;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(Integer.toString(major));
+ sb.append(".").append(Integer.toString(minor)); //$NON-NLS-1$
+ if (micro > 0) {
+ sb.append(".").append(Integer.toString(micro)); //$NON-NLS-1$
+ } else if (micro < 0) {
+ sb.append("RC").append(Integer.toString(micro + 100)); //$NON-NLS-1$
+ }
+ if (plus) {
+ sb.append("+"); //$NON-NLS-1$
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/response/data/BugzillaRestErrorResponse.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/response/data/BugzillaRestErrorResponse.java
new file mode 100644
index 000000000..3e467fe88
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/response/data/BugzillaRestErrorResponse.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core.response.data;
+
+public class BugzillaRestErrorResponse {
+ private boolean error;
+
+ private String message;
+
+ private int code;
+
+ public boolean isError() {
+ return error;
+ }
+
+ public void setError(boolean error) {
+ this.error = error;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/response/data/BugzillaRestLoginToken.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/response/data/BugzillaRestLoginToken.java
new file mode 100644
index 000000000..a8cbe0baa
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/response/data/BugzillaRestLoginToken.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core.response.data;
+
+public class BugzillaRestLoginToken {
+ private String id;
+
+ private String token;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getToken() {
+ return token;
+ }
+
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/response/data/BugzillaRestVersionResponse.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/response/data/BugzillaRestVersionResponse.java
new file mode 100644
index 000000000..8adf5eea6
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/response/data/BugzillaRestVersionResponse.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.bugzilla.rest.core.response.data;
+
+public class BugzillaRestVersionResponse {
+
+ private String version;
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+}

Back to the top