diff --git a/osgi/catalog-rest-endpoint/.gitignore b/osgi/catalog-rest-endpoint/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/osgi/catalog-rest-endpoint/.gitignore @@ -0,0 +1 @@ +/target diff --git a/osgi/catalog-rest-endpoint/pom.xml b/osgi/catalog-rest-endpoint/pom.xml new file mode 100644 index 0000000..c4d121f --- /dev/null +++ b/osgi/catalog-rest-endpoint/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + org.glassfish.javaeetutorial + osgi + 7.0.6-SNAPSHOT + + + catalog-rest-endpoint + Simple REST endpoint + bundle + + + + org.glassfish.javaeetutorial + catalog-service + 7.0.6-SNAPSHOT + + + javax.ws.rs + jsr311-api + 1.1.1 + provided + + + + + + + org.apache.felix + maven-bundle-plugin + 2.5.3 + true + + + + bundle + + + + ${project.artifactId} + ${project.version} + com.forest.osgi.rest* + * + <_dsannotations>* + + + + + + + + + \ No newline at end of file diff --git a/osgi/catalog-rest-endpoint/src/main/java/com/forest/osgi/rest/ProductResource.java b/osgi/catalog-rest-endpoint/src/main/java/com/forest/osgi/rest/ProductResource.java new file mode 100644 index 0000000..f161b7d --- /dev/null +++ b/osgi/catalog-rest-endpoint/src/main/java/com/forest/osgi/rest/ProductResource.java @@ -0,0 +1,44 @@ +package com.forest.osgi.rest; + +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; + +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +import com.forest.model.Product; +import com.forest.usecase.catalog.ProductManager; + +@Path("product") +@Component(immediate = true, service = Object.class) +public class ProductResource { + + private ProductManager productManager; + + @Reference + protected void bindProductManager(ProductManager productManager) { + this.productManager = productManager; + } + + protected void unbindProductManager(ProductManager productManager) { + this.productManager = null; + } + + @GET + @Produces("application/json") + public List getAll () { + return productManager.getAll(); + } + + @GET + @Produces("application/json") + @Path("{id}") + public Product get (@PathParam ("id") int id) { + return productManager.getProduct(id); + } + +} diff --git a/osgi/lib/compendium/org.apache.felix.configadmin-1.8.0.jar b/osgi/lib/compendium/org.apache.felix.configadmin-1.8.0.jar new file mode 100644 index 0000000..bc3e22a Binary files /dev/null and b/osgi/lib/compendium/org.apache.felix.configadmin-1.8.0.jar differ diff --git a/osgi/lib/compendium/org.apache.felix.eventadmin-1.4.2.jar b/osgi/lib/compendium/org.apache.felix.eventadmin-1.4.2.jar new file mode 100644 index 0000000..1df2226 Binary files /dev/null and b/osgi/lib/compendium/org.apache.felix.eventadmin-1.4.2.jar differ diff --git a/osgi/lib/compendium/org.apache.felix.metatype-1.0.10.jar b/osgi/lib/compendium/org.apache.felix.metatype-1.0.10.jar new file mode 100644 index 0000000..abe8b3c Binary files /dev/null and b/osgi/lib/compendium/org.apache.felix.metatype-1.0.10.jar differ diff --git a/osgi/lib/dm/org.apache.felix.dependencymanager-3.2.0.jar b/osgi/lib/dm/org.apache.felix.dependencymanager-3.2.0.jar new file mode 100644 index 0000000..36f36d9 Binary files /dev/null and b/osgi/lib/dm/org.apache.felix.dependencymanager-3.2.0.jar differ diff --git a/osgi/lib/dm/org.apache.felix.dependencymanager.shell-3.2.0.jar b/osgi/lib/dm/org.apache.felix.dependencymanager.shell-3.2.0.jar new file mode 100644 index 0000000..90f5dd0 Binary files /dev/null and b/osgi/lib/dm/org.apache.felix.dependencymanager.shell-3.2.0.jar differ diff --git a/osgi/lib/http/org.apache.felix.http.api-2.3.2.jar b/osgi/lib/http/org.apache.felix.http.api-2.3.2.jar new file mode 100644 index 0000000..8865e04 Binary files /dev/null and b/osgi/lib/http/org.apache.felix.http.api-2.3.2.jar differ diff --git a/osgi/lib/http/org.apache.felix.http.jetty-3.0.0.jar b/osgi/lib/http/org.apache.felix.http.jetty-3.0.0.jar new file mode 100644 index 0000000..708eaa0 Binary files /dev/null and b/osgi/lib/http/org.apache.felix.http.jetty-3.0.0.jar differ diff --git a/osgi/lib/http/org.apache.felix.http.servlet-api-1.1.0.jar b/osgi/lib/http/org.apache.felix.http.servlet-api-1.1.0.jar new file mode 100644 index 0000000..686971c Binary files /dev/null and b/osgi/lib/http/org.apache.felix.http.servlet-api-1.1.0.jar differ diff --git a/osgi/lib/http/org.apache.felix.http.whiteboard-2.3.2.jar b/osgi/lib/http/org.apache.felix.http.whiteboard-2.3.2.jar new file mode 100644 index 0000000..1abbe8c Binary files /dev/null and b/osgi/lib/http/org.apache.felix.http.whiteboard-2.3.2.jar differ diff --git a/osgi/lib/rest/jackson-annotations-2.5.1.jar b/osgi/lib/rest/jackson-annotations-2.5.1.jar new file mode 100644 index 0000000..9bce595 Binary files /dev/null and b/osgi/lib/rest/jackson-annotations-2.5.1.jar differ diff --git a/osgi/lib/rest/jackson-core-2.5.1.jar b/osgi/lib/rest/jackson-core-2.5.1.jar new file mode 100644 index 0000000..8c9c4e0 Binary files /dev/null and b/osgi/lib/rest/jackson-core-2.5.1.jar differ diff --git a/osgi/lib/rest/jackson-databind-2.5.1.jar b/osgi/lib/rest/jackson-databind-2.5.1.jar new file mode 100644 index 0000000..9b82e3f Binary files /dev/null and b/osgi/lib/rest/jackson-databind-2.5.1.jar differ diff --git a/osgi/lib/rest/jackson-jaxrs-base-2.5.1.jar b/osgi/lib/rest/jackson-jaxrs-base-2.5.1.jar new file mode 100644 index 0000000..7ac3209 Binary files /dev/null and b/osgi/lib/rest/jackson-jaxrs-base-2.5.1.jar differ diff --git a/osgi/lib/rest/jackson-jaxrs-json-provider-2.5.1.jar b/osgi/lib/rest/jackson-jaxrs-json-provider-2.5.1.jar new file mode 100644 index 0000000..4e8ef3a Binary files /dev/null and b/osgi/lib/rest/jackson-jaxrs-json-provider-2.5.1.jar differ diff --git a/osgi/lib/rest/org.amdatu.web.rest.jaxrs-1.0.7.jar b/osgi/lib/rest/org.amdatu.web.rest.jaxrs-1.0.7.jar new file mode 100644 index 0000000..bc9050d Binary files /dev/null and b/osgi/lib/rest/org.amdatu.web.rest.jaxrs-1.0.7.jar differ diff --git a/osgi/lib/rest/org.amdatu.web.rest.wink-2.0.2.jar b/osgi/lib/rest/org.amdatu.web.rest.wink-2.0.2.jar new file mode 100644 index 0000000..1b54417 Binary files /dev/null and b/osgi/lib/rest/org.amdatu.web.rest.wink-2.0.2.jar differ diff --git a/osgi/lib/swagger/org.amdatu.web.resourcehandler-1.0.7.jar b/osgi/lib/swagger/org.amdatu.web.resourcehandler-1.0.7.jar new file mode 100644 index 0000000..f9b81a3 Binary files /dev/null and b/osgi/lib/swagger/org.amdatu.web.resourcehandler-1.0.7.jar differ diff --git a/osgi/lib/swagger/org.amdatu.web.rest.doc-1.2.1.jar b/osgi/lib/swagger/org.amdatu.web.rest.doc-1.2.1.jar new file mode 100644 index 0000000..80a7630 Binary files /dev/null and b/osgi/lib/swagger/org.amdatu.web.rest.doc-1.2.1.jar differ diff --git a/osgi/lib/swagger/org.amdatu.web.rest.doc.swagger-1.0.8.jar b/osgi/lib/swagger/org.amdatu.web.rest.doc.swagger-1.0.8.jar new file mode 100644 index 0000000..0481de7 Binary files /dev/null and b/osgi/lib/swagger/org.amdatu.web.rest.doc.swagger-1.0.8.jar differ diff --git a/osgi/lib/swagger/org.amdatu.web.rest.doc.swagger.ui-1.0.6.jar b/osgi/lib/swagger/org.amdatu.web.rest.doc.swagger.ui-1.0.6.jar new file mode 100644 index 0000000..331cb64 Binary files /dev/null and b/osgi/lib/swagger/org.amdatu.web.rest.doc.swagger.ui-1.0.6.jar differ diff --git a/osgi/pom.xml b/osgi/pom.xml index 5ceef95..88882d6 100644 --- a/osgi/pom.xml +++ b/osgi/pom.xml @@ -29,5 +29,6 @@ catalog-service catalog-commands + catalog-rest-endpoint