LogManager.getLogManager().readConfiguration(CalculatorClient.class.getResourceAsStream("/logging.properties"));
Properties levels = new Properties();
MonitorFactory monitorFactory = new JavaLoggingMonitorFactory(levels, Level.FINEST, "MonitorMessages");
// Create a Tuscany runtime for the sample module component
TuscanyRuntime tuscany = new TuscanyRuntime("CalculatorModuleComponent", "http://calculator", monitorFactory);
// Start the Tuscany runtime and associate it with this thread
tuscany.start();
// Get the SCA module context.
ModuleContext moduleContext = CurrentModuleContext.getContext();
// Locate the Calculator service
CalculatorService calculatorService = (CalculatorService) moduleContext.locateService("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));
System.out.flush();
// Disassociate the runtime from this thread
tuscany.stop();
// Shut down the runtime
tuscany.shutdown();
}