com.novell.emframe.dev.config
Class GeneralConfig

java.lang.Object
  extended bycom.novell.emframe.dev.config.GeneralConfig
Direct Known Subclasses:
SystemConfig

public class GeneralConfig
extends java.lang.Object

The GeneralConfig class is used to read and write module or task settings for all users. The settings are written to the file system under the WEB-INF/config directory based upon the sModuleID and sTaskID strings used to create the GeneralConfig object. Each unique sModuleID and sTaskID combination are given a separate file in the file system to avoid setting collisions. No security is inforced on these setting files, meaning that the settings written by a particular module or task are available to the iManager system and all other modules or tasks if they know the sModuleID and sTaskID combination used.


Constructor Summary
GeneralConfig(java.lang.String sModuleID, java.lang.String sTaskID)
          Construct a GeneralConfig object based on the sModuleID and sTaskID passed in.
 
Method Summary
 void addSettingValue(java.lang.String sName, java.lang.String sValue)
          Add a String value to the end of the String array of values for a setting.
 java.lang.Object getObjectSetting(java.lang.String sName)
          Get a setting's first value as a serialized Object.
 java.lang.Object[] getObjectSettings(java.lang.String sName)
          Get all of a setting's values as a serialized Object array.
 java.lang.String getSetting(java.lang.String sName)
          Get a setting's first value as a String.
 java.lang.String getSetting(java.lang.String sName, java.lang.String sDefaultValue)
          Get a setting's first value as a String.
 java.lang.String[] getSettingNames()
          Get a String array of all setting names available for this sModuleID and sTaskID.
 java.lang.String[] getSettings(java.lang.String sName)
          Get all of a setting's values as a String array.
 void removeSetting(java.lang.String sName)
          Removes all setting values from a setting.
 void removeSettingValue(java.lang.String sName, java.lang.String sValue)
          Remove a String value from the String array of values for a setting.
 void setObjectSetting(java.lang.String sName, java.lang.Object oValue)
          Set a setting to be a serialized Object value.
 void setObjectSetting(java.lang.String sName, java.lang.Object[] oaValues)
          Set a setting to be a serialized Object array of values.
 void setSetting(java.lang.String sName, java.lang.String sValue)
          Set a setting to be a single String value.
 void setSetting(java.lang.String sName, java.lang.String[] saValues)
          Set a setting to be a String array of values.
 void writeSettings()
          Writes settings to file system storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneralConfig

public GeneralConfig(java.lang.String sModuleID,
                     java.lang.String sTaskID)
Construct a GeneralConfig object based on the sModuleID and sTaskID passed in. A GeneralConfig object holds all settings with the same sModuleID and sTaskID combination. You must have either an sModuleID or an sTaskID, or you may have both. You may not have null for both.

Parameters:
sModuleID - Configuration Module ID or null
sTaskID - Configuration Task ID or null
Method Detail

addSettingValue

public void addSettingValue(java.lang.String sName,
                            java.lang.String sValue)
                     throws ConfigException
Add a String value to the end of the String array of values for a setting. All current values are preserved. You must call writeSettings after calling this call to have the settings written to persistent storage.

Parameters:
sName - Name of the setting
sValue - Value to add to the current values already present
Throws:
ConfigException - If the current logged in user is unable to perform the operation
See Also:
removeSettingValue(java.lang.String, java.lang.String), writeSettings()

getObjectSetting

public java.lang.Object getObjectSetting(java.lang.String sName)
Get a setting's first value as a serialized Object. If there are multiple values, only the first value is returned.

Parameters:
sName - Name of the setting
Returns:
Object if found, null if none found
See Also:
setObjectSetting(java.lang.String, java.lang.Object)

getObjectSettings

public java.lang.Object[] getObjectSettings(java.lang.String sName)
Get all of a setting's values as a serialized Object array.

Parameters:
sName - Name of the setting
Returns:
Object array if found, null if none found
See Also:
setObjectSetting(java.lang.String, java.lang.Object)

getSetting

public java.lang.String getSetting(java.lang.String sName)
Get a setting's first value as a String. If there are multiple values, only the first value is returned.

Parameters:
sName - Name of the setting
Returns:
Value of the setting, null if none found
See Also:
setSetting(java.lang.String, java.lang.String)

getSetting

public java.lang.String getSetting(java.lang.String sName,
                                   java.lang.String sDefaultValue)
Get a setting's first value as a String. If there are multiple values, only the first value is returned. If no value is found, sDefaultValue is returned instead.

Parameters:
sName - Name of the setting
sDefaultValue - Value to be returned of no value is found
Returns:
String value of the setting, sDefaultValue is returned if no value found
See Also:
setSetting(java.lang.String, java.lang.String)

getSettingNames

public java.lang.String[] getSettingNames()
Get a String array of all setting names available for this sModuleID and sTaskID.

Returns:
String array of the setting names

getSettings

public java.lang.String[] getSettings(java.lang.String sName)
Get all of a setting's values as a String array.

Parameters:
sName - Name of the setting
Returns:
String array of values of the setting, null if none found
See Also:
setSetting(java.lang.String, java.lang.String)

removeSetting

public void removeSetting(java.lang.String sName)
                   throws ConfigException
Removes all setting values from a setting. You must call writeSettings after calling this call to have the settings written to persistent storage.

Parameters:
sName - Name of setting
Throws:
ConfigException - If the current logged in user is unable to perform the operation
See Also:
writeSettings()

removeSettingValue

public void removeSettingValue(java.lang.String sName,
                               java.lang.String sValue)
                        throws ConfigException
Remove a String value from the String array of values for a setting. All other current values are preserved. You must call writeSettings after calling this call to have the settings written to persistent storage.

Parameters:
sName - Name of the setting
sValue - Value to be removed
Throws:
ConfigException - If the current logged in user is unable to perform the operation
See Also:
addSettingValue(java.lang.String, java.lang.String), writeSettings()

setObjectSetting

public void setObjectSetting(java.lang.String sName,
                             java.lang.Object oValue)
                      throws ConfigException
Set a setting to be a serialized Object value. All previous values are overwritten. You must call writeSettings after calling this call to have the settings written to persistent storage.

Parameters:
sName - Name of the setting
oValue - Value to set, all other values will be overwritten
Throws:
ConfigException - If the current logged in user is unable to perform the operation
See Also:
getObjectSetting(java.lang.String), writeSettings()

setObjectSetting

public void setObjectSetting(java.lang.String sName,
                             java.lang.Object[] oaValues)
                      throws ConfigException
Set a setting to be a serialized Object array of values. All previous values are overwritten. You must call writeSettings after calling this call to have the settings written to persistent storage.

Parameters:
sName - Name of the setting
oaValues - Values to be set, all other values will be overwritten
Throws:
ConfigException - If the current logged in user is unable to perform the operation
See Also:
getObjectSettings(java.lang.String), writeSettings()

setSetting

public void setSetting(java.lang.String sName,
                       java.lang.String sValue)
                throws ConfigException
Set a setting to be a single String value. All previous values are overwritten. You must call writeSettings after calling this call to have the settings written to persistent storage.

Parameters:
sName - Name of the setting
sValue - Value to set, all other values will be overwritten
Throws:
ConfigException - If the current logged in user is unable to perform the operation
See Also:
getSetting(java.lang.String), writeSettings()

setSetting

public void setSetting(java.lang.String sName,
                       java.lang.String[] saValues)
                throws ConfigException
Set a setting to be a String array of values. All previous values are overwritten. You must call writeSettings after calling this call to have the settings written to persistent storage.

Parameters:
sName - Name of the setting
saValues - Values to be set, all other values will be overwritten
Throws:
ConfigException - If the current logged in user is unable to perform the operation
See Also:
getSettings(java.lang.String), writeSettings()

writeSettings

public void writeSettings()
                   throws ConfigException
Writes settings to file system storage. You must call writeSettings after calling any of the set or remove calls to have the settings written to persistent storage.

Throws:
ConfigException - If the current logged in user is unable to perform the operation


API Documentation Copyright © 1998-2004 Novell, Inc. All rights reserved.
NDS is a registered trademark of Novell, Inc. in the United States and other countries.
Generated September 2 2004 0111.