Examples of locateService()


Examples of org.osoa.sca.ModuleContext.locateService()

        String name = moduleContext.getName();
        if (!"/testContext".equals(name)) {
            throw new ServletException("Invalid module context name: " + name);
        }

        HelloWorldService helloService = (HelloWorldService) moduleContext.locateService("HelloWorld");
        String greetings = helloService.getGreetings("World");
        if (!"Hello World".equals(greetings)) {
            throw new ServletException("Serivce returned " + greetings);
        }
    }
View Full Code Here

Examples of org.osoa.sca.ModuleContext.locateService()

        // 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");
       
View Full Code Here

Examples of org.osoa.sca.ModuleContext.locateService()

        // 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));
View Full Code Here

Examples of org.osoa.sca.ModuleContext.locateService()

        TuscanyRuntime tuscany = new TuscanyRuntime("getQuote", null);
        tuscany.start();
        ModuleContext moduleContext = CurrentModuleContext.getContext();

        Object serviceProxy = moduleContext.locateService("webserviceXSQ");
        Method m = serviceProxy.getClass().getMethod("GetQuote", new Class[] { String.class });

        String sqResponse = (String) m.invoke(serviceProxy, "IBM");

        assertTrue(sqResponse.startsWith("<StockQuotes><Stock><Symbol>IBM</Symbol>"));
View Full Code Here

Examples of org.osoa.sca.ModuleContext.locateService()

        // Get the SCA module context.
        ModuleContext moduleContext = CurrentModuleContext.getContext();

        // Locate the Calculator service
        CalculatorService calculatorService = (CalculatorService) moduleContext.locateService("CalculatorServiceComponent");
       
        // Calculate
        assertEquals(calculatorService.add(3, 2), 5.0);
        assertEquals(calculatorService.subtract(3, 2), 1.0);
        assertEquals(calculatorService.multiply(3, 2), 6.0);
View Full Code Here

Examples of org.osoa.sca.ModuleContext.locateService()

        // Obtain SCA module context.
        ModuleContext moduleContext = CurrentModuleContext.getContext();

        // Locate the HelloWorld service component and invoke it
        Customer customer = (Customer) moduleContext.locateService("CustomerComponent");
        System.out.println("Main thread " + Thread.currentThread());
        customer.purchaseGoods();

    }
}
View Full Code Here

Examples of org.osoa.sca.ModuleContext.locateService()

        // Obtain SCA module context.
        ModuleContext moduleContext = CurrentModuleContext.getContext();

        // Locate the HelloWorld service component and invoke it
        // Locate the CustomerComponent service component and invoke it
        Customer customer = (Customer) moduleContext.locateService("CustomerComponent");
        System.out.println("Main thread " + Thread.currentThread());
        customer.purchaseGoods();

    }
}
View Full Code Here

Examples of org.osoa.sca.ModuleContext.locateService()

        TuscanyRuntime tuscany = new TuscanyRuntime("test", null);
        tuscany.start();
        ModuleContext moduleContext = CurrentModuleContext.getContext();
        assertNotNull(moduleContext);

        HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorld");
        assertNotNull(helloworldService);

        String value = helloworldService .getGreetings("World");
        assertEquals("Hello World", value);
View Full Code Here

Examples of org.osoa.sca.ModuleContext.locateService()

        // Obtain SCA module context.
        ModuleContext moduleContext = CurrentModuleContext.getContext();

        // Locate the HelloWorld service component and invoke it
        HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldService");

        String value = helloworldService.getGreetings(name);
       
        // Stop the runtime
        tuscany.stop();
View Full Code Here

Examples of org.osoa.sca.ModuleContext.locateService()

        TuscanyRuntime tuscany = new TuscanyRuntime("test", null);
        tuscany.start();
        ModuleContext moduleContext = CurrentModuleContext.getContext();
        assertNotNull(moduleContext);

        HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorld");
        assertNotNull(helloworldService);

        String value = helloworldService .getGreetings("World");
        assertEquals("Hello World", value);
        tuscany.stop();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.