com.sdm.quasar.client.core.application
Class AbstractApplication

java.lang.Object
  extended bycom.sdm.quasar.client.core.application.AbstractApplication
All Implemented Interfaces:
Application, SystemInfoProvider
Direct Known Subclasses:
AbstractJSFApplication, AbstractSwingApplication

public abstract class AbstractApplication
extends java.lang.Object
implements Application, SystemInfoProvider

Abstract implementation for the Application interface. This is a common implementation shared by all more specific client-architecture developments.

A derived class should overwrite the methods Application.start() and Application.stop(). The implementation of this class may be used to allow a simple initialization of the application.

Version:
1.0
Author:
Carsten Lucke, sd&m AG, Bernd Olleck, sd&m AG

Constructor Summary
AbstractApplication(ID applicationId)
          Constructor.
 
Method Summary
 void collectSystemInfo(SystemInfoNode root, SystemInfoOptions options)
          Builds the system information tree upon local information of the implementor.
protected  DisposeException extendDestructionException(DisposeException destructionException, java.lang.String message, java.lang.Throwable cause)
          Helper method used during stop().
protected  ApplicationConfiguration getApplicationConfiguration()
          Returns the ApplicationConfiguration instance used to configure this application instance.
 ID getApplicationID()
          Returns the application ID.
 ConfigManager getConfigManager()
          Returns the ConfigManager of the application scope.
 ServiceManager getServiceManager()
          Returns the object that implements the ServiceManager interface.
 SessionManager getSessionManager()
          Returns the SessionManager of the application scope.
protected  void initializeErrorHandler()
          Initializes the error handling.
 void start()
          This implementation initializes the additional application components in the following order: ErrorHandler by using initializeErrorHandler() LoggerFactory by using #initializeLogging()
 void stop()
          This implementation disposed the application components in the following order if the corresponding component implements Disposable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractApplication

public AbstractApplication(ID applicationId)
Constructor.

Parameters:
applicationId - the id of the application
Method Detail

getApplicationConfiguration

protected ApplicationConfiguration getApplicationConfiguration()
Returns the ApplicationConfiguration instance used to configure this application instance.


getApplicationID

public ID getApplicationID()
Description copied from interface: Application
Returns the application ID. The application ID is used to identify the application as a target for communication purposes.

Specified by:
getApplicationID in interface Application
Returns:
the application id.

getConfigManager

public ConfigManager getConfigManager()
Description copied from interface: Application
Returns the ConfigManager of the application scope.

Specified by:
getConfigManager in interface Application
Returns:
the config manager

getServiceManager

public ServiceManager getServiceManager()
Description copied from interface: Application
Returns the object that implements the ServiceManager interface.

Specified by:
getServiceManager in interface Application
Returns:
the service manager

getSessionManager

public SessionManager getSessionManager()
Description copied from interface: Application
Returns the SessionManager of the application scope.

Specified by:
getSessionManager in interface Application
Returns:
the session manager

start

public void start()
This implementation initializes the additional application components in the following order:
  1. ErrorHandler by using initializeErrorHandler()
  2. LoggerFactory by using #initializeLogging()

Specified by:
start in interface Application

stop

public void stop()
          throws DisposeException
This implementation disposed the application components in the following order if the corresponding component implements Disposable. Otherwise the component is skipped.

Specified by:
stop in interface Application
Throws:
DisposeException - if there is an exception while disposing the components
See Also:
for further information

extendDestructionException

protected DisposeException extendDestructionException(DisposeException destructionException,
                                                      java.lang.String message,
                                                      java.lang.Throwable cause)
Helper method used during stop(). Extends a destruction exception that includes the given message and cause. If there is already a destruction exception present, message and cause will be added to it and it will be returned. If there is no destruction exception, one will be created with the default message and the given message and cause will be added.

Parameters:
destructionException - the possibly existing destruction exception, may be null
message - the message to be added, may be null
cause - the cause to be added, may be null
Returns:
the new or the modified destruction exception

initializeErrorHandler

protected void initializeErrorHandler()
Initializes the error handling. This implementation registers a default ErrorHandlerAdapter with the ErrorHandler that calls Application.stop() to stop the application. The ErrorHandlerAdapter registered in this implementation does not attempt to restrict the error to a single dialog or session.

Depending on the client enviromnent you need to override this error handler to do something more useful.


collectSystemInfo

public void collectSystemInfo(SystemInfoNode root,
                              SystemInfoOptions options)
Description copied from interface: SystemInfoProvider
Builds the system information tree upon local information of the implementor. The system information tree can be used within development by inspecting the system; so implementors should append their internal state (depending on the details settings within SystemInfoOptions). The information can be appended to the tree by adding new child SystemInformationNodes to the root node given using the SystemInfoNode.createChild(String) method and by setting information attributes the these nodes or the given root node.

Specified by:
collectSystemInfo in interface SystemInfoProvider
Parameters:
root - the SystemInfoNode to add information to (guaranteed to be not null)
options - contains additional options, that might influence the amount of information added to the tree (guaranteed to be not null)
See Also:
SystemInfoProvider.collectSystemInfo(com.sdm.quasar.client.core.common.sysinfo.SystemInfoNode, com.sdm.quasar.client.core.common.sysinfo.SystemInfoOptions)