Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java')
-rw-r--r--plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java38
1 files changed, 38 insertions, 0 deletions
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
new file mode 100644
index 00000000000..6450e618375
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java
@@ -0,0 +1,38 @@
+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.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<OTEMasterServerResult> {
+
+ private WebClientProvider webClientProvider;
+ private OTEServer server;
+ private URI uri;
+
+ public AddServer(WebClientProvider webClientProvider, URI uri, OTEServer server) {
+ this.webClientProvider = webClientProvider;
+ this.uri = uri;
+ this.server = server;
+ }
+
+ @Override
+ public OTEMasterServerResult call() throws Exception {
+ OTEMasterServerResult result = new OTEMasterServerResult();
+ try{
+ WebResource resource = webClientProvider.createResource(uri);
+ resource.path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).accept(MediaType.APPLICATION_XML).post(server);
+ } catch (Throwable th){
+ result.setSuccess(false);
+ result.setThrowable(th);
+ }
+ return result;
+ }
+
+}

Back to the top