Package org.oasisopen.sca

Examples of org.oasisopen.sca.ComponentContext


        } catch (ServletException e) {
            throw new JspException("Exception initializing Tuscany webapp: " + e, e);
        }
        ServletContext servletContext = pageContext.getServletContext();
        ComponentContext componentContext = (ComponentContext)servletContext.getAttribute("org.oasisopen.sca.ComponentContext");
        Node scaDomain = null;
        if (componentContext == null) {
            scaDomain = (Node)servletContext.getAttribute(WebAppServletHost.SCA_NODE_ATTRIBUTE);
            if (scaDomain == null) {
                throw new JspException("SCADomain is null. Check Tuscany configuration in web.xml");
            }
        }

        Class<?> typeClass;
        try {
            typeClass = Class.forName(type, true, Thread.currentThread().getContextClassLoader());
        } catch (ClassNotFoundException e) {
            throw new JspException("Reference '" + name + "' type class not found: " + type);
        }

        Object o;
        try {
            if (componentContext != null) {
                o = componentContext.getService(typeClass, name);
            } else {
                o = scaDomain.getService(typeClass, name);
            }
        } catch (Exception e) {
            throw new JspException("Exception getting service for reference'" + name + "': " + e, e);
View Full Code Here


    protected EightBall eightball;

    @Override
    public void init(ServletConfig servletConfig) throws ServletException {
        if (eightball == null) {
            ComponentContext cc = (ComponentContext)servletConfig.getServletContext().getAttribute("org.oasisopen.sca.ComponentContext");
            eightball = cc.getService(EightBall .class, "eightball");
        }
    }
View Full Code Here

    @Override
    public void init(ServletConfig servletConfig) throws ServletException {
        if (service == null) {
            System.out.println("HelloworldServlet reference injection failed, using ComponentContext");
            ComponentContext cc = (ComponentContext)servletConfig.getServletContext().getAttribute("org.oasisopen.sca.ComponentContext");
            service = cc.getService(HelloworldService.class, "service");
        }
    }
View Full Code Here

TOP

Related Classes of org.oasisopen.sca.ComponentContext

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.