Search in sources :

Example 86 with ModuleAssembly

use of org.qi4j.bootstrap.ModuleAssembly 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 87 with ModuleAssembly

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

the class HelloWorldTest method setUp.

@Before
public void setUp() throws Exception {
    SingletonAssembler assembly = new SingletonAssembler() {

        @Override
        public void assemble(ModuleAssembly module) throws AssemblyException {
            module.transients(HelloWorldComposite.class);
        }
    };
    helloWorld = assembly.module().newTransient(HelloWorldComposite.class);
}
Also used : ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) SingletonAssembler(org.qi4j.bootstrap.SingletonAssembler) Before(org.junit.Before)

Example 88 with ModuleAssembly

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

the class HelloWorldTest method setUp.

@Before
public void setUp() throws Exception {
    SingletonAssembler assembly = new SingletonAssembler() {

        @Override
        public void assemble(ModuleAssembly module) throws AssemblyException {
            module.transients(HelloWorldComposite.class);
        }
    };
    helloWorld = assembly.module().newTransientBuilder(HelloWorldComposite.class).newInstance();
}
Also used : ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) SingletonAssembler(org.qi4j.bootstrap.SingletonAssembler) Before(org.junit.Before)

Example 89 with ModuleAssembly

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

the class Main method main.

public static void main(String[] args) throws Exception {
    SingletonAssembler assembler = new // <1>
    SingletonAssembler() {

        @Override
        public void assemble(ModuleAssembly assembly) throws AssemblyException {
            // <2>
            assembly.transients(Speaker.class);
        }
    };
    // <3>
    Speaker speaker = assembler.module().newTransient(Speaker.class);
    System.out.println(speaker.sayHello());
}
Also used : ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) SingletonAssembler(org.qi4j.bootstrap.SingletonAssembler)

Example 90 with ModuleAssembly

use of org.qi4j.bootstrap.ModuleAssembly 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)

Aggregations

ModuleAssembly (org.qi4j.bootstrap.ModuleAssembly)191 SingletonAssembler (org.qi4j.bootstrap.SingletonAssembler)87 Test (org.junit.Test)82 EntityTestAssembler (org.qi4j.test.EntityTestAssembler)59 AssemblyException (org.qi4j.bootstrap.AssemblyException)27 Application (org.qi4j.api.structure.Application)26 OrgJsonValueSerializationAssembler (org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler)24 Assembler (org.qi4j.bootstrap.Assembler)23 Module (org.qi4j.api.structure.Module)19 LayerAssembly (org.qi4j.bootstrap.LayerAssembly)15 Before (org.junit.Before)12 UnitOfWork (org.qi4j.api.unitofwork.UnitOfWork)12 Energy4Java (org.qi4j.bootstrap.Energy4Java)12 DataSourceAssembler (org.qi4j.library.sql.assembly.DataSourceAssembler)11 DBCPDataSourceServiceAssembler (org.qi4j.library.sql.dbcp.DBCPDataSourceServiceAssembler)9 IOException (java.io.IOException)8 ApplicationAssemblerAdapter (org.qi4j.bootstrap.ApplicationAssemblerAdapter)8 ApplicationAssembly (org.qi4j.bootstrap.ApplicationAssembly)8 File (java.io.File)7 OrgJsonValueSerializationService (org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationService)7