diff --git a/README.md b/README.md index 8e98e79f..916de4c7 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,40 @@ -# OSGi - JAX-RS Connector 3.1.0 [![Build Status](https://travis-ci.org/hstaudacher/osgi-jax-rs-connector.png)](https://travis-ci.org/hstaudacher/osgi-jax-rs-connector) +# OSGi - JAX-RS Connector 3.2.0 [![Build Status](https://travis-ci.org/hstaudacher/osgi-jax-rs-connector.png)](https://travis-ci.org/hstaudacher/osgi-jax-rs-connector) ![](http://download.eclipsesource.com/~hstaudacher/connector.png) -[JAX-RS (JSR 311)](http://jsr311.java.net/) is the community-driven Standard for +[JAX-RS (JSR 311)](http://jsr311.java.net/) is the community-driven standard for building RESTful web services with Java. The reference implementation for JAX-RS is [Jersey](http://jersey.java.net/) and ships as OSGi bundles. -This project connects Jersey and OSGi at the service level. This means that OSGi services can be published as +This project connects Jersey and OSGi at the *service level*. This means that OSGi services can be published as RESTful web services by simply registering them as OSGi services and also consumed as OSGi services ;). *To see how to get started with JAX-RS 2.0 and Jersey please read the [Jersey getting started guide](https://jersey.java.net/documentation/latest/getting-started.html).* ## Features -The OSGi-JAX-RS Connector provides **two bundles**. A **publisher** and a **consumer**. Both can be used completely separately or together, it's up to you. Additional the connector provides custom `@Provider` implementations that can be used optionally. +The OSGi-JAX-RS Connector provides **two bundles**. A **publisher** and a **consumer**. Both can be used completely separately or together, it's up to you. Additional the connector provides custom `@Provider` and `Feature` implementations that can be used optionally. ### Publisher -The publisher is located in the bundle `com.eclipsesource.jaxrs.publisher`. All it does is tracking up services. When it sports a service that is annotated with the JAX-RS annotations `@Path` or `@Provider` the work begins. The publisher hooks these service into Jersey and the OSGi HTTPService. Basically this means it publishes them as RESTful web services. It's just that simple. +The publisher is located in the bundle `com.eclipsesource.jaxrs.publisher`. All it does is tracking services. When it spots a service that is annotated with the JAX-RS annotations `@Path` or `@Provider` the work begins. The publisher hooks these services into Jersey and the OSGi HTTPService. Basically this means it publishes them as RESTful web services. It's just that simple. -By default the publisher registers the services using the context path `/services`. This means an OSGi service that is annotated with `@Path( "/foo" )` will be available using the path `/services/foo`. This context path is configurable using the OSGi configuration admin. You can condigure the service usign the service.pid `com.eclipsesource.jaxrs.connector` and the property `root` to define a custom path. +By default the publisher registers the services using the context path `/services`. This means an OSGi service that is annotated with `@Path( "/foo" )` will be available using the path `/services/foo`. This context path is configurable using the OSGi configuration admin. You can configure the service using the service.pid `com.eclipsesource.jaxrs.connector` and the property `root` to define a custom path. As said earlier, the publisher uses the OSGi HTTPService to publish the services. As a result all configuration topics regarding ports, protocol and so on are up to the HTTPService implementation of your choice. If it's your wish to publish services on different ports, just register them and add the service property `http.port` with the port of your choice. Of course it's necessary that an HTTPService is up and running on such a port. ### Consumer -The consumer is lcoated in the bundle `com.eclipsesource.jaxrs.consumer`. The idea of the consumer is to reuse your `@Path` and `@Provider` interfaces for calling a service. From a technical point of view it takes your interfaces together with a base url and creates Java Proxies. These proxies will make an HTTP call when a method will be invoked on it. The proxy knows which method, parameters and so on it should use because you have it defined with the JAX-RS annotations. The consumer uses the JAX-RS 2.0 client API to send requests. So, there will be no additional dependencies. +The consumer is located in the bundle `com.eclipsesource.jaxrs.consumer`. The idea of the consumer is to reuse your `@Path` and `@Provider` interfaces for calling a service. From a technical point of view it takes your interfaces together with a base url and creates Java Proxies. These proxies will make an HTTP call when a method will be invoked on it. The proxy knows which http method, parameters and so on it should use because you have it defined with the JAX-RS annotations. The consumer uses the JAX-RS 2.0 client API to send requests. So, there will be no additional dependencies. A nice side effect of the consumer is, that it does not need OSGi. It's just a jar that can be used to create the mentioned proxies. See the [ConsumerFactory](https://github.com/hstaudacher/osgi-jax-rs-connector/blob/master/bundles/com.eclipsesource.jaxrs.consumer/src/com/eclipsesource/jaxrs/consumer/ConsumerFactory.java) for more information. When using it together with OSGi it provides a helper to create your proxies and automatically register them as OSGi services. But it's up to you if you want to take care regarding the publishing by your own. See the [ConsumerPublisher](https://github.com/hstaudacher/osgi-jax-rs-connector/blob/master/bundles/com.eclipsesource.jaxrs.consumer/src/com/eclipsesource/jaxrs/consumer/ConsumerPublisher.java) for more information. -A detailed explenation of the concepts of the consumer together with some examples can be found on our blog: [Consuming REST services in Java the cool way](http://eclipsesource.com/blogs/2012/11/27/consuming-rest-services-in-java-the-cool-way/), [Consuming REST services in OSGi the cool way](http://eclipsesource.com/blogs/2012/11/28/consuming-rest-services-in-osgi-the-cool-way/). +A detailed explanation of the concepts of the consumer together with some examples can be found on our blog: [Consuming REST services in Java the cool way](http://eclipsesource.com/blogs/2012/11/27/consuming-rest-services-in-java-the-cool-way/), [Consuming REST services in OSGi the cool way](http://eclipsesource.com/blogs/2012/11/28/consuming-rest-services-in-osgi-the-cool-way/). ### Providers -The custom `@Provider` implementations are located in their own feature. The following providers are currently included. +The custom `@Provider` and `Feature` implementations are located in their own features. The following features are currently included. * `com.eclipsesource.jaxrs.provider.moxy` - Allows the de/serialization using [EclipseLink MOXy](http://www.eclipse.org/eclipselink/moxy.php). * `com.eclipsesource.jaxrs.provider.gson` - Allows the de/serialization using [Gson](https://code.google.com/p/google-gson/). -* `com.eclipsesource.jaxrs.provider.security` - Provides an OSGi friendly integration of Jersey's/JAX-RS security features. [Reade the wiki for more information](https://github.com/hstaudacher/osgi-jax-rs-connector/wiki/security). +* `com.eclipsesource.jaxrs.provider.security` - Provides an OSGi friendly integration of Jersey's/JAX-RS security features. [Read the wiki for more information](https://github.com/hstaudacher/osgi-jax-rs-connector/wiki/security). * `com.eclipsesource.jaxrs.provider.sse` - Provides an integration of Jersey's [SSE feature](https://jersey.java.net/documentation/latest/sse.html). ## Installation @@ -51,7 +51,7 @@ Install from this software repository into your target: `http://hstaudacher.gith com.eclipsesource osgi-jaxrs-connector - 3.1.0 + 3.2.0 ``` @@ -60,7 +60,7 @@ Install from this software repository into your target: `http://hstaudacher.gith com.eclipsesource jaxrs-consumer - 2.1.0 + 2.2.0 ``` @@ -71,8 +71,8 @@ Install from this software repository into your target: `http://hstaudacher.gith Basically all you need to to is add the publisher and/or the consumer to your OSGi container and start them. For people new to OSGi the steps to get started with the connector and Eclipse are described below. 1. Add the com.eclipsesource.jaxrs.connector.feature (OSGi JAX-RS Connector) to your target using the url mentioned in the Installation/p2 section. -2. Add the `com.eclipsesource.jaxrs.publisher` and its' dependencies bundles to your OSGi instance. -3. Convert some OSGi service to resources like in [this tutorial](http://jersey.java.net/nonav/documentation/latest/getting-started.html#d4e45) +2. Add the `com.eclipsesource.jaxrs.publisher` and its dependencies bundles to your OSGi instance. +3. Convert some OSGi services to resources like in [this tutorial](http://jersey.java.net/nonav/documentation/latest/getting-started.html#d4e45) 4. Point your client to the specified url. Don't forget that the default root path is `/services`. So registering a service with the path `/example` would lead to `/services/example`. @@ -82,14 +82,15 @@ The steps how the consumer will be handled are dscribed in this [post](http://ec Examples for the publisher and consumer can be found within the [examples](https://github.com/hstaudacher/osgi-jax-rs-connector/tree/master/examples) folder. ### Publisher Examples -Two examples exist for the publisher. They are located in the bundles `com.eclipsesource.jaxrs.connector.example` -and `com.eclipsesource.jaxrs.connector.example.ds`. As the names say one uses Declarative services and the other don't. +Some examples exist for the publisher. They are located in the bundles `com.eclipsesource.jaxrs.connector.example` and `com.eclipsesource.jaxrs.connector.example.ds`. As the names say one uses Declarative services and the other don't. In both exampels a simple POJO is annotated with `@Path` and will be registered as an OSGIi service. Both bundles contain an Eclipse Launch Configuration to start them (please don't forget to add the publisher bundle to the launch config). After starting the launch configs the service will be available at `http://localhost:9090/services/osgi-jax-rs`. As a bonus the `com.eclipsesource.jaxrs.connector.example.ds` contains an example how to use the `@Provider` together with the publisher. +Besides these basic example two example exist that are shwoing how the [security integration](https://github.com/hstaudacher/osgi-jax-rs-connector/tree/master/examples/com.eclipsesource.jaxrs.security.example) and [Jersey's SSE integration](https://github.com/hstaudacher/osgi-jax-rs-connector/tree/master/examples/com.eclipsesource.jaxrs.sse.example) works. + ### Consumer Examples -The example for the consumer is splitted into two bundles called `com.eclipsesource.jaxrs.consumer.example` and `com.eclipsesource.jaxrs.consumer.example.caller`. The example bundle contains the data model and the resource interface while the caller just calls the service. The example fetches data from github and is prett simple. +The example for the consumer is splitted into two bundles called `com.eclipsesource.jaxrs.consumer.example` and `com.eclipsesource.jaxrs.consumer.example.caller`. The example bundle contains the data model and the resource interface while the caller just calls the service. The example fetches data from github and is pretty simple. ## Requirements * OSGi Core Specification 4.2 and an OSGi HttpService implementation (e.g. Equinox, Felix). @@ -100,7 +101,7 @@ The example for the consumer is splitted into two bundles called `com.eclipsesou * OSGi Remote Services (e.g. [Apache CXF](http://cxf.apache.org/distributed-osgi-reference.html#DistributedOSGiReference-ServiceProviderpropertiesForConfiguringRESTfulJAXRSbasedendpointsandconsumers)) ## Jersey version -Jersey 2.3.1 + dependencies are included in the p2 software repository. +Jersey 2.5.0 + dependencies are included in the p2 software repository. ## Changelog Checkout the [github releases](https://github.com/hstaudacher/osgi-jax-rs-connector/releases). @@ -108,4 +109,4 @@ Checkout the [github releases](https://github.com/hstaudacher/osgi-jax-rs-connec ## License The code is published under the terms of the [Eclipse Public License, version 1.0](http://www.eclipse.org/legal/epl-v10.html). -Included binaries from [Jersey](http://jersey.java.net/), version 2.3.1, which are published under two licenses, the [CDDL 1.1 and GPL 2 with CPE](http://glassfish.java.net/public/CDDL+GPL_1_1.html) +Included binaries from [Jersey](http://jersey.java.net/), version 2.5.0, which are published under two licenses, the [CDDL 1.1 and GPL 2 with CPE](http://glassfish.java.net/public/CDDL+GPL_1_1.html) diff --git a/build/com.eclipsesource.jaxrs.connector.feature/feature.xml b/build/com.eclipsesource.jaxrs.connector.feature/feature.xml index 1faaa453..7fe514b6 100644 --- a/build/com.eclipsesource.jaxrs.connector.feature/feature.xml +++ b/build/com.eclipsesource.jaxrs.connector.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/build/com.eclipsesource.jaxrs.connector.feature/pom.xml b/build/com.eclipsesource.jaxrs.connector.feature/pom.xml index 9f50076b..fe02f0ad 100644 --- a/build/com.eclipsesource.jaxrs.connector.feature/pom.xml +++ b/build/com.eclipsesource.jaxrs.connector.feature/pom.xml @@ -12,7 +12,7 @@ com.eclipsesource com.eclipsesource.jaxrs.connector.feature - 3.1.0-SNAPSHOT + 3.2.0-SNAPSHOT eclipse-feature diff --git a/build/com.eclipsesource.jaxrs.provider.moxy.feature/feature.xml b/build/com.eclipsesource.jaxrs.provider.moxy.feature/feature.xml index 676dd310..91b66733 100644 --- a/build/com.eclipsesource.jaxrs.provider.moxy.feature/feature.xml +++ b/build/com.eclipsesource.jaxrs.provider.moxy.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/build/com.eclipsesource.jaxrs.provider.moxy.feature/pom.xml b/build/com.eclipsesource.jaxrs.provider.moxy.feature/pom.xml index d6ecae5a..604c2184 100644 --- a/build/com.eclipsesource.jaxrs.provider.moxy.feature/pom.xml +++ b/build/com.eclipsesource.jaxrs.provider.moxy.feature/pom.xml @@ -11,7 +11,7 @@ com.eclipsesource com.eclipsesource.jaxrs.provider.moxy.feature - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT eclipse-feature diff --git a/build/com.eclipsesource.jaxrs.repository/category.xml b/build/com.eclipsesource.jaxrs.repository/category.xml index d76715b3..97178e4a 100644 --- a/build/com.eclipsesource.jaxrs.repository/category.xml +++ b/build/com.eclipsesource.jaxrs.repository/category.xml @@ -1,9 +1,9 @@ - + - + @@ -12,10 +12,10 @@ - + - + diff --git a/build/com.eclipsesource.jaxrs.repository/pom.xml b/build/com.eclipsesource.jaxrs.repository/pom.xml index 6e8cb853..2878b99c 100644 --- a/build/com.eclipsesource.jaxrs.repository/pom.xml +++ b/build/com.eclipsesource.jaxrs.repository/pom.xml @@ -11,7 +11,7 @@ com.eclipsesource com.eclipsesource.jaxrs.repository - 1.0.0-SNAPSHOT + 3.2.0-SNAPSHOT eclipse-repository diff --git a/bundles/com.eclipsesource.jaxrs.consumer/META-INF/MANIFEST.MF b/bundles/com.eclipsesource.jaxrs.consumer/META-INF/MANIFEST.MF index 41340bf3..67cc9b8a 100644 --- a/bundles/com.eclipsesource.jaxrs.consumer/META-INF/MANIFEST.MF +++ b/bundles/com.eclipsesource.jaxrs.consumer/META-INF/MANIFEST.MF @@ -2,10 +2,10 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: JAX-RS Consumer Bundle-SymbolicName: com.eclipsesource.jaxrs.consumer -Bundle-Version: 2.1.0.qualifier +Bundle-Version: 2.2.0.qualifier Bundle-Vendor: EclipseSource Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Export-Package: com.eclipsesource.jaxrs.consumer;version="2.0.0" +Export-Package: com.eclipsesource.jaxrs.consumer;version="2.2.0" Import-Package: com.google.common.collect;version="[14.0.0,14.1.0)", javax.annotation;version="[1.1.99,2.0.0)", javax.inject;version="[1.0.0,2.0.0)", diff --git a/bundles/com.eclipsesource.jaxrs.consumer/pom.xml b/bundles/com.eclipsesource.jaxrs.consumer/pom.xml index 98ee5b4d..29f0803b 100644 --- a/bundles/com.eclipsesource.jaxrs.consumer/pom.xml +++ b/bundles/com.eclipsesource.jaxrs.consumer/pom.xml @@ -12,7 +12,7 @@ com.eclipsesource com.eclipsesource.jaxrs.consumer - 2.1.0-SNAPSHOT + 2.2.0-SNAPSHOT eclipse-plugin diff --git a/bundles/com.eclipsesource.jaxrs.provider.moxy/META-INF/MANIFEST.MF b/bundles/com.eclipsesource.jaxrs.provider.moxy/META-INF/MANIFEST.MF index 392676df..3b62b55a 100644 --- a/bundles/com.eclipsesource.jaxrs.provider.moxy/META-INF/MANIFEST.MF +++ b/bundles/com.eclipsesource.jaxrs.provider.moxy/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: com.eclipsesource.jaxrs.provider.moxy -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 1.1.0.qualifier Bundle-Vendor: %Bundle-Vendor Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: javax.ws.rs.ext;version="[2.0.0,3.0.0)", diff --git a/bundles/com.eclipsesource.jaxrs.provider.moxy/pom.xml b/bundles/com.eclipsesource.jaxrs.provider.moxy/pom.xml index 8a53462c..ea945f00 100644 --- a/bundles/com.eclipsesource.jaxrs.provider.moxy/pom.xml +++ b/bundles/com.eclipsesource.jaxrs.provider.moxy/pom.xml @@ -12,7 +12,7 @@ com.eclipsesource com.eclipsesource.jaxrs.provider.moxy - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT eclipse-plugin diff --git a/bundles/com.eclipsesource.jaxrs.publisher/META-INF/MANIFEST.MF b/bundles/com.eclipsesource.jaxrs.publisher/META-INF/MANIFEST.MF index 296632b0..bbd9e4a3 100644 --- a/bundles/com.eclipsesource.jaxrs.publisher/META-INF/MANIFEST.MF +++ b/bundles/com.eclipsesource.jaxrs.publisher/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: com.eclipsesource.jaxrs.publisher -Bundle-Version: 3.1.0.qualifier +Bundle-Version: 3.2.0.qualifier Bundle-Vendor: %Bundle-Name Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-Localization: plugin @@ -19,5 +19,5 @@ Import-Package: javax.servlet;version="[2.3.0,4.0.0)", org.osgi.service.cm;version="[1.4.0,2.0.0)", org.osgi.service.http;version="[1.2.0,2.0.0)", org.osgi.util.tracker;version="[1.5.0,2.0.0)" -Export-Package: com.eclipsesource.jaxrs.connector;version="3.1.0", - com.eclipsesource.jaxrs.publisher;version="3.1.0" +Export-Package: com.eclipsesource.jaxrs.connector;version="3.2.0", + com.eclipsesource.jaxrs.publisher;version="3.2.0" diff --git a/bundles/com.eclipsesource.jaxrs.publisher/pom.xml b/bundles/com.eclipsesource.jaxrs.publisher/pom.xml index 333bb330..e3e540b9 100644 --- a/bundles/com.eclipsesource.jaxrs.publisher/pom.xml +++ b/bundles/com.eclipsesource.jaxrs.publisher/pom.xml @@ -12,7 +12,7 @@ com.eclipsesource com.eclipsesource.jaxrs.publisher - 3.1.0-SNAPSHOT + 3.2.0-SNAPSHOT eclipse-plugin diff --git a/tests/com.eclipsesource.jaxrs.consumer.test/META-INF/MANIFEST.MF b/tests/com.eclipsesource.jaxrs.consumer.test/META-INF/MANIFEST.MF index b65d9e2f..66748496 100644 --- a/tests/com.eclipsesource.jaxrs.consumer.test/META-INF/MANIFEST.MF +++ b/tests/com.eclipsesource.jaxrs.consumer.test/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: JAX-RS Consumer Test Bundle-SymbolicName: com.eclipsesource.jaxrs.consumer.test -Bundle-Version: 2.1.0.qualifier +Bundle-Version: 2.2.0.qualifier Bundle-Vendor: EclipseSource Fragment-Host: com.eclipsesource.jaxrs.consumer;bundle-version="2.1.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/tests/com.eclipsesource.jaxrs.consumer.test/pom.xml b/tests/com.eclipsesource.jaxrs.consumer.test/pom.xml index 4251ef70..cc8fc289 100644 --- a/tests/com.eclipsesource.jaxrs.consumer.test/pom.xml +++ b/tests/com.eclipsesource.jaxrs.consumer.test/pom.xml @@ -12,7 +12,7 @@ com.eclipsesource com.eclipsesource.jaxrs.consumer.test - 2.1.0-SNAPSHOT + 2.2.0-SNAPSHOT eclipse-plugin diff --git a/tests/com.eclipsesource.jaxrs.publisher.test/META-INF/MANIFEST.MF b/tests/com.eclipsesource.jaxrs.publisher.test/META-INF/MANIFEST.MF index 773d3af3..b11d4977 100644 --- a/tests/com.eclipsesource.jaxrs.publisher.test/META-INF/MANIFEST.MF +++ b/tests/com.eclipsesource.jaxrs.publisher.test/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: OSGi JAX-RS Connector Tests Bundle-SymbolicName: com.eclipsesource.jaxrs.publisher.test -Bundle-Version: 3.1.0.qualifier +Bundle-Version: 3.2.0.qualifier Bundle-Vendor: EclipseSource Fragment-Host: com.eclipsesource.jaxrs.publisher;bundle-version="3.1.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/tests/com.eclipsesource.jaxrs.publisher.test/pom.xml b/tests/com.eclipsesource.jaxrs.publisher.test/pom.xml index 6a3f26ca..d64c35af 100644 --- a/tests/com.eclipsesource.jaxrs.publisher.test/pom.xml +++ b/tests/com.eclipsesource.jaxrs.publisher.test/pom.xml @@ -11,7 +11,7 @@ com.eclipsesource com.eclipsesource.jaxrs.publisher.test - 3.1.0-SNAPSHOT + 3.2.0-SNAPSHOT eclipse-plugin