Package org.picocontainer.defaults

Examples of org.picocontainer.defaults.ObjectReference


                new ConstantParameter(getClassLoader()) };
        nano.registerComponentImplementation(containerBuilderClassName,
                containerBuilderClassName, parameters);
        ContainerBuilder containerBuilder = (ContainerBuilder) nano
                .getPico().getComponentInstance(containerBuilderClassName);
        ObjectReference parentRef = new SimpleReference();
        parentRef.set(parent);
        containerBuilder.buildContainer(new SimpleReference(), parentRef, null, false);
        return (ContainerPopulator) containerBuilder;
    }
View Full Code Here


    private MutablePicoContainer getActionsContainer() {
        HttpServletRequest request = ServletActionContext.getRequest();
        if ( request != null ) {
            return actionsContainerFactory.getActionsContainer(request);
        } else {
            ObjectReference ref = new ActionContextScopeObjectReference(KeyConstants.REQUEST_CONTAINER);
            return (MutablePicoContainer) ref.get();
        }
    }
View Full Code Here

        }
        return container;
    }

    protected MutablePicoContainer getApplicationContainer(ServletContext context) {
        ObjectReference ref = new ApplicationScopeObjectReference(context, KeyConstants.APPLICATION_CONTAINER);
        return (MutablePicoContainer) ref.get();
    }
View Full Code Here

        ObjectReference ref = new ApplicationScopeObjectReference(context, KeyConstants.APPLICATION_CONTAINER);
        return (MutablePicoContainer) ref.get();
    }

    protected MutablePicoContainer getSessionContainer(HttpSession session) {
        ObjectReference ref = new SessionScopeObjectReference(session, KeyConstants.SESSION_CONTAINER);
        return (MutablePicoContainer) ref.get();
    }
View Full Code Here

        ObjectReference ref = new SessionScopeObjectReference(session, KeyConstants.SESSION_CONTAINER);
        return (MutablePicoContainer) ref.get();
    }

    protected MutablePicoContainer getRequestContainer(ServletRequest request) {
        ObjectReference ref = new RequestScopeObjectReference(request, KeyConstants.REQUEST_CONTAINER);
        return (MutablePicoContainer) ref.get();
    }
View Full Code Here

    public void contextInitialized(ServletContextEvent event) {
        ServletContext context = event.getServletContext();
        try {
            ContainerBuilder containerBuilder = createContainerBuilder(context);

            ObjectReference builderRef = new ApplicationScopeObjectReference(context, BUILDER);
            builderRef.set(containerBuilder);

            ObjectReference containerRef = new ApplicationScopeObjectReference(context, APPLICATION_CONTAINER);
            containerBuilder.buildContainer(containerRef, new SimpleReference(), context, false);
        } catch (Exception e) {
            // Not all servlet containers print the nested exception. Do it here.
            event.getServletContext().log(e.getMessage(), e);
            throw new PicoCompositionException(e);
View Full Code Here

        String extension = scriptName.substring(scriptName.lastIndexOf('.'));
        return ScriptedContainerBuilderFactory.getBuilderClassName(extension);
    }
   
    protected PicoContainer buildContainer(ScriptedContainerBuilder builder) {
        ObjectReference containerRef = new SimpleReference();
        builder.buildContainer(containerRef, new SimpleReference(), new SimpleReference(), false);
        return (PicoContainer) containerRef.get();
    }
View Full Code Here

        return (PicoContainer) containerRef.get();
    }
   
    public void contextDestroyed(ServletContextEvent event) {
        ServletContext context = event.getServletContext();
        ObjectReference containerRef = new ApplicationScopeObjectReference(context, APPLICATION_CONTAINER);
        killContainer(containerRef);
    }
View Full Code Here

    public void sessionCreated(HttpSessionEvent event) {
        HttpSession session = event.getSession();
        ServletContext context = session.getServletContext();
        ContainerBuilder containerBuilder = getBuilder(context);
        ObjectReference sessionContainerRef = new SessionScopeObjectReference(session, SESSION_CONTAINER);
        ObjectReference webappContainerRef = new ApplicationScopeObjectReference(context, APPLICATION_CONTAINER);
        containerBuilder.buildContainer(sessionContainerRef, webappContainerRef, session, false);

        session.setAttribute(KILLER_HELPER, new SessionContainerKillerHelper() {
            public void valueBound(HttpSessionBindingEvent bindingEvent) {
                HttpSession session = bindingEvent.getSession();
View Full Code Here

    public void sessionDestroyed(HttpSessionEvent event) {
        // no implementation - session scoped container killed by SessionContainerKillerHelper
    }

    private ContainerBuilder getBuilder(ServletContext context) {
        ObjectReference assemblerRef = new ApplicationScopeObjectReference(context, BUILDER);
        return (ContainerBuilder) assemblerRef.get();
    }
View Full Code Here

TOP

Related Classes of org.picocontainer.defaults.ObjectReference

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.