Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

The greeter demo can be found in the samples/greeter directory of the SVN code base and implements a simple OSGi Greeter Service and a consumer to that service with a trivial UI.
In this walkthrough all the required bundles are installed straight from the maven release repository, so no need to check out SVN and build anything to get started with the Greeter Demo.

NOTE: this demo requires CXF/DOSGi 1.1

The Greeter demo design

The demo is composed of 3 bundles:

...

Code Block
C:\felix-framework-3.0.1>

Welcome to Apache Felix Gogo
g! install http://repo1.maven.org/maven2/org/osgi/org.osgi.compendium/4.2.0/org.osgi.compendium-4.2.0.jar
g! start http://www.apache.org/dist/cxf/dosgi/1.12/cxf-dosgi-ri-singlebundle-distribution-1.12.jar
... some log messages may appear...
g! lb
    0|Active     |    0|org.apache.felix.framework (3.0.1)
    1|Active     |    1|org.apache.felix.bundlerepository (1.6.2)
    2|Active     |    1|org.apache.felix.gogo.command (0.6.0)
    3|Active     |    1|org.apache.felix.gogo.runtime (0.6.0)
    4|Active     |    1|org.apache.felix.gogo.shell (0.6.0)
    5|Resolved   |    1|osgi.cmpn (4.2.0.200908310645)
    6|Active     |    1|cxf-dosgi-ri-singlebundle-distribution (1.2.0)

...

Code Block
g! start http://repo1.maven.org/maven2/org/apache/cxf/dosgi/samples/cxf-dosgi-ri-samples-greeter-interface/1.12/cxf-dosgi-ri-samples-greeter-interface-1.12.jar
g! start http://repo1.maven.org/maven2/org/apache/cxf/dosgi/samples/cxf-dosgi-ri-samples-greeter-impl/1.12/cxf-dosgi-ri-samples-greeter-impl-1.12.jar
... some log messages will appear ...
g! lb
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (3.0.1)
    1|Active     |    1|Apache Felix Bundle Repository (1.6.2)
    2|Active     |    1|Apache Felix Gogo Command (0.6.0)
    3|Active     |    1|Apache Felix Gogo Runtime (0.6.0)
    4|Active     |    1|Apache Felix Gogo Shell (0.6.0)
    5|Resolved   |    1|osgi.cmpn (4.2.0.200908310645)
    6|Active     |    1|Distributed OSGi Distribution Software Single-Bundle Distribution
    7|Active     |    1|CXF Distributed OSGi Greeter Demo Interface Bundle
    8|Active     |    1|CXF Distributed OSGi Greeter Demo Service Implementation Bundle

At the end of the log messages you will see one appear that says:
INFO: TopologyManager: export sucessful Endpoints: [ Endpoint Desctiption Description for ServiceReference [org.apache.cxf.dosgi.samples.greeter.GreeterService]
This means that the service is successfully exposed remotely, and you can verify this by requesting the WSDL:

...

Code Block
xml
xml
<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0"
  xmlns:other="http://www.acme.org/xmlns/other/v1.0.0">
  <endpoint-description>
    <property name="objectClass">
      <array>
        <value>org.apache.cxf.dosgi.samples.greeter.GreeterService</value>
      </array>
    </property>
    <property name="endpoint.id">http://localhost:9090/greeter</property>
    <property name="service.imported.configs">org.apache.cxf.ws</property>
  </endpoint-description>
</endpoint-descriptions>

...

Code Block
/eclipse> java -jar plugins/org.eclipse.osgi_3.6.0.v20100517.jar -console
osgi> install install file:plugins/org.eclipse.osgi.services_3.2.100.v20100503.jar
Bundle id is 1

osgi> install http://www.apache.org/dist/cxf/dosgi/1.12/cxf-dosgi-ri-singlebundle-distribution-1.12.jar
Bundle id is 2

osgi> start 2
... some log messages may appear...

...

Code Block
osgi> install http://repo1.maven.org/maven2/org/apache/cxf/dosgi/samples/cxf-dosgi-ri-samples-greeter-interface/1.12/cxf-dosgi-ri-samples-greeter-interface-1.12.jar
Bundle id is 3
osgi> install http://repo1.maven.org/maven2/org/apache/cxf/dosgi/samples/cxf-dosgi-ri-samples-greeter-client/1.12/cxf-dosgi-ri-samples-greeter-client-1.12.jar
Bundle id is 4
osgi> ss

Framework is launched.

id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.6.0.v20100517
1       RESOLVED    org.eclipse.osgi.services_3.2.100.v20100503
2       ACTIVE      cxf-dosgi-ri-singlebundle-distribution
3       INSTALLED   cxf-dosgi-ri-samples-greeter-interface
4       INSTALLED   cxf-dosgi-ri-samples-greeter-client

osgi> start 4

...