com.sdm.quasar.client.core.common.config
Class ValueConfigurationDescriptor

java.lang.Object
  extended bycom.sdm.quasar.client.core.common.config.ValueConfigurationDescriptor
All Implemented Interfaces:
ConfigurationDescriptor, Disposable

public class ValueConfigurationDescriptor
extends java.lang.Object
implements ConfigurationDescriptor

Version:
1.$Revision$
Author:
Thomas Wolf

Constructor Summary
ValueConfigurationDescriptor(java.lang.Class configurationKeyClass, java.lang.Object configurationValue)
          Creates a new ValueConfigurationDescriptor.
ValueConfigurationDescriptor(java.lang.String configurationKey, java.lang.Object configurationValue)
          Creates a new ValueConfigurationDescriptor.
 
Method Summary
 void dispose()
          Disposes the component.
 java.lang.String getKey()
          Returns the key for the configuration entry.
 java.lang.Object getValue()
          Returns the configuration value.
 boolean isLoaded()
          Returns true, iff this ConfigurationDescriptor is loaded; this means, loadConfiguration(ConfigProvider) was called before and the value can be accessed.
 void loadConfiguration(ConfigProvider configProvider)
          Loads the configuration, which means, that getValue() might be called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueConfigurationDescriptor

public ValueConfigurationDescriptor(java.lang.String configurationKey,
                                    java.lang.Object configurationValue)
Creates a new ValueConfigurationDescriptor.

Parameters:
configurationKey - the key of the ValueConfigurationDescriptor (not null)
configurationValue - the value of this ValueConfigurationDescriptor (not null)

ValueConfigurationDescriptor

public ValueConfigurationDescriptor(java.lang.Class configurationKeyClass,
                                    java.lang.Object configurationValue)
Creates a new ValueConfigurationDescriptor.

Parameters:
configurationKeyClass - the key class of the ValueConfigurationDescriptor (not null, must implement Configuration)
configurationValue - the value of this ValueConfigurationDescriptor (not null, must implement the given key class)
Method Detail

getKey

public java.lang.String getKey()
Description copied from interface: ConfigurationDescriptor
Returns the key for the configuration entry.

Specified by:
getKey in interface ConfigurationDescriptor
See Also:
ConfigurationDescriptor.getKey()

getValue

public java.lang.Object getValue()
Description copied from interface: ConfigurationDescriptor
Returns the configuration value. The caller must ensure, that this method will only be called, if the ConfigurationDescriptor is loaded.

Specified by:
getValue in interface ConfigurationDescriptor
See Also:
ConfigurationDescriptor.getValue()

isLoaded

public boolean isLoaded()
Description copied from interface: ConfigurationDescriptor
Returns true, iff this ConfigurationDescriptor is loaded; this means, ConfigurationDescriptor.loadConfiguration(ConfigProvider) was called before and the value can be accessed.

Specified by:
isLoaded in interface ConfigurationDescriptor
See Also:
ConfigurationDescriptor.isLoaded()

loadConfiguration

public void loadConfiguration(ConfigProvider configProvider)
Description copied from interface: ConfigurationDescriptor
Loads the configuration, which means, that ConfigurationDescriptor.getValue() might be called. The call occures only once, until Disposable.dispose() is called.

Specified by:
loadConfiguration in interface ConfigurationDescriptor
Parameters:
configProvider - the ConfigProvider, that may be used to access other values.
See Also:
ConfigurationDescriptor.loadConfiguration(com.sdm.quasar.client.core.common.config.ConfigProvider)

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()