diff options
author | rescobar | 2011-10-06 01:45:29 +0000 |
---|---|---|
committer | Roberto E. Escobar | 2011-10-06 01:45:29 +0000 |
commit | e6f4b92f01d7632e1715ddd41042b35a6f07e13c (patch) | |
tree | 548165d1bcbf32017068e9343846e335e2e18d24 | |
parent | c38083becfe9c4ed02057ed50a4ac8d157333730 (diff) | |
download | org.eclipse.osee-e6f4b92f01d7632e1715ddd41042b35a6f07e13c.tar.gz org.eclipse.osee-e6f4b92f01d7632e1715ddd41042b35a6f07e13c.tar.xz org.eclipse.osee-e6f4b92f01d7632e1715ddd41042b35a6f07e13c.zip |
feature[ats_Q9NLC]: Initial ORCS rest api
16 files changed, 456 insertions, 0 deletions
diff --git a/features/org.eclipse.osee.x.server.feature.source/feature.xml b/features/org.eclipse.osee.x.server.feature.source/feature.xml index 69a91035282..e682d357fa4 100644 --- a/features/org.eclipse.osee.x.server.feature.source/feature.xml +++ b/features/org.eclipse.osee.x.server.feature.source/feature.xml @@ -98,4 +98,11 @@ version="0.0.0" unpack="false"/> + <plugin + id="org.eclipse.osee.orcs.rest.source" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + </feature> diff --git a/features/org.eclipse.osee.x.server.feature/feature.xml b/features/org.eclipse.osee.x.server.feature/feature.xml index a77a2e94b41..e8f849fea47 100644 --- a/features/org.eclipse.osee.x.server.feature/feature.xml +++ b/features/org.eclipse.osee.x.server.feature/feature.xml @@ -110,4 +110,11 @@ version="0.0.0" unpack="false"/> + <plugin + id="org.eclipse.osee.orcs.rest" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + </feature> diff --git a/plugins/org.eclipse.osee.orcs.rest/.classpath b/plugins/org.eclipse.osee.orcs.rest/.classpath new file mode 100644 index 00000000000..ad32c83a788 --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.rest/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/org.eclipse.osee.orcs.rest/.project b/plugins/org.eclipse.osee.orcs.rest/.project new file mode 100644 index 00000000000..de7aa49de53 --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.rest/.project @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.osee.orcs.rest</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ds.core.builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/org.eclipse.osee.orcs.rest/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.rest/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..40f8a47421e --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.rest/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Osee ORCS Rest +Bundle-SymbolicName: org.eclipse.osee.orcs.rest +Bundle-Version: 0.9.9.qualifier +Bundle-Vendor: Eclipse Open System Engineering Environment +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Service-Component: OSGI-INF/*.xml +Import-Package: com.sun.jersey.multipart, + javax.ws.rs, + javax.ws.rs.core, + org.eclipse.osee.orcs diff --git a/plugins/org.eclipse.osee.orcs.rest/OSGI-INF/orcs.application.xml b/plugins/org.eclipse.osee.orcs.rest/OSGI-INF/orcs.application.xml new file mode 100644 index 00000000000..971f47abeaa --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.rest/OSGI-INF/orcs.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" name="org.eclipse.osee.orcs.rest.internal.OrcsApplication"> + <implementation class="org.eclipse.osee.orcs.rest.internal.OrcsApplication"/> + <service> + <provide interface="javax.ws.rs.core.Application"/> + </service> + <property name="context.name" type="String" value="osee"/> +<!-- <reference bind="setOseeApi" cardinality="1..1" interface="org.eclipse.osee.orcs.OseeApi" name="OseeApi" policy="static"/>--> +</scr:component> diff --git a/plugins/org.eclipse.osee.orcs.rest/build.properties b/plugins/org.eclipse.osee.orcs.rest/build.properties new file mode 100644 index 00000000000..f774171de07 --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.rest/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + OSGI-INF/ +additional.bundles = org.eclipse.osee.orcs,\ + javax.ws.rs diff --git a/plugins/org.eclipse.osee.orcs.rest/pom.xml b/plugins/org.eclipse.osee.orcs.rest/pom.xml new file mode 100644 index 00000000000..0059a4853c3 --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.rest/pom.xml @@ -0,0 +1,34 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.osee</groupId> + <artifactId>org.eclipse.osee.x.server.parent</artifactId> + <version>0.9.9-SNAPSHOT</version> + <relativePath>../../plugins/org.eclipse.osee.x.server.parent</relativePath> + </parent> + + <artifactId>org.eclipse.osee.orcs.rest</artifactId> + <packaging>eclipse-plugin</packaging> + <name>OSEE ORCS Rest - (Incubation)</name> + + <build> + <!-- workaround for https://issues.sonatype.org/browse/TYCHO-168 --> + <resources> + <resource> + <directory>src</directory> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-source-plugin</artifactId> + </plugin> + </plugins> + </build> +</project>
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactResource.java new file mode 100644 index 00000000000..6df3753cb68 --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactResource.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * 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.orcs.rest.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; + +/** + * @author Roberto E. Escobar + */ +public class ArtifactResource { + + @Context + UriInfo uriInfo; + @Context + Request request; + + String branchUuid; + String artifactUuid; + + public ArtifactResource(UriInfo uriInfo, Request request, String branchUuid, String artifactUuid) { + this.uriInfo = uriInfo; + this.request = request; + this.branchUuid = branchUuid; + this.artifactUuid = artifactUuid; + } + + @Path("version") + public VersionsResource getArtifactVersions() { + return new VersionsResource(uriInfo, request, branchUuid, artifactUuid); + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String getAsText() { + return String.format("BranchUuid [%s] ArtifactUuid [%s]", branchUuid, artifactUuid); + } +} diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java new file mode 100644 index 00000000000..b3090bdc1df --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * 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.orcs.rest.internal; + +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.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Request; +import javax.ws.rs.core.UriInfo; + +/** + * @author Roberto E. Escobar + */ +public class ArtifactsResource { + + // Allows to insert contextual objects into the class, + // e.g. ServletContext, Request, Response, UriInfo + @Context + UriInfo uriInfo; + @Context + Request request; + + String branchUuid; + + public ArtifactsResource(UriInfo uriInfo, Request request, String branchUuid) { + this.uriInfo = uriInfo; + this.request = request; + this.branchUuid = branchUuid; + } + + @Path("{uuid}") + public ArtifactResource getArtifact(@PathParam("uuid") String artifactUuid) { + return new ArtifactResource(uriInfo, request, branchUuid, artifactUuid); + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String getAllBranchesAsText() { + return String.format("All artifacts at branch uuid[%s]", branchUuid); + } +} diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchResource.java new file mode 100644 index 00000000000..b56beacc36f --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchResource.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * 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.orcs.rest.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; + +/** + * @author Roberto E. Escobar + */ +public class BranchResource { + + @Context + UriInfo uriInfo; + @Context + Request request; + + String branchUuid; + + public BranchResource(UriInfo uriInfo, Request request, String branchUuid) { + this.uriInfo = uriInfo; + this.request = request; + this.branchUuid = branchUuid; + } + + @Path("artifact") + public ArtifactsResource getArtifacts() { + return new ArtifactsResource(uriInfo, request, branchUuid); + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String getAsText() { + return String.format("BranchUuid [%s]", branchUuid); + } +} diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchesResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchesResource.java new file mode 100644 index 00000000000..cd66007685f --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchesResource.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * 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.orcs.rest.internal; + +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.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Request; +import javax.ws.rs.core.UriInfo; + +/** + * @author Roberto E. Escobar + */ +@Path("branch") +public class BranchesResource { + + // Allows to insert contextual objects into the class, + // e.g. ServletContext, Request, Response, UriInfo + @Context + UriInfo uriInfo; + @Context + Request request; + + @Path("{uuid}") + public BranchResource getBranch(@PathParam("uuid") String id) { + return new BranchResource(uriInfo, request, id); + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String getAllBranchesAsText() { + return "All Branches"; + } +} diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java new file mode 100644 index 00000000000..ac4c73085d8 --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * 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.orcs.rest.internal; + +import java.util.Collections; +import java.util.Set; +import javax.ws.rs.core.Application; +import org.eclipse.osee.orcs.OseeApi; + +/** + * Get application.wadl at this context to get rest documentation + * + * @author Roberto E. Escobar + */ +public class OrcsApplication extends Application { + + private static OseeApi oseeApi; + + public void setOseeApi(OseeApi oseeApi) { + OrcsApplication.oseeApi = oseeApi; + } + + public static OseeApi getOseeApi() { + return oseeApi; + } + + @Override + public Set<Class<?>> getClasses() { + return Collections.<Class<?>> singleton(BranchesResource.class); + } + +} diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/VersionResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/VersionResource.java new file mode 100644 index 00000000000..e08717964db --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/VersionResource.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * 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.orcs.rest.internal; + +import javax.ws.rs.GET; +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; + +/** + * @author Roberto E. Escobar + */ +public class VersionResource { + + @Context + UriInfo uriInfo; + @Context + Request request; + + String branchUuid; + String artifactUuid; + int transactionId; + + public VersionResource(UriInfo uriInfo, Request request, String branchUuid, String artifactUuid, int transactionId) { + this.uriInfo = uriInfo; + this.request = request; + this.branchUuid = branchUuid; + this.artifactUuid = artifactUuid; + this.transactionId = transactionId; + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String getAsText() { + return String.format("BranchUuid [%s] ArtifactUuid [%s] Version [%s]", branchUuid, artifactUuid, transactionId); + } +} diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/VersionsResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/VersionsResource.java new file mode 100644 index 00000000000..40dfbc2ba54 --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/VersionsResource.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * 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.orcs.rest.internal; + +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.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Request; +import javax.ws.rs.core.UriInfo; + +/** + * @author Roberto E. Escobar + */ +@Path("version") +public class VersionsResource { + + // Allows to insert contextual objects into the class, + // e.g. ServletContext, Request, Response, UriInfo + @Context + UriInfo uriInfo; + @Context + Request request; + + String branchUuid; + String artifactUuid; + + public VersionsResource(UriInfo uriInfo, Request request, String branchUuid, String artifactUuid) { + this.uriInfo = uriInfo; + this.request = request; + this.branchUuid = branchUuid; + this.artifactUuid = artifactUuid; + } + + @Path("{versionId}") + public VersionResource getVersion(@PathParam("versionId") int transactionId) { + return new VersionResource(uriInfo, request, branchUuid, artifactUuid, transactionId); + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String getAllBranchesAsText() { + return String.format("All versions for branch uuid[%s] artifact [%s]", branchUuid, artifactUuid); + } +} diff --git a/plugins/org.eclipse.osee.x.server.parent/pom.xml b/plugins/org.eclipse.osee.x.server.parent/pom.xml index 1f56178f055..7bb688381f2 100644 --- a/plugins/org.eclipse.osee.x.server.parent/pom.xml +++ b/plugins/org.eclipse.osee.x.server.parent/pom.xml @@ -33,6 +33,7 @@ <module>../../plugins/org.eclipse.osee.orcs.core.test</module> <module>../../plugins/org.eclipse.osee.orcs.db</module> <module>../../plugins/org.eclipse.osee.orcs.db.mock</module> + <module>../../plugins/org.eclipse.osee.orcs.rest</module> <module>../../plugins/org.eclipse.osee.framework.h2</module> <module>../../plugins/org.eclipse.osee.orcs.db.test</module> |