Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • The Greeter Interface bundle
  • The Greeter Service Implementation bundle
  • The Greeter Service Consumer bundle

The Greeter Interface bundle exports the GreeterService interface which both other bundles depend on. This is the interface:

Code Block
java
java
public interface GreeterService {
    Map<GreetingPhrase, String> greetMe(String name);
    GreetingPhrase [] greetMe(GreeterData name) throws GreeterException;
}

The GreetingPhase and GreeterException classes are also defined by this bundle.

In this walkthrough, the following setup will be used:

The client side bundles will be running in Equinox, invoking on a Distributed OSGi Service running in Felix. Note that the choice of containers is completely trivial. Any OSGi container that implements the Service Registry Hooks (a new feature in OSGi 4.2) can be used on either side.

...

Let's run the server in Felix 1.8.0. As a prerequisite it requires some of the OSGi Compendium Specification interfaces. These don't come with the Felix download, but you can install a bundle that contains these interfaces straight from the Felix download areaMaven.
In this walkthrough I'm using the single-bundle distribution of CXF/DOSGi which can be installed straight from the Maven release repository.

...

Code Block
C:\felix-1.8.0>java -jar bin\felix.jar

Welcome to Felix.
=================

-> 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)
-> start http://wwwrepo2.apachemaven.org/dist/felixmaven2/org/osgi/org.osgi.compendium/4.1.0/org.osgi.compendium-4.1.2.0.jar
-> start https://repository.apache.org/content/groups/snapshots/org/apache/cxf/dosgi/cxf-dosgi-ri-singlebundle-distribution/1.1-SNAPSHOT/cxf-dosgi-ri-singlebundle-distribution-1.1-SNAPSHOT.jar

...

Now let's start up the server-side greeter bundles. Like with the DOSGi bundle itself, I'm installing these straight from the Maven release repository.

Code Block
-> start httphttps://repo2repository.mavenapache.org/content/groups/maven2snapshots/org/apache/cxf/dosgi/samples/cxf-dosgi-ri-samples-greeter-interface/1.01-SNAPSHOT/cxf-dosgi-ri-samples-greeter-interface-1.01-SNAPSHOT.jar
-> start httphttps://repo2repository.mavenapache.org/content/groups/maven2snapshots/org/apache/cxf/dosgi/samples/cxf-dosgi-ri-samples-greeter-impl/1.01-SNAPSHOT/cxf-dosgi-ri-samples-greeter-impl-1.01-SNAPSHOT.jar
-> 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
[   8] [Active     ] [    1] CXF Distributed OSGi Greeter Demo Interface Bundle
[   9] [Active     ] [    1] CXF Distributed OSGi Greeter Demo Service Implementation Bundle

...