summaryrefslogtreecommitdiffstats
path: root/java/sca/samples/dosgi-calculator/src/main
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-04-07 21:08:52 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-04-07 21:08:52 +0000
commit3ef97e3558b10b558afaaac3942b60993faa7441 (patch)
treec721de38f9cc42df137e829e74fbc3b9a46ae436 /java/sca/samples/dosgi-calculator/src/main
parent5e55cb31f442091bdcaeebf59146f43d0e2f017e (diff)
Expose the CalculatorService as a web service
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@762966 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/samples/dosgi-calculator/src/main')
-rw-r--r--java/sca/samples/dosgi-calculator/src/main/java/calculator/rmi/OperationsRMIServer.java2
-rw-r--r--java/sca/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.componentType14
-rw-r--r--java/sca/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.composite19
3 files changed, 20 insertions, 15 deletions
diff --git a/java/sca/samples/dosgi-calculator/src/main/java/calculator/rmi/OperationsRMIServer.java b/java/sca/samples/dosgi-calculator/src/main/java/calculator/rmi/OperationsRMIServer.java
index 1cfc438fca..1a3e36f571 100644
--- a/java/sca/samples/dosgi-calculator/src/main/java/calculator/rmi/OperationsRMIServer.java
+++ b/java/sca/samples/dosgi-calculator/src/main/java/calculator/rmi/OperationsRMIServer.java
@@ -58,12 +58,14 @@ public class OperationsRMIServer implements OperationsRemote, Serializable {
Thread thread = new Thread() {
public void run() {
try {
+ System.out.println("Starting the RMI server for calculator operations...");
Remote stub = UnicastRemoteObject.exportObject(OperationsRMIServer.this);
registry = LocateRegistry.createRegistry(8085);
registry.bind("AddService", stub);
registry.bind("SubtractService", stub);
registry.bind("MultiplyService", stub);
registry.bind("DivideService", stub);
+ System.out.println("RMI server for calculator operations is now started.");
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/java/sca/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.componentType b/java/sca/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.componentType
index 7860094626..92b0ac7bf9 100644
--- a/java/sca/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.componentType
+++ b/java/sca/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.componentType
@@ -7,28 +7,28 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
-->
-<componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+<componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1">
<!-- The service elment defines an SCA view of the OSGi service -->
- <service name="Calculator">
+ <service name="CalculatorService">
<!-- The interface will be mapped into the OSGi service class -->
<interface.java interface="calculator.dosgi.CalculatorService"/>
<!-- The list of OSGi properties -->
<t:osgi.property name="prop1">1</t:osgi.property>
<t:osgi.property name="prop2">ABC</t:osgi.property>
</service>
-
+
<!-- The reference elment defines an SCA proxy to a remote OSGi service -->
<reference name="addService">
<interface.java interface="calculator.dosgi.operations.AddService"/>
@@ -50,5 +50,5 @@
<t:osgi.property name="prop1">1</t:osgi.property>
<t:osgi.property name="prop2">ABC</t:osgi.property>
</reference>
-
+
</componentType>
diff --git a/java/sca/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.composite b/java/sca/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.composite
index 3c77086c45..7109300293 100644
--- a/java/sca/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.composite
+++ b/java/sca/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.composite
@@ -7,24 +7,27 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
-->
-<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://calculator.dosgi"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://calculator.dosgi"
name="CalculatorComposite">
<component name="CalculatorComponent">
<tuscany:implementation.osgi bundleSymbolicName="calculator.dosgi" bundleVersion="1.0.0" />
+ <service name="CalculatorService">
+ <binding.ws uri="http://localhost:8086/CalculatorService"/>
+ </service>
<reference name="addService">
<tuscany:binding.rmi uri="rmi://localhost:8085/AddService"/>
</reference>
@@ -37,8 +40,8 @@
<reference name="divideService">
<tuscany:binding.rmi uri="rmi://localhost:8085/DivideService"/>
</reference>
-
- <!--
+
+ <!--
<reference name="addService" target="OperationsComponent/AddService">
</reference>
<reference name="subtractService" target="OperationsComponent/SubtractService">