|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.ibm.di.config.base.BaseConfigurationImpl
public class BaseConfigurationImpl
This class provides the basic methods for all the configuration classes.
| Field Summary | |
|---|---|
static String |
NAME
Name used for notify events. |
| Fields inherited from interface com.ibm.di.config.interfaces.BaseConfiguration |
|---|
CHILD_PATH_SEPARATOR, DISABLE_EXTPROPS, DISABLE_INHERITANCE, INHERIT_NONE, INHERIT_PARENT, ONE_LEVEL, RECURSIVE, RECURSIVE_ONELEVEL, RECURSIVE_SUBTREE, SEARCH_EXACTCASE, SEARCH_ONELEVEL, SEARCH_PARAMNAME, SEARCH_PARAMNAME_RE, SEARCH_PROPERTY, SEARCH_REGEX, SEARCH_SUBSTRING, SUBTREE |
| Constructor Summary | |
|---|---|
BaseConfigurationImpl()
Empty constructor |
|
BaseConfigurationImpl(Object data)
Constructor providing a TreeMap of attribute/value pairs |
|
| Method Summary | |
|---|---|
void |
addListener(MetamergeConfigChangeListener listener)
Registers an object to be notified of change events in this object. |
void |
configurationChanged(MetamergeConfigChange mcc)
|
TreeMap |
deepClone(TreeMap inputMap)
Clones the local data structure. |
boolean |
detachFromParent()
This method removes this objects from its parent container. |
Object |
expandPropertyValue(Object name,
Object value)
Substitutes the parameter value with a user property value. |
Object |
expandPropertyValue(Object name,
Object value,
List<String> cref)
Substitutes the parameter value with a user property value. |
boolean |
flatten(List<String> excludedNS)
This method combines all values from this object and its inherited objects into one single config object. |
void |
fromEntry(Object entry)
This method populates this object's internal data with the data from a Entry object. |
boolean |
getBooleanParameter(Object key,
boolean defval)
Converts value from getParameter call to a boolean |
BaseConfiguration |
getChild(Object name)
|
BaseConfiguration |
getChildForPath(String path)
This method traverses the child hierarchy (from the top) and returns the configuration object associated with the path. |
List<String> |
getChildNames()
Returns a list of names for all child configuration object |
Object |
getClone()
|
TreeMap |
getData()
Returns a TreeMap with key/value pairs for all local parameters. |
Iterator<String> |
getDataIterator()
Returns an Iterator for all keys in this object. |
boolean |
getDebug()
Returns the debug flag for the object. |
boolean |
getDebug(boolean defval)
Returns the debug flag for the object. |
boolean |
getDebugBreak(boolean defval)
Gets the debugBreak attribute of this object. |
boolean |
getEnabled()
Gets the enabled attribute of this object. |
int |
getFlags()
Returns the flags which determines how the getParameter behaves in terms of inheritance and external properties. |
BaseConfiguration |
getInheritsFrom()
Returns the object from which this object inherits data. |
String |
getInheritsFromRef()
Gets the name of the object this object should inherit its values. |
int |
getIntegerParameter(Object key,
int defval)
Converts value from getParameter call to an int |
List<String> |
getKeys(int level)
Returns a list of keys in this object. |
boolean |
getLogEnabled()
Gets the log enabled attribute of this object. |
String |
getLongName()
|
MetamergeConfig |
getMetamergeConfig()
Gets the MetamergeConfig object to which this object belongs. |
boolean |
getModified()
Returns the modified state of this object. |
Name |
getName()
The object's full name |
Object |
getNamespace()
Gets the namespace attribute of the BaseConfiguration object |
String |
getNullBehavior()
Gets the nullBehavior attribute of this object. |
String |
getNullBehaviorValue()
Gets the nullBehaviorValue attribute of this object. |
String |
getNullDefinition()
Gets the nullDefinition attribute of the BaseConfiguration object |
String |
getNullDefinitionValue()
Gets the nullDefinitionValue attribute of the BaseConfiguration object |
Object |
getParameter(Object name)
Returns the value for a given config item. |
Object |
getParameter(Object name,
Object createValue)
Gets the parameter attribute of this config object. |
Object |
getParameter(Object name,
Object createValue,
List<String> cref)
Returns the value for a given config item. |
String |
getParameterPropertySource(Object name)
Returns the user property name for a parameter. |
String |
getParameterPropertySourceFromValue(Object value)
|
Object |
getParameterRaw(Object name)
Returns the value for a given config item without expanding the property value. |
BaseConfiguration |
getParent()
Returns the parent object to which this object belongs. |
String |
getParentName()
|
String |
getPath()
This method returns the path to this object. |
List<String> |
getReferences(List<String> list)
|
static ResourceHash |
getResHash()
|
String |
getScript()
Gets the script attribute of this object. |
String |
getScriptEngine()
Gets the ScriptEngine attribute of this object. |
String |
getShortName()
Gets the shortName attribute of the BaseConfiguration object. |
String |
getStringParameter(Object name)
Converts value from getParameter call to a string |
Map<String,Object> |
getSubstitutionMap()
|
static boolean |
getUseConfigListeners()
|
boolean |
getUseListeners()
Deprecated. |
String |
getUserComment()
|
boolean |
hasParameter(Object name)
Returns true if parameter name is local to this object. |
void |
init()
Called after internal data structure is set. |
boolean |
isExpression(Object parameter)
|
boolean |
isParameterLocal(Object name)
Returns true if the parameter is local and
false if the parameter does not exist either in this
object or in any inherited object. |
String |
nameForChild(BaseConfiguration config)
Returns the name for a configuration object |
void |
notifyChange(MetamergeConfigChange event)
Signal a change event to listeners. |
void |
notifyChange(Object source,
Object key,
int operation)
Notifies listeners for a change event. |
void |
notifyChange(Object source,
Object key,
int operation,
Object userObject)
Notifies listeners for a change event. |
protected void |
performNotifyChange(MetamergeConfigChange mcc)
Notifies all registered listeners for a specified config for a change event. |
boolean |
reattachToParent(int position)
This method reattaches this object to its former parent. |
void |
removeListener(MetamergeConfigChangeListener listener)
Removes a listener from the notification list. |
void |
removeParameter(Object name)
Removes a local parameter from this object. |
List<Binding> |
search(String text,
int options,
int sizelimit)
Searches a configuration object and optionally its children for a specific key or value. |
List<Binding> |
search(String text,
int options,
int sizelimit,
List<Binding> results)
Searches a configuration object and optionally its children for a specific key or value. |
void |
setBooleanParameter(Object name,
boolean value)
Calls setParameter converting value to a Boolean object. |
void |
setChild(Object name,
BaseConfiguration config)
Associates a configuration object with a name in this configuration |
void |
setData(TreeMap obj)
Sets the data to be used by this object. |
void |
setDebug(boolean debug)
Sets the debug flag for the object. |
void |
setDebugBreak(boolean debug)
Sets the debugBreak attribute of this object. |
void |
setEnabled(boolean autoStart)
Sets the enabled attribute of this object. |
void |
setFlags(int flags)
Sets flags. |
void |
setInheritsFrom(BaseConfiguration inherit)
Sets the object from which this object inherits data. |
void |
setInheritsFromRef(String ref)
Sets the name of the object from which this object should inherit its values. |
void |
setIntegerParameter(Object name,
int value)
Calls setParameter converting value to an Integer object. |
void |
setLogEnabled(boolean enabled)
Sets the log enabled attribute of this object. |
void |
setMetamergeConfig(MetamergeConfig mc)
Sets the MetamergeConfig object to which this object belongs. |
void |
setModified(boolean modified)
Sets the modified attribute of the BaseConfiguration object |
void |
setName(Name name)
Sets the name of this object. |
void |
setName(String name)
Sets the name attribute of this object. |
void |
setNullBehavior(String nb)
Sets the nullBehavior attribute of this object. |
void |
setNullBehaviorValue(String nbv)
Sets the nullBehaviorValue attribute of this object. |
void |
setNullDefinition(String nb)
Sets the nullDefinition attribute of the BaseConfiguration object |
void |
setNullDefinitionValue(String nbv)
Sets the nullDefinitionValue attribute of the BaseConfiguration object |
void |
setParameter(Object name,
Object value)
Sets the value for a given config item |
void |
setParameter(Object name,
Object value,
boolean notify)
Sets the value for a given config item, optionally notifying the change. |
void |
setParameterPropertySource(Object name,
String propertySource)
Associates a parameter name with a user property. |
void |
setParent(BaseConfiguration parent)
Sets the parent object. |
void |
setProtectedParameter(Object name,
Object value)
Stores the parameter value in the default password store if one is configured. |
void |
setScript(String script)
Sets the script attribute of this object. |
void |
setScriptEngine(String engine)
Sets the ScriptEngine attribute of this object. |
void |
setStringParameter(Object name,
String value)
Calls setParameter. |
void |
setSubstitutionMap(Map<String,Object> map)
Sets the substitution map for this configuration object |
void |
setupInheritanceChain()
Established the inheritance chain for this object. |
static void |
setUseConfigListeners(boolean value)
Enable/disable the use of configuration listeners in the JVM. |
void |
setUseListeners(boolean value)
Deprecated. |
void |
setUserComment(String comment)
Sets the user defined comment string. |
int |
size()
Number of key/value pairs. |
Object |
toEntry()
This method returns a Entry object constructed from the internal
data structure. |
String |
toString()
Answers a string containing the name of the config. |
void |
updateInheritsFrom(String ref)
Sets the name of the object from which this object should inherit its values and calls the setupInheritanceChain to activate the change. |
boolean |
willExpandProps()
|
boolean |
willFlatten(List<String> excludedNS)
|
boolean |
willUseInherited()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String NAME
| Constructor Detail |
|---|
public BaseConfigurationImpl()
public BaseConfigurationImpl(Object data)
data - TreeMap of attribute/value pairs| Method Detail |
|---|
public static ResourceHash getResHash()
public void setupInheritanceChain()
throws Exception
setupInheritanceChain in interface BaseConfigurationException - if the operation could not be performedpublic BaseConfiguration getInheritsFrom()
getInheritsFrom in interface BaseConfigurationpublic String getInheritsFromRef()
getInheritsFromRef in interface BaseConfigurationpublic void setInheritsFrom(BaseConfiguration inherit)
Note: Call this method to setup a temporary (non persistent) object for inheritance.
setInheritsFrom in interface BaseConfigurationinherit - The new inheritsFrom value.
public void updateInheritsFrom(String ref)
throws Exception
updateInheritsFrom in interface BaseConfigurationref - The new inheritsFromRef value
Exception - if the operation does not succeedpublic void setInheritsFromRef(String ref)
setInheritsFromRef in interface BaseConfigurationref - The new inheritsFromRef valuepublic boolean getModified()
getModified in interface BaseConfigurationpublic void setModified(boolean modified)
setModified in interface BaseConfigurationmodified - The new modified value@Deprecated public void setUseListeners(boolean value)
setUseListeners in interface BaseConfigurationvalue - true indicates using event listeners;
false - not using@Deprecated public boolean getUseListeners()
getUseListeners in interface BaseConfigurationtrue if event listeners are used; otherwise
false.public static void setUseConfigListeners(boolean value)
value - False to disable configuration listeners.public static boolean getUseConfigListeners()
setUseConfigListeners(boolean)public void addListener(MetamergeConfigChangeListener listener)
addListener in interface BaseConfigurationlistener - The listener object to notify.public void removeListener(MetamergeConfigChangeListener listener)
removeListener in interface BaseConfigurationlistener - The listener object to remove.public void configurationChanged(MetamergeConfigChange mcc)
configurationChanged in interface MetamergeConfigChangeListener
public void notifyChange(Object source,
Object key,
int operation)
Note: This method is typically called by setParameter method but not from user code.
notifyChange in interface BaseConfigurationsource - The caller initiating the change eventkey - The key that changedoperation - The operation performed on key
public void notifyChange(Object source,
Object key,
int operation,
Object userObject)
Note: This method is typically called by setParameter method but not from user code.
notifyChange in interface BaseConfigurationsource - The caller initiating the change eventkey - The key that changedoperation - The operation performed on keyuserObject - Arbitrary object provided by callerpublic void notifyChange(MetamergeConfigChange event)
notifyChange in interface BaseConfigurationevent - The event describing the changeprotected void performNotifyChange(MetamergeConfigChange mcc)
mcc - the config objectpublic int size()
BaseConfiguration
size in interface BaseConfigurationpublic Name getName()
BaseConfiguration
getName in interface BaseConfigurationpublic String getShortName()
getShortName in interface BaseConfigurationpublic String getLongName()
public Object getNamespace()
getNamespace in interface BaseConfigurationpublic void setName(Name name)
setName in interface BaseConfigurationname - The new name value
public void setName(String name)
throws Exception
setName in interface BaseConfigurationname - The new name value
Exception - if the operation does not succeedpublic TreeMap getData()
getData in interface BaseConfigurationpublic TreeMap deepClone(TreeMap inputMap)
inputMap - TreeMap object to be cloned
inputMap parameter.public void setData(TreeMap obj)
Note: The TreeMap data is not cloned.
setData in interface BaseConfigurationobj - The new data value.
public void init()
throws Exception
init in interface BaseConfigurationExceptionpublic Iterator<String> getDataIterator()
getDataIterator in interface BaseConfigurationpublic List<String> getKeys(int level)
getKeys in interface BaseConfigurationlevel - can have these values: public BaseConfiguration getParent()
getParent in interface BaseConfigurationpublic String getParentName()
public void setParent(BaseConfiguration parent)
setParent in interface BaseConfigurationparent - the new parentpublic void setFlags(int flags)
setFlags in interface BaseConfigurationflags - the new flags to setpublic int getFlags()
getFlags in interface BaseConfigurationpublic void removeParameter(Object name)
removeParameter in interface BaseConfigurationname - Parameter namepublic boolean isParameterLocal(Object name)
true if the parameter is local and
false if the parameter does not exist either in this
object or in any inherited object.
isParameterLocal in interface BaseConfigurationname - Parameter name
true if name is local; otherwise
false.public boolean hasParameter(Object name)
true if parameter name is local to this object.
hasParameter in interface BaseConfigurationname - Parameter name
true if name is local.public Object getParameterRaw(Object name)
getParameterRaw in interface BaseConfigurationname - The parameter name
public Object getParameter(Object name)
getParameter in interface BaseConfigurationname - The parameter name
public Object getParameter(Object name,
Object createValue)
createValue.
getParameter in interface BaseConfigurationname - The parameter namecreateValue - The value added to this object in case the parameter does not
exist
public Object getParameter(Object name,
Object createValue,
List<String> cref)
This method also conveys the List object to ParameterSubstitution calls to resolve circular references. If the parameter is not present even after calling inherited object's getParameter, a default value is assigned to the parameter using createValue.
getParameter in interface BaseConfigurationname - The parameter namecreateValue - The value added to this object in case the parameter does not
existcref - The circular references list of previously used config object
expressions
public String getStringParameter(Object name)
getStringParameter in interface BaseConfigurationname - The parameter name
public boolean getBooleanParameter(Object key,
boolean defval)
getBooleanParameter in interface BaseConfigurationkey - The parameter namedefval - The default value if parameter does not exist
public int getIntegerParameter(Object key,
int defval)
getIntegerParameter in interface BaseConfigurationkey - The parameter namedefval - The default value if parameter does not exist
public void setParameter(Object name,
Object value)
setParameter in interface BaseConfigurationname - Parameter namevalue - Parameter value
public void setParameter(Object name,
Object value,
boolean notify)
true, the behavior is identical to
setParameter( name, value ).
setParameter in interface BaseConfigurationname - Parameter namevalue - Parameter valuenotify - If true, notify of the change.
public void setProtectedParameter(Object name,
Object value)
throws Exception
setProtectedParameter in interface BaseConfigurationname - Parameter namevalue - Parameter value
Exception - if error occurs while setting property to the property store
chosen by TDIProperties object associated with this config
public void setBooleanParameter(Object name,
boolean value)
setBooleanParameter in interface BaseConfigurationname - Parameter namevalue - Parameter value
public void setIntegerParameter(Object name,
int value)
setIntegerParameter in interface BaseConfigurationname - Parameter namevalue - Parameter value
public void setStringParameter(Object name,
String value)
setStringParameter in interface BaseConfigurationname - Parameter namevalue - Parameter valuepublic String getParameterPropertySource(Object name)
BaseConfiguration
getParameterPropertySource in interface BaseConfigurationname - the parameter name
public String getParameterPropertySourceFromValue(Object value)
value - parameter value
public void setParameterPropertySource(Object name,
String propertySource)
setParameterPropertySource in interface BaseConfigurationname - parameter namepropertySource - parameter property source
public Object expandPropertyValue(Object name,
Object value)
name - parameter namevalue - parameter value
public Object expandPropertyValue(Object name,
Object value,
List<String> cref)
name - parameter namevalue - parameter valuecref - The circular references list of previously used config object
expressions
public Object toEntry()
throws Exception
Entry object constructed from the internal
data structure. Default implementation simply copies every attribute
to/from entry using String values.
toEntry in interface BaseConfigurationException
public void fromEntry(Object entry)
throws Exception
Entry object.
fromEntry in interface BaseConfigurationentry - The entry containing data.
Exceptionpublic String toString()
toString in class Objectpublic void setMetamergeConfig(MetamergeConfig mc)
setMetamergeConfig in interface BaseConfigurationmc - The new metamergeConfig objectpublic MetamergeConfig getMetamergeConfig()
getMetamergeConfig in interface BaseConfigurationpublic boolean getDebug()
getDebug in interface BaseConfigurationpublic boolean getDebug(boolean defval)
getDebug in interface BaseConfigurationdefval - The value to be returned, if the debug parameter cannot be
found
public void setDebug(boolean debug)
setDebug in interface BaseConfigurationdebug - The new debug valuepublic boolean getDebugBreak(boolean defval)
getDebugBreak in interface BaseConfigurationdefval - The value to be returned, if the debugBreak parameter cannot
be found
public void setDebugBreak(boolean debug)
setDebugBreak in interface BaseConfigurationdebug - The new debugBreak value.public String getScript()
getScript in interface BaseConfigurationpublic void setScript(String script)
setScript in interface BaseConfigurationscript - The new script valuepublic String getScriptEngine()
getScriptEngine in interface BaseConfigurationpublic void setScriptEngine(String engine)
setScriptEngine in interface BaseConfigurationengine - The new ScriptEngine valuepublic String getNullBehavior()
getNullBehavior in interface BaseConfigurationpublic String getNullBehaviorValue()
getNullBehaviorValue in interface BaseConfigurationpublic void setNullBehavior(String nb)
setNullBehavior in interface BaseConfigurationnb - The new nullBehavior valuepublic void setNullBehaviorValue(String nbv)
setNullBehaviorValue in interface BaseConfigurationnbv - The new nullBehaviorValue valuepublic String getNullDefinition()
getNullDefinition in interface BaseConfigurationpublic String getNullDefinitionValue()
getNullDefinitionValue in interface BaseConfigurationpublic void setNullDefinition(String nb)
setNullDefinition in interface BaseConfigurationnb - The new nullBehavior valuepublic void setNullDefinitionValue(String nbv)
setNullDefinitionValue in interface BaseConfigurationnbv - The new nullBehaviorValue valuepublic boolean getEnabled()
getEnabled in interface BaseConfigurationpublic void setEnabled(boolean autoStart)
setEnabled in interface BaseConfigurationautoStart - true for enabling; false otherwise.public boolean willExpandProps()
true if this object will expand the external
properties; false otherwise.public boolean willUseInherited()
true if this object will enable inherited access;
false otherwise.
public Object getClone()
throws Exception
getClone in interface BaseConfigurationExceptionpublic boolean getLogEnabled()
getLogEnabled in interface BaseConfigurationpublic void setLogEnabled(boolean enabled)
setLogEnabled in interface BaseConfigurationenabled - true for enabled log; false
otherwise.public void setUserComment(String comment)
setUserComment in interface BaseConfigurationcomment - new value for user commentpublic String getUserComment()
getUserComment in interface BaseConfigurationpublic Map<String,Object> getSubstitutionMap()
getSubstitutionMap in interface BaseConfigurationpublic void setSubstitutionMap(Map<String,Object> map)
setSubstitutionMap in interface BaseConfigurationmap - the new substitution map
public boolean flatten(List<String> excludedNS)
throws Exception
flatten in interface BaseConfigurationexcludedNS - List of namespaces to exclude from flattening
true if object attempted flattening, FALSE is this
object inherits from an excluded namespace or has no inheritance
Exceptionpublic boolean willFlatten(List<String> excludedNS)
willFlatten in interface BaseConfigurationexcludedNS - List of namespaces to exclude from flattening
true if this object will attempt flattening given
the provided excluded namespaces.public List<String> getReferences(List<String> list)
getReferences in interface BaseConfigurationlist - If non-null, the object must use the provided list rather than
creating its own
public List<Binding> search(String text,
int options,
int sizelimit)
search in interface BaseConfigurationtext - The search textoptions - Search options (oneLevel=1, exactCase=2, regExp=4,
paramName=8)sizelimit - Max number of hits returned
Binding objects containing results from the
performed search.
public List<Binding> search(String text,
int options,
int sizelimit,
List<Binding> results)
search in interface BaseConfigurationtext - The search textoptions - Search options (oneLevel=1, exactCase=2, regExp=4,
paramName=8)sizelimit - Max number of hits returnedresults - A list of results.
results parameter.public BaseConfiguration getChild(Object name)
getChild in interface BaseConfigurationname - The name of the configuration object
public void setChild(Object name,
BaseConfiguration config)
setChild in interface BaseConfigurationname - The nameconfig - The configuration objectpublic List<String> getChildNames()
getChildNames in interface BaseConfigurationpublic String nameForChild(BaseConfiguration config)
nameForChild in interface BaseConfigurationconfig - The configuration object
public BaseConfiguration getChildForPath(String path)
throws NameNotFoundException
getChildForPath in interface BaseConfigurationpath - The complete path to an object (as returned by getPath())
NameNotFoundException - if the child could not be found.public String getPath()
getPath in interface BaseConfigurationpublic boolean detachFromParent()
detachFromParent in interface BaseConfigurationtrue if this object was removed;
false if it could not be removed.public boolean reattachToParent(int position)
reattachToParent in interface BaseConfigurationtrue if this object was reattached;
false if not;public boolean isExpression(Object parameter)
isExpression in interface BaseConfigurationparameter - name of the parameter
true if the parameter is an expression.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||