Search in sources :

Example 6 with LayerAssembly

use of org.qi4j.bootstrap.LayerAssembly in project qi4j-sdk by Qi4j.

the class Assembler method assemble.

public ApplicationAssembly assemble(ApplicationAssemblyFactory applicationFactory) throws AssemblyException {
    // Application assembly
    ApplicationAssembly assembly = applicationFactory.newApplicationAssembly();
    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);
    communicationLayer.uses(contextLayer, dataLayer, infrastructureLayer);
    contextLayer.uses(dataLayer, infrastructureLayer);
    dataLayer.uses(infrastructureLayer);
    // Assemble
    assembleBootstrapLayer(bootstrapLayer);
    assembleCommunicationLayer(communicationLayer);
    assembleContextLayer(contextLayer);
    assembleDataLayer(dataLayer);
    assembleInfrastructureLayer(infrastructureLayer);
    return assembly;
}
Also used : ApplicationAssembly(org.qi4j.bootstrap.ApplicationAssembly) LayerAssembly(org.qi4j.bootstrap.LayerAssembly)

Example 7 with LayerAssembly

use of org.qi4j.bootstrap.LayerAssembly in project qi4j-sdk by Qi4j.

the class QueryPerformanceTest method createDomainLayer.

private LayerAssembly createDomainLayer(ApplicationAssembly applicationAssembly) throws AssemblyException {
    LayerAssembly domainLayer = applicationAssembly.layer(LAYER_DOMAIN);
    ModuleAssembly domainModule = domainLayer.module(MODULE_DOMAIN);
    domainModule.addServices(LeadRepositoryService.class);
    domainModule.addServices(LeadEntityFactoryService.class);
    domainModule.entities(LeadEntity.class);
    return domainLayer;
}
Also used : ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) LayerAssembly(org.qi4j.bootstrap.LayerAssembly)

Example 8 with LayerAssembly

use of org.qi4j.bootstrap.LayerAssembly in project qi4j-sdk by Qi4j.

the class QueryPerformanceTest method createConfigurationLayer.

private LayerAssembly createConfigurationLayer(ApplicationAssembly applicationAssembly) throws AssemblyException {
    LayerAssembly layer = applicationAssembly.layer(LAYER_CONFIGURATION);
    ModuleAssembly configModule = layer.module(MODULE_CONFIG);
    configModule.entities(NativeConfiguration.class).visibleIn(Visibility.application);
    new EntityTestAssembler().assemble(configModule);
    return layer;
}
Also used : ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) EntityTestAssembler(org.qi4j.test.EntityTestAssembler) NativeConfiguration(org.qi4j.library.rdf.repository.NativeConfiguration) LayerAssembly(org.qi4j.bootstrap.LayerAssembly)

Example 9 with LayerAssembly

use of org.qi4j.bootstrap.LayerAssembly in project qi4j-sdk by Qi4j.

the class VisitableDetailTest method visit.

@Test
public void visit() throws AssemblyException, ActivationException {
    ApplicationDescriptor application = new Energy4Java().newApplicationModel(new ApplicationAssembler() {

        @Override
        public ApplicationAssembly assemble(ApplicationAssemblyFactory applicationFactory) throws AssemblyException {
            ApplicationAssembly app = applicationFactory.newApplicationAssembly();
            app.setName("UnderTestApp");
            app.withActivators(ApplicationActivator.class);
            LayerAssembly layer = app.layer("LayerName");
            layer.withActivators(LayerActivator.class);
            ModuleAssembly module = layer.module("ModuleName");
            module.withActivators(ModuleActivator.class);
            return app;
        }
    });
    ApplicationDetailDescriptor detail = createApplicationDetailDescriptor(application);
    Visitor visitor = new Visitor();
    detail.accept(visitor);
    assertThat(visitor.events, equalTo(Arrays.asList(// Application
    "visitEnter( UnderTestApp )", "visit( " + ApplicationActivator.class.getName() + " )", // Layer
    "visitEnter( LayerName )", "visit( " + LayerActivator.class.getName() + " )", // Module
    "visitEnter( ModuleName )", "visit( " + ModuleActivator.class.getName() + " )", // Leaving Structure
    "visitLeave( ModuleName )", "visitLeave( LayerName )", "visitLeave( UnderTestApp )")));
}
Also used : ApplicationAssemblyFactory(org.qi4j.bootstrap.ApplicationAssemblyFactory) ApplicationDetailDescriptorBuilder.createApplicationDetailDescriptor(org.qi4j.tools.model.descriptor.ApplicationDetailDescriptorBuilder.createApplicationDetailDescriptor) ApplicationDetailDescriptor(org.qi4j.tools.model.descriptor.ApplicationDetailDescriptor) HierarchicalVisitor(org.qi4j.functional.HierarchicalVisitor) ApplicationAssembly(org.qi4j.bootstrap.ApplicationAssembly) ApplicationDescriptor(org.qi4j.api.structure.ApplicationDescriptor) LayerAssembly(org.qi4j.bootstrap.LayerAssembly) AssemblyException(org.qi4j.bootstrap.AssemblyException) ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) ApplicationAssembler(org.qi4j.bootstrap.ApplicationAssembler) Energy4Java(org.qi4j.bootstrap.Energy4Java) Test(org.junit.Test)

Example 10 with LayerAssembly

use of org.qi4j.bootstrap.LayerAssembly in project qi4j-sdk by Qi4j.

the class SchoolAssembler method assemble.

@Override
public ApplicationAssembly assemble(ApplicationAssemblyFactory applicationFactory) throws AssemblyException {
    final ApplicationAssembly appAssembly = applicationFactory.newApplicationAssembly();
    appAssembly.setName("School");
    // Create layers
    LayerAssembly layerUI = createUILayer(appAssembly);
    LayerAssembly layerDomain = createDomainLayer(appAssembly);
    LayerAssembly layerInfra = createInfrastructureLayer(appAssembly);
    LayerAssembly layerConfig = createConfigLayer(appAssembly);
    layerUI.uses(layerDomain);
    layerDomain.uses(layerInfra);
    layerDomain.uses(layerConfig);
    return appAssembly;
}
Also used : ApplicationAssembly(org.qi4j.bootstrap.ApplicationAssembly) LayerAssembly(org.qi4j.bootstrap.LayerAssembly)

Aggregations

LayerAssembly (org.qi4j.bootstrap.LayerAssembly)31 ApplicationAssembly (org.qi4j.bootstrap.ApplicationAssembly)16 ModuleAssembly (org.qi4j.bootstrap.ModuleAssembly)15 AssemblyException (org.qi4j.bootstrap.AssemblyException)5 Test (org.junit.Test)4 Application (org.qi4j.api.structure.Application)4 ApplicationAssembler (org.qi4j.bootstrap.ApplicationAssembler)4 ApplicationAssemblyFactory (org.qi4j.bootstrap.ApplicationAssemblyFactory)4 Energy4Java (org.qi4j.bootstrap.Energy4Java)4 ApplicationDescriptor (org.qi4j.api.structure.ApplicationDescriptor)3 HashMap (java.util.HashMap)2 OrgJsonValueSerializationAssembler (org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ActivationEventListener (org.qi4j.api.activation.ActivationEventListener)1 EntityComposite (org.qi4j.api.entity.EntityComposite)1 Layer (org.qi4j.api.structure.Layer)1 LayerDescriptor (org.qi4j.api.structure.LayerDescriptor)1 Module (org.qi4j.api.structure.Module)1 Assembler (org.qi4j.bootstrap.Assembler)1