com.filenet.api.util
Class ConfigurationParameters

java.lang.Object
  extended by com.filenet.api.util.ConfigurationParameters
All Implemented Interfaces:
java.io.Serializable

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

Represents a group of parameters that define the behavior of the client API. This class is a map of ConfigurationParameter keys to Object values. Instances are initially empty; they are not pre-populated with default values.

See Also:
Serialized Form

Constructor Summary
ConfigurationParameters()
          Constructs an empty map of configuration parameters.
ConfigurationParameters(ConfigurationParameters parameters)
          Constructs a map of configuration parameters to Object values.
 
Method Summary
 java.lang.Object getParameter(ConfigurationParameter parameter)
          Retrieves a configured value.
 void loadMap(java.util.Map map)
          Parses a map of key/value pairs into valid ConfigurationParameter keys and Object values.
 java.lang.Object setParameter(ConfigurationParameter parameter, java.lang.Object value)
          Sets a configuration parameter.
 void setParameters(ConfigurationParameters parameters)
          Sets the connection parameters specified in the parameters argument.
 java.lang.String toString()
          Returns a string representation of this instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfigurationParameters

public ConfigurationParameters()
Constructs an empty map of configuration parameters.


ConfigurationParameters

public ConfigurationParameters(ConfigurationParameters parameters)
Constructs a map of configuration parameters to Object values. The parameters are populated with the values specified in the input collection.

Parameters:
parameters - A collection of ConfigurationParameter objects. Cannot be null.
Method Detail

getParameter

public java.lang.Object getParameter(ConfigurationParameter parameter)
Retrieves a configured value.

A returned value of null indicates that no value has been explicitly configured for the requested parameter and an appropriate default value for the parameter in question is used instead.

Parameters:
parameter - The parameter for which the value is to be retrieved. See ConfigurationParameter.
Returns:
The Object associated with the requested parameter value. If no value has been configured for the requested parameter, this method returns null.

setParameter

public java.lang.Object setParameter(ConfigurationParameter parameter,
                                     java.lang.Object value)
Sets a configuration parameter. If the value of the value argument is null, this method removes the value. Defaults are used for removed values.

Parameters:
parameter - The configuration parameter value to set.
value - The value of the parameter to set, or null.
Returns:
The previous value, if any.
Throws:
EngineRuntimeException - if the type or value of the object are invalid.
See Also:
ExceptionCode.API_INVALID_CONFIGURATION_PARAMETER

setParameters

public void setParameters(ConfigurationParameters parameters)
Sets the connection parameters specified in the parameters argument. Other connection parameters are unchanged. This is equivalent to calling setParameter(parameter, value) for each parameter with a non-null value in the parameters argument.

Parameters:
parameters - A ConnectionParameters collection.
Throws:
EngineRuntimeException - if one or more parameters are invalid.
See Also:
ExceptionCode.API_INVALID_CONFIGURATION_PARAMETER

loadMap

public void loadMap(java.util.Map map)
Parses a map of key/value pairs into valid ConfigurationParameter keys and Object values. The resulting configuration values are used to populate this ConfigurationParameters class.

The standard java.util.Properties class implements the Map interface. A common usage of this method is to load a properties file into a Properties object and call this method to parse the properties into valid configuration parameters.

Each key must be a ConfigurationParameter or a String. The key is used as-is if it is already a ConfigurationParameter; otherwise, the String is parsed for a valid ConfigurationParameter string value.

All string comparisons and lookups are case-insensitive.

If a String key does not start with "FileNet.", the key/value pair is logged at the debug level but otherwise skipped and ignored. The entire key is then used to look up the corresponding ConfigurationParameter constant; an exception is thrown if it is not found.

The value for a valid key is then parsed. If the value is already of the required type, it is used as-is; otherwise, it is transformed into one of the required types. The type of transformation depends on the parameter and type of value. An exception is thrown if the transformation fails. An exception is also thrown if the given or transformed valued is invalid for the parameter.

Parameters:
map - A Java Map object containing configuration key/value pairs. Cannot be null

toString

public java.lang.String toString()
Returns a string representation of this instance.

Overrides:
toString in class java.lang.Object
Returns:
A String representing the instance.


© Copyright IBM Corporation 2006, 2008. All rights reserved.