Package org.qi4j.bootstrap

Examples of org.qi4j.bootstrap.LayerAssembly


        assembly.setName( "DCI Sample (version A) - TEST" );
        assembly.setVersion( "A.1.0" );
        assembly.setMode( test );

        // Layers
        LayerAssembly infrastructureLayer = assembly.layer( "INFRASTRUCTURE" );
        LayerAssembly domainLayer = assembly.layer( "DOMAIN" );
        LayerAssembly contextLayer = assembly.layer( "CONTEXT" );
        LayerAssembly bootstrapLayer = assembly.layer( "BOOTSTRAP" );

        // Layer dependencies
        bootstrapLayer.uses(
              contextLayer,
              domainLayer,
              infrastructureLayer );

        contextLayer.uses(
View Full Code Here


        assembly.setName( "DCI Sample (version B)" );
        assembly.setVersion( "B.1.0" );
        assembly.setMode( development );

        // Layers (adding bottom-up - will be assembled in this order)
        LayerAssembly infrastructureLayer = assembly.layer( "INFRASTRUCTURE" );
        LayerAssembly dataLayer = assembly.layer( "DATA" );
        LayerAssembly contextLayer = assembly.layer( "CONTEXT" );
        LayerAssembly communicationLayer = assembly.layer( "COMMUNICATION" );
        LayerAssembly bootstrapLayer = assembly.layer( "BOOTSTRAP" );

        // Layer dependencies
        bootstrapLayer.uses(
            communicationLayer,
            contextLayer,
            dataLayer,
            infrastructureLayer );
View Full Code Here

        throws AssemblyException
    {
        ApplicationAssembly applicationAssembly = newApplicationAssembly();

        // Build all layers bottom-up
        LayerAssembly below = null;
        for( int layer = assemblers.length - 1; layer >= 0; layer-- )
        {
            // Create Layer
            LayerAssembly layerAssembly = applicationAssembly.layer( "Layer " + ( layer + 1 ) );
            for( int module = 0; module < assemblers[ layer ].length; module++ )
            {
                // Create Module
                ModuleAssembly moduleAssembly = layerAssembly.module( "Module " + ( module + 1 ) );
                for( Assembler assembler : assemblers[ layer ][ module ] )
                {
                    // Register Assembler
                    assembler.assemble( moduleAssembly );
                }
            }
            if( below != null )
            {
                layerAssembly.uses( below ); // Link layers
            }
            below = layerAssembly;
        }
        return applicationAssembly;
    }
View Full Code Here

    public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
        throws AssemblyException
    {
        ApplicationAssembly assembly = applicationFactory.newApplicationAssembly();
        assembly.setMode( mode );
        LayerAssembly webLayer = assembly.layer( "WebLayer" );
        new PagesModule().assemble( webLayer.module( "PagesModule" ) );
        LayerAssembly domainLayer = assembly.layer( "DomainLayer" );
        new RentalModule().assemble( domainLayer.module( "RentalModule" ) );
        LayerAssembly infraLayer = assembly.layer( "InfraLayer" );
        new StorageModule().assemble( infraLayer.module( "StorageModule" ) );

        webLayer.uses( domainLayer );
        domainLayer.uses( infraLayer );
        return assembly;
    }
View Full Code Here

    @Override
    protected void defineApplication( ApplicationAssembly applicationAssembly )
        throws AssemblyException
    {
        LayerAssembly layer = applicationAssembly.layer( "Layer 1" );
        ModuleAssembly module = layer.module( "Module 1" );
        module.objects( AbstractQi4jTest.this.getClass() );
        assemble( module );
    }
View Full Code Here

    {
        ApplicationAssembly appAss = applicationFactory.newApplicationAssembly();
        appAss.setName( "SQL Support Sample" );

        // Config
        LayerAssembly configLayer = appAss.layer( "config" );
        ModuleAssembly configModule = configLayer.module( "config" );
        {
            configModule.services( OrgJsonValueSerializationService.class ).
                taggedWith( ValueSerialization.Formats.JSON );
            configModule.services( MemoryEntityStoreService.class ).
                visibleIn( Visibility.module );
            // Use a PreferenceEntityStore instead if you want the configuration to be persistent
            // new PreferenceEntityStoreAssembler( Visibility.module ).assemble( configModule );
        }

        // Infra
        LayerAssembly infraLayer = appAss.layer( "infra" );
        ModuleAssembly persistenceModule = infraLayer.module( "persistence" );
        {
            persistenceModule.services( OrgJsonValueSerializationService.class ).
                taggedWith( ValueSerialization.Formats.JSON );

            // SQL DataSource Service
            String dataSourceServiceIdentity = "postgresql-datasource-service";
            new DBCPDataSourceServiceAssembler().
                identifiedBy( dataSourceServiceIdentity ).
                visibleIn( Visibility.module ).
                withConfig( configModule, Visibility.application ).
                assemble( persistenceModule );

            // SQL EntityStore DataSource and Service
            new DataSourceAssembler().
                withDataSourceServiceIdentity( dataSourceServiceIdentity ).
                identifiedBy( "postgresql-es-datasource" ).
                visibleIn( Visibility.module ).
                withCircuitBreaker( DataSources.newDataSourceCircuitBreaker() ).assemble( persistenceModule );
            new PostgreSQLEntityStoreAssembler().
                visibleIn( Visibility.application ).
                withConfig( configModule, Visibility.application ).
                assemble( persistenceModule );

            // SQL Index/Query DataSource and Service
            new DataSourceAssembler().
                withDataSourceServiceIdentity( dataSourceServiceIdentity ).
                identifiedBy( "postgresql-index-datasource" ).
                visibleIn( Visibility.module ).
                withCircuitBreaker().
                assemble( persistenceModule );
            new PostgreSQLIndexQueryAssembler().
                visibleIn( Visibility.application ).
                withConfig( configModule, Visibility.application ).
                assemble( persistenceModule );
        }

        // App
        LayerAssembly appLayer = appAss.layer( "app" );
        ModuleAssembly domainModule = appLayer.module( "domain" );
        {
            domainModule.entities( PretextEntity.class );
        }

        // Uses
        infraLayer.uses( configLayer );
        appLayer.uses( infraLayer );

        return appAss;
    }
View Full Code Here

                ApplicationAssembly assembly = factory.newApplicationAssembly();
                assembly.setName( applicationName );
                HashMap<String, LayerAssembly> createdLayers = new HashMap<>();
                for( Map.Entry<String, LayerDeclaration> entry : layers.entrySet() )
                {
                    LayerAssembly layer = entry.getValue().createLayer( assembly );
                    createdLayers.put( entry.getKey(), layer );
                }
                for( LayerDeclaration layer : layers.values() )
                {
                    layer.initialize( createdLayers );
                }
                return assembly;
            }
        } );
        Application application = model.newInstance( qi4j.api() );
View Full Code Here

    void initialize( HashMap<String, LayerAssembly> createdLayers )
        throws AssemblyException
    {
        for( String uses : using )
        {
            LayerAssembly usedLayer = createdLayers.get( uses );
            layer.uses( usedLayer );
        }
        for( ModuleDeclaration module : modules.values() )
        {
            module.initialize();
View Full Code Here

        assembly.setName( "DCI Sample (version A) - TEST" );
        assembly.setVersion( "B.1.0" );
        assembly.setMode( test );

        // Layers
        LayerAssembly infrastructureLayer = assembly.layer( "INFRASTRUCTURE" );
        LayerAssembly dataLayer = assembly.layer( "DATA" );
        LayerAssembly contextLayer = assembly.layer( "CONTEXT" );
        LayerAssembly bootstrapLayer = assembly.layer( "BOOTSTRAP" );

        // Layer dependencies
        bootstrapLayer.uses(
            contextLayer,
            dataLayer,
            infrastructureLayer );

        contextLayer.uses(
View Full Code Here

        assembly.setName( "DCI Sample (version A)" );
        assembly.setVersion( "A.1.0" );
        assembly.setMode( development );

        // Layers (adding bottom-up - will be assembled in this order)
        LayerAssembly infrastructureLayer = assembly.layer( "INFRASTRUCTURE" );
        LayerAssembly dataLayer = assembly.layer( "DATA" );
        LayerAssembly contextLayer = assembly.layer( "CONTEXT" );
        LayerAssembly communicationLayer = assembly.layer( "COMMUNICATION" );
        LayerAssembly bootstrapLayer = assembly.layer( "BOOTSTRAP" );

        // Layer dependencies
        bootstrapLayer.uses(
            communicationLayer,
            contextLayer,
            dataLayer,
            infrastructureLayer );
View Full Code Here

TOP

Related Classes of org.qi4j.bootstrap.LayerAssembly

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.