} catch (java.lang.SecurityException e) {
System.setProperty("java.security.auth.login.config", CalculatorClient.class.getClassLoader()
.getResource("CalculatorJass.config").toString());
}
SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
CalculatorService calculatorService =
scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
// Calculate
System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
"policy for subtract and divide operations...");
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));
calculatorService =
scaDomain.getService(CalculatorService.class, "AnotherCalculatorServiceComponent");
// Calculate
System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
"for all operations in the implementation...");
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();
}