From 084c45c60fc7a165829f21c535299b22ed0620fd Mon Sep 17 00:00:00 2001 From: Roberto E. Escobar Date: Fri, 13 Jun 2014 15:35:17 -0700 Subject: refactor: Rename WebClientProvider to JaxRsClient Change-Id: I1622fbde33c53f8d1c99c570df0c9d749b8ef6be --- .../OSGI-INF/account.rest.client.xml | 2 +- .../rest/client/internal/AccountClientImpl.java | 38 +++++------ .../OSGI-INF/web.client.provider.xml | 4 +- .../org/eclipse/osee/jaxrs/client/JaxRsClient.java | 28 ++++++++ .../osee/jaxrs/client/WebClientProvider.java | 31 --------- .../jaxrs/client/internal/JaxRsClientImpl.java | 67 ++++++++++++++++++++ .../internal/StandadloneWebClientProvider.java | 2 +- .../jaxrs/client/internal/StandaloneModule.java | 4 +- .../client/internal/WebClientProviderImpl.java | 74 ---------------------- .../OSGI-INF/osee.client.xml | 2 +- .../orcs/rest/client/internal/OseeClientImpl.java | 14 ++-- .../client/internal/search/QueryExecutorV1.java | 6 +- .../OSGI-INF/ote.master.rest.client.xml | 2 +- .../ote/master/rest/client/internal/AddServer.java | 6 +- .../rest/client/internal/GetAvailableServers.java | 6 +- .../rest/client/internal/OTEMasterServerImpl.java | 14 ++-- .../master/rest/client/internal/RemoveServer.java | 6 +- .../OSGI-INF/ote.client.xml | 2 +- .../rest/client/internal/ConfigureOteServer.java | 8 +-- .../ote/rest/client/internal/GetOteServerFile.java | 6 +- .../ote/rest/client/internal/OteClientImpl.java | 18 +++--- .../rest/client/internal/PrepareOteServerFile.java | 6 +- .../osee/ote/rest/client/internal/RunTests.java | 6 +- 23 files changed, 171 insertions(+), 181 deletions(-) create mode 100644 plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClient.java delete mode 100644 plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/WebClientProvider.java create mode 100644 plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientImpl.java delete mode 100644 plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/WebClientProviderImpl.java diff --git a/plugins/org.eclipse.osee.account.rest.client/OSGI-INF/account.rest.client.xml b/plugins/org.eclipse.osee.account.rest.client/OSGI-INF/account.rest.client.xml index f244843eb57..85b25f48752 100644 --- a/plugins/org.eclipse.osee.account.rest.client/OSGI-INF/account.rest.client.xml +++ b/plugins/org.eclipse.osee.account.rest.client/OSGI-INF/account.rest.client.xml @@ -4,5 +4,5 @@ - + diff --git a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java index 2b7afe6e6eb..04485d28b33 100644 --- a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java +++ b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java @@ -32,8 +32,8 @@ import org.eclipse.osee.account.rest.model.AccountSessionDetailsData; import org.eclipse.osee.account.rest.model.SubscriptionData; import org.eclipse.osee.framework.jdk.core.type.ResultSet; import org.eclipse.osee.framework.jdk.core.type.ResultSets; +import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.jaxrs.client.OseeClientProperties; -import org.eclipse.osee.jaxrs.client.WebClientProvider; import com.google.inject.Inject; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.UniformInterfaceException; @@ -44,12 +44,12 @@ import com.sun.jersey.api.client.WebResource; */ public class AccountClientImpl implements AccountClient { - private WebClientProvider clientProvider; + private JaxRsClient client; private URI serverUri; @Inject - public void setWebClientProvider(WebClientProvider clientProvider) { - this.clientProvider = clientProvider; + public void setJaxRsClient(JaxRsClient client) { + this.client = client; } public void start() { @@ -66,11 +66,11 @@ public class AccountClientImpl implements AccountClient { } private T get(URI uri, Class clazz) { - WebResource resource = clientProvider.createResource(uri); + WebResource resource = client.createResource(uri); try { return resource.accept(MediaType.APPLICATION_JSON_TYPE).get(clazz); } catch (UniformInterfaceException ex) { - throw clientProvider.handleException(ex); + throw client.handleException(ex); } } @@ -85,11 +85,11 @@ public class AccountClientImpl implements AccountClient { data.setPassword(password); data.setScheme(scheme); - WebResource resource = clientProvider.createResource(uri); + WebResource resource = client.createResource(uri); try { return resource.post(AccountSessionData.class, data); } catch (UniformInterfaceException ex) { - throw clientProvider.handleException(ex); + throw client.handleException(ex); } } @@ -99,7 +99,7 @@ public class AccountClientImpl implements AccountClient { .path(AccountContexts.ACCOUNT_LOGOUT)// .build(); - WebResource resource = clientProvider.createResource(uri); + WebResource resource = client.createResource(uri); int status; try { ClientResponse response = resource.post(ClientResponse.class, session); @@ -108,7 +108,7 @@ public class AccountClientImpl implements AccountClient { ClientResponse clientResponse = ex.getResponse(); status = clientResponse.getStatus(); if (Status.NOT_MODIFIED.getStatusCode() != status) { - throw clientProvider.handleException(ex); + throw client.handleException(ex); } } return Status.OK.getStatusCode() == status; @@ -120,14 +120,14 @@ public class AccountClientImpl implements AccountClient { .path(AccountContexts.ACCOUNT_USERNAME_TEMPLATE)// .build(userName); - WebResource resource = clientProvider.createResource(uri); + WebResource resource = client.createResource(uri); try { AccountInfoData data = resource.accept(MediaType.APPLICATION_JSON_TYPE).type(MediaType.APPLICATION_JSON_TYPE).post( AccountInfoData.class, input); return data; } catch (UniformInterfaceException ex) { - throw clientProvider.handleException(ex); + throw client.handleException(ex); } } @@ -136,13 +136,13 @@ public class AccountClientImpl implements AccountClient { URI uri = newBuilder()// .path(AccountContexts.ACCOUNT_ID_TEMPLATE)// .build(accountId); - WebResource resource = clientProvider.createResource(uri); + WebResource resource = client.createResource(uri); ClientResponse response; try { response = resource.delete(ClientResponse.class); } catch (UniformInterfaceException ex) { - throw clientProvider.handleException(ex); + throw client.handleException(ex); } int status = response.getStatus(); return Status.OK.getStatusCode() == status; @@ -190,7 +190,7 @@ public class AccountClientImpl implements AccountClient { .path(AccountContexts.ACCOUNT_ID_TEMPLATE)// .path(AccountContexts.ACCOUNT_ACTIVE)// .build(accountId); - WebResource resource = clientProvider.createResource(uri); + WebResource resource = client.createResource(uri); boolean result; if (active) { result = setAccountActive(resource); @@ -219,7 +219,7 @@ public class AccountClientImpl implements AccountClient { ClientResponse clientResponse = ex.getResponse(); status = clientResponse.getStatus(); if (Status.NOT_MODIFIED.getStatusCode() != status) { - throw clientProvider.handleException(ex); + throw client.handleException(ex); } } return Status.OK.getStatusCode() == status; @@ -234,7 +234,7 @@ public class AccountClientImpl implements AccountClient { ClientResponse clientResponse = ex.getResponse(); status = clientResponse.getStatus(); if (Status.NOT_MODIFIED.getStatusCode() != status) { - throw clientProvider.handleException(ex); + throw client.handleException(ex); } } return Status.OK.getStatusCode() == status; @@ -250,7 +250,7 @@ public class AccountClientImpl implements AccountClient { AccountPreferencesInput input = new AccountPreferencesInput(); input.setMap(preferences); - WebResource resource = clientProvider.createResource(uri); + WebResource resource = client.createResource(uri); int status; try { ClientResponse response = resource.put(ClientResponse.class, input); @@ -259,7 +259,7 @@ public class AccountClientImpl implements AccountClient { ClientResponse clientResponse = ex.getResponse(); status = clientResponse.getStatus(); if (Status.NOT_MODIFIED.getStatusCode() != status) { - throw clientProvider.handleException(ex); + throw client.handleException(ex); } } return Status.OK.getStatusCode() == status; diff --git a/plugins/org.eclipse.osee.jaxrs.client/OSGI-INF/web.client.provider.xml b/plugins/org.eclipse.osee.jaxrs.client/OSGI-INF/web.client.provider.xml index 319c0f619af..cdd564872f8 100644 --- a/plugins/org.eclipse.osee.jaxrs.client/OSGI-INF/web.client.provider.xml +++ b/plugins/org.eclipse.osee.jaxrs.client/OSGI-INF/web.client.provider.xml @@ -1,7 +1,7 @@ - + - + diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClient.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClient.java new file mode 100644 index 00000000000..d844de6be05 --- /dev/null +++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClient.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2012 Boeing. + * 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: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.jaxrs.client; + +import java.net.URI; +import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; +import com.sun.jersey.api.client.UniformInterfaceException; +import com.sun.jersey.api.client.WebResource; + +/** + * @author John Misinco + * @author Roberto E. Escobar + */ +public interface JaxRsClient { + + WebResource createResource(URI uri) throws OseeCoreException; + + RuntimeException handleException(UniformInterfaceException ex); + +} \ No newline at end of file diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/WebClientProvider.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/WebClientProvider.java deleted file mode 100644 index 9f2421e82b4..00000000000 --- a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/WebClientProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Boeing. - * 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: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.jaxrs.client; - -import java.net.URI; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import com.sun.jersey.api.client.AsyncWebResource; -import com.sun.jersey.api.client.UniformInterfaceException; -import com.sun.jersey.api.client.WebResource; - -/** - * @author John Misinco - * @author Roberto E. Escobar - */ -public interface WebClientProvider { - - WebResource createResource(URI uri) throws OseeCoreException; - - AsyncWebResource createAsyncResource(URI uri) throws OseeCoreException; - - RuntimeException handleException(UniformInterfaceException ex); - -} \ No newline at end of file diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientImpl.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientImpl.java new file mode 100644 index 00000000000..30b9bfcbc2c --- /dev/null +++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientImpl.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2013 Boeing. + * 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: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.jaxrs.client.internal; + +import java.net.URI; +import java.util.Map; +import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; +import org.eclipse.osee.jaxrs.ErrorResponse; +import org.eclipse.osee.jaxrs.client.JaxRsClient; +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.UniformInterfaceException; +import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.api.client.config.ClientConfig; +import com.sun.jersey.client.apache.ApacheHttpClient; +import com.sun.jersey.client.apache.config.DefaultApacheHttpClientConfig; + +/** + * @author Roberto E. Escobar + */ +public class JaxRsClientImpl implements JaxRsClient { + + private Client client; + + @Override + public WebResource createResource(URI uri) { + Client client = createClient(uri); + return client.resource(uri); + } + + @Override + public RuntimeException handleException(UniformInterfaceException ex) { + String message = null; + try { + ClientResponse response = ex.getResponse(); + ErrorResponse error = response.getEntity(ErrorResponse.class); + message = error != null ? error.toString() : "Error message not available."; + } catch (Throwable th) { + message = String.format("Error Response object not available - [%s]", th.getLocalizedMessage()); + } + return new OseeCoreException(ex, message); + } + + protected void configure(URI uri, Map properties) { + properties.put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, true); + } + + private Client createClient(URI uri) { + if (client == null) { + DefaultApacheHttpClientConfig clientConfig = new DefaultApacheHttpClientConfig(); + Map properties = clientConfig.getProperties(); + properties.put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, true); + configure(uri, properties); + client = ApacheHttpClient.create(clientConfig); + } + return client; + } + +} diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/StandadloneWebClientProvider.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/StandadloneWebClientProvider.java index fe5d7694196..009f75631af 100644 --- a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/StandadloneWebClientProvider.java +++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/StandadloneWebClientProvider.java @@ -21,7 +21,7 @@ import com.sun.jersey.client.apache.config.ApacheHttpClientConfig; /** * @author Roberto E. Escobar */ -public class StandadloneWebClientProvider extends WebClientProviderImpl { +public class StandadloneWebClientProvider extends JaxRsClientImpl { private final String proxyAddress; diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/StandaloneModule.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/StandaloneModule.java index d31bc1a0af8..a3c08826cb2 100644 --- a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/StandaloneModule.java +++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/StandaloneModule.java @@ -13,7 +13,7 @@ package org.eclipse.osee.jaxrs.client.internal; import org.eclipse.osee.jaxrs.client.OseeClientConfig; import org.eclipse.osee.jaxrs.client.OseeHttpProxyAddress; import org.eclipse.osee.jaxrs.client.OseeServerAddress; -import org.eclipse.osee.jaxrs.client.WebClientProvider; +import org.eclipse.osee.jaxrs.client.JaxRsClient; import com.google.inject.AbstractModule; /** @@ -32,6 +32,6 @@ public class StandaloneModule extends AbstractModule { bindConstant().annotatedWith(OseeServerAddress.class).to(config.getServerAddress()); bindConstant().annotatedWith(OseeHttpProxyAddress.class).to(config.getProxyAddress()); - bind(WebClientProvider.class).to(StandadloneWebClientProvider.class); + bind(JaxRsClient.class).to(StandadloneWebClientProvider.class); } } diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/WebClientProviderImpl.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/WebClientProviderImpl.java deleted file mode 100644 index 3096d3f5492..00000000000 --- a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/WebClientProviderImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * 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: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.jaxrs.client.internal; - -import java.net.URI; -import java.util.Map; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.jaxrs.ErrorResponse; -import org.eclipse.osee.jaxrs.client.WebClientProvider; -import com.sun.jersey.api.client.AsyncWebResource; -import com.sun.jersey.api.client.Client; -import com.sun.jersey.api.client.ClientResponse; -import com.sun.jersey.api.client.UniformInterfaceException; -import com.sun.jersey.api.client.WebResource; -import com.sun.jersey.api.client.config.ClientConfig; -import com.sun.jersey.client.apache.ApacheHttpClient; -import com.sun.jersey.client.apache.config.DefaultApacheHttpClientConfig; - -/** - * @author Roberto E. Escobar - */ -public class WebClientProviderImpl implements WebClientProvider { - - private Client client; - - @Override - public WebResource createResource(URI uri) { - Client client = createClient(uri); - return client.resource(uri); - } - - @Override - public AsyncWebResource createAsyncResource(URI uri) { - Client client = createClient(uri); - return client.asyncResource(uri); - } - - @Override - public RuntimeException handleException(UniformInterfaceException ex) { - String message = null; - try { - ClientResponse response = ex.getResponse(); - ErrorResponse error = response.getEntity(ErrorResponse.class); - message = error != null ? error.toString() : "Error message not available."; - } catch (Throwable th) { - message = String.format("Error Response object not available - [%s]", th.getLocalizedMessage()); - } - return new OseeCoreException(ex, message); - } - - protected void configure(URI uri, Map properties) { - properties.put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, true); - } - - private Client createClient(URI uri) { - if (client == null) { - DefaultApacheHttpClientConfig clientConfig = new DefaultApacheHttpClientConfig(); - Map properties = clientConfig.getProperties(); - properties.put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, true); - configure(uri, properties); - client = ApacheHttpClient.create(clientConfig); - } - return client; - } - -} diff --git a/plugins/org.eclipse.osee.orcs.rest.client/OSGI-INF/osee.client.xml b/plugins/org.eclipse.osee.orcs.rest.client/OSGI-INF/osee.client.xml index fa3684b5026..d8217c57541 100644 --- a/plugins/org.eclipse.osee.orcs.rest.client/OSGI-INF/osee.client.xml +++ b/plugins/org.eclipse.osee.orcs.rest.client/OSGI-INF/osee.client.xml @@ -4,5 +4,5 @@ - + diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java index 768ab0ce087..da8aef52280 100644 --- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java +++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java @@ -17,8 +17,8 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriBuilder; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.data.OseeCodeVersion; +import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.jaxrs.client.OseeClientProperties; -import org.eclipse.osee.jaxrs.client.WebClientProvider; import org.eclipse.osee.orcs.rest.client.OseeClient; import org.eclipse.osee.orcs.rest.client.QueryBuilder; import org.eclipse.osee.orcs.rest.client.internal.search.PredicateFactory; @@ -42,16 +42,16 @@ public class OseeClientImpl implements OseeClient, BaseUriBuilder { private PredicateFactory predicateFactory; private QueryExecutorV1 executor; - private WebClientProvider clientProvider; + private JaxRsClient client; @Inject - public void setWebClientProvider(WebClientProvider clientProvider) { - this.clientProvider = clientProvider; + public void setJaxRsClient(JaxRsClient client) { + this.client = client; } public void start() { predicateFactory = new PredicateFactoryImpl(); - executor = new QueryExecutorV1(clientProvider, this); + executor = new QueryExecutorV1(client, this); } public void stop() { @@ -76,7 +76,7 @@ public class OseeClientImpl implements OseeClient, BaseUriBuilder { public boolean isClientVersionSupportedByApplicationServer() { boolean result = false; URI uri = newBuilder().path("client").build(); - WebResource resource = clientProvider.createResource(uri); + WebResource resource = client.createResource(uri); Client clientResult = null; try { clientResult = resource.accept(MediaType.APPLICATION_XML).get(Client.class); @@ -84,7 +84,7 @@ public class OseeClientImpl implements OseeClient, BaseUriBuilder { result = clientResult.getSupportedVersions().contains(OseeCodeVersion.getVersion()); } } catch (UniformInterfaceException ex) { - throw clientProvider.handleException(ex); + throw client.handleException(ex); } return result; } diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryExecutorV1.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryExecutorV1.java index 4115a844c8e..38bc14bedf4 100644 --- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryExecutorV1.java +++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryExecutorV1.java @@ -16,7 +16,7 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriBuilder; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.jaxrs.client.WebClientProvider; +import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.orcs.rest.model.search.artifact.OutputFormat; import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate; import org.eclipse.osee.orcs.rest.model.search.artifact.RequestType; @@ -35,10 +35,10 @@ public class QueryExecutorV1 implements QueryExecutor { UriBuilder newBuilder(); } - private final WebClientProvider clientProvider; + private final JaxRsClient clientProvider; private final BaseUriBuilder baseUriBuilder; - public QueryExecutorV1(WebClientProvider clientProvider, BaseUriBuilder baseUriBuilder) { + public QueryExecutorV1(JaxRsClient clientProvider, BaseUriBuilder baseUriBuilder) { super(); this.clientProvider = clientProvider; this.baseUriBuilder = baseUriBuilder; diff --git a/plugins/org.eclipse.osee.ote.master.rest.client/OSGI-INF/ote.master.rest.client.xml b/plugins/org.eclipse.osee.ote.master.rest.client/OSGI-INF/ote.master.rest.client.xml index 10ff996630e..a2fd3832043 100644 --- a/plugins/org.eclipse.osee.ote.master.rest.client/OSGI-INF/ote.master.rest.client.xml +++ b/plugins/org.eclipse.osee.ote.master.rest.client/OSGI-INF/ote.master.rest.client.xml @@ -4,5 +4,5 @@ - + diff --git a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java index 9aab0fbb8f4..d05e927ffd3 100644 --- a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java +++ b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java @@ -3,18 +3,18 @@ package org.eclipse.osee.ote.master.rest.client.internal; import java.net.URI; import java.util.concurrent.Callable; import javax.ws.rs.core.MediaType; -import org.eclipse.osee.jaxrs.client.WebClientProvider; +import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.ote.master.rest.client.OTEMasterServerResult; import org.eclipse.osee.ote.master.rest.model.OTEServer; import com.sun.jersey.api.client.WebResource; public class AddServer implements Callable { - private final WebClientProvider webClientProvider; + private final JaxRsClient webClientProvider; private final OTEServer server; private final URI uri; - public AddServer(WebClientProvider webClientProvider, URI uri, OTEServer server) { + public AddServer(JaxRsClient webClientProvider, URI uri, OTEServer server) { this.webClientProvider = webClientProvider; this.uri = uri; this.server = server; diff --git a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java index 7449c0f7953..d1fbe75b596 100644 --- a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java +++ b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java @@ -3,17 +3,17 @@ package org.eclipse.osee.ote.master.rest.client.internal; import java.net.URI; import java.util.concurrent.Callable; import javax.ws.rs.core.MediaType; -import org.eclipse.osee.jaxrs.client.WebClientProvider; +import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.ote.master.rest.client.OTEMasterServerAvailableNodes; import org.eclipse.osee.ote.master.rest.model.OTEServer; import com.sun.jersey.api.client.WebResource; public class GetAvailableServers implements Callable { - private final WebClientProvider webClientProvider; + private final JaxRsClient webClientProvider; private final URI uri; - public GetAvailableServers(WebClientProvider webClientProvider, URI uri) { + public GetAvailableServers(JaxRsClient webClientProvider, URI uri) { this.webClientProvider = webClientProvider; this.uri = uri; } diff --git a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/OTEMasterServerImpl.java b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/OTEMasterServerImpl.java index c7993e93ed4..a395da7fe2d 100644 --- a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/OTEMasterServerImpl.java +++ b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/OTEMasterServerImpl.java @@ -5,7 +5,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ThreadFactory; -import org.eclipse.osee.jaxrs.client.WebClientProvider; +import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.ote.master.rest.client.OTEMasterServer; import org.eclipse.osee.ote.master.rest.client.OTEMasterServerAvailableNodes; import org.eclipse.osee.ote.master.rest.client.OTEMasterServerResult; @@ -16,11 +16,11 @@ public class OTEMasterServerImpl implements OTEMasterServer { static final String CONTEXT_NAME = "otemaster"; static final String CONTEXT_SERVERS = "servers"; - private WebClientProvider webClientProvider; + private JaxRsClient client; private ExecutorService executor; - public void setWebClientProvider(WebClientProvider webClientProvider) { - this.webClientProvider = webClientProvider; + public void setJaxRsClient(JaxRsClient client) { + this.client = client; } public void start() { @@ -43,17 +43,17 @@ public class OTEMasterServerImpl implements OTEMasterServer { @Override public Future getAvailableServers(URI uri) { - return executor.submit(new GetAvailableServers(webClientProvider, uri)); + return executor.submit(new GetAvailableServers(client, uri)); } @Override public Future addServer(URI uri, OTEServer server) { - return executor.submit(new AddServer(webClientProvider, uri, server)); + return executor.submit(new AddServer(client, uri, server)); } @Override public Future removeServer(URI uri, OTEServer server) { - return executor.submit(new RemoveServer(webClientProvider, uri, server)); + return executor.submit(new RemoveServer(client, uri, server)); } } diff --git a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java index 6f8b2d2fcfe..e29a6b00ee4 100644 --- a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java +++ b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java @@ -3,18 +3,18 @@ package org.eclipse.osee.ote.master.rest.client.internal; import java.net.URI; import java.util.concurrent.Callable; import javax.ws.rs.core.MediaType; -import org.eclipse.osee.jaxrs.client.WebClientProvider; +import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.ote.master.rest.client.OTEMasterServerResult; import org.eclipse.osee.ote.master.rest.model.OTEServer; import com.sun.jersey.api.client.WebResource; public class RemoveServer implements Callable { - private final WebClientProvider webClientProvider; + private final JaxRsClient webClientProvider; private final OTEServer server; private final URI uri; - public RemoveServer(WebClientProvider webClientProvider, URI uri, OTEServer server) { + public RemoveServer(JaxRsClient webClientProvider, URI uri, OTEServer server) { this.webClientProvider = webClientProvider; this.uri = uri; this.server = server; diff --git a/plugins/org.eclipse.osee.ote.rest.client/OSGI-INF/ote.client.xml b/plugins/org.eclipse.osee.ote.rest.client/OSGI-INF/ote.client.xml index 0f7cffa4690..8d857e8f933 100644 --- a/plugins/org.eclipse.osee.ote.rest.client/OSGI-INF/ote.client.xml +++ b/plugins/org.eclipse.osee.ote.rest.client/OSGI-INF/ote.client.xml @@ -4,5 +4,5 @@ - + diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java index 99bfd102b5e..c0d3bb6e6b1 100644 --- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java +++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java @@ -6,7 +6,7 @@ import java.net.URI; import java.util.List; import javax.ws.rs.core.MediaType; import org.eclipse.osee.framework.jdk.core.util.network.PortUtil; -import org.eclipse.osee.jaxrs.client.WebClientProvider; +import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.ote.core.BundleInfo; import org.eclipse.osee.ote.rest.client.Progress; import org.eclipse.osee.ote.rest.client.internal.jarserver.HeadlessClassServer; @@ -22,12 +22,12 @@ public class ConfigureOteServer extends BaseClientCallable { private final URI uri; private List jars; private final Progress progress; - private final WebClientProvider factory; + private final JaxRsClient factory; private OTEJobStatus status; private HeadlessClassServer classServer; private OTEConfiguration configuration; - public ConfigureOteServer(URI uri, List jars, Progress progress, WebClientProvider factory) { + public ConfigureOteServer(URI uri, List jars, Progress progress, JaxRsClient factory) { super(progress); this.uri = uri; this.jars = jars; @@ -35,7 +35,7 @@ public class ConfigureOteServer extends BaseClientCallable { this.factory = factory; } - public ConfigureOteServer(URI uri, OTEConfiguration configuration, Progress progress, WebClientProvider factory) { + public ConfigureOteServer(URI uri, OTEConfiguration configuration, Progress progress, JaxRsClient factory) { super(progress); this.uri = uri; this.configuration = configuration; diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java index fc14831b00c..8210d9c5cf8 100644 --- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java +++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java @@ -6,7 +6,7 @@ import java.io.InputStream; import java.net.URI; import javax.ws.rs.core.MediaType; import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.eclipse.osee.jaxrs.client.WebClientProvider; +import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.ote.rest.client.Progress; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; @@ -17,10 +17,10 @@ public class GetOteServerFile extends BaseClientCallable { private final String filePath; @SuppressWarnings("unused") private final Progress progress; - private final WebClientProvider factory; + private final JaxRsClient factory; private final File destination; - public GetOteServerFile(URI uri, File destination, String filePath, Progress progress, WebClientProvider factory) { + public GetOteServerFile(URI uri, File destination, String filePath, Progress progress, JaxRsClient factory) { super(progress); this.uri = uri; this.filePath = filePath; diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java index 0fc34e0fcb1..78b9cd4e6c0 100644 --- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java +++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java @@ -17,7 +17,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ThreadFactory; -import org.eclipse.osee.jaxrs.client.WebClientProvider; +import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.ote.rest.client.OTECacheItem; import org.eclipse.osee.ote.rest.client.OteClient; import org.eclipse.osee.ote.rest.client.Progress; @@ -31,10 +31,10 @@ import org.eclipse.osee.ote.rest.model.OTETestRun; public class OteClientImpl implements OteClient { private ExecutorService executor; - private WebClientProvider provider; + private JaxRsClient client; - public void setWebClientProvider(WebClientProvider provider) { - this.provider = provider; + public void setJaxRsClient(JaxRsClient client) { + this.client = client; } public void start() { @@ -57,27 +57,27 @@ public class OteClientImpl implements OteClient { @Override public Future getFile(URI uri, File destination, String filePath, final Progress progress) { - return executor.submit(new GetOteServerFile(uri, destination, filePath, progress, provider)); + return executor.submit(new GetOteServerFile(uri, destination, filePath, progress, client)); } @Override public Future configureServerEnvironment(URI uri, List jars, final Progress progress) { - return executor.submit(new ConfigureOteServer(uri, jars, progress, provider)); + return executor.submit(new ConfigureOteServer(uri, jars, progress, client)); } @Override public Future updateServerJarCache(URI uri, String baseJarURL, List jars, Progress progress) { - return executor.submit(new PrepareOteServerFile(uri, baseJarURL, jars, progress, provider)); + return executor.submit(new PrepareOteServerFile(uri, baseJarURL, jars, progress, client)); } @Override public Future runTest(URI uri, OTETestRun tests, Progress progress) { - return executor.submit(new RunTests(uri, tests, progress, provider)); + return executor.submit(new RunTests(uri, tests, progress, client)); } @Override public Future configureServerEnvironment(URI uri, OTEConfiguration configuration, Progress progress) { - return executor.submit(new ConfigureOteServer(uri, configuration, progress, provider)); + return executor.submit(new ConfigureOteServer(uri, configuration, progress, client)); } } diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java index 1a5d2ed27ea..3d249bd7a90 100644 --- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java +++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java @@ -3,7 +3,7 @@ package org.eclipse.osee.ote.rest.client.internal; import java.net.URI; import java.util.List; import javax.ws.rs.core.MediaType; -import org.eclipse.osee.jaxrs.client.WebClientProvider; +import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.ote.rest.client.OTECacheItem; import org.eclipse.osee.ote.rest.client.Progress; import org.eclipse.osee.ote.rest.model.OTEConfiguration; @@ -18,11 +18,11 @@ public class PrepareOteServerFile extends BaseClientCallable { private final URI uri; private final List jars; private final Progress progress; - private final WebClientProvider factory; + private final JaxRsClient factory; private OTEJobStatus status; private final String baseJarURL; - public PrepareOteServerFile(URI uri, String baseJarURL, List jars, Progress progress, WebClientProvider factory) { + public PrepareOteServerFile(URI uri, String baseJarURL, List jars, Progress progress, JaxRsClient factory) { super(progress); this.uri = uri; this.jars = jars; diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java index f87cf1703a0..77aec5cac23 100644 --- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java +++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java @@ -5,7 +5,7 @@ import java.util.concurrent.Callable; import java.util.logging.Level; import javax.ws.rs.core.MediaType; import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.jaxrs.client.WebClientProvider; +import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.ote.rest.client.Progress; import org.eclipse.osee.ote.rest.client.ProgressWithCancel; import org.eclipse.osee.ote.rest.model.OTEJobStatus; @@ -17,11 +17,11 @@ public class RunTests implements ProgressWithCancel, Callable