org.olat.modules
Class ModuleConfiguration

java.lang.Object
  extended by org.olat.modules.ModuleConfiguration
All Implemented Interfaces:
java.io.Serializable

public class ModuleConfiguration
extends java.lang.Object
implements java.io.Serializable

Initial Date: Dec 8, 2003

Author:
gnaegi
See Also:
Serialized Form

Constructor Summary
ModuleConfiguration()
          Default constructor.
 
Method Summary
 java.lang.Object get(java.lang.String key)
          Get value by key.
 java.lang.Boolean getBooleanEntry(java.lang.String config_key)
          return a config value as a Boolean
 boolean getBooleanSafe(java.lang.String config_key)
           
 boolean getBooleanSafe(java.lang.String config_key, boolean defaultvalue)
           
 int getConfigurationVersion()
          Get the version of this module configuration.
 int getIntegerSafe(java.lang.String config_key, int defaultValue)
           
 java.lang.String getStringValue(java.lang.String config_key)
          Get a string value from the config.
 java.lang.String getStringValue(java.lang.String config_key, java.lang.String defaultValue)
          Get a string value from the config.
 void putAll(ModuleConfiguration theConfig)
          Copy all entrys from the given module configuration into this module configuration.
 java.lang.Object remove(java.lang.String key)
          Remove key/value.
 void set(java.lang.String key, java.lang.Object value)
          Set a key to a value.
 void setBooleanEntry(java.lang.String config_key, boolean value)
           
 void setConfigurationVersion(int version)
          Set the configuration version to a specific value
 void setIntValue(java.lang.String config_key, int value)
           
 void setStringValue(java.lang.String config_key, java.lang.String value)
          Set a string value to the config
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModuleConfiguration

public ModuleConfiguration()
Default constructor.

Method Detail

set

public void set(java.lang.String key,
                java.lang.Object value)
Set a key to a value. Important: Value must be serailizable.

Parameters:
key -
value -

get

public java.lang.Object get(java.lang.String key)
Get value by key.

Parameters:
key -
Returns:
value or null if no such key

remove

public java.lang.Object remove(java.lang.String key)
Remove key/value.

Parameters:
key -
Returns:
value of removed key

putAll

public void putAll(ModuleConfiguration theConfig)
Copy all entrys from the given module configuration into this module configuration.

Parameters:
theConfig -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getBooleanEntry

public java.lang.Boolean getBooleanEntry(java.lang.String config_key)
return a config value as a Boolean

Parameters:
config_key - the key
Returns:
null if no such key, or true if there is a entry under 'key' of type string with value "true", or false otherwise

getBooleanSafe

public boolean getBooleanSafe(java.lang.String config_key)
Parameters:
config_key -
Returns:
false if the key is "false" or does not exist, true otherwise

getBooleanSafe

public boolean getBooleanSafe(java.lang.String config_key,
                              boolean defaultvalue)

getIntegerSafe

public int getIntegerSafe(java.lang.String config_key,
                          int defaultValue)

setIntValue

public void setIntValue(java.lang.String config_key,
                        int value)

setStringValue

public void setStringValue(java.lang.String config_key,
                           java.lang.String value)
Set a string value to the config

Parameters:
config_key -
value -

getStringValue

public java.lang.String getStringValue(java.lang.String config_key)
Get a string value from the config. Returns false when the config key does not exist

Parameters:
config_key -
Returns:

getStringValue

public java.lang.String getStringValue(java.lang.String config_key,
                                       java.lang.String defaultValue)
Get a string value from the config. Returns the defaultValue when the config key does not exist

Parameters:
config_key -
defaultValue -
Returns:

setBooleanEntry

public void setBooleanEntry(java.lang.String config_key,
                            boolean value)
Parameters:
config_key -
value -

getConfigurationVersion

public int getConfigurationVersion()
Get the version of this module configuration. The version specifies which configuration attributes are available for this course node. If no version has been set so far version=1 will be returned

Returns:
integer representing the version

setConfigurationVersion

public void setConfigurationVersion(int version)
Set the configuration version to a specific value

Parameters:
version -