Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2014-06-10 14:27:50 -0400
committerRoberto E. Escobar2014-08-28 19:58:34 -0400
commit56ed1da4a2ae6d59e163e7b4ae1fd05df0ec5775 (patch)
tree3d3647cdbd778e3689d081a429a06691b77eea95 /plugins/org.eclipse.osee.ote.master.rest.client
parent21a3c5b7427ef9991dc88c1e8b498bc8d59f84e7 (diff)
downloadorg.eclipse.osee-56ed1da4a2ae6d59e163e7b4ae1fd05df0ec5775.tar.gz
org.eclipse.osee-56ed1da4a2ae6d59e163e7b4ae1fd05df0ec5775.tar.xz
org.eclipse.osee-56ed1da4a2ae6d59e163e7b4ae1fd05df0ec5775.zip
bug[ats_ATS64246]: Fix JAX-RS Client server address config
Use OSGI style properties to configure JAX-RS clients Setup JAX-RS Client as a static factory library instead of OSGI service. Change-Id: Icd6798214da9264670a46f134638bd0b41963fb8
Diffstat (limited to 'plugins/org.eclipse.osee.ote.master.rest.client')
-rw-r--r--plugins/org.eclipse.osee.ote.master.rest.client/OSGI-INF/ote.master.rest.client.xml3
-rw-r--r--plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/OTEMasterServerImpl.java16
2 files changed, 11 insertions, 8 deletions
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 a2fd383204..6c2a6e593a 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
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" modified="update">
<implementation class="org.eclipse.osee.ote.master.rest.client.internal.OTEMasterServerImpl"/>
<service>
<provide interface="org.eclipse.osee.ote.master.rest.client.OTEMasterServer"/>
</service>
- <reference bind="setJaxRsClient" cardinality="1..1" interface="org.eclipse.osee.jaxrs.client.JaxRsClient" name="JaxRsClient" policy="static"/>
</scr:component>
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 a395da7fe2..3456be01f3 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
@@ -1,11 +1,13 @@
package org.eclipse.osee.ote.master.rest.client.internal;
import java.net.URI;
+import java.util.Map;
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.JaxRsClient;
+import org.eclipse.osee.jaxrs.client.JaxRsClientFactory;
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,14 +18,10 @@ public class OTEMasterServerImpl implements OTEMasterServer {
static final String CONTEXT_NAME = "otemaster";
static final String CONTEXT_SERVERS = "servers";
- private JaxRsClient client;
+ private volatile JaxRsClient client;
private ExecutorService executor;
- public void setJaxRsClient(JaxRsClient client) {
- this.client = client;
- }
-
- public void start() {
+ public void start(Map<String, Object> props) {
executor = Executors.newCachedThreadPool(new ThreadFactory() {
@Override
public Thread newThread(Runnable arg0) {
@@ -33,12 +31,18 @@ public class OTEMasterServerImpl implements OTEMasterServer {
return th;
}
});
+ update(props);
}
public void stop() {
if (executor != null) {
executor.shutdown();
}
+ client = null;
+ }
+
+ public void update(Map<String, Object> props) {
+ client = JaxRsClientFactory.createClient(props);
}
@Override

Back to the top