|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BaseConfiguration
This interface provides the basic methods used by all configuration sub-classes. It provides a number of getter/setter methods for parameters as well as methods for change notification. Every instance of BaseConfiguration also has a pointer to the MetamergeConfig object that created it. When changes are made, the MetamergeConfig object is also notified by calling the setModified() method. Other objects are notified only if they have registered for change notification.
Inheritance from other objects is only configured when the setupInheritanceChain() method is called. The latter method retrieves the inherit from attribute which names the object from which this object inherits values. It is also possible to call the setInheritsFrom() method to setup a temporary (non persistent) object for inheritance.
When inherited data is returned it should be cloned so that the object from which we inherit is not tampered with. Configuration objects that return inherited data (such as AttributeMapConfig) typically returns an orphaned object. The class that returns such an orphaned object typically register itself as a listener for change event. When a change event occurs, the orphaned object is added to the local store for the object.
One example of such behavior is the AttributeMapConfig. It will return an orphaned AttributeMapItem object and register itself for change notification. When a change occurs in the AttributeMapItem object, the AttributeMapConfig call its own setAttribute() method to add the object to the local attribute map items list (and unregisters for notifications of course).
Field Summary | |
---|---|
static char |
CHILD_PATH_SEPARATOR
Separator between path components |
static int |
DISABLE_EXTPROPS
Flag to disable expansion of external properties (getParameter) |
static int |
DISABLE_INHERITANCE
Flag to disable inherited access (getParameter) |
static java.lang.String |
INHERIT_NONE
Explicitly disregards inheritance |
static java.lang.String |
INHERIT_PARENT
Inherit from parent |
static int |
ONE_LEVEL
Return keys of this object |
static int |
RECURSIVE
Flag that determines if getKeys() should recurse to inherited object |
static int |
RECURSIVE_ONELEVEL
Convenience for RECURSIVE + ONE_LEVEL |
static int |
RECURSIVE_SUBTREE
Convenience for RECURSIVE + SUBTREE |
static int |
SEARCH_EXACTCASE
Search option. |
static int |
SEARCH_ONELEVEL
Search option. |
static int |
SEARCH_PARAMNAME
Search option. |
static int |
SEARCH_PARAMNAME_RE
Search option. |
static int |
SEARCH_PROPERTY
Search option. |
static int |
SEARCH_REGEX
Search option. |
static int |
SEARCH_SUBSTRING
Search option. |
static int |
SUBTREE
Return child entries's keys of this object |
Method Summary | |
---|---|
void |
addListener(MetamergeConfigChangeListener listener)
Registers an object to be notified of change events in this object. |
boolean |
detachFromParent()
This method removes this objects from its parent container. |
boolean |
flatten(java.util.List<java.lang.String> excludedNS)
flatten - combines all values from this object and its inherited objects into one single config object. |
void |
fromEntry(java.lang.Object entry)
This method populates this object's internal data with the data from a Entry object. |
boolean |
getBooleanParameter(java.lang.Object name,
boolean defval)
Converts value from getParameter call to a boolean |
BaseConfiguration |
getChild(java.lang.Object name)
|
BaseConfiguration |
getChildForPath(java.lang.String path)
This method traverses the child hierarchy (from the top) and returns the configuration object associated with the path. |
java.util.List<java.lang.String> |
getChildNames()
Returns a list of names for all child configuration object |
java.lang.Object |
getClone()
|
java.util.TreeMap |
getData()
Returns a TreeMap with key/value pairs for all local parameters. |
java.util.Iterator<java.lang.String> |
getDataIterator()
Returns an Iterator for the keys in the data 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 the BaseConfiguration object. |
boolean |
getEnabled()
Gets the enabled attribute of the BaseConfiguration 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. |
java.lang.String |
getInheritsFromRef()
Gets the name of the object this object should inherit its values. |
int |
getIntegerParameter(java.lang.Object name,
int defval)
Converts value from getParameter call to an int |
java.util.List<java.lang.String> |
getKeys(int level)
Gets the keys attribute of the BaseConfiguration object |
boolean |
getLogEnabled()
Gets the log enabled attribute of the BaseConfiguration object. |
MetamergeConfig |
getMetamergeConfig()
Gets the MetamergeConfig object to which this object belongs. |
boolean |
getModified()
Modified state |
long |
getModTS()
Returns the last time this BaseConfiguration was changed. |
javax.naming.Name |
getName()
The object's full name |
java.lang.Object |
getNamespace()
Gets the namespace attribute of the BaseConfiguration object |
java.lang.String |
getNullBehavior()
Gets the nullBehavior attribute of the BaseConfiguration object. |
java.lang.String |
getNullBehaviorValue()
Gets the nullBehaviorValue attribute of the BaseConfiguration object. |
java.lang.String |
getNullDefinition()
Gets the nullDefinition attribute of the BaseConfiguration object. |
java.lang.String |
getNullDefinitionValue()
Gets the nullDefinitionValue attribute of the BaseConfiguration object. |
java.lang.Object |
getParameter(java.lang.Object name)
Returns the value for a given config item. |
java.lang.Object |
getParameter(java.lang.Object name,
java.lang.Object createValue)
Gets the parameter attribute of the BaseConfiguration object. |
java.lang.Object |
getParameter(java.lang.Object name,
java.lang.Object createValue,
java.util.List<java.lang.String> cref)
Returns the value for a given config item. |
java.lang.String |
getParameterPropertySource(java.lang.Object name)
Returns the user property name for a parameter. |
java.lang.Object |
getParameterRaw(java.lang.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. |
java.lang.String |
getPath()
Returns the complete path to this object. |
java.util.List<java.lang.String> |
getReferences(java.util.List<java.lang.String> list)
|
java.lang.String |
getScript()
Gets the script attribute of the BaseConfiguration object. |
java.lang.String |
getScriptEngine()
Gets the ScriptEngine attribute of the BaseConfiguration object. |
java.lang.String |
getShortName()
Gets the shortName attribute of the BaseConfiguration object. |
java.lang.String |
getStringParameter(java.lang.Object name)
Converts value from getParameter call to a string |
java.util.Map<java.lang.String,java.lang.Object> |
getSubstitutionMap()
|
boolean |
getUseListeners()
Deprecated. use the MetamergeConfigFactory.getUseConfigListeners() method
instead |
java.lang.String |
getUserComment()
|
boolean |
hasParameter(java.lang.Object name)
Returns true if parameter name is local to this object. |
void |
init()
Called to initialize to object. |
boolean |
isExpression(java.lang.Object parameter)
|
boolean |
isParameterLocal(java.lang.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. |
boolean |
isProtectedParameter(java.lang.String name)
Returns true if this is a parameter that needs to be protected (a password) |
java.lang.String |
nameForChild(BaseConfiguration config)
Returns the name for a configuration object |
void |
notifyChange(MetamergeConfigChange event)
Signal a change event to listeners. |
void |
notifyChange(java.lang.Object source,
java.lang.Object key,
int operation)
Notifies listeners for a change event. |
void |
notifyChange(java.lang.Object source,
java.lang.Object key,
int operation,
java.lang.Object userObject)
Notifies listeners 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(java.lang.Object name)
Removes a local parameter from this object. |
java.util.List<javax.naming.Binding> |
search(java.lang.String text,
int options,
int sizelimit)
Searches a configuration object and optionally its children for a specific key or value. |
java.util.List<javax.naming.Binding> |
search(java.lang.String text,
int options,
int sizelimit,
java.util.List<javax.naming.Binding> results)
Searches a configuration object and optionally its children for a specific key or value. |
void |
setBooleanParameter(java.lang.Object name,
boolean value)
Calls setParameter converting value to a Boolean object. |
void |
setChild(java.lang.Object name,
BaseConfiguration config)
Associates a configuration object with a name in this configuration |
void |
setData(java.util.TreeMap data)
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 the BaseConfiguration object. |
void |
setEnabled(boolean enabled)
Sets the enabled attribute of the BaseConfiguration object. |
void |
setFlags(int flags)
Controls how the getParameter behaves in terms of inheritance and external properties. |
void |
setInheritsFrom(BaseConfiguration inherit)
Sets the object from which this object inherits data. |
void |
setInheritsFromRef(java.lang.String ref)
Sets the name of the object from which this object should inherit its values. |
void |
setIntegerParameter(java.lang.Object name,
int value)
Calls setParameter converting value to an Integer object. |
void |
setLogEnabled(boolean enabled)
Sets the log enabled attribute of the BaseConfiguration 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 |
setModTS(long time)
Sets the last time this BaseConfiguration was changed For internal use. |
void |
setName(javax.naming.Name name)
Sets the name attribute of the BaseConfiguration object |
void |
setName(java.lang.String name)
Sets the name attribute of the BaseConfiguration object |
void |
setNullBehavior(java.lang.String nb)
Sets the nullBehavior attribute of the BaseConfiguration object. |
void |
setNullBehaviorValue(java.lang.String nbv)
Sets the nullBehaviorValue attribute of the BaseConfiguration object. |
void |
setNullDefinition(java.lang.String nb)
Sets the nullDefinition attribute of the BaseConfiguration object. |
void |
setNullDefinitionValue(java.lang.String nbv)
Sets the nullDefinitionValue attribute of the BaseConfiguration object. |
void |
setParameter(java.lang.Object name,
java.lang.Object value)
Sets the value for a given config item |
void |
setParameter(java.lang.Object name,
java.lang.Object value,
boolean notify)
Sets the value for a given config item, optionally notifying the change. |
void |
setParameterPropertySource(java.lang.Object name,
java.lang.String propertySource)
Sets the user property name to use for an attribute. |
void |
setParent(BaseConfiguration parent)
Sets the parent object to which this object belongs. |
void |
setProtectedParameter(java.lang.Object name,
java.lang.Object value)
Stores the parameter value in the default password store if one is configured. |
void |
setProtectedParameter(java.lang.String name)
Marks a parameter as needing protection (a password) |
void |
setScript(java.lang.String script)
Sets the script attribute of the BaseConfiguration object. |
void |
setScriptEngine(java.lang.String engine)
Sets the ScriptEngine attribute of the BaseConfiguration object. |
void |
setStringParameter(java.lang.Object name,
java.lang.String value)
Calls setParameter. |
void |
setSubstitutionMap(java.util.Map<java.lang.String,java.lang.Object> map)
Sets the substitution map for this configuration object. |
void |
setupInheritanceChain()
Called to initialize the inheritance chain for this object. |
void |
setUseListeners(boolean value)
Deprecated. use the MetamergeConfigFactory.setUseConfigListeners(boolean)
method instead |
void |
setUserComment(java.lang.String comment)
Sets the user defined comment string. |
int |
size()
Number of key/value pairs. |
java.lang.Object |
toEntry()
This method returns a Entry object constructed from the internal
data structure. |
void |
updateInheritsFrom(java.lang.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 |
willFlatten(java.util.List<java.lang.String> excludedNS)
|
Field Detail |
---|
static final java.lang.String INHERIT_NONE
static final java.lang.String INHERIT_PARENT
static final int ONE_LEVEL
static final int SUBTREE
static final int RECURSIVE
static final int RECURSIVE_SUBTREE
static final int RECURSIVE_ONELEVEL
static final int DISABLE_INHERITANCE
static final int DISABLE_EXTPROPS
static final char CHILD_PATH_SEPARATOR
static final int SEARCH_ONELEVEL
static final int SEARCH_EXACTCASE
static final int SEARCH_REGEX
static final int SEARCH_PARAMNAME
static final int SEARCH_PROPERTY
static final int SEARCH_SUBSTRING
static final int SEARCH_PARAMNAME_RE
Method Detail |
---|
javax.naming.Name getName()
java.lang.String getShortName()
void setName(javax.naming.Name name)
name
- The new name valuevoid setName(java.lang.String name) throws java.lang.Exception
name
- The new name value
java.lang.Exception
- if the operation does not succeedjava.lang.Object getNamespace()
boolean getModified()
void setModified(boolean modified)
modified
- The new modified valuevoid setFlags(int flags)
flags
- new value for the flagsint getFlags()
java.lang.Object getParameterRaw(java.lang.Object name)
name
- The parameter name
java.lang.Object getParameter(java.lang.Object name)
name
- The parameter name
java.lang.Object getParameter(java.lang.Object name, java.lang.Object createValue)
name
- The parameter namecreateValue
- The value added to this object in case the parameter does not
exist
java.lang.Object getParameter(java.lang.Object name, java.lang.Object createValue, java.util.List<java.lang.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.
name
- 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
java.lang.String getStringParameter(java.lang.Object name)
name
- The parameter name
boolean getBooleanParameter(java.lang.Object name, boolean defval)
name
- The parameter namedefval
- The default value if parameter does not exist
int getIntegerParameter(java.lang.Object name, int defval)
name
- The parameter namedefval
- The default value if parameter does not exist
void setParameter(java.lang.Object name, java.lang.Object value)
name
- Parameter namevalue
- Parameter valuevoid setProtectedParameter(java.lang.Object name, java.lang.Object value) throws java.lang.Exception
name
- Parameter namevalue
- Parameter value
java.lang.Exception
- if error occurs while setting property to the property store
chosen by TDIProperties object associated with this configvoid setBooleanParameter(java.lang.Object name, boolean value)
name
- Parameter namevalue
- Parameter valuevoid setIntegerParameter(java.lang.Object name, int value)
name
- Parameter namevalue
- Parameter valuevoid setStringParameter(java.lang.Object name, java.lang.String value)
name
- Parameter namevalue
- Parameter valuevoid setParameter(java.lang.Object name, java.lang.Object value, boolean notify)
true
, the behavior is identical to
setParameter( name, value ).
name
- Parameter namevalue
- Parameter valuenotify
- If true
, notify of the change.void removeParameter(java.lang.Object name)
name
- Parameter nameboolean hasParameter(java.lang.Object name)
true
if parameter name is local to this object.
name
- Parameter name
true
if name is local.boolean isParameterLocal(java.lang.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.
name
- Parameter name
true
if name is local; otherwise
false
.java.lang.String getParameterPropertySource(java.lang.Object name)
name
- Parameter name
void setParameterPropertySource(java.lang.Object name, java.lang.String propertySource)
name
- Parameter namepropertySource
- User property nameint size()
java.util.TreeMap getData()
void setData(java.util.TreeMap data)
Note: The TreeMap data is not cloned.
data
- The new data value.void init() throws java.lang.Exception
java.lang.Exception
- if the initialization fails.java.util.Iterator<java.lang.String> getDataIterator()
java.util.List<java.lang.String> getKeys(int level)
level
- The level of keys returned.
@Deprecated boolean getUseListeners()
MetamergeConfigFactory.getUseConfigListeners()
method
instead
true
if event listeners are used; otherwise
false
.@Deprecated void setUseListeners(boolean value)
MetamergeConfigFactory.setUseConfigListeners(boolean)
method instead
value
- true
indicates using event listeners;
false
- not usingvoid addListener(MetamergeConfigChangeListener listener)
listener
- The listener object to notify.void removeListener(MetamergeConfigChangeListener listener)
listener
- The listener object to remove.void notifyChange(java.lang.Object source, java.lang.Object key, int operation)
Note: This method is typically called by setParameter method but not from user code.
source
- The caller initiating the change eventkey
- The key that changedoperation
- The operation performed on keyvoid notifyChange(java.lang.Object source, java.lang.Object key, int operation, java.lang.Object userObject)
Note: This method is typically called by setParameter method but not from user code.
source
- The caller initiating the change eventkey
- The key that changedoperation
- The operation performed on keyuserObject
- Arbitrary object provided by callerjava.lang.Object toEntry() throws java.lang.Exception
Entry
object constructed from the internal
data structure.
java.lang.Exception
- Any exception thrown by the implementing class.void fromEntry(java.lang.Object entry) throws java.lang.Exception
Entry
object.
entry
- The entry containing data.
java.lang.Exception
- Any exception thrown by the implementing class.void setParent(BaseConfiguration parent)
parent
- The new parent valueBaseConfiguration getParent()
void setMetamergeConfig(MetamergeConfig mc)
mc
- The new metamergeConfig objectMetamergeConfig getMetamergeConfig()
void setupInheritanceChain() throws java.lang.Exception
java.lang.Exception
- if the operation does not succeedBaseConfiguration getInheritsFrom()
java.lang.String getInheritsFromRef()
void setInheritsFromRef(java.lang.String ref)
ref
- The new inheritsFromRef valuevoid updateInheritsFrom(java.lang.String ref) throws java.lang.Exception
ref
- The new inheritsFromRef value
java.lang.Exception
- if the operation does not succeedvoid setInheritsFrom(BaseConfiguration inherit)
Note: Call this method to setup a temporary (non persistent) object for inheritance.
inherit
- The new inheritsFrom value.boolean getDebug()
boolean getDebug(boolean defval)
defval
- The value to be returned, if the debug parameter cannot be
found
void setDebug(boolean debug)
debug
- The new debug valueboolean getDebugBreak(boolean defval)
defval
- The value to be returned, if the debugBreak parameter cannot
be found
void setDebugBreak(boolean debug)
debug
- The new debugBreak valuejava.lang.String getScript()
void setScript(java.lang.String script)
script
- The new script valuejava.lang.String getScriptEngine()
void setScriptEngine(java.lang.String engine)
engine
- The new ScriptEngine valuejava.lang.String getNullBehavior()
java.lang.String getNullBehaviorValue()
void setNullBehavior(java.lang.String nb)
nb
- The new nullBehavior valuevoid setNullBehaviorValue(java.lang.String nbv)
nbv
- The new nullBehaviorValue valuejava.lang.String getNullDefinition()
java.lang.String getNullDefinitionValue()
void setNullDefinition(java.lang.String nb)
nb
- The new nullBehavior valuevoid setNullDefinitionValue(java.lang.String nbv)
nbv
- The new nullBehaviorValue valueboolean getEnabled()
void setEnabled(boolean enabled)
enabled
- true
for enabling; false
otherwise.java.lang.Object getClone() throws java.lang.Exception
java.lang.Exception
boolean getLogEnabled()
void setLogEnabled(boolean enabled)
enabled
- true
for enabled log; false
otherwise.void setUserComment(java.lang.String comment)
comment
- new value for user commentjava.lang.String getUserComment()
java.util.Map<java.lang.String,java.lang.Object> getSubstitutionMap()
void setSubstitutionMap(java.util.Map<java.lang.String,java.lang.Object> map)
map
- the new value for the substitution mapboolean willFlatten(java.util.List<java.lang.String> excludedNS)
excludedNS
- List of namespaces to exclude from flattening
true
if this object will attempt flattening given
the provided excluded namespaces.boolean flatten(java.util.List<java.lang.String> excludedNS) throws java.lang.Exception
excludedNS
- List of namespaces to exclude from flattening
false
if this object did not flatten because of
inheritance from excludedNS; true
otherwise.
java.lang.Exception
java.util.List<java.lang.String> getReferences(java.util.List<java.lang.String> list)
list
- If non-null, the object must use the provided list rather than
creating its own
java.util.List<javax.naming.Binding> search(java.lang.String text, int options, int sizelimit)
text
- 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.java.util.List<javax.naming.Binding> search(java.lang.String text, int options, int sizelimit, java.util.List<javax.naming.Binding> results)
text
- 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.BaseConfiguration getChild(java.lang.Object name)
name
- The name of the configuration object
void setChild(java.lang.Object name, BaseConfiguration config)
name
- The nameconfig
- The configuration objectjava.lang.String nameForChild(BaseConfiguration config)
config
- The configuration object
java.util.List<java.lang.String> getChildNames()
java.lang.String getPath()
BaseConfiguration getChildForPath(java.lang.String path) throws javax.naming.NameNotFoundException
path
- The complete path to an object (as returned by getPath())
javax.naming.NameNotFoundException
- if the child could not be found.boolean detachFromParent()
true
if this object was removed;
false
if it could not be removed.boolean reattachToParent(int position)
position
-
true
if this object was reattached;
false
if not;boolean isExpression(java.lang.Object parameter)
parameter
- name of the parameter
true
if the parameter is an expression.void notifyChange(MetamergeConfigChange event)
event
- The event describing the changelong getModTS()
void setModTS(long time)
void setProtectedParameter(java.lang.String name)
boolean isProtectedParameter(java.lang.String name)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |