...
Code Block |
---|
java -jar ..\..\..\modules\osgi-3.5.0-v20090520.jar -configuration ..\..\..\features\configuration -clean -console |
On *Unix, run
Code Block |
---|
java -jar ../../../modules/osgi-3.5.0-v20090520.jar -configuration ../../../features/configuration -clean -console |
...
These samples demonstrate the execution of Tuscany contributions in a OSGI environment. In particular the two projects bundle project in this directory define calculator objects that communicate with one another using the mechanisms defined in the OSGi remote services specifications. Here the Tuscany SCA runtime provides dynamic service discovery functionality. The calculator objects are registered as services directly with the OSGi bundle context by the bundle activator. Under the covers SCA provides the remote service disovery features that allow OSGi registered service to discover and communicate with one anothe another across two JVMs.
...
To run the sample each bundle must be build using maven and then loaded into a separate OSGi environment into which the Tuscany SCA runtime has already been installed (See "osgi" under running-tuscany)
dosgi-dynamic-calculator-operations
implementation-bpel
...
title | TODO |
---|
...
This bundle provides the calculator add, subtract, multiple, divide operations services.
Panel | ||
---|---|---|
| ||
The bundle Jar can be built using Maven as follows:
|
Note | ||
---|---|---|
| ||
check instructions work and fix up |
This sample demonstrates an SCA service implemented by a BPEL process.
If you just want to run it to see what happens open a command prompt, navigate
to this sample directory, and do
Code Block |
---|
ant compile run
|
OR if you don't have ant, on Windows do
projects should be called dosgi-dynamic-calculator-operations-bundle |
To run the bundle see "osgi" under running-tuscany. In short do the following:
On Windows, run
Code Block |
---|
java -jar ..\..\ |
Code Block |
mkdir target\classes mkdir target\wsdl2java-source java \-cp ..\..\libmodules\tuscany-sca-manifestosgi-3.5.0-v20090520.jar org.apache.tuscany.sdo.generate.XSD2JavaGenerator \-targetDirectory target/wsdl2java-source \-prefix HelloWorld \-noContainment \-noUnsettable src/main/resources/helloworld.wsdl java \-cp ..\..\lib\tuscany-sca-manifest.jar org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator \-targetDirectory target/wsdl2java-source src/main/resources/helloworld.wsdl unzip ..\..\lib\ode-dao-jpa-ojpa-derby-1.1.zip \-d target\database javac \-d target\classes \-cp target\classes;..\..\lib\tuscany-sca-manifest.jar \-sourcepath src\main\java;target\wsdl2java-source \-target 1.5 \-g \-source 1.5 src\main\java\helloworld\BPELClient.java copy src\main\resources\* target\classes java \-cp ..\..\lib\tuscany-sca-manifest.jar;target\classes;target\database helloworld.BPELClient |
and on *nix do
Code Block |
---|
mkdir target/classes
mkdir target/wsdl2java-source
java \-cp ../../lib/tuscany-sca-manifest.jar org.apache.tuscany.sdo.generate.XSD2JavaGenerator \-targetDirectory target/wsdl2java-source \-prefix HelloWorld \-noContainment \-noUnsettable src/main/resources/helloworld.wsdl
java \-cp ../../lib/tuscany-sca-manifest.jar org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator \-targetDirectory target/wsdl2java-source src/main/resources/helloworld.wsdl
unzip ../../lib/ode-dao-jpa-ojpa-derby-1.1.zip \-d target/database
javac \-d target/classes \-cp target/classes;../../lib/tuscany-sca-manifest.jar \-sourcepath src/main/java;target/wsdl2java-source \-target 1.5 \-g \-source 1.5 src/main/java/helloworld/BPELClient.java
cp src/main/resources/\* target/classes
java \-cp ../../lib/tuscany-sca-manifest.jar:target/classes:target/database helloworld.BPELClient
|
The sample will start an embedded BPEL engine, deploy a process and invoke it.
Sample Overview
The sample provides a single component that is wired to a service with a
web service binding.
Code Block |
---|
helloworld-bpel/
src/
main/
java/
helloworld/
BPELClient.java - client application for
BEPELHelloWorldComponent
resources/
deploy.xml - ODE deployment descriptor
helloworld.bpel - helloworld bpel process
helloworld.componentType - helloworld bpel service description
helloworld.composite - the SCA assembly for this sample
helloworld.wsdl - the service description that describes
the bpel process
log4j.properties - logging configuration
test/
java/
helloworld/
BPELHelloWorldTestCase.java - JUnit test case
helloworld-bpel.png - a pictorial representation of the
sample .composite file
build.xml - the Ant build file
pom.xml - the Maven build file
|
Building And Running The Sample Using Ant
With the binary distribution the sample can be built and run using Ant as
follows
Code Block |
---|
cd helloworld-bpel
ant compile
ant run
|
You should see the following output from the run target.
Code Block |
---|
run:
[java] Starting BPELHelloWorldComponent
[java] >>> Deploying : D:\temp\SCA1.1-RC1\tuscany-sca-1.1-incubating\samples\helloworld-bpel\target\classes
[java] ::arg:::::: <?xml version="1.0" encoding="UTF-8"?>
[java] <hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"><message xmlns="http://tuscany.apache.org/implementation/bpel/exampl
e/helloworld.wsdl">Hello</message></hello>
[java] ::message:: <?xml version="1.0" encoding="UTF-8"?>
[java] <message><TestPart><hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"><message xmlns="http://tuscany.apache.org/impleme
ntation/bpel/example/helloworld.wsdl">Hello</message></hello></TestPart></message>
[java] Status: RESPONSE
[java] Response: <?xml version="1.0" encoding="UTF-8"?>
[java] <message><TestPart><hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">Hello World</hello></TestPart></message>
[java] Hello World
[java] Stopping BPELHelloWorldComponent
[java] Stopped \!\!\!
BUILD SUCCESSFUL
Total time: 36 seconds
|
Building And Running The Sample Using Maven
With either the binary or source distributions the sample can be built and run
using Maven as follows. When using Maven, a simple test is present that exercise
the same logic as the client to invoke the BPEl process.
Code Block |
---|
cd helloworld-bpel
mvn
|
You should see the following output from the test phase.
Code Block |
---|
\------------------------------------------------------\-
T E S T S
\------------------------------------------------------\-
Running helloworld.BPELHelloWorldTestCase
Starting BPELHelloWorldComponent
>>> Deploying : D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\classes
::arg:::::: <?xml version="1.0" encoding="UTF-8"?>
<hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"><message xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld
.wsdl">Hello</message></hello>
::message:: <?xml version="1.0" encoding="UTF-8"?>
<message><TestPart><hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"><message xmlns="http://tuscany.apache.org/implementation/bpel
/example/helloworld.wsdl">Hello</message></hello></TestPart></message>
Status: RESPONSE
Response: <?xml version="1.0" encoding="UTF-8"?>
<message><TestPart><hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">Hello World</hello></TestPart></message>
Stopping BPELHelloWorldComponent
Stopped \!\!\!
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.656 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] [jar:jar]
[INFO] Building jar: D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\sample-helloworld-bpel.jar
[INFO] [install:install]
[INFO] Installing D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\sample-helloworld-bpel.jar to C:\Documents and Settings\lresend
e\.m2\repository\org\apache\tuscany\sca\sample-helloworld-bpel\1.1-incubating-SNAPSHOT\sample-helloworld-bpel-1.1-incubating-SNAPSHOT.jar
[INFO] \-----------------------------------------------------------------------\-
[INFO] BUILD SUCCESSFUL
[INFO] \-----------------------------------------------------------------------\-
[INFO] Total time: 53 seconds
[INFO] Finished at: Sun Jan 13 09:54:39 PST 2008
[INFO] Final Memory: 24M/43M
[INFO] \-----------------------------------------------------------------------\-
|
...
-configuration ..\..\..\..\features\configuration -clean -console
|
You should see the osgi console. You can run "ss" command under the osgi> to see the status of the bundles.
Code Block |
---|
osgi> ss
|
Then you can install and start the bundle that's just been built:
Code Block |
---|
osgi> install file:./target/sample-dosgi-dynamic-calculator-operations.jar
|
dosgi-dynamic-calculator
Panel | ||
---|---|---|
| ||
The bundle Jar can be built using Maven as follows:
|
Note | ||
---|---|---|
| ||
projects should be called dosgi-dynamic-calculator-bundle |
To run the bundle see "osgi" under running-tuscany. In short do the following:
On Windows, run
Code Block |
---|
java -jar ..\..\..\..\modules\osgi-3.5.0-v20090520.jar -configuration ..\..\..\..\features\configuration -clean -console
|
You should see the osgi console. You can run "ss" command under the osgi> to see the status of the bundles.
Code Block |
---|
osgi> ss
|
Then you can install and start the bundle that's just been built:
Code Block |
---|
osgi> install file:./target/sample-dosgi-dynamic-calculator.jar
|
You should see the calculator service start.
implementation-bpel
BPEL component implementations will be useful to those who wish to describe a sequence of calls that must be made to other component services.
contribution-helloworld-bpel
Panel | ||||
---|---|---|---|---|
| ||||
The contribution Jar can be built using Ant as follows:
The contribution can be installed and the composite it contains run using Ant as follows:
|
Panel | ||||
---|---|---|---|---|
| ||||
The contribution Jar can be built using Maven as follows:
The contribution can be installed and the composite it contains run using Maven as follows
|
helloworld-bpel-webapp
implementation-composite
...