Search in sources :

Example 11 with LayerAssembly

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

the class SchoolAssembler method createInfrastructureLayer.

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;
}
Also used : ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) MailServiceAssembler(org.qi4j.envisage.school.infrastructure.mail.assembly.MailServiceAssembler) PersistenceAssembler(org.qi4j.envisage.school.infrastructure.persistence.PersistenceAssembler) LayerAssembly(org.qi4j.bootstrap.LayerAssembly)

Example 12 with LayerAssembly

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

the class SchoolAssembler method createDomainLayer.

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;
}
Also used : ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) SchoolModelAssembler(org.qi4j.envisage.school.domain.school.assembly.SchoolModelAssembler) LayerAssembly(org.qi4j.bootstrap.LayerAssembly) PersonModelAssembler(org.qi4j.envisage.school.domain.person.assembly.PersonModelAssembler)

Example 13 with LayerAssembly

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

the class SchoolAssembler method createUILayer.

private LayerAssembly createUILayer(ApplicationAssembly appAssembly) throws AssemblyException {
    LayerAssembly layerUI = appAssembly.layer("UI");
    // Add admin
    ModuleAssembly moduleAdmin = layerUI.module("admin");
    new AdminAssembler().assemble(moduleAdmin);
    return layerUI;
}
Also used : ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) AdminAssembler(org.qi4j.envisage.school.ui.admin.AdminAssembler) LayerAssembly(org.qi4j.bootstrap.LayerAssembly)

Example 14 with LayerAssembly

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

the class ApplicationAssemblyFactoryImpl method newApplicationAssembly.

@Override
public ApplicationAssembly newApplicationAssembly(Assembler[][][] assemblers) 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) {
            // Link layers
            layerAssembly.uses(below);
        }
        below = layerAssembly;
    }
    return applicationAssembly;
}
Also used : ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) ApplicationAssembly(org.qi4j.bootstrap.ApplicationAssembly) Assembler(org.qi4j.bootstrap.Assembler) LayerAssembly(org.qi4j.bootstrap.LayerAssembly)

Example 15 with LayerAssembly

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

the class LayerDeclaration method initialize.

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();
    }
}
Also used : 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