Class ConfigurationParameters
- java.lang.Object
-
- 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 ofConfigurationParameter
keys toObject
values. Instances are initially empty; they are not pre-populated with default values.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ConfigurationParameters()
Constructs an empty map of configuration parameters.ConfigurationParameters(ConfigurationParameters parameters)
Constructs a map of configuration parameters toObject
values.
-
Method Summary
Methods Modifier and Type Method and Description java.lang.Object
getParameter(ConfigurationParameter parameter)
Retrieves a configured value.void
loadMap(java.util.Map map)
Parses a map of key/value pairs into validConfigurationParameter
keys andObject
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 theparameters
argument.java.lang.String
toString()
Returns a string representation of this instance.
-
-
-
Constructor Detail
-
ConfigurationParameters
public ConfigurationParameters()
Constructs an empty map of configuration parameters.
-
ConfigurationParameters
public ConfigurationParameters(ConfigurationParameters parameters)
Constructs a map of configuration parameters toObject
values. The parameters are populated with the values specified in the input collection.- Parameters:
parameters
- A collection ofConfigurationParameter
objects. Cannot benull
.
-
-
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. SeeConfigurationParameter
.- Returns:
- The
Object
associated with the requested parameter value. If no value has been configured for the requested parameter, this method returnsnull
.
-
setParameter
public java.lang.Object setParameter(ConfigurationParameter parameter, java.lang.Object value)
Sets a configuration parameter. If the value of thevalue
argument isnull
, 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, ornull
.- 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 theparameters
argument. Other connection parameters are unchanged. This is equivalent to callingsetParameter(parameter, value)
for each parameter with a non-null
value in theparameters
argument.- Parameters:
parameters
- AConnectionParameters
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 validConfigurationParameter
keys andObject
values. The resulting configuration values are used to populate thisConfigurationParameters
class.The standard
java.util.Properties
class implements theMap
interface. A common usage of this method is to load a properties file into aProperties
object and call this method to parse the properties into valid configuration parameters.Each key must be a
ConfigurationParameter
or aString
. The key is used as-is if it is already aConfigurationParameter
; otherwise, theString
is parsed for a validConfigurationParameter
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 correspondingConfigurationParameter
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 JavaMap
object containing configuration key/value pairs. Cannot benull
-
toString
public java.lang.String toString()
Returns a string representation of this instance.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A
String
representing the instance.
-
-