diff options
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(); } } |