private void testCalcCombo(String args[]) {
System.out.println("\n\n***************************************");
System.out.println("Starting the Calculator Combo sample!!!");
System.out.println("***************************************");
CompositeContext context = CurrentCompositeContext.getContext();
CalculatorService calculatorService =
(CalculatorService)context.locateService(CalculatorService.class, "CalculatorServiceComponent");
System.out.println("\nInvoking Java Implementation ... ");
System.out.println((new StringBuilder()).append("3 + 2 = ").append(calculatorService.add(3D, 2D))
.toString());
System.out.println("\nInvoking Ruby Implementation ... ");
System.out.println((new StringBuilder()).append("3 - 2 = ")
.append(calculatorService.subtract(3D, 2D)).toString());
System.out.println("\nInvoking over RMI Reference... ");
System.out.println((new StringBuilder()).append("3 * 2 = ")
.append(calculatorService.multiply(3D, 2D)).toString());
System.out.println("\nInvoking WebService Implementation ... ");
System.out.println((new StringBuilder()).append("3 / 2 = ").append(calculatorService.divide(3D, 2D))
.toString());
System.out.println("\nInvoking Scientific Calculator Composite Implementation ... ");
SciCalculatorService sciCalculator =
(SciCalculatorService)context.locateService(SciCalculatorService.class, "sciCalculatorService");
double values[] = {1.0D, 2D, 3D, 4D, 5D, 6D, 7D, 8D, 9D};
System.out.println("\tInvoking Java Implementation ... ");
System.out.println((new StringBuilder()).append("\tAverage of 1,2,3,4,5,6,7,8,9 = ")
.append(sciCalculator.average(values)).toString());
System.out.println("\n\tInvoking JavaScript Implementation ... ");