* @throws ActivationException if the activation failed
*/
public Application newApplication()
throws AssemblyException, ActivationException
{
Energy4Java qi4j = new Energy4Java();
ApplicationDescriptor model = qi4j.newApplicationModel( new ApplicationAssembler()
{
@Override
public ApplicationAssembly assemble( ApplicationAssemblyFactory factory )
throws AssemblyException
{
ApplicationAssembly assembly = factory.newApplicationAssembly();
assembly.setName( applicationName );
HashMap<String, LayerAssembly> createdLayers = new HashMap<>();
for( Map.Entry<String, LayerDeclaration> entry : layers.entrySet() )
{
LayerAssembly layer = entry.getValue().createLayer( assembly );
createdLayers.put( entry.getKey(), layer );
}
for( LayerDeclaration layer : layers.values() )
{
layer.initialize( createdLayers );
}
return assembly;
}
} );
Application application = model.newInstance( qi4j.api() );
for( ActivationEventListener activationListener : activationListeners )
{
application.registerActivationEventListener( activationListener );
}
beforeActivation();