com.sdm.quasar.client.core.dialog.impl
Class DefaultFeatureManager

java.lang.Object
  extended bycom.sdm.quasar.client.core.dialog.impl.DefaultFeatureManager
All Implemented Interfaces:
Disposable, FeatureManager, SystemInfoProvider

public class DefaultFeatureManager
extends java.lang.Object
implements FeatureManager, SystemInfoProvider, Disposable

A default implementation of FeatureManager.

Version:
1.$Revision$
Author:
Thomas Wolf

Constructor Summary
DefaultFeatureManager(DialogControl dialogControl)
          Creates a new DefaultFeatureManager.
 
Method Summary
 void collectSystemInfo(SystemInfoNode root, SystemInfoOptions options)
          Builds the system information tree upon local information of the implementor.
 void dispose()
          Disposes the component.
 Feature getFeature(java.lang.Class keyClass)
          Returns the Feature associated with the given key class.
 boolean hasFeature(java.lang.Class keyClass)
          Returns true, if a Feature is registered under the given key class.
 Feature installFeature(java.lang.Class featureClass)
          Installs an instance of the specified feature class.
 Feature installFeature(java.lang.Class keyClass, java.lang.Class featureClass)
          Installs an instance of the specified feature class under the given key class.
 Feature installFeature(java.lang.Class keyClass, Feature feature)
          Installs the specified feature under the given key class.
 Feature installFeature(Feature feature)
          Installs the specified feature.
 Feature requireFeature(java.lang.Class featureClass)
          Returns the feature associated with the given key class; if no such feature was registered before, a new instance of the given class will created and installed as Feature for it's concrete class as feature key class.
 Feature uninstallFeature(Feature feature)
          Uninstalls the specified feature instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFeatureManager

public DefaultFeatureManager(DialogControl dialogControl)
Creates a new DefaultFeatureManager.

Method Detail

installFeature

public Feature installFeature(Feature feature)
Description copied from interface: FeatureManager
Installs the specified feature. The Feature cannote be accessed by a key class, so therefore FeatureManager.installFeature(Class, Feature) should be called.

Specified by:
installFeature in interface FeatureManager
Parameters:
feature - the feature instance to be installed
Returns:
the installed Feature instance (the same than the parameter)
See Also:
FeatureManager.installFeature(Feature)

installFeature

public Feature installFeature(java.lang.Class keyClass,
                              Feature feature)
Description copied from interface: FeatureManager
Installs the specified feature under the given key class. The given feature must be of the same class or a subclass or subinterface of the key class.

Note: There must no feature installed with the given key class before, otherwise an assertion will be thrown.

Specified by:
installFeature in interface FeatureManager
Parameters:
keyClass - the key class to refer to the feature
feature - the feature instance to be installed
Returns:
the installed Feature instance (the same than the parameter)
See Also:
FeatureManager.installFeature(java.lang.Class, Feature)

uninstallFeature

public Feature uninstallFeature(Feature feature)
Description copied from interface: FeatureManager
Uninstalls the specified feature instance. Only the exact feature instance will be uninstalled.

Specified by:
uninstallFeature in interface FeatureManager
Parameters:
feature - the feature instance to be uninstalled
Returns:
the uninstalled Feature instance
See Also:
FeatureManager.uninstallFeature(Feature)

hasFeature

public boolean hasFeature(java.lang.Class keyClass)
Description copied from interface: FeatureManager
Returns true, if a Feature is registered under the given key class.

Specified by:
hasFeature in interface FeatureManager
Parameters:
keyClass - the key class to check containment for
See Also:
FeatureManager.hasFeature(java.lang.Class)

getFeature

public Feature getFeature(java.lang.Class keyClass)
Description copied from interface: FeatureManager
Returns the Feature associated with the given key class.

Specified by:
getFeature in interface FeatureManager
Parameters:
keyClass - the key class to get a Feature for
Returns:
the Feature instance
See Also:
FeatureManager.getFeature(java.lang.Class)

installFeature

public Feature installFeature(java.lang.Class keyClass,
                              java.lang.Class featureClass)
Description copied from interface: FeatureManager
Installs an instance of the specified feature class under the given key class. The FeatureManager tries to create the feature instance using the registered FeatureCreator's. It is assumed, that the most specific FeatureCreator is added last. The given feature class must be a subclass of the key class given.

Note: There must no feature installed with the given key class before, otherwise an assertion will be thrown.

Specified by:
installFeature in interface FeatureManager
Parameters:
keyClass - the key class to refer to the feature (if null, the feature instance will be installed, but no mapping will be made)
featureClass - the feature class to install an instance of
Returns:
the installed Feature instance
See Also:
FeatureManager.installFeature(java.lang.Class, java.lang.Class)

installFeature

public Feature installFeature(java.lang.Class featureClass)
Description copied from interface: FeatureManager
Installs an instance of the specified feature class. This feature instance if mapped to no key class. To install a feature under a key class use FeatureManager.installFeature(Class, Class). The FeatureManager tries to create the feature instance using the registered FeatureCreator's. It is assumed, that the most specific FeatureCreator is added last.

Specified by:
installFeature in interface FeatureManager
Parameters:
featureClass - the feature class to install an instance of
Returns:
the installed Feature instance
See Also:
FeatureManager.installFeature(java.lang.Class)

requireFeature

public Feature requireFeature(java.lang.Class featureClass)
Description copied from interface: FeatureManager
Returns the feature associated with the given key class; if no such feature was registered before, a new instance of the given class will created and installed as Feature for it's concrete class as feature key class.

Specified by:
requireFeature in interface FeatureManager
Parameters:
featureClass - the key and concrete feature class
Returns:
the Feature associated with the given key class.
See Also:
FeatureManager.requireFeature(java.lang.Class)

dispose

public void dispose()
             throws DisposeException
Description copied from interface: Disposable
Disposes the component.

Important:
This method is called by an administrating component and must never be called directly.

The implementation should release any resources or objects allocated and any services registered. Furthermore, this method should be developed carefully to free a maximum of resources even when the system may have become unstable. In case of one or multiple errors, you should collect them in a DisposeException, continue with the execution, and throw it at the end of the method.

Note: The implementation must not return before the component is disposed. Any threads or asynchronous calls started must be completed before this method returns.

Specified by:
dispose in interface Disposable
Throws:
DisposeException - if there was one or more errors while disposing the component.
See Also:
Disposable.dispose()

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)