Package org.osoa.sca

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


            ClassLoader classLoader = getClass().getClassLoader();
            addExtension("test.extensions", classLoader.getResource("META-INF/tuscany/test-extensions.scdl"));

            super.setUp();
            CompositeContext compositeContext = CurrentCompositeContext.getContext();
            greeterLocal = compositeContext.locateService(GreeterLocal.class, "GreeterServiceComponent");
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
    }
View Full Code Here


public class CalculatorClient {
    public static void main(String[] args) throws Exception {

        CompositeContext context = CurrentCompositeContext.getContext();
        CalculatorService calculatorService =
                context.locateService(CalculatorService.class, "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

    }

    static int login(final String login, final String password) throws ServletException {

        CompositeContext moduleContext = CurrentCompositeContext.getContext();
        LoginService loginMgr = moduleContext.locateService(LoginService.class, "LoginServiceComponent");

        if (loginMgr == null) {
            throw new ServletException("LoginManager not found");
        }
View Full Code Here

    public final static void main(String[] args) throws Exception {

        CompositeContext compositeContext = CurrentCompositeContext.getContext();
        HelloWorldLocal helloWorldLocal =
            compositeContext.locateService(HelloWorldLocal.class, "HelloWorldServiceComponent");
        helloWorldLocal.getGreetings("John");

        // Sleep for 5 seconds to wait the callback to happen
        Thread.sleep(5000);
    }
View Full Code Here

        try {
            final String action = pReq.getParameter("action");

            CompositeContext moduleContext = CurrentCompositeContext.getContext();
            AccountService accountServices = (AccountService) moduleContext.locateService(AccountService.class, "AccountServiceComponent");
            if (accountServices == null) {
                throw new ServletException("AccountServiceComponent");
            }
            ProfileService profileServices = null;
            if (!"createAccount".equals(action)) {
View Full Code Here

            if (accountServices == null) {
                throw new ServletException("AccountServiceComponent");
            }
            ProfileService profileServices = null;
            if (!"createAccount".equals(action)) {
                profileServices = moduleContext.locateService(ProfileService.class, "ProfileServiceComponent");
                if (profileServices == null) {
                    throw new ServletException("ProfileServiceComponent not found.");
                }
                if (!profileServices.isLoggedIn()) {
                    throw new ServletException("User id '" + profileServices.getId() + "' not logged on.");
View Full Code Here

            addExtension("test.extensions", classLoader.getResource("META-INF/tuscany/test-extensions.scdl"));

            super.setUp();
            CompositeContext compositeContext = CurrentCompositeContext.getContext();
            helloWorldLocal =
                compositeContext.locateService(HelloWorldLocal.class, "HelloWorldServiceComponent");
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
    }
View Full Code Here

        addExtension("JavaScriptContainer", scdl);
        setApplicationSCDL(HelloWorldService.class, "META-INF/sca/default.scdl");
        super.setUp();

        CompositeContext context = CurrentCompositeContext.getContext();
        helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldComponent");
    }

    protected void tearDown() throws Exception {
    }
View Full Code Here

    }

    public static void main(String[] args) throws Exception {
        CompositeContext moduleContext = CurrentCompositeContext.getContext();

        AccountService accountService = (AccountService) moduleContext.locateService(AccountService.class, "AccountServiceComponent");

        AccountReport report = accountService.getAccountReport(12345);
        List summaries = report.getAccountSummaries();

        System.out.println("retrieved " + summaries.size() + " summaries");
View Full Code Here

    }

    public static void main(String[] args) throws Exception {

        CompositeContext moduleContext = CurrentCompositeContext.getContext();
        LoginService loginService = moduleContext.locateService(LoginService.class, "LoginServiceComponent");

        if (loginService.login("test", "password") == LoginService.SUCCESS) {
            System.out.println("Success");
        } else {
            System.out.println("Failure");
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.