org.qi4j.bootstrap.layered

## Class LayeredApplicationAssembler

- java.lang.Object
- - org.qi4j.bootstrap.layered.LayeredApplicationAssembler

- All Implemented Interfaces:
    ApplicationAssembler

      public abstract class LayeredApplicationAssembler
      extends Object
      implements ApplicationAssembler

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Application` | `application`
    `protected String` | `name`
    `protected String` | `version`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LayeredApplicationAssembler(String name, String version, Application.Mode mode)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Application` | `application()`
    `ApplicationAssembly` | `assemble(ApplicationAssemblyFactory applicationFactory)`
    `protected abstract void` | `assembleLayers(ApplicationAssembly assembly)` Called from the constructor to assemble the layers in the applcation.
    `protected <T extends LayerAssembler> T` | `assemblerOf(Class<T> layerAssemblerClass)`
    `ApplicationAssembly` | `assembly()`
    `protected LayerAssembly` | `createLayer(Class<? extends LayerAssembler> layerAssemblerClass)`
    `protected void` | `instantiateApplication(Energy4Java qi4j, ApplicationDescriptor model)` This method is called from the constructor to instantiate the Zest application from the application model.
    `protected void` | `onModelCreated(ApplicationDescriptor model)` This method is called after the Application Model has been created, before the instantiation of the Zest application.
    `void` | `start()`
    `void` | `stop()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### application

          protected Application application

    - #### name

          protected String name

    - #### version

          protected String version

  - ### Constructor Detail

    - #### LayeredApplicationAssembler

          public LayeredApplicationAssembler(String name,
                                     String version,
                                     Application.Mode mode)
                                      throws AssemblyException

      Throws:
        `AssemblyException`

  - ### Method Detail

    - #### assembly

          public ApplicationAssembly assembly()

    - #### instantiateApplication

          protected void instantiateApplication(Energy4Java qi4j,
                                    ApplicationDescriptor model)

      This method is called from the constructor to instantiate the Zest application from the application model.

      The default implementation simply calls;

             application = model.newInstance( qi4j.spi() );

      Parameters:
        `qi4j` - The Zest runtime engine.
        `model` - The application model descriptor.

    - #### onModelCreated

          protected void onModelCreated(ApplicationDescriptor model)

      This method is called after the Application Model has been created, before the instantiation of the Zest application.

      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.

      Parameters:
        `model` -

    - #### application

          public Application application()

    - #### start

          public void start()
                     throws ActivationException

      Throws:
        `ActivationException`

    - #### stop

          public void stop()
                    throws PassivationException

      Throws:
        `PassivationException`

    - #### assemble

          public ApplicationAssembly assemble(ApplicationAssemblyFactory applicationFactory)
                                       throws AssemblyException

      Specified by:
        `assemble` in interface `ApplicationAssembler`
      Throws:
        `AssemblyException`

    - #### createLayer

          protected LayerAssembly createLayer(Class<? extends LayerAssembler> layerAssemblerClass)
                                       throws IllegalArgumentException

      Throws:
        `IllegalArgumentException`

    - #### assemblerOf

          protected <T extends LayerAssembler> T assemblerOf(Class<T> layerAssemblerClass)

    - #### assembleLayers

          protected abstract void assembleLayers(ApplicationAssembly assembly)
                                          throws AssemblyException

      Called from the constructor to assemble the layers in the applcation.

      This method must be implemented, and is typically a list of LayerAssmebler instantitations, followed by `LayerAssembly.uses(LayerAssembly...)` declarations.

      Throws:
        `AssemblyException`