summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorClient.java
blob: 3b977259e8243be10b1e02b386c989d55e5fd541 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package calculator;

import org.apache.tuscany.sca.host.embedded.SCADomain;



/**
 * This client program shows how to create an SCA runtime, start it,
 * and locate and invoke a SCA component
 */
public class CalculatorClient {
    public static void main(String[] args) throws Exception {

        
        SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
        
        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();
        
    }

}