Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid W. Miller2017-05-25 15:09:40 -0400
committerDavid Miller2017-05-26 11:52:08 -0400
commit23d5699eadf6ac55367c8b94cf73a32fd29c7199 (patch)
treee63ede9c2390baf7304248757073181ad724519d
parent6bd7c1dfd316b9455166b6225f009372b6f6957a (diff)
downloadorg.eclipse.osee-23d5699eadf6ac55367c8b94cf73a32fd29c7199.tar.gz
org.eclipse.osee-23d5699eadf6ac55367c8b94cf73a32fd29c7199.tar.xz
org.eclipse.osee-23d5699eadf6ac55367c8b94cf73a32fd29c7199.zip
feature: Add Osee App Application
-rw-r--r--plugins/org.eclipse.osee.app/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.app/OSGI-INF/app.application.xml8
-rw-r--r--plugins/org.eclipse.osee.app/src/org/eclipse/osee/app/OseeAppResource.java74
-rw-r--r--plugins/org.eclipse.osee.app/src/org/eclipse/osee/app/OseeAppsApplication.java40
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java1
5 files changed, 126 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.app/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.app/META-INF/MANIFEST.MF
index 7e8b897dc9..b44d21417f 100644
--- a/plugins/org.eclipse.osee.app/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.app/META-INF/MANIFEST.MF
@@ -4,11 +4,14 @@ Bundle-Name: OSEE Server Application Support (Incubation)
Bundle-SymbolicName: org.eclipse.osee.app
Bundle-Version: 0.25.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Service-Component: OSGI-INF/*.xml
Import-Package: javax.ws.rs;version="2.0.0",
javax.ws.rs.core;version="2.0.0",
+ org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.server,
org.eclipse.osee.framework.jdk.core.type,
+ org.eclipse.osee.framework.jdk.core.util,
org.eclipse.osee.logger,
org.eclipse.osee.orcs,
org.eclipse.osee.orcs.data,
diff --git a/plugins/org.eclipse.osee.app/OSGI-INF/app.application.xml b/plugins/org.eclipse.osee.app/OSGI-INF/app.application.xml
new file mode 100644
index 0000000000..3b27fb4ea4
--- /dev/null
+++ b/plugins/org.eclipse.osee.app/OSGI-INF/app.application.xml
@@ -0,0 +1,8 @@
+<?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.app.OseeAppsApplication"/>
+ <reference bind="setOrcsApi" cardinality="1..1" interface="org.eclipse.osee.orcs.OrcsApi" name="OrcsApi" policy="static"/>
+ <service>
+ <provide interface="javax.ws.rs.core.Application"/>
+ </service>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.app/src/org/eclipse/osee/app/OseeAppResource.java b/plugins/org.eclipse.osee.app/src/org/eclipse/osee/app/OseeAppResource.java
new file mode 100644
index 0000000000..1f910c3f47
--- /dev/null
+++ b/plugins/org.eclipse.osee.app/src/org/eclipse/osee/app/OseeAppResource.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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.app;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import org.eclipse.osee.framework.core.data.ArtifactId;
+import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.jdk.core.type.ResultSet;
+import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.data.ArtifactReadable;
+
+/**
+ * @author David W. Miller
+ */
+@Path("/api")
+public final class OseeAppResource {
+ private final OrcsApi orcsApi;
+
+ public OseeAppResource(OrcsApi orcsApi) {
+ this.orcsApi = orcsApi;
+ }
+
+ /**
+ * get a list of all of the available OSEE Application artifacts
+ *
+ * @return provides json containing a map of Application token, description
+ */
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map<String, Long> getOseeAppListJson() {
+ BranchId branchId =
+ orcsApi.getQueryFactory().branchQuery().andNameEquals("Common").getResultsAsId().getExactlyOne();
+ ResultSet<ArtifactReadable> apps =
+ orcsApi.getQueryFactory().fromBranch(branchId).andTypeEquals(CoreArtifactTypes.OseeApp).getResults();
+ Map<String, Long> results = new HashMap<String, Long>();
+ for (ArtifactReadable art : apps) {
+ results.put(art.getName(), art.getUuid());
+ }
+ return results;
+ }
+
+ /**
+ * get the schema for the requested application object
+ *
+ * @param appId (artifact id for application object type).
+ * @return provides the application json for the requested id
+ */
+ @GET
+ @Path("/{id}")
+ @Produces(MediaType.APPLICATION_JSON)
+ public String getOseeAppJson(@PathParam("id") Long id) {
+ BranchId branchId =
+ orcsApi.getQueryFactory().branchQuery().andNameEquals("Common").getResultsAsId().getExactlyOne();
+ ArtifactReadable app =
+ orcsApi.getQueryFactory().fromBranch(branchId).andId(ArtifactId.valueOf(id)).getResults().getExactlyOne();
+ return app.getSoleAttributeAsString(CoreAttributeTypes.OseeAppDefinition);
+ }
+}
diff --git a/plugins/org.eclipse.osee.app/src/org/eclipse/osee/app/OseeAppsApplication.java b/plugins/org.eclipse.osee.app/src/org/eclipse/osee/app/OseeAppsApplication.java
new file mode 100644
index 0000000000..abd0fc507a
--- /dev/null
+++ b/plugins/org.eclipse.osee.app/src/org/eclipse/osee/app/OseeAppsApplication.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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.app;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+import org.eclipse.osee.orcs.OrcsApi;
+
+/**
+ * @author David W. Miller
+ */
+@ApplicationPath("apps")
+public final class OseeAppsApplication extends Application {
+ private final Set<Object> singletons = new HashSet<>();
+ private OrcsApi orcsApi;
+
+ public void setOrcsApi(OrcsApi orcsApi) {
+ this.orcsApi = orcsApi;
+ }
+
+ public void start(Map<String, Object> properties) {
+ singletons.add(new OseeAppResource(orcsApi));
+ }
+
+ @Override
+ public Set<Object> getSingletons() {
+ return singletons;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java
index d5bb562baf..b175bc2e1b 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java
@@ -67,6 +67,7 @@ public final class CoreAttributeTypes {
public static final AttributeTypeToken Name = AttributeTypeToken.valueOf(1152921504606847088L, "Name");
public static final AttributeTypeToken NativeContent = AttributeTypeToken.valueOf(1152921504606847097L, "Native Content");
public static final AttributeTypeToken Notes = AttributeTypeToken.valueOf(1152921504606847085L, "Notes");
+ public static final AttributeTypeToken OseeAppDefinition = AttributeTypeToken.valueOf(1152921504606847380L, "Osee App Definition");
public static final AttributeTypeToken PageType = AttributeTypeToken.valueOf(1152921504606847091L, "Page Type");
public static final AttributeTypeToken ParagraphNumber = AttributeTypeToken.valueOf(1152921504606847101L, "Paragraph Number");
public static final AttributeTypeToken Partition = AttributeTypeToken.valueOf(1152921504606847111L, "Partition");

Back to the top