Package org.qi4j.bootstrap.builder

Examples of org.qi4j.bootstrap.builder.ApplicationBuilder


    @Test
    public void testPassivationExceptionsAccrossStructure()
        throws AssemblyException, ActivationException
    {
        ApplicationBuilder appBuilder = new ApplicationBuilder( "TestApplication" );
        appBuilder.withLayer( "Layer 1" ).withModule( "Module A" ).withAssembler( new Assembler()
        {
            @Override
            public void assemble( ModuleAssembly module )
                throws AssemblyException
            {
                module.services( TestService.class ).
                    identifiedBy( "TestService_Module.A" ).
                    withActivators( FailBeforePassivationServiceActivator.class ).
                    instantiateOnStartup();
            }
        } );
        appBuilder.withLayer( "Layer 2" ).withModule( "Module B" ).withAssembler( new Assembler()
        {
            @Override
            public void assemble( ModuleAssembly module )
                throws AssemblyException
            {
                module.services( TestService.class ).
                    identifiedBy( "TestService_Module.B" ).
                    withActivators( FailAfterPassivationServiceActivator.class ).
                    instantiateOnStartup();
            }
        } );
        appBuilder.registerActivationEventListener( new TestActivationEventListener() );

        Application app = appBuilder.newApplication();

        try
        {
            Module moduleA = app.findModule( "Layer 1", "Module A" );
            TestService service = moduleA.findService( TestService.class ).get();
View Full Code Here

TOP

Related Classes of org.qi4j.bootstrap.builder.ApplicationBuilder

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.