public abstract class LayeredApplicationAssembler extends Object implements ApplicationAssembler
Modifier and Type | Field and Description |
---|---|
protected Application |
application |
protected ApplicationDescriptor |
model |
protected String |
name |
protected Energy4Java |
polygene |
protected String |
version |
Constructor and Description |
---|
LayeredApplicationAssembler(String name,
String version,
Application.Mode mode) |
Modifier and Type | Method and Description |
---|---|
Application |
application() |
ApplicationAssembly |
assemble(ApplicationAssemblyFactory applicationFactory) |
protected void |
assembleApplication() |
protected void |
assembleLayer(LayerAssembler layerAssembler,
LayerAssembly layer) |
protected abstract void |
assembleLayers(ApplicationAssembly assembly)
Called from the
assemble method to assemble the layers in the application. |
protected <T extends LayerAssembler> |
assemblerOf(Class<T> layerAssemblerClass) |
ApplicationAssembly |
assembly() |
protected LayerAssembly |
createLayer(Class<? extends LayerAssembler> layerAssemblerClass) |
void |
initialize() |
protected void |
instantiateApplication(Energy4Java polygene,
ApplicationDescriptor model)
This method is called from the
initialize method to instantiate the Polygene application from the
application model. |
protected <T extends LayerAssembler> |
instantiateLayerAssembler(Class<T> layerAssemblerClass,
LayerAssembly layer) |
ApplicationDescriptor |
model() |
protected void |
onModelCreated(ApplicationDescriptor model)
This method is called after the Application Model has been created, before the instantiation of the Polygene
application.
|
void |
start() |
void |
stop() |
protected final Energy4Java polygene
protected final String name
protected final String version
protected ApplicationDescriptor model
protected Application application
public LayeredApplicationAssembler(String name, String version, Application.Mode mode) throws AssemblyException
AssemblyException
public void initialize() throws AssemblyException
AssemblyException
public ApplicationAssembly assembly()
protected void instantiateApplication(Energy4Java polygene, ApplicationDescriptor model)
initialize
method to instantiate the Polygene application from the
application model.
The default implementation simply calls;
application = model.newInstance( polygene.spi() );
polygene
- The Polygene runtime engine.model
- The application model descriptor.protected void onModelCreated(ApplicationDescriptor model)
The default implementation does nothing. Applications may have advanced features to inspect or modify the model prior to instantiation, and this is the place where such advanced manipulation is expected to take place.
model
- The model that has just been created.public ApplicationDescriptor model()
public Application application()
public void start() throws ActivationException
ActivationException
public void stop() throws PassivationException
PassivationException
public ApplicationAssembly assemble(ApplicationAssemblyFactory applicationFactory)
assemble
in interface ApplicationAssembler
protected void assembleApplication()
protected LayerAssembly createLayer(Class<? extends LayerAssembler> layerAssemblerClass) throws IllegalArgumentException
IllegalArgumentException
protected void assembleLayer(LayerAssembler layerAssembler, LayerAssembly layer) throws AssemblyException
AssemblyException
protected <T extends LayerAssembler> LayerAssembler instantiateLayerAssembler(Class<T> layerAssemblerClass, LayerAssembly layer) throws InstantiationException, IllegalAccessException, InvocationTargetException, IllegalLayerAssemblerException
protected <T extends LayerAssembler> T assemblerOf(Class<T> layerAssemblerClass)
protected abstract void assembleLayers(ApplicationAssembly assembly) throws AssemblyException
assemble
method to assemble the layers in the application.
This method must be implemented, and is typically a list of LayerAssembler instantiations, followed
by LayerAssembly.uses(LayerAssembly...)
declarations.
assembly
- Application assemblyAssemblyException
- on invalid assembly