LogManager.getLogManager().readConfiguration(CustomerInfoClient.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("CustomerInfoModuleComponent", "http://customerinfo", monitorFactory);
// Start the Tuscany runtime and associate it with this thread
tuscany.start();
// Get the SCA module context.
ModuleContext moduleContext = CurrentModuleContext.getContext();
// Locate the CustomerInfo service
Object customerInfoService = moduleContext.locateService("CustomerInfoServiceComponent");
// Invoke the CustomerInfo service
Method getCustomerInfo = customerInfoService.getClass().getMethod("getCustomerInfo", new Class[] {String.class});
DataObject customer = (DataObject)getCustomerInfo.invoke(customerInfoService, "12345");
System.out.println("customerID = " + customer.getString("customerID"));
System.out.println("firstName = " + customer.getString("firstName"));
System.out.println("lastName = " + customer.getString("lastName"));
System.out.flush();
// Disassociate the runtime from this thread
tuscany.stop();
// Shut down the runtime
tuscany.shutdown();
}