Parte IV: La última comida
37. Buddhasarirapuja Veneración de los restos del cuerpo del Buda
- The demo is based on: http://cxf.apache.org/distributed-osgi-greeter-demo-walkthrough.html -The demo will go through the following steps:
Step 1: Develop the Greeter Interface bundle in Eclipse.
Step 2: Develop the Greeter Service Implementation bundle in Eclipse. Step 3: Deploy Greeter Service as web service.
Step 4: Export bundles as jar files.
Step 5: Deploy above jar files in Apache Felix.
Step 6: Develop and Deploy the Greeter Interface bundle and the Greeter Service Consumer bundle in Eclipse that consume Greeter Service deployed in Apache Felix.
Step 1: Develop the Greeter Interface bundle in Eclipse - Create new plugin-project called ‘Interface’
- right click on project explorer -> new -> other -> Plug-in Project ->next
- set Project name to ‘Interface’ and select run with OSGi framework Equinox -> next
- remove the Activator class->finish
- copy the files GreeterData.java, GreeterException.java, GreeterService.java, GreetingPhrase.java from: http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/greeter/interface/src/main/java/org/apache/cxf/dos gi/samples/greeter/
- set import and export packages in MANIFEST.MF as fallows:
Step 2: Develop the Greeter Service Implementation bundle in Eclipse. - create new plugin-project called ‘Impl’
- right click on project explorer -> new -> other -> Plug-in Project ->next
- set Project name to ‘Impl’ and select run with OSGi framework Equinox -> next - set the activator as: org.apache.cxf.dosgi.samples.greeter.impl.Activator ->finish - copy files Activator.java, GreeterServiceImpl.java from:
http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/greeter/impl/src/main/java/org/apache/cxf/dosgi/s amples/greeter/impl/
- in the Activator class add org.apache.cxf.dosgi.samples.greeter.GreeterService as imported packages. - now MANIFEST.MF look like as follows;
Step 3: Deploy Greeter Service as web service.
- right click on cxf-dosgi-ri-singlebundle-distribution project -> Run as -> Run Configuration - create new configuration on OSGi framework name the new configuration.
- select only the workspace bundle as follows:
- click Run
- you can verify running web service by checking http://localhost:9090/greeter?wsdl
Step 4: Export bundles as jar files.
- right click on the bundle -> export -> Java -> JAR file -> next - select the bundle, name and target location
- select options -> next
- select use existing manifest file from the workspace -> finish
- delete Interface, Impl bundles in Eclipse (use ‘close’ exit from osgi prompt)
Step 5: Deploy above jar files in Apache Felix. -set up felix environment
- move to felix-framework-3.0.2> execute commands:
F:\felix-framework-3.0.2>java -jar bin/felix.jar _______________
Welcome to Apache Felix Gogo g! install http://repo1.maven.org/maven2/org/osgi/org.osgi.compendium/4.2.0/org.osgi.com pendium-4.2.0.jar Bundle ID: 5 g! start http://www.apache.org/dist/cxf/dosgi/1.2/cxf-dosgi-ri-singlebundle- distribution-1.2.jar ..
INFO: TopologyManager: triggerExportImportForRemoteSericeAdmin() g!
- start interface, impl bundles in felix:
g! start file:/F:/Jar/interface.jar g! start file:/F:/Jar/impl.jar
- to check status of the bundles: lb
START LEVEL 1
ID|State |Level|Name
0|Active | 0|System Bundle (3.0.2)
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 Dis- tribution (1.2.0)
7|Active | 1|Interface (1.0.0.qualifier) 8|Active | 1|Impl (1.0.0.qualifier) g!
- you can verify running web service by checking http://localhost:9090/greeter?wsdl
Step 6: Develop and Deploy the Greeter Interface bundle and the Greeter Service Consumer bundle in Eclipse
- develop Greeter Interface bundle similar to above.
- create new plugin project called ‘client’ and set Activator class as: org.apache.cxf.dosgi.samples.greeter.client.Activator
http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/greeter/client/src/main/java/org/apache/cxf/dosgi/ samples/greeter/client/
- add org.apache.cxf.dosgi.samples.greeter as imported package. - add org.osgi.framework as imported package
- manifest file looks like as fallows
- create remote-services.xml in OSGI-INF\remote-service
<?xml version="1.0" encoding="UTF-8"?>
<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0"> <service-description>
<provide inter-
face="org.apache.cxf.dosgi.samples.greeter.GreeterService" /> <property name="osgi.remote.interfaces">*</property>
<property name="osgi.remote.configuration.type">pojo</property> <property
name="osgi.remote.configuration.pojo.address">http://localhost:9090/greeter</
property>
</service-description>
<!-- further service-description tags are allowed here -->
</service-descriptions>
- deploy the client
- right click on client -> Run as -> Run Configuration -> select
- then client will appear
- output will look like this:
*** Opening greeter client dialog *** *** Invoking greeter *** greetMe("Cool") returns: Hola Cool Bonjour Cool Hoi Cool Hello Cool