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;
}
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);
}
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();
}
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());
}
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;
}
Aggregations