Package org.osoa.sca

Examples of org.osoa.sca.ModuleContext


    }

    public static void main(String[] args) throws Exception {
        TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.account.testclient", null);
        tuscany.start();
        ModuleContext moduleContext = CurrentModuleContext.getContext();

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

        AccountReport accountReport = accountService.getAccountReport(12345);

        for (Iterator i = accountReport.getAccountSummaries().iterator(); i.hasNext();) {
            AccountSummary accountSummary = (AccountSummary) i.next();
View Full Code Here


    }

    public static void main(String[] args) throws Exception {
        TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.webclient.testclient", null);
        tuscany.start();
        ModuleContext moduleContext = CurrentModuleContext.getContext();

        AccountService accountService = (AccountService) moduleContext.locateService("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 {


        TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.webclient.testclient", null);
        tuscany.start();
        ModuleContext moduleContext = CurrentModuleContext.getContext();
        LoginService loginService = (LoginService)
                moduleContext.locateService("LoginServiceComponent");

        if (loginService.login("test", "password") == LoginService.SUCCESS)
            System.out.println("Success");
        else
            System.out.println("Failure");
View Full Code Here

    public void setId(String pId) {
        mId = pId;
    }

    public int doStartTag() throws JspException {
        ModuleContext moduleContext = CurrentModuleContext.getContext();
        Object service = moduleContext.locateService(mName);
        if (service == null) {
            throw new JspException("Service [" + mName + "] not found in current module context");
        }
        if (mId == null) {
            // if the Id name was not specified, default to the basic name of the
View Full Code Here

    public int doStartTag() throws JspException {
        if (mProfile == null || mProfile.length() < 1) {
            throw new JspException("Invalid profile location specified");
        }

        ModuleContext moduleContext = CurrentModuleContext.getContext();

        ProfileService profile = (ProfileService) moduleContext.locateService(mProfile);

        if (profile == null) {
            throw new JspException("Profile [" + mProfile + "] not found in current module context");
        }
View Full Code Here

    }

    private Iterator mIterator;

    public int doStartTag() throws JspException {
        ModuleContext moduleContext = CurrentModuleContext.getContext();
        ProfileService profile = (ProfileService) moduleContext.locateService(mProfileService);
        if (profile == null) {
            throw new JspException("Profile [" + mProfileService + "] not found in current module context");
        }

        AccountService service = (AccountService) moduleContext.locateService(mAccountService);
        if (service == null) {
            throw new JspException("Service [" + mAccountService + "] not found in current module context");
        }
        List summaries;
        try {
View Full Code Here

        }
    }

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

        ModuleContext moduleContext = CurrentModuleContext.getContext();
        LoginService loginMgr = (LoginService) moduleContext.locateService("LoginServiceComponent");

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

    public void doPost(HttpServletRequest pReq, HttpServletResponse pResp) throws ServletException {

        try {
            final String action = pReq.getParameter("action");
            ModuleContext moduleContext = CurrentModuleContext.getContext();
            AccountService accountServices = (AccountService) moduleContext.locateService("AccountServiceComponent");
            if (accountServices == null) {
                throw new ServletException("AccountServiceComponent");
            }
            ProfileService profileServices = null;
            if (!"createAccount".equals(action)) {
                profileServices = (ProfileService) moduleContext.locateService("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

        // Start the Tuscany runtime and associate it with this thread
        tuscany.start();

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

        // Locate the HelloWorld service
        HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldService");
       
        // Invoke the HelloWorld service
        String value = helloworldService.getGreetings("World");
       
        System.out.println(value);
View Full Code Here

        // do nothing since sessions are lazily created in {@link TuscanyRequestFilter}
    }

    public void sessionDestroyed(HttpSessionEvent event) {
        // todo do we actually need to bind the module context to the thread to fire this event?
        ModuleContext oldContext = CurrentModuleContext.getContext();
        try {
            ContextBinder.BINDER.setContext((ModuleContext) moduleContext);
            moduleContext.publish(new HttpSessionEnd(this, event.getSession()));
        } finally{
            ContextBinder.BINDER.setContext(oldContext);
View Full Code Here

TOP

Related Classes of org.osoa.sca.ModuleContext

Copyright © 2018 www.massapicom. 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.