diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-08-12 00:55:14 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-08-12 00:55:14 +0000 |
commit | 87a1386ea8d95f5dd1596451e1ac30ee5f0e5964 (patch) | |
tree | 6eb4d83f12a85ac16ed66d6a6941b976a122f006 /java/sca/samples/calculator/src/main | |
parent | 6399d365e1d9622edcf8c60d9cd048e5deab56f4 (diff) |
Convert to SCA Node API
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@685008 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/samples/calculator/src/main')
-rw-r--r-- | java/sca/samples/calculator/src/main/java/calculator/CalculatorClient.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/java/sca/samples/calculator/src/main/java/calculator/CalculatorClient.java b/java/sca/samples/calculator/src/main/java/calculator/CalculatorClient.java index 9d180bf52e..6dc2cbbe6f 100644 --- a/java/sca/samples/calculator/src/main/java/calculator/CalculatorClient.java +++ b/java/sca/samples/calculator/src/main/java/calculator/CalculatorClient.java @@ -19,7 +19,9 @@ package calculator; -import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; /** * This client program shows how to create an SCA runtime, start it, @@ -28,18 +30,19 @@ import org.apache.tuscany.sca.host.embedded.SCADomain; public class CalculatorClient { public static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("Calculator.composite"); + SCANode2Factory factory = SCANode2Factory.newInstance(); + SCANode2 node = factory.createSCANodeFromClassLoader("Calculator.composite", CalculatorClient.class.getClassLoader()); + node.start(); + + CalculatorService calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); - CalculatorService calculatorService = - scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); - // Calculate System.out.println("3 + 2=" + calculatorService.add(3, 2)); System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); System.out.println("3 / 2=" + calculatorService.divide(3, 2)); - scaDomain.close(); + node.stop(); } } |