com.novell.emframe.dev.config
Class UserConfig

java.lang.Object
  extended bycom.novell.emframe.dev.config.UserConfig

public class UserConfig
extends java.lang.Object

The UserConfig class is used to read and write module or task settings for a specific user. These settings would overwrite the GeneralConfig settings for the same sModuleID or sTaskID. The settings are written to a respository specific to the user logged in based upon the sModuleID and sTaskID strings used to create the UserConfig object. Only the user who wrote the settings are able to read the settings back in. However, the settings written by a particular module or task are available to all other modules or tasks if they know the sModuleID and sTaskID combination used for the same logged in user.


Constructor Summary
UserConfig(java.lang.String sModuleID, java.lang.String sTaskID, PluginContext ctx)
          This method will create a UserConfig object for the user logged into the current session based upon the sModuleID and sTaskID parameters.
 
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.
static UserConfig getUserConfig(java.lang.String sModuleID, java.lang.String sTaskID, PluginContext ctx)
          This method will get either a previously created UserConfig object from the session or create a new one for the user currently logged in based upon the sModuleID and sTaskID parameters.
 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 persistent storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserConfig

public UserConfig(java.lang.String sModuleID,
                  java.lang.String sTaskID,
                  PluginContext ctx)
This method will create a UserConfig object for the user logged into the current session based upon the sModuleID and sTaskID parameters. A UserConfig 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:
ctx - Context of the task to determine the currently logged in user
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)

getUserConfig

public static UserConfig getUserConfig(java.lang.String sModuleID,
                                       java.lang.String sTaskID,
                                       PluginContext ctx)
This method will get either a previously created UserConfig object from the session or create a new one for the user currently logged in based upon the sModuleID and sTaskID parameters. A UserConfig 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:
ctx - Context of the task to determine the currently logged in user
sModuleID - Configuration Module ID or null
sTaskID - Configuration Task ID or null
Returns:
UserConfig A UserConfig object based upon the sModuleID and sTaskID for the currently logged in user

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 persistent 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.