|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AppModule
The interface of the an application module. Several application modules build an application where each application module is responsible for a distinct functionality of the application.
This interface defines the methods which are called during the initialization, startup and shutdown of an application.
Each application module implementation that shall be part of an application
must be registered with the RootApp
by calling the
RootApp.registerAppModule(AppModule)
method on it.
The methods are called in the following order:
registerConfiguration(RootApp)
preStartup(RootApp)
startup(RootApp)
shutdown(RootApp)
postShutdown(RootApp)
preStartup(...)
is called, the
registerConfiguration(...)
has been called on all registered
application modules. This is true for all methods, that is, the first method
is called on all the registered application modules, then the second method
is called on all registered application modules, and so on.
The order of registered application modules is defined by the order of which
the registerAppModules(...)
is called on the
RootApp
is called. The shutdown methods are called in reverse
order though.
RootApp
Method Summary | |
---|---|
java.lang.String |
getId()
Returns the unique id of this application module. |
void |
postShutdown(RootApp rootApp)
Called after all application modules were shutdown. |
void |
preStartup(RootApp rootApp)
This callback is invoked before the real startup. |
void |
registerConfiguration(RootApp rootApp)
Gives the application module a change to register its configuration with the root application. |
void |
shutdown(RootApp rootApp)
This callback indicates that this application module shall shutdown. |
void |
startup(RootApp rootApp)
This callback indicates that this application module can now start. |
Method Detail |
---|
java.lang.String getId()
void registerConfiguration(RootApp rootApp) throws java.lang.Exception
The method RootApp.registerConfiguration(Configuration)
must be
called on the RootApp
class to do this. If the AppModule wants to
contribute any command line options, it can use the
RootApp.registerConfiguration(Configuration, CommandlineMapper)
instead.
The configuration that is being registered through the methods mentioned
above, is automatically loaded by the root application, so do not call
Configuration.load()
here.
rootApp
- The root application. This is the instance where the
register
methods can be invoked.
java.lang.Exception
- An application module can throw an exception if anything goes
wrong during the configuration initialization.RootApp
,
Configuration
void preStartup(RootApp rootApp) throws java.lang.Exception
rootApp
- A reference to the root application
java.lang.Exception
- Indicates that something went wrong during the application
module pre-startup.void startup(RootApp rootApp) throws java.lang.Exception
In practice this means that after this method returns, the application module should be up and running. In the case of a GUI application module this probably means that the GUI is being displayed on the screen and is ready for user inputs.
rootApp
- A reference to the root application
java.lang.Exception
- Indicates that something went wrong during the application
module startup.void shutdown(RootApp rootApp) throws java.lang.Exception
rootApp
- A reference to the root application
java.lang.Exception
- Indicates that something went wrong during the application
shutdown.void postShutdown(RootApp rootApp) throws java.lang.Exception
rootApp
- A reference to the root application
java.lang.Exception
- Indicates that something went wrong during the application
shutdown.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |