Apache CXF provides the Reference Implementation of the Distribution Software (DSW) component of the Distributed OSGi Specification (RFC 119 in http://www.osgi.org/download/osgi-4.2-early-draft3.pdf).
It implements RFC 119 using Web Services, leveraging SOAP over HTTP and exposing the Web Service over a WSDL contract.
An implementation of the RFC 119 Discovery service is also worked on in this project.
Looking for the developer reference? See the Distributed OSGi Reference pages.
Presentations and other documents are on the DOSGi Presentations page.
Getting Started
To get started, get yourself a CXF-DOSGi distribution.
The following distributions are available:
- Multi Bundle Distribution: This distribution is a zip file containing the Distributed OSGi bundles, as well as all their dependencies.
- Single Bundle Distribution: This is a convenience distribution of a single bundle that embeds all the dependencies.
Which distribution to take? That depends on what you are doing. The single-bundle distribution is a really convenient way of getting started as it provides all of Distributed OSGi plus its dependencies in one.
The multi-bundle distribution is obviously a little more work to install, but the fine-grained bundles do have an extra benefit: they allow sharing. So if your application depends on one or more of the library bundles, it can use them from the multi-bundle distribution. Similarly, the multi-bundle distribution makes it possible to update the dependency bundles - if compatible - without having to replace the Distributed OSGi bundles.
Get a distribution by:
- Downloading a built distribution. See the DOSGi Releases page.
- Alternatively, built the distribution yourself. See the DOSGi Build page.
Setting up your OSGi container
Setting up the single-bundle distribution is really simple. For instructions on setting up the multi-bundle distribution see the Multi Bundle Setup page.
Prerequisites for the single-bundle distribution:
The single-bundle distribution requires some of the interfaces of the OSGi compendium specification. These are provided with the Equinox and Felix OSGi distributions, but not installed by default.
Setting up Felix
The compendium interfaces can be downloaded from the following here: http://archive.apache.org/dist/felix/org.osgi.compendium-1.2.0.jar or from a local mirror as per the Felix Download page.
To set up Felix you can follow these steps:
Verified with: Felix 1.8.0
../felix-1.8.0> java -jar bin/felix.jar Welcome to Felix. ================= -> start http://archive.apache.org/dist/felix/org.osgi.compendium-1.2.0.jar -> start http://www.apache.org/dist/cxf/dosgi/1.0/cxf-dosgi-ri-singlebundle-distribution-1.0.jar ... some log messages may appear... -> ps START LEVEL 1 ID State Level Name [ 0] [Active ] [ 0] System Bundle (1.8.0) [ 1] [Active ] [ 1] Apache Felix Shell Service (1.2.0) [ 2] [Active ] [ 1] Apache Felix Shell TUI (1.2.0) [ 3] [Active ] [ 1] Apache Felix Bundle Repository (1.4.0) [ 4] [Active ] [ 1] OSGi R4 Compendium Bundle (4.1.0) [ 5] [Active ] [ 1] Distributed OSGi Distribution Software Single-Bundle Distribution (1.0)
However, you can also change the conf/config.properties
file to automatically load these bundles. This approach is described in the Multi Bundle Setup page.
Setting up Equinox
The compendium interfaces are part of the Equinox/Eclipse distribution and can be found in a file called plugins/org.eclipse.osgi.services_3.2.0.v20090520-1800.jar (the timestamp could vary).
To set up Equinox you can follow these steps:
Verified with: Eclipse 3.5 RC 3
.../eclipse> java -jar plugins/org.eclipse.osgi_3.5.0.v20090520.jar -console osgi> install file:plugins/org.eclipse.osgi.services_3.2.0.v20090520-1800.jar Bundle id is 1 osgi> install http://www.apache.org/dist/cxf/dosgi/1.0/cxf-dosgi-ri-singlebundle-distribution-1.0.jar Bundle id is 2 osgi> start 2 ... some log messages may appear... osgi> ss Framework is launched. id State Bundle 0 ACTIVE org.eclipse.osgi_3.5.0.v20090520 1 RESOLVED org.eclipse.osgi.services_3.2.0.v20090520-1800 2 ACTIVE cxf-dosgi-ri-singlebundle-distribution_1.0.0
However, you can also create a config.ini
file to automatically load these bundles. This approach is described in the Multi Bundle Setup page.
Using Equinox from with the Eclipse IDE
This option is really handy for debugging. Verified with: Eclipse 3.5M4
Setting up Eclipse for Running and Debugging Distributed OSGi
The Samples
The samples directory contains the these sample projects:
Sample |
Description |
Doc Page |
---|---|---|
greeter |
a very simple demo of a Greeter OSGi Service exposed remotely and a Consumer invoking on it. |
|
spring_dm |
a demo created using Spring-DM. Rather than invoking on the OSGi API's directly, the Spring-DM demo shows how you can use Spring to configure your beans as OSGi Services and similarly how to use Spring-DM to invoke a (remote) OSGi Service. |
|
ds |
this demo shows how Distributed OSGi can be used with OSGi Declarative Services (DS). |
To get all the source of the samples:
- simply check out the DOSGi trunk from SVN (http://svn.apache.org/repos/asf/cxf/dosgi/trunk)
- go into the
samples
directory - and build them using
mvn install
Using it in your OSGi container
Configuration file snippets for Felix and Equinox are automatically generated during the build process. You can paste these snippets in the configuration of you OSGi container to automatically load the bundles for your distribution.
After doing a build, the following snippets are available:
distribution/multi-bundle/target/felix.config.properties.append
distribution/multi-bundle/target/equinox.config.ini.append
distribution/single-bundle/felix.config.properties.append
distribution/single-bundle/equinox.config.ini.append
Note that to run the Distributed OSGi bundles, you need an OSGi container that implements the ListenerHook Service Registry Hook. This is a new feature in OSGi 4.2 which is available in Felix from version 1.6.0 and Equinox 3.5 milestones since December 2008.
Using Felix
Verified with: Felix 1.8.0
- Append the content of the felix.config.properties.append file to the conf/config.properties file that comes with Felix.
- Then start Felix as normal.
For the single-bundle distribution, the following bundles will be present:
java -jar bin\felix.jar ... log output ommitted ... -> ps START LEVEL 2 ID State Level Name [ 0] [Active ] [ 0] System Bundle [ 1] [Active ] [ 1] Apache Felix Shell Service [ 2] [Active ] [ 1] Apache Felix Shell TUI [ 3] [Active ] [ 1] Apache Felix Bundle Repository [ 4] [Active ] [ 2] OSGi R4 Compendium Bundle (4.1.0) [ 5] [Active ] [ 2] Distributed OSGi Distribution Software Single-Bundle Distribution
For the multi-bundle distribution the list is obviously much longer:
START LEVEL 34 ID State Level Name [ 0] [Active ] [ 0] System Bundle (1.5.0.SNAPSHOT) [ 1] [Active ] [ 1] Apache Felix Shell Service (1.1.0.SNAPSHOT) [ 2] [Active ] [ 1] Apache Felix Shell TUI (1.1.0.SNAPSHOT) [ 3] [Active ] [ 1] Apache Felix Bundle Repository (1.3.0.SNAPSHOT) [ 4] [Active ] [ 2] OSGi R4 Compendium Bundle (4.1.0) [ 5] [Active ] [ 3] geronimo-annotation_1.0_spec (1.1.1) [ 6] [Active ] [ 4] geronimo-activation_1.1_spec (1.0.2) [ 7] [Active ] [ 5] geronimo-javamail_1.4_spec (1.2) [ 8] [Active ] [ 6] geronimo-ws-metadata_2.0_spec (1.1.2) [ 9] [Active ] [ 7] geronimo-servlet_2.5_spec (1.1.2) [ 10] [Active ] [ 8] Apache Commons Logging (1.1.1) [ 11] [Active ] [ 9] JDOM DOM Processor (1.0.0) [ 12] [Active ] [ 10] spring-core (2.5.5) [ 13] [Active ] [ 11] spring-beans (2.5.5) [ 14] [Active ] [ 12] spring-context (2.5.5) [ 15] [Active ] [ 13] AOP Appliance API (1.0.0) [ 16] [Active ] [ 14] spring-aop (2.5.5) [ 17] [Active ] [ 15] spring-osgi-io (1.1.2) [ 18] [Active ] [ 16] spring-osgi-core (1.1.2) [ 19] [Active ] [ 17] spring-osgi-extender (1.1.2) [ 20] [Active ] [ 18] Jetty Utilities (6.1.9) [ 21] [Active ] [ 19] Jetty Server (6.1.9) [ 22] [Active ] [ 20] org.apache.servicemix.specs.locator-1.0.0.jar [ 23] [Active ] [ 21] Apache ServiceMix OSGI Common Bundles: jaxb-impl (4.0.0.m1) [ 24] [Active ] [ 22] Apache ServiceMix OSGI Common Bundles: wsdl4j (4.0.0.m1) [ 25] [Active ] [ 23] Apache ServiceMix OSGI Common Bundles: xmlschema (4.0.0.m1) [ 26] [Active ] [ 24] Apache ServiceMix OSGI Common Bundles: asm-2.2.3 (1.0.0.rc1) [ 27] [Active ] [ 25] Apache ServiceMix OSGI Common Bundles: xmlresolver (4.0.0.m1) [ 28] [Active ] [ 26] Apache ServiceMix OSGI Common Bundles: neethi (4.0.0.m1) [ 29] [Active ] [ 27] Apache ServiceMix Bundles: woodstox-3.2.7 (3.2.7.1) [ 30] [Active ] [ 28] Apache CXF Minimal Bundle Jar (2.0.8) [ 31] [Active ] [ 29] CXF Local Discovery Service Bundle [ 32] [Active ] [ 30] CXF Distributed Software Bundle [ 33] [Active ] [ 31] Apache ServiceMix Specs :: SAAJ API 1.3 (1.0.0) [ 34] [Active ] [ 32] Apache ServiceMix Specs :: STAX API 1.0 (1.0.0) [ 35] [Active ] [ 33] Apache ServiceMix Specs :: JAXB API 2.0 (1.0.0) [ 36] [Active ] [ 34] Apache ServiceMix Specs :: JAXWS API 2.0 (1.0.0)
Using Equinox
Verified with: Eclipse Equinox 3.5M4
Append the contents of the equinox.config.ini.append file to your Equinox configuration/config.ini file. Or create a new config.ini file with the contents of the equinox.config.ini.append file if you don't have one.
Then start up equinox as normal. You will get something like this (for the single-bundle distribution):
java -jar plugins\org.eclipse.osgi_3.5.0.v20081201-1815.jar -configuration configuration -console ... log output ommitted ... osgi> ss Framework is launched. id State Bundle 0 ACTIVE org.eclipse.osgi_3.5.0.v20081201-1815 1 ACTIVE org.eclipse.osgi.services_3.2.0.v20081205-1800 2 ACTIVE cxf-dosgi-ri-singlebundle-distribution
Using Equinox from with the Eclipse IDE
This option is really handy for debugging. Verified with: Eclipse 3.5M4
Setting up Eclipse for Running and Debugging Distributed OSGi
Reference
See Distributed OSGi Reference pages.