Package org.qi4j.bootstrap

Examples of org.qi4j.bootstrap.ModuleAssembly


    }

    private void assembleCommunicationLayer( LayerAssembly communicationLayer )
        throws AssemblyException
    {
        ModuleAssembly queryModule = communicationLayer.module( "COMMUNICATION-Query" );
        queryModule
            .values(
                CargoDTO.class,
                LocationDTO.class,
                HandlingEventDTO.class,
                VoyageDTO.class );

        queryModule
            .transients(
                BookingQueries.class )
            .visibleIn( application );

        queryModule
            .addServices(
                EntityToDTOService.class,
                OrgJsonValueSerializationService.class )
            .visibleIn( application );
    }
View Full Code Here


    }

    private void assembleContextLayer( LayerAssembly contextLayer )
        throws AssemblyException
    {
        ModuleAssembly roleMapModule = contextLayer.module( "CONTEXT-RoleMap" );
        roleMapModule
            .entities(
                CargoRoleMap.class,
                CargosRoleMap.class,
                HandlingEventsRoleMap.class )
            .visibleIn( application );

        ModuleAssembly roleMapCandidatesModule = contextLayer.module( "CONTEXT-RoleMapCandidates" );
        roleMapCandidatesModule
            .entities(
                HandlingEventEntity.class,
                LocationEntity.class,
                VoyageEntity.class )
            .visibleIn( application );

        roleMapCandidatesModule
            .values(
                Itinerary.class )
            .visibleIn( application );

        ModuleAssembly interactionModule = contextLayer.module( "CONTEXT-Interaction" );
        interactionModule
            .transients(
                ProcessHandlingEvent.class )
            .visibleIn( application );

        ModuleAssembly contextServiceModule = contextLayer.module( "CONTEXT-Service" );
        contextServiceModule
            .addServices(
                ParseHandlingEventData.class,
                RoutingService.class,
                RouteSpecificationFactoryService.class )
            .visibleIn( application );

        contextServiceModule
            .values(
                ParsedHandlingEventData.class )
            .visibleIn( application );
    }
View Full Code Here

    }

    private void assembleDataLayer( LayerAssembly dataLayer )
        throws AssemblyException
    {
        ModuleAssembly dataModule = dataLayer.module( "DATA-Structure" );
        dataModule
            .values(
                TrackingId.class,
                RouteSpecification.class,
                Delivery.class,
                NextHandlingEvent.class,
View Full Code Here

    }

    private void assembleInfrastructureLayer( LayerAssembly infrastructureLayer )
        throws AssemblyException
    {
        ModuleAssembly serializationModule = infrastructureLayer.module( "INFRASTRUCTURE-Serialization" );
        serializationModule
            .services( OrgJsonValueSerializationService.class )
            .taggedWith( ValueSerialization.Formats.JSON )
            .setMetaInfo( new Function<Application, Module>()
        {
            @Override
            public Module map( Application application )
            {
                return application.findModule( "CONTEXT", "CONTEXT-RoleMap" );
            }
        } )
        .visibleIn( application );

        ModuleAssembly indexingModule = infrastructureLayer.module( "INFRASTRUCTURE-Indexing" );
        indexingModule
            .objects(
                EntityStateSerializer.class,
                EntityTypeSerializer.class );

        indexingModule
            .services(
                MemoryRepositoryService.class,
                RdfIndexingEngineService.class )
            .instantiateOnStartup()
            .visibleIn( application );

        ModuleAssembly entityStoreModule = infrastructureLayer.module( "INFRASTRUCTURE-EntityStore" );
        entityStoreModule
            .services(
                MemoryEntityStoreService.class,
                UuidIdentityGeneratorService.class )
            .instantiateOnStartup()
            .visibleIn( application );

        ModuleAssembly externalServiceModule = infrastructureLayer.module( "INFRASTRUCTURE-ExternalService" );
        externalServiceModule
            .importedServices(
                GraphTraversalService.class )
            .setMetaInfo( new GraphTraversalServiceImpl( new GraphDAO() ) )
            .visibleIn( application );
    }
View Full Code Here

            // 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 );
                }
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 );
View Full Code Here

    {
        layer = application.layer( layerName );
        layer.setName( layerName );
        for( ModuleDeclaration module : modules.values() )
        {
            ModuleAssembly assembly = module.createModule( layer );
        }
        return layer;
    }
View Full Code Here

            public void assemble( ModuleAssembly module )
                throws AssemblyException
            {
                new JdbmEntityStoreAssembler().assemble( module );
                new OrgJsonValueSerializationAssembler().assemble( module );
                ModuleAssembly configModule = module.layer().module( "Config" );
                configModule.entities( JdbmConfiguration.class ).visibleIn( Visibility.layer );
                new EntityTestAssembler().assemble( configModule );

                module.services( EhCachePoolService.class );
                configModule.entities( EhCacheConfiguration.class ).visibleIn( Visibility.layer );
            }
        };
    }
View Full Code Here

    {
        super.assemble( module );
        System.out.println( "Registering GAE services." );
        module.services( GaeEntityStoreService.class );

        ModuleAssembly configModule = module.layer().module( "config" );
        configModule.entities( GaeEntityStoreConfiguration.class ).visibleIn( Visibility.layer );
        configModule.services( MemoryEntityStoreService.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.