Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Commit

Permalink
Preparation of 3.2 release
Browse files Browse the repository at this point in the history
Updates bundle and feature vesions
Adopts README
  • Loading branch information
hstaudacher committed Dec 31, 2013
1 parent dbb48a1 commit fc4bb97
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 41 deletions.
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -51,7 +51,7 @@ Install from this software repository into your target: `http://hstaudacher.gith
<dependency>
<groupId>com.eclipsesource</groupId>
<artifactId>osgi-jaxrs-connector</artifactId>
<version>3.1.0</version>
<version>3.2.0</version>
</dependency>
```

Expand All @@ -60,7 +60,7 @@ Install from this software repository into your target: `http://hstaudacher.gith
<dependency>
<groupId>com.eclipsesource</groupId>
<artifactId>jaxrs-consumer</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
```

Expand All @@ -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`.

Expand All @@ -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).
Expand All @@ -100,12 +101,12 @@ 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).

## 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)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="com.eclipsesource.jaxrs.connector.feature"
label="OSGi - JAX-RS Connector"
version="3.1.0.qualifier"
version="3.2.0.qualifier"
provider-name="EclipseSource">

<description>
Expand Down
2 changes: 1 addition & 1 deletion build/com.eclipsesource.jaxrs.connector.feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.eclipsesource</groupId>
<artifactId>com.eclipsesource.jaxrs.connector.feature</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="com.eclipsesource.jaxrs.provider.moxy.feature"
label="JAX-RS MOXy Provider"
version="1.0.0.qualifier"
version="1.1.0.qualifier"
provider-name="EclipseSource">

<description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>com.eclipsesource</groupId>
<artifactId>com.eclipsesource.jaxrs.provider.moxy.feature</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>

</project>
8 changes: 4 additions & 4 deletions build/com.eclipsesource.jaxrs.repository/category.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/com.eclipsesource.jaxrs.connector.feature_3.1.0.qualifier.jar" id="com.eclipsesource.jaxrs.connector.feature" version="3.1.0.qualifier">
<feature url="features/com.eclipsesource.jaxrs.connector.feature_3.2.0.qualifier.jar" id="com.eclipsesource.jaxrs.connector.feature" version="3.2.0.qualifier">
<category name="com.eclipsesource.jaxrs.connector"/>
</feature>
<feature url="features/com.eclipsesource.jaxrs.connector.feature.source_3.1.0.qualifier.jar" id="com.eclipsesource.jaxrs.connector.feature.source" version="3.1.0.qualifier">
<feature url="features/com.eclipsesource.jaxrs.connector.feature.source_3.2.0.qualifier.jar" id="com.eclipsesource.jaxrs.connector.feature.source" version="3.2.0.qualifier">
<category name="com.eclipsesource.jaxrs.connector.sources"/>
</feature>
<feature url="features/com.eclipsesource.jaxrs.provider.gson.feature_1.0.0.qualifier.jar" id="com.eclipsesource.jaxrs.provider.gson.feature" version="1.0.0.qualifier">
Expand All @@ -12,10 +12,10 @@
<feature url="features/com.eclipsesource.jaxrs.provider.gson.feature.source_1.0.0.qualifier.jar" id="com.eclipsesource.jaxrs.provider.gson.feature.source" version="1.0.0.qualifier">
<category name="com.eclipsesource.jaxrs.connector.sources"/>
</feature>
<feature url="features/com.eclipsesource.jaxrs.provider.moxy.feature_1.0.0.qualifier.jar" id="com.eclipsesource.jaxrs.provider.moxy.feature" version="1.0.0.qualifier">
<feature url="features/com.eclipsesource.jaxrs.provider.moxy.feature_1.1.0.qualifier.jar" id="com.eclipsesource.jaxrs.provider.moxy.feature" version="1.1.0.qualifier">
<category name="com.eclipsesource.jaxrs.connector.providers"/>
</feature>
<feature url="features/com.eclipsesource.jaxrs.provider.moxy.feature.source_1.0.0.qualifier.jar" id="com.eclipsesource.jaxrs.provider.moxy.feature.source" version="1.0.0.qualifier">
<feature url="features/com.eclipsesource.jaxrs.provider.moxy.feature.source_1.1.0.qualifier.jar" id="com.eclipsesource.jaxrs.provider.moxy.feature.source" version="1.1.0.qualifier">
<category name="com.eclipsesource.jaxrs.connector.sources"/>
</feature>
<feature url="features/com.eclipsesource.jaxrs.provider.security.feature_1.0.0.qualifier.jar" id="com.eclipsesource.jaxrs.provider.security.feature" version="1.0.0.qualifier">
Expand Down
2 changes: 1 addition & 1 deletion build/com.eclipsesource.jaxrs.repository/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>com.eclipsesource</groupId>
<artifactId>com.eclipsesource.jaxrs.repository</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<packaging>eclipse-repository</packaging>

</project>
4 changes: 2 additions & 2 deletions bundles/com.eclipsesource.jaxrs.consumer/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
2 changes: 1 addition & 1 deletion bundles/com.eclipsesource.jaxrs.consumer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.eclipsesource</groupId>
<artifactId>com.eclipsesource.jaxrs.consumer</artifactId>
<version>2.1.0-SNAPSHOT</version>
<version>2.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
2 changes: 1 addition & 1 deletion bundles/com.eclipsesource.jaxrs.provider.moxy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.eclipsesource</groupId>
<artifactId>com.eclipsesource.jaxrs.provider.moxy</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
2 changes: 1 addition & 1 deletion bundles/com.eclipsesource.jaxrs.publisher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.eclipsesource</groupId>
<artifactId>com.eclipsesource.jaxrs.publisher</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/com.eclipsesource.jaxrs.consumer.test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.eclipsesource</groupId>
<artifactId>com.eclipsesource.jaxrs.consumer.test</artifactId>
<version>2.1.0-SNAPSHOT</version>
<version>2.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/com.eclipsesource.jaxrs.publisher.test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>com.eclipsesource</groupId>
<artifactId>com.eclipsesource.jaxrs.publisher.test</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down

0 comments on commit fc4bb97

Please sign in to comment.