From 1fd00705939747143753aeae8c8aa084e3d9f800 Mon Sep 17 00:00:00 2001 From: rfeng Date: Mon, 29 Jun 2009 22:10:28 +0000 Subject: Merge changes from trunk to bring up the distributed osgi samples with Tuscany distribution git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@789466 13f79535-47bb-0310-9956-ffa450edef68 --- .../OSGI-INF/add-component.xml | 25 +++ .../OSGI-INF/blueprint/operations-module.xml | 40 +++++ .../OSGI-INF/divide-component.xml | 25 +++ .../OSGI-INF/multiply-component.xml | 25 +++ .../OSGI-INF/sca/bundle.componentType | 47 ++++++ .../OSGI-INF/sca/bundle.composite | 43 +++++ .../OSGI-INF/subtract-component.xml | 25 +++ .../samples/dosgi-calculator-operations/README | 183 +++++++++++++++++++++ .../src/main/resources/OSGI-INF/add-component.xml | 25 --- .../OSGI-INF/blueprint/operations-module.xml | 40 ----- .../main/resources/OSGI-INF/divide-component.xml | 25 --- .../main/resources/OSGI-INF/multiply-component.xml | 25 --- .../resources/OSGI-INF/sca/bundle.componentType | 47 ------ .../main/resources/OSGI-INF/sca/bundle.composite | 43 ----- .../main/resources/OSGI-INF/subtract-component.xml | 25 --- .../OSGI-INF/blueprint/calculator-module.xml | 43 +++++ .../OSGI-INF/calculator-component.xml | 36 ++++ .../calculator-service-descriptions.xml | 67 ++++++++ .../OSGI-INF/sca/bundle.componentType | 54 ++++++ .../dosgi-calculator/OSGI-INF/sca/bundle.composite | 56 +++++++ .../samples/dosgi-calculator/README | 155 +++++++++++++++++ .../samples/dosgi-calculator/dosgi-calculator.png | Bin 0 -> 85103 bytes .../OSGI-INF/blueprint/calculator-module.xml | 43 ----- .../resources/OSGI-INF/calculator-component.xml | 36 ---- .../calculator-service-descriptions.xml | 67 -------- .../resources/OSGI-INF/sca/bundle.componentType | 54 ------ .../main/resources/OSGI-INF/sca/bundle.composite | 56 ------- 27 files changed, 824 insertions(+), 486 deletions(-) create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/add-component.xml create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/blueprint/operations-module.xml create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/divide-component.xml create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/multiply-component.xml create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/sca/bundle.componentType create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/sca/bundle.composite create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/subtract-component.xml create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/README delete mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/add-component.xml delete mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/blueprint/operations-module.xml delete mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/divide-component.xml delete mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/multiply-component.xml delete mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/sca/bundle.componentType delete mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/sca/bundle.composite delete mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/subtract-component.xml create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/blueprint/calculator-module.xml create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/calculator-component.xml create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/remote-service/calculator-service-descriptions.xml create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/sca/bundle.componentType create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/sca/bundle.composite create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator/README create mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator/dosgi-calculator.png delete mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/blueprint/calculator-module.xml delete mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/calculator-component.xml delete mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/remote-service/calculator-service-descriptions.xml delete mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.componentType delete mode 100644 branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.composite (limited to 'branches/sca-java-2.0-M3/samples') diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/add-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/add-component.xml new file mode 100644 index 0000000000..bf4ccc3d28 --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/add-component.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/blueprint/operations-module.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/blueprint/operations-module.xml new file mode 100644 index 0000000000..e3b690f24a --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/blueprint/operations-module.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/divide-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/divide-component.xml new file mode 100644 index 0000000000..b939a5de80 --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/divide-component.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/multiply-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/multiply-component.xml new file mode 100644 index 0000000000..2bf897d72a --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/multiply-component.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/sca/bundle.componentType b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/sca/bundle.componentType new file mode 100644 index 0000000000..6f6f4bdce6 --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/sca/bundle.componentType @@ -0,0 +1,47 @@ + + + + + + + + + 1 + ABC + + + + 1 + ABC + + + + 1 + ABC + + + + 1 + ABC + + + diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/sca/bundle.composite b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/sca/bundle.composite new file mode 100644 index 0000000000..c9fb3818b8 --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/sca/bundle.composite @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/subtract-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/subtract-component.xml new file mode 100644 index 0000000000..4af00695da --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/subtract-component.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/README b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/README new file mode 100644 index 0000000000..9e616c1f50 --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/README @@ -0,0 +1,183 @@ +Distributed OSGi Calculator Sample +================================== +This sample implements a distributed calculator using Distributed OSGi (RFC 119) over SCA. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +On Windows, run +java -jar ..\..\modules\osgi-3.4.0-v20080605-1900.jar -configuration ..\..\features\configuration -clean -console + +On *Unix, run +java -jar ../../modules/osgi-3.4.0-v20080605-1900.jar -configuration ../../features/configuration -clean -console + +You should see the osgi console: + +osgi> + +osgi> Jun 22, 2009 1:32:27 PM org.apache.tuscany.sca.extensibility.equinox.EquinoxServiceDiscoveryActivator start +INFO: Equinox-based service discoverer is now configured. + +You can run "ss" command under the osgi> to see the status of the bundles. +osgi> ss + +Then you can install and start the calculator.dosgi bundle: + +osgi> install file:./target/sample-dosgi-calculator-operations.jar +Bundle id is 181 + +osgi> start 181 +Jun 22, 2009 2:09:21 PM calculator.dosgi.operations.impl.OperationsActivator sta +rt +INFO: Starting file:./target/sample-dosgi-calculator-operations.jar [181] +Jun 22, 2009 2:09:21 PM calculator.dosgi.operations.impl.OperationsActivator sta +rt +INFO: Registering calculator.dosgi.operations.AddService +Jun 22, 2009 2:09:21 PM calculator.dosgi.operations.impl.OperationsActivator sta +rt +INFO: Registering calculator.dosgi.operations.SubtractService +Jun 22, 2009 2:09:21 PM calculator.dosgi.operations.impl.OperationsActivator sta +rt +INFO: Registering calculator.dosgi.operations.MultiplyService +Jun 22, 2009 2:09:21 PM calculator.dosgi.operations.impl.OperationsActivator sta +rt +INFO: Registering calculator.dosgi.operations.DivideService +Jun 22, 2009 2:09:21 PM calculator.dosgi.operations.impl.OperationsActivator get +Bundle +INFO: calculator.dosgi.operations.AddService is loaded by bundle: calculator.dos +gi.operations +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.node.impl.NodeImpl start +INFO: Starting node: calculator.dosgi.operations +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.node.impl.NodeFactoryImpl configu +reNode +INFO: Loading contribution: bundleentry://181/ +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpoint +INFO: EndpointRegistry: Add endpoint - Endpoint: URI = OperationsComponent#serv +ice-binding(AddService/AddService) +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost registerS +ervice +INFO: RMI service registered: rmi://localhost:8085/AddService +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpoint +INFO: EndpointRegistry: Add endpoint - Endpoint: URI = OperationsComponent#serv +ice-binding(SubtractService/SubtractService) +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost registerS +ervice +INFO: RMI service registered: rmi://localhost:8085/SubtractService +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpoint +INFO: EndpointRegistry: Add endpoint - Endpoint: URI = OperationsComponent#serv +ice-binding(MultiplyService/MultiplyService) +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost registerS +ervice +INFO: RMI service registered: rmi://localhost:8085/MultiplyService +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpoint +INFO: EndpointRegistry: Add endpoint - Endpoint: URI = OperationsComponent#serv +ice-binding(DivideService/DivideService) +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost registerS +ervice +INFO: RMI service registered: rmi://localhost:8085/DivideService + +osgi> + +To stop the bundle: + +osgi> stop 181 +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.node.impl.NodeImpl stop +INFO: Stopping node: calculator.dosgi.operations +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry removeEndpoint +INFO: EndpointRegistry: Remove endpoint - Endpoint: URI = OperationsComponent#s +ervice-binding(AddService/AddService) +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost unregiste +rService +INFO: RMI service unregistered: rmi://localhost:8085/AddService +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry removeEndpoint +INFO: EndpointRegistry: Remove endpoint - Endpoint: URI = OperationsComponent#s +ervice-binding(SubtractService/SubtractService) +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost unregiste +rService +INFO: RMI service unregistered: rmi://localhost:8085/SubtractService +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry removeEndpoint +INFO: EndpointRegistry: Remove endpoint - Endpoint: URI = OperationsComponent#s +ervice-binding(MultiplyService/MultiplyService) +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost unregiste +rService +INFO: RMI service unregistered: rmi://localhost:8085/MultiplyService +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry removeEndpoint +INFO: EndpointRegistry: Remove endpoint - Endpoint: URI = OperationsComponent#s +ervice-binding(DivideService/DivideService) +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost unregiste +rService +INFO: RMI service unregistered: rmi://localhost:8085/DivideService +Jun 22, 2009 2:09:48 PM calculator.dosgi.operations.impl.OperationsActivator sto +p +INFO: Stopping file:./target/sample-dosgi-calculator-operations.jar [181] + +osgi> + +To exit the console, run: +osgi> exit + +Sample Overview +--------------- +The application consists of two OSGi bundles: + * The calculator bundle: It provides the calculator service. The service is implemented by a java class that + consumes other services to perform the “add”, “subtract”, “multiply” and “divide” operations. + * The operations bundle: It provides the add/subtract/multiply/divide services. + (See ../samples/dosgi-calculator-operations) + + +dosgi-calculator-operations/ + src/ + main/ + java/ + calculator/ + dosgi/ + operations/ + AddService.java - Interface for Add + SubtractService.java - Interface for Subtract + MultiplyService.java - Interface for Multiply + DivideService.java - Interface for Divide + impl/ + OperationsActivator.java - OSGi bundle activator + AddServiceImpl.java - Implementation for Add + SubtractServiceImpl.java - Implementation for Subtract + MultiplyServiceImpl.java - Implementation for Multiply + DivideServiceImpl.java - Implementation for Divide + resources/ + META-INF/ + sca-contribution.xml + OSGI-INF/ + sca/ + bundle.componentType - The component type for implementation.osgi of this bundle + bundle.composite - The composite file + test/ + java/ + src/ + calculator/ + dosgi/ + operations/ + test/ + OperationsOSGiNodeTestCase.java - The JUNIT test case that tests this bundle using a RMI client + + META-INF/ + MANIFEST.MF - The OSGi manifest for this bundle + pom.xml - the Maven build file + + + +Building And Running The Test Case Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd dosgi-calculator-operations +mvn + diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/add-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/add-component.xml deleted file mode 100644 index bf4ccc3d28..0000000000 --- a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/add-component.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/blueprint/operations-module.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/blueprint/operations-module.xml deleted file mode 100644 index e3b690f24a..0000000000 --- a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/blueprint/operations-module.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/divide-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/divide-component.xml deleted file mode 100644 index b939a5de80..0000000000 --- a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/divide-component.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/multiply-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/multiply-component.xml deleted file mode 100644 index 2bf897d72a..0000000000 --- a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/multiply-component.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/sca/bundle.componentType b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/sca/bundle.componentType deleted file mode 100644 index 6f6f4bdce6..0000000000 --- a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/sca/bundle.componentType +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - 1 - ABC - - - - 1 - ABC - - - - 1 - ABC - - - - 1 - ABC - - - diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/sca/bundle.composite b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/sca/bundle.composite deleted file mode 100644 index c9fb3818b8..0000000000 --- a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/sca/bundle.composite +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/subtract-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/subtract-component.xml deleted file mode 100644 index 4af00695da..0000000000 --- a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/subtract-component.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/blueprint/calculator-module.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/blueprint/calculator-module.xml new file mode 100644 index 0000000000..fe0bbf21df --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/blueprint/calculator-module.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/calculator-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/calculator-component.xml new file mode 100644 index 0000000000..457588bfb6 --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/calculator-component.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/remote-service/calculator-service-descriptions.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/remote-service/calculator-service-descriptions.xml new file mode 100644 index 0000000000..1a35665803 --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/remote-service/calculator-service-descriptions.xml @@ -0,0 +1,67 @@ + + + + + + + + sca:SOAP sca:HTTP + sca + + OSGI-INF/sca/bundle.componentType + + + addService + + + + + sca:SOAP sca:HTTP + sca + + OSGI-INF/sca/bundle.componentType + + + subtractService + + + + + sca:SOAP sca:HTTP + sca + + OSGI-INF/sca/bundle.componentType + + + multiplyService + + + + + sca:SOAP sca:HTTP + sca + + OSGI-INF/sca/bundle.componentType + + + divideService + + + \ No newline at end of file diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/sca/bundle.componentType b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/sca/bundle.componentType new file mode 100644 index 0000000000..92b0ac7bf9 --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/sca/bundle.componentType @@ -0,0 +1,54 @@ + + + + + + + + + 1 + ABC + + + + + + 1 + ABC + + + + 1 + ABC + + + + 1 + ABC + + + + 1 + ABC + + + diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/sca/bundle.composite b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/sca/bundle.composite new file mode 100644 index 0000000000..7109300293 --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/sca/bundle.composite @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/README b/branches/sca-java-2.0-M3/samples/dosgi-calculator/README new file mode 100644 index 0000000000..374c0f0a8b --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator/README @@ -0,0 +1,155 @@ +Distributed OSGi Calculator Sample +================================== +This sample implements a distributed calculator using Distributed OSGi (RFC 119) over SCA. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +On Windows, run +java -jar ..\..\modules\osgi-3.4.0-v20080605-1900.jar -configuration ..\..\features\configuration -clean -console + +On *Unix, run +java -jar ../../modules/osgi-3.4.0-v20080605-1900.jar -configuration ../../features/configuration -clean -console + +You should see the osgi console: + +osgi> + +osgi> Jun 22, 2009 1:32:27 PM org.apache.tuscany.sca.extensibility.equinox.EquinoxServiceDiscoveryActivator start +INFO: Equinox-based service discoverer is now configured. + +You can run "ss" command under the osgi> to see the status of the bundles. +osgi> ss + +Then you can install and start the calculator.dosgi bundle: + +osgi> install file:./target/sample-dosgi-calculator.jar +Bundle id is 181 + +osgi> start 181 +Jun 22, 2009 1:37:21 PM calculator.dosgi.impl.CalculatorActivator start +INFO: Starting file:./target/sample-dosgi-calculator.jar [181] +Jun 22, 2009 1:37:21 PM calculator.dosgi.impl.CalculatorActivator start +INFO: Registering calculator.dosgi.CalculatorService +Jun 22, 2009 1:37:21 PM calculator.dosgi.impl.CalculatorActivator getBundle +INFO: calculator.dosgi.operations.AddService is loaded by bundle: calculator.dos +gi +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.node.impl.NodeImpl start +INFO: Starting node: calculator.dosgi +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.node.impl.NodeFactoryImpl configu +reNode +INFO: Loading contribution: bundleentry://181/ +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpoint +INFO: EndpointRegistry: Add endpoint - Endpoint: URI = CalculatorComponent#serv +ice-binding(CalculatorService/CalculatorService) +2009-06-22 13:37:21.953::INFO: jetty-6.1.x +2009-06-22 13:37:21.953::INFO: Started SelectChannelConnector@0.0.0.0:8086 +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.http.jetty.JettyServer addServlet +Mapping +INFO: Added Servlet mapping: http://rfengt61p:8086/CalculatorService +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpointReference +INFO: EndpointRegistry: Add endpoint reference - Endpoint Reference: URI = Calc +ulatorComponent#reference-binding(addService/addService) Target = Endpoint: +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpointReference +INFO: EndpointRegistry: Add endpoint reference - Endpoint Reference: URI = Calc +ulatorComponent#reference-binding(subtractService/subtractService) Target = Endp +oint: +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpointReference +INFO: EndpointRegistry: Add endpoint reference - Endpoint Reference: URI = Calc +ulatorComponent#reference-binding(multiplyService/multiplyService) Target = Endp +oint: +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpointReference +INFO: EndpointRegistry: Add endpoint reference - Endpoint Reference: URI = Calc +ulatorComponent#reference-binding(divideService/divideService) Target = Endpoint +: + +osgi> + +You can point your browser to http://localhost:8086/CalculatorService?wsdl to see +the WSDL. + +You can also use the WebService Explorer from Eclipse WTP to test the Web Service. + +To stop the bundle: + +osgi> stop 181 +Jun 22, 2009 1:39:09 PM org.apache.tuscany.sca.node.impl.NodeImpl stop +INFO: Stopping node: calculator.dosgi +Jun 22, 2009 1:39:09 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry removeEndpoint +INFO: EndpointRegistry: Remove endpoint - Endpoint: URI = CalculatorComponent#s +ervice-binding(CalculatorService/CalculatorService) +Jun 22, 2009 1:39:09 PM org.apache.tuscany.sca.http.jetty.JettyServer removeServ +letMapping +INFO: Removed Servlet mapping: /CalculatorService +Jun 22, 2009 1:39:09 PM calculator.dosgi.impl.CalculatorActivator stop +INFO: Stopping file:./target/sample-dosgi-calculator.jar [181] + +To exit the console, run: +osgi> exit + +Sample Overview +--------------- +The application consists of two OSGi bundles: + * The calculator bundle: It provides the calculator service. The service is implemented by a java class that + consumes other services to perform the “add”, “subtract”, “multiply” and “divide” operations. + * The operations bundle: It provides the add/subtract/multiply/divide services. + (See ../samples/dosgi-calculator-operations) + + +dosgi-calculator/ + src/ + main/ + java/ + calculator/ + dosgi/ + CalculatorService.java - The interface for Calculator service + impl/ + CalculatorActivator.java - OSGi bundle activator for Calculator bundle + CalculatorServiceDSImpl.java - OSGi declarative service based implementation + CalculatorServiceImpl.java - Basic OSGi implementation + operations/ + AddService.java - Interface for Add + SubtractService.java - Interface for Subtract + MultiplyService.java - Interface for Multiply + DivideService.java - Interface for Divide + rmi/ + OperationsRemote.java - RMI remote interface for operations + OperationsRMIServer_Stub.java - RMI stub + OperationsRMIServer.java - RMI server implementation of the operations + resources/ + META-INF/ + sca-contribution.xml + OSGI-INF/ + sca/ + bundle.componentType - The component type for implementation.osgi of this bundle + bundle.composite - The composite file + test/ + java/ + src/ + calculator/ + dosgi/ + test/ + CalculatorOSGiNodeTestCase.java - The JUNIT test case that tests this bundle against a RMI service + + META-INF/ + MANIFEST.MF - The OSGi manifest for this bundle + dosig-calculator.png - a pictorial representation of the sample + pom.xml - the Maven build file + + + +Building And Running The Test Case Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd dosgi-calculator +mvn + diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/dosgi-calculator.png b/branches/sca-java-2.0-M3/samples/dosgi-calculator/dosgi-calculator.png new file mode 100644 index 0000000000..805baa54d2 Binary files /dev/null and b/branches/sca-java-2.0-M3/samples/dosgi-calculator/dosgi-calculator.png differ diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/blueprint/calculator-module.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/blueprint/calculator-module.xml deleted file mode 100644 index fe0bbf21df..0000000000 --- a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/blueprint/calculator-module.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/calculator-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/calculator-component.xml deleted file mode 100644 index 457588bfb6..0000000000 --- a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/calculator-component.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/remote-service/calculator-service-descriptions.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/remote-service/calculator-service-descriptions.xml deleted file mode 100644 index 1a35665803..0000000000 --- a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/remote-service/calculator-service-descriptions.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - sca:SOAP sca:HTTP - sca - - OSGI-INF/sca/bundle.componentType - - - addService - - - - - sca:SOAP sca:HTTP - sca - - OSGI-INF/sca/bundle.componentType - - - subtractService - - - - - sca:SOAP sca:HTTP - sca - - OSGI-INF/sca/bundle.componentType - - - multiplyService - - - - - sca:SOAP sca:HTTP - sca - - OSGI-INF/sca/bundle.componentType - - - divideService - - - \ No newline at end of file diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.componentType b/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.componentType deleted file mode 100644 index 92b0ac7bf9..0000000000 --- a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.componentType +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - 1 - ABC - - - - - - 1 - ABC - - - - 1 - ABC - - - - 1 - ABC - - - - 1 - ABC - - - diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.composite b/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.composite deleted file mode 100644 index 7109300293..0000000000 --- a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.composite +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3