Skip to content

Commit

Permalink
Catalog OSGi REST endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
azzazzel committed Mar 15, 2015
1 parent 731c61b commit d027af1
Show file tree
Hide file tree
Showing 24 changed files with 101 additions and 0 deletions.
1 change: 1 addition & 0 deletions osgi/catalog-rest-endpoint/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
55 changes: 55 additions & 0 deletions osgi/catalog-rest-endpoint/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.glassfish.javaeetutorial</groupId>
<artifactId>osgi</artifactId>
<version>7.0.6-SNAPSHOT</version>
</parent>

<artifactId>catalog-rest-endpoint</artifactId>
<name>Simple REST endpoint</name>
<packaging>bundle</packaging>

<dependencies>
<dependency>
<groupId>org.glassfish.javaeetutorial</groupId>
<artifactId>catalog-service</artifactId>
<version>7.0.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.5.3</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>bundle</goal>
</goals>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Export-Package>com.forest.osgi.rest*</Export-Package>
<Import-Package>*</Import-Package>
<_dsannotations>*</_dsannotations>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -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<Product> getAll () {
return productManager.getAll();
}

@GET
@Produces("application/json")
@Path("{id}")
public Product get (@PathParam ("id") int id) {
return productManager.getProduct(id);
}

}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added osgi/lib/http/org.apache.felix.http.api-2.3.2.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added osgi/lib/rest/jackson-annotations-2.5.1.jar
Binary file not shown.
Binary file added osgi/lib/rest/jackson-core-2.5.1.jar
Binary file not shown.
Binary file added osgi/lib/rest/jackson-databind-2.5.1.jar
Binary file not shown.
Binary file added osgi/lib/rest/jackson-jaxrs-base-2.5.1.jar
Binary file not shown.
Binary file not shown.
Binary file added osgi/lib/rest/org.amdatu.web.rest.jaxrs-1.0.7.jar
Binary file not shown.
Binary file added osgi/lib/rest/org.amdatu.web.rest.wink-2.0.2.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions osgi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
<modules>
<module>catalog-service</module>
<module>catalog-commands</module>
<module>catalog-rest-endpoint</module>
</modules>
</project>

0 comments on commit d027af1

Please sign in to comment.