You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2007/06/20 10:31:03 UTC

svn commit: r548991 - in /incubator/tuscany/java/sca/samples/calculator-distributed: ./ src/main/java/calculator/ src/main/resources/

Author: slaws
Date: Wed Jun 20 01:31:02 2007
New Revision: 548991

URL: http://svn.apache.org/viewvc?view=rev&rev=548991
Log:
Combine the separate node classes into one configurable node classes
TUSCANY-1338

Added:
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorNodeExe.java   (with props)
Removed:
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorNodeA.java
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorNodeB.java
Modified:
    incubator/tuscany/java/sca/samples/calculator-distributed/build.xml
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/runtime.topology

Modified: incubator/tuscany/java/sca/samples/calculator-distributed/build.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/calculator-distributed/build.xml?view=diff&rev=548991&r1=548990&r2=548991
==============================================================================
--- incubator/tuscany/java/sca/samples/calculator-distributed/build.xml (original)
+++ incubator/tuscany/java/sca/samples/calculator-distributed/build.xml Wed Jun 20 01:31:02 2007
@@ -17,7 +17,7 @@
  * under the License.    
 -->
 <project name="calculator" default="compile">
-    <property name="test.class" value="calculator.CalculatorNode" />
+    <property name="test.class" value="calculator.CalculatorNodeExe" />
 	<property name="test.jar"   value="sample-calculator.jar" />
 	
 	<!-- a classpath so I can test without building the distribution jars -->
@@ -87,24 +87,26 @@
     </target>	
 	
     <target name="runA">
-        <java classname="${test.class}A"
+        <java classname="${test.class}"
               fork="true">
             <classpath>
                 <!--pathelement path="target/classes"/-->
             	<!--pathelement location="../../lib/tuscany-sca-manifest.jar"/-->
             	<path refid="test.classpath"/>
             </classpath>
+        	<arg value="nodeA"/>        	        	
         </java>
     </target>
 	
     <target name="runB">
-        <java classname="${test.class}B"
+        <java classname="${test.class}"
               fork="true">
             <classpath>
                 <!--pathelement path="target/classes"/-->
             	<!--pathelement location="../../lib/tuscany-sca-manifest.jar"/-->
             	<path refid="test.classpath"/>
             </classpath>
+        	<arg value="nodeB"/>        	
         </java>
     </target>	
 	

Added: incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorNodeExe.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorNodeExe.java?view=auto&rev=548991
==============================================================================
--- incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorNodeExe.java (added)
+++ incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorNodeExe.java Wed Jun 20 01:31:02 2007
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * 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.    
+ */
+
+package calculator;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke an SCA component
+ */
+public class CalculatorNodeExe {
+
+    public static void main(String[] args) throws Exception {
+              
+        if (null == args || args.length != 1) {
+             System.err.println("Useage: java CalculatorNodeExe nodename");   
+             System.exit(1);
+        }    
+        
+        String nodeName = args[0];
+        
+        // start the node and the domain at that node
+        CalculatorNode node = new CalculatorNode("domainA",nodeName);
+        SCADomain domain = node.startDomain();        
+        
+        if ( nodeName.equals("nodeA") ) {            
+            // do some application stuff
+            CalculatorService calculatorService = 
+                domain.getService(CalculatorService.class, "CalculatorServiceComponent");
+    
+            // Calculate
+            System.out.println("3 + 2=" + calculatorService.add(3, 2));
+        } else {
+            // start up and wait for messages
+            try {
+                System.out.println("Node started (press enter to shutdown)");
+                System.in.read();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }  
+        }
+        
+        node.stopDomain();        
+             
+    }
+}

Propchange: incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorNodeExe.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorNodeExe.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/runtime.topology
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/runtime.topology?view=diff&rev=548991&r1=548990&r2=548991
==============================================================================
--- incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/runtime.topology (original)
+++ incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/runtime.topology Wed Jun 20 01:31:02 2007
@@ -20,14 +20,14 @@
 
 <runtime>
     <node name="nodeA">
-        <schema name="http" baseURL="http://localhost:80" domain="DomainA"/> 
-        <schema name="https" baseURL="https://localhost:443" domain="DomainA"/>
-        <component name="CalculatorServiceComponent" domain="DomainA"/>
+        <schema name="http" baseURL="http://localhost:80" /> 
+        <schema name="https" baseURL="https://localhost:443" />
+        <component name="CalculatorServiceComponent" />
     </node>
     <node name="nodeB">
-        <schema name="http" baseURL="http://localhost:81" domain="DomainA"/> 
-        <schema name="https" baseURL="https://localhost:444" domain="DomainA"/>
-        <component name="AddServiceComponent" domain="DomainA"/>
+        <schema name="http" baseURL="http://localhost:81"/> 
+        <schema name="https" baseURL="https://localhost:444" />
+        <component name="AddServiceComponent"/>
     </node>    
 </runtime>
 



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org