Package org.nanocontainer.integrationkit

Examples of org.nanocontainer.integrationkit.ContainerBuilder


          throw new FileSystemException("Could not find a suitable builder for: " + deploymentScript.getName()
              + ".  Known extensions are: [groovy|bsh|js|py|xml]");
        }

        ScriptedContainerBuilderFactory scriptedContainerBuilderFactory = new ScriptedContainerBuilderFactory(scriptReader, builderClassName, applicationClassLoader);
        ContainerBuilder builder = scriptedContainerBuilderFactory.getContainerBuilder();
        builder.buildContainer(result, parentContainerRef, null, true);

        return result;
    }
View Full Code Here


        Parameter[] parameters = new Parameter[] {
                new ConstantParameter(reader),
                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

    public static final String CONTAINER_COMPOSER_CONFIGURATION = CONTAINER_COMPOSER + ".configuration";
   
    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

    }

    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();
                containerRef = new SimpleReference();
View Full Code Here

        ObjectReference assemblerRef = new ApplicationScopeObjectReference(context, BUILDER);
        return (ContainerBuilder) assemblerRef.get();
    }

    private void killContainer(ObjectReference containerRef) {
        ContainerBuilder containerKiller = new DefaultLifecycleContainerBuilder(null);
        if (containerRef.get() != null) {
            containerKiller.killContainer(containerRef);
        }
    }
View Full Code Here

        Parameter[] parameters = new Parameter[] {
                new ConstantParameter(reader),
                new ConstantParameter(classLoader) };
        nano.registerComponentImplementation(containerBuilderClassName,
                containerBuilderClassName, parameters);
        ContainerBuilder containerBuilder = (ContainerBuilder) nano.getPico()
                .getComponentInstance(containerBuilderClassName);
        //containerBuilder.buildContainer(new SimpleReference(), null, null,
        //        false);
        return (ContainerPopulator) containerBuilder;
    }
View Full Code Here

    }   

    private PicoContainer buildApplicationContainer(String script, Class containerBuilderClass) throws ClassNotFoundException {
        Mock servletContextMock = mock(ServletContext.class);
        ServletContext context = (ServletContext)servletContextMock.proxy();
        ContainerBuilder containerBuilder = createContainerBuilder(script, containerBuilderClass);
       
        ObjectReference containerRef = new SimpleReference();
        containerBuilder.buildContainer(containerRef, new SimpleReference(), context, false);
        return (PicoContainer) containerRef.get();
    }
View Full Code Here

TOP

Related Classes of org.nanocontainer.integrationkit.ContainerBuilder

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.