Package org.qi4j.bootstrap

Examples of org.qi4j.bootstrap.ModuleAssembly


    private LayerAssembly createInfrastructureLayer( ApplicationAssembly appAssembly )
        throws AssemblyException
    {
        LayerAssembly layerInfrastructure = appAssembly.layer( "Infrastructure" );

        ModuleAssembly moduleMail = layerInfrastructure.module( "Mail" );
        new MailServiceAssembler().assemble( moduleMail );

        ModuleAssembly modulePersistence = layerInfrastructure.module( "Persistence" );
        new PersistenceAssembler().assemble( modulePersistence );

        return layerInfrastructure;
    }
View Full Code Here


    private LayerAssembly createConfigLayer( ApplicationAssembly appAssembly )
        throws AssemblyException
    {
        LayerAssembly layerConfig = appAssembly.layer( "configuration" );

        ModuleAssembly persistenceConfig = layerConfig.module( "persistence" );
        new PersistenceConfigAssembler().assemble( persistenceConfig );
        return layerConfig;
    }
View Full Code Here

    private LayerAssembly createDomainLayer( ApplicationAssembly appAssembly )
        throws AssemblyException
    {
        LayerAssembly layerDomain = appAssembly.layer( "domain" );

        ModuleAssembly modulePerson = layerDomain.module( "person" );
        new PersonModelAssembler().assemble( modulePerson );

        ModuleAssembly moduleSchool = layerDomain.module( "school" );
        new SchoolModelAssembler().assemble( moduleSchool );

        return layerDomain;
    }
View Full Code Here

        throws AssemblyException
    {
        LayerAssembly layerUI = appAssembly.layer( "UI" );

        // Add admin
        ModuleAssembly moduleAdmin = layerUI.module( "admin" );
        new AdminAssembler().assemble( moduleAdmin );

        return layerUI;
    }
View Full Code Here

    @Override
    public void assemble( ModuleAssembly module ) throws AssemblyException
    {
        module.services( FileConfigurationService.class );
        ModuleAssembly prefModule = module.layer().module( "PrefModule" );
        prefModule.entities( NativeConfiguration.class ).visibleIn( Visibility.application );
        prefModule.forMixin( NativeConfiguration.class ).declareDefaults().tripleIndexes().set( "spoc,cspo" );
        prefModule.forMixin( NativeConfiguration.class ).declareDefaults().dataDirectory().set( DATA_DIR.getAbsolutePath() );
        new EntityTestAssembler().assemble( prefModule );

        module.entities( ExampleEntity.class );

        EntityTestAssembler testAss = new EntityTestAssembler();
View Full Code Here

    {
        @Override
        public void assemble( ModuleAssembly module )
            throws AssemblyException
        {
            ModuleAssembly config = module;

            // START SNIPPET: bonecp
            // Assemble the BoneCP based Service Importer
            new BoneCPDataSourceServiceAssembler().
                identifiedBy( DS_SERVICE_ID ).
View Full Code Here

                // Set up DataSource service that will manage the connection pools
                new C3P0DataSourceServiceAssembler().identifiedBy( "datasource-service" ).visibleIn( Visibility.layer ).assemble( module );

                {
                    ModuleAssembly testModule = module.layer().module( "TestDS" );

                    // Create a specific DataSource that uses the "datasource" service to do the main work
                    new DataSourceAssembler().
                            withDataSourceServiceIdentity( "datasource-service" ).
                            identifiedBy( "testds" ).
                            visibleIn( Visibility.module ).
                            withCircuitBreaker( DataSources.newDataSourceCircuitBreaker() ).
                            assemble( testModule );

                    // Set up Liquibase service that will create the tables
                    testModule.services( LiquibaseService.class ).identifiedBy( "liquibase1" ).instantiateOnStartup();
                    testModule.entities( LiquibaseConfiguration.class );
                    testModule.forMixin( LiquibaseConfiguration.class ).declareDefaults().enabled().set( true );
                    testModule.forMixin( LiquibaseConfiguration.class ).declareDefaults().changeLog().set( "changelog.xml" );
                }

                {
                    ModuleAssembly testModule2 = module.layer().module( "TestDS2" );

                    // Create another specific DataSource that uses the "datasource" service to do the main work
                    // Use DataSourceAssembler to assemble the DataSource.
                    new DataSourceAssembler().
                            withDataSourceServiceIdentity( "datasource-service" ).
                            identifiedBy( "testds2" ).
                            visibleIn( Visibility.module ).
                            withCircuitBreaker( DataSources.newDataSourceCircuitBreaker() ).
                            assemble( testModule2 );

                    // Set up Liquibase service that will create the tables
                    testModule2.services( LiquibaseService.class ).identifiedBy( "liquibase2" ).instantiateOnStartup();
                    testModule2.entities( LiquibaseConfiguration.class );
                    testModule2.forMixin( LiquibaseConfiguration.class ).declareDefaults().enabled().set( true );
                    testModule2.forMixin( LiquibaseConfiguration.class ).declareDefaults().changeLog().set( "changelog.xml" );
                }

                // START SNIPPET: jmx
                new DataSourceJMXAssembler().visibleIn( Visibility.module ).assemble( module );
                // END SNIPPET: jmx
View Full Code Here

                    // In a real case you would "detect" the plugins somehow. Here the plugin assembler is hardcoded
                    List<Assembler> pluginAssemblers = Collections.<Assembler>singletonList( new SimonAssembler() );

                    for( int i = 0; i < pluginAssemblers.size(); i++ )
                    {
                        ModuleAssembly pluginModule = layer.module( "Plugin " + ( i + 1 ) );
                        Assembler assembler = pluginAssemblers.get( i );
                        assembler.assemble( pluginModule );
                    }

                    // Import host services
View Full Code Here

        return layer;
    }

    private static void createCustomerWebModule( LayerAssembly layer )
    {
        ModuleAssembly assembly = layer.module( "Customer Web Module" );
        assembly.transients( CustomerViewComposite.class );
        assembly.transients( CustomerEditComposite.class );
        assembly.transients( CustomerListViewComposite.class );
        assembly.transients( CustomerSearchComposite.class );
    }
View Full Code Here

        assembly.transients( CustomerSearchComposite.class );
    }

    private static void createCustomerDomainModule( LayerAssembly layer )
    {
        ModuleAssembly assembly = layer.module( "Customer Domain Module" );
        assembly.entities( CustomerEntity.class );
        assembly.entities( CountryEntity.class );
        assembly.transients( AddressComposite.class );
    }
View Full Code Here

TOP

Related Classes of org.qi4j.bootstrap.ModuleAssembly

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.