Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2014-01-24 21:18:29 +0000
committerRoberto E. Escobar2014-03-04 19:42:15 +0000
commit8bc75ed4fff5f4e07811929d5542e32520e05e6d (patch)
tree54ecf89d821bc47b808328c33803d1cdf25ff2fa /plugins/org.eclipse.osee.framework.manager.servlet
parent3fd5484f36cc6e848f7253c01b5b1e88ccabfbae (diff)
downloadorg.eclipse.osee-8bc75ed4fff5f4e07811929d5542e32520e05e6d.tar.gz
org.eclipse.osee-8bc75ed4fff5f4e07811929d5542e32520e05e6d.tar.xz
org.eclipse.osee-8bc75ed4fff5f4e07811929d5542e32520e05e6d.zip
bug: Move ClientResource to higher level bundle
Fix lower level component dependencies on higher level components. The orcs bundle is a lower level than core.server therefore, when performing a staged build the core server bundle is not available causing build errors. Moved ClientResource to manager.servlet. Change-Id: I744b65fd44e479295e98882800b22a0ea6b0a49a
Diffstat (limited to 'plugins/org.eclipse.osee.framework.manager.servlet')
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/server.application.xml9
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientResource.java53
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerApplication.java46
4 files changed, 111 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF
index b217c586db0..688180b588e 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF
@@ -8,6 +8,8 @@ Import-Package: com.google.common.base,
com.google.common.collect,
javax.servlet,
javax.servlet.http,
+ javax.ws.rs,
+ javax.ws.rs.core,
org.eclipse.core.runtime,
org.eclipse.core.runtime.jobs,
org.eclipse.osee.event,
@@ -36,6 +38,7 @@ Import-Package: com.google.common.base,
org.eclipse.osee.logger,
org.eclipse.osee.orcs,
org.eclipse.osee.orcs.data,
+ org.eclipse.osee.orcs.rest.model,
org.eclipse.osee.orcs.search,
org.eclipse.osee.orcs.transaction,
org.eclipse.osgi.framework.console,
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/server.application.xml b/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/server.application.xml
new file mode 100644
index 00000000000..528c682d6d4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/server.application.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop">
+ <implementation class="org.eclipse.osee.framework.manager.servlet.internal.ServerApplication"/>
+ <service>
+ <provide interface="javax.ws.rs.core.Application"/>
+ </service>
+ <property name="context.name" type="String" value="oseex"/>
+ <reference bind="setServerManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.IApplicationServerManager" name="IApplicationServerManager" policy="static"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientResource.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientResource.java
new file mode 100644
index 00000000000..b6e8a9a6e37
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientResource.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 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.framework.manager.servlet.internal;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.UriInfo;
+import org.eclipse.osee.framework.core.server.IApplicationServerManager;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.orcs.rest.model.Client;
+
+/**
+ * @author Donald G. Dunne
+ */
+@Path("client")
+public class ClientResource {
+
+ // Allows to insert contextual objects into the class,
+ // e.g. ServletContext, Request, Response, UriInfo
+ @Context
+ UriInfo uriInfo;
+ @Context
+ Request request;
+ private final IApplicationServerManager serverManager;
+
+ public ClientResource(IApplicationServerManager serverManager) {
+ this.serverManager = serverManager;
+ }
+
+ @GET
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ public Client get() throws OseeCoreException {
+ Client client = new Client();
+ String[] supportedVersions = serverManager.getSupportedVersions();
+ for (String ver : supportedVersions) {
+ client.addSupportedVersion(ver);
+ }
+ return client;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerApplication.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerApplication.java
new file mode 100644
index 00000000000..d5330f43c91
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerApplication.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 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.framework.manager.servlet.internal;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.ws.rs.core.Application;
+import org.eclipse.osee.framework.core.server.IApplicationServerManager;
+
+/**
+ * Get application.wadl at this context to get rest documentation
+ *
+ * @author Roberto E. Escobar
+ */
+public class ServerApplication extends Application {
+
+ private final Set<Object> resources = new HashSet<Object>();
+
+ private IApplicationServerManager serverManager;
+
+ public void setServerManager(IApplicationServerManager serverManager) {
+ this.serverManager = serverManager;
+ }
+
+ public void start() {
+ resources.add(new ClientResource(serverManager));
+ }
+
+ public void stop() {
+ resources.clear();
+ }
+
+ @Override
+ public Set<Object> getSingletons() {
+ return resources;
+ }
+
+}

Back to the top