com.ibm.di.config.xml
Class MetamergeConfigXML

java.lang.Object
  extended by com.ibm.di.config.base.BaseConfigurationImpl
      extended by com.ibm.di.config.base.MetamergeConfigImpl
          extended by com.ibm.di.config.xml.MetamergeConfigXML
All Implemented Interfaces:
BaseConfiguration, MetamergeConfig, MetamergeConfigChangeListener, MetamergeFolder, java.io.Serializable
Direct Known Subclasses:
MetamergeConfigFS

public class MetamergeConfigXML
extends MetamergeConfigImpl

MetamergeConfigXML is a class that provides support for TDI XML configuration files. It can create new configurations, load and store existing ones. This class provides access to the structure of a TDI configuration as well to its current status.

See Also:
Serialized Form

Nested Class Summary
static class MetamergeConfigXML.LazyConfig
           
 
Field Summary
static java.lang.String IDI_CREATED
           
static java.lang.String IDI_VERSION
           
static java.lang.String METAMERGE_CONFIG_TAG
           
static java.lang.String METAMERGE_CREATED_TAG
           
static java.lang.String METAMERGE_CREATEDBY_TAG
           
static java.lang.String METAMERGE_MODIFIED_TAG
           
static java.lang.String METAMERGE_MODIFIEDBY_TAG
           
static java.lang.String METAMERGE_VERSION_ID
           
static java.lang.String METAMERGE_VERSION_TAG
           
static java.lang.String SERVER_ENCRYPTED_SIGNATURE
           
 
Fields inherited from class com.ibm.di.config.base.MetamergeConfigImpl
classMap, DEFAULT_FOLDER_IMPL, DEFAULT_FOLDER_NAMES, env, externalPropertiesDelegator, logger
 
Fields inherited from class com.ibm.di.config.base.BaseConfigurationImpl
NAME
 
Fields inherited from interface com.ibm.di.config.interfaces.MetamergeConfig
ASSEMBLYLINE_FOLDER, ATTRIBUTEMAP_FOLDER, CONFIG_FOLDER, CONNECTOR_FOLDER, DEFAULT_ASSEMBLYLINE_FOLDER, DEFAULT_ATTRIBUTEMAP_FOLDER, DEFAULT_CONFIG_FOLDER, DEFAULT_CONNECTOR_FOLDER, DEFAULT_EXTPROP_FOLDER, DEFAULT_EXTPROP_NAME, DEFAULT_FORM_FOLDER, DEFAULT_FUNCTION_FOLDER, DEFAULT_LIBRARY_FOLDER, DEFAULT_LIBS_FOLDER, DEFAULT_LOGGER_FOLDER, DEFAULT_NAMESPACE_FOLDER, DEFAULT_PARSER_FOLDER, DEFAULT_PROPERTY_FOLDER, DEFAULT_PROPSTORE_FOLDER, DEFAULT_SCHEDULER_FOLDER, DEFAULT_SCRIPT_FOLDER, DEFAULT_SEQUENCE_FOLDER, DEFAULT_SERVER_AUTOSTART, DEFAULT_SERVER_FOLDER, DEFAULT_SERVER_INSTANCE_PROPERTIES, DEFAULT_SERVER_LOG, DEFAULT_SERVER_TOMBSTONES, DEFAULT_SOLUTION_INTERFACE, EXTPROP_FOLDER, FORM_FOLDER, FUNCTION_FOLDER, LIBRARY_FOLDER, LIBS_FOLDER, LOGGER_FOLDER, LOGGING_FOLDER, NAMESPACE_FOLDER, PARSER_FOLDER, PROPERTY_FOLDER, PROPSTORE_FOLDER, SCHEDULER_FOLDER, SCRIPT_FOLDER, SEQUENCE_FOLDER
 
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
MetamergeConfigXML()
           
MetamergeConfigXML(java.util.Hashtable<java.lang.String,java.lang.Object> env)
           
 
Method Summary
 void bind(java.lang.Object name, java.lang.Object obj)
          Adds a new object to the configuration at the location specified by name
 void commitChanges(java.lang.Object output, boolean isSave)
          Save XML tree to output stream.
 MetamergeFolder createFolder(java.lang.Object name)
          This method creates a folder
 void debug(java.lang.String msg)
           
 org.w3c.dom.Element findByName(org.w3c.dom.Element root, java.lang.Object name)
          This method traverses the document tree searching for an element with an attribute (name) equal to name.
 org.w3c.dom.Element findOneByName(org.w3c.dom.Element root, java.lang.String name)
          This method searches the children of an element for an element with an attribute (name) equal to name.
protected  ConfigCache getCache()
           
 java.lang.String getConfigVersion()
           
 java.lang.String getDirectory()
          Returns the directory this config is placed in.
 org.w3c.dom.Document getDocument()
          Returns the XML document object.
 boolean getModified()
          XML Doc needs to be saved if we have dirty objects in our cache or if there has been any successful bind/rebind/unbind calls.
 java.io.OutputStream getOutputStream(java.lang.Object out)
          Returns the output stream to which the XML document is written.
 org.w3c.dom.Element getRootElement()
          Returns the root element of the XML document.
 java.lang.String getShortName()
          Gets the shortName attribute of the BaseConfiguration object.
 void initializeConfig()
          Initializes the XML configuration, including the reading and parsing of the XML file.
protected  java.lang.Object internalLookup(java.lang.Object namex)
          Called by super's lookup
 boolean isCommittable()
          Returns true if the configuration driver implements the commitChanges method and the current value for PROVIDER_URL is writable.
 boolean isDebugMode()
           
 boolean isOldVersion()
           
 boolean isReadOnly()
          Returns true if this configuration cannot be modified.
 boolean isRemote()
           
 java.util.Enumeration<javax.naming.Binding> list()
          This method returns an enumeration with the names in the given folder.
 java.util.Enumeration<javax.naming.Binding> list(java.lang.Object name)
          Returns an enumeration of the immediate children of this node
 void logmsg(java.lang.String msg)
           
 BaseConfiguration newInstanceOf(java.lang.Object typeName)
          This method returns a new instance of the object type specified by typeName.
 void rebind(java.lang.Object name, java.lang.Object obj)
          Adds or replaces a new object to the configuration.
protected  void removeElement(java.lang.Object name)
           
 void rename(java.lang.Object name, java.lang.Object newname)
          Renames an object.
 void setNoBackupOfOldVersion()
          Sets a flag to prevent an old version of the file to be used as backup.
 void setOutput(java.lang.Object output)
          Changes the output to wich the configuration driver writes its configuration.
 void unbind(java.lang.Object name)
          Removes a named object from this configuration.
 
Methods inherited from class com.ibm.di.config.base.MetamergeConfigImpl
addDefaultFolders, addNameComponent, closeConfig, commitChanges, commitChangesNoEncryption, copy, getAssemblyLine, getAttributeMap, getConnector, getDefaultFolder, getDriverParameter, getDriverParameters, getExternalProperties, getExternalProperties, getFileConfig, getFunction, getNames, getNamespace, getParser, getPassword, getScript, getSequence, getSolutionInterface, getTDIProperties, getTreeMap, getVector, hasPassword, initializeClassMap, instantiateAllObjects, instantiateAllObjects, isModTSEnabled, lookup, lookupInFolder, newInstanceOf, newInstanceOf, setDriverParameter, setDriverParameters, setFileConfig, setModTSEnabled, shouldEncryptProtected, toString, useEncryption
 
Methods inherited from class com.ibm.di.config.base.BaseConfigurationImpl
addListener, configurationChanged, deepClone, detachFromParent, expandPropertyValue, expandPropertyValue, flatten, fromEntry, getBooleanParameter, getChild, getChildForPath, getChildNames, getClone, getData, getDataIterator, getDebug, getDebug, getDebugBreak, getEnabled, getFlags, getInheritsFrom, getInheritsFromRef, getIntegerParameter, getKeys, getLogEnabled, getLongName, getMetamergeConfig, getModTS, getName, getNamespace, getNullBehavior, getNullBehaviorValue, getNullDefinition, getNullDefinitionValue, getParameter, getParameter, getParameter, getParameterPropertySource, getParameterPropertySourceFromValue, getParameterRaw, getParent, getParentName, getPath, getReferences, getResHash, getScript, getScriptEngine, getStringParameter, getSubstitutionMap, getUseConfigListeners, getUseListeners, getUserComment, hasParameter, init, isExpression, isParameterLocal, isProtectedParameter, nameForChild, notifyChange, notifyChange, notifyChange, performNotifyChange, reattachToParent, removeListener, removeParameter, search, search, setBooleanParameter, setChild, setData, setDebug, setDebugBreak, setEnabled, setFlags, setInheritsFrom, setInheritsFromRef, setIntegerParameter, setLogEnabled, setMetamergeConfig, setModified, setModTS, setName, setName, setNullBehavior, setNullBehaviorValue, setNullDefinition, setNullDefinitionValue, setParameter, setParameter, setParameterPropertySource, setParent, setProtectedParameter, setProtectedParameter, setScript, setScriptEngine, setStringParameter, setSubstitutionMap, setupInheritanceChain, setUseConfigListeners, setUseListeners, setUserComment, size, toEntry, updateInheritsFrom, willExpandProps, willFlatten, willUseInherited
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.di.config.interfaces.BaseConfiguration
addListener, detachFromParent, flatten, fromEntry, getBooleanParameter, getChild, getChildForPath, getChildNames, getClone, getData, getDataIterator, getDebug, getDebug, getDebugBreak, getEnabled, getFlags, getInheritsFrom, getInheritsFromRef, getIntegerParameter, getKeys, getLogEnabled, getMetamergeConfig, getModTS, getName, getNamespace, getNullBehavior, getNullBehaviorValue, getNullDefinition, getNullDefinitionValue, getParameter, getParameter, getParameter, getParameterPropertySource, getParameterRaw, getParent, getPath, getReferences, getScript, getScriptEngine, getStringParameter, getSubstitutionMap, getUseListeners, getUserComment, hasParameter, init, isExpression, isParameterLocal, isProtectedParameter, nameForChild, notifyChange, notifyChange, notifyChange, reattachToParent, removeListener, removeParameter, search, search, setBooleanParameter, setChild, setData, setDebug, setDebugBreak, setEnabled, setFlags, setInheritsFrom, setInheritsFromRef, setIntegerParameter, setLogEnabled, setMetamergeConfig, setModified, setModTS, setName, setName, setNullBehavior, setNullBehaviorValue, setNullDefinition, setNullDefinitionValue, setParameter, setParameter, setParameterPropertySource, setParent, setProtectedParameter, setProtectedParameter, setScript, setScriptEngine, setStringParameter, setSubstitutionMap, setupInheritanceChain, setUseListeners, setUserComment, size, toEntry, updateInheritsFrom, willFlatten
 

Field Detail

SERVER_ENCRYPTED_SIGNATURE

public static final java.lang.String SERVER_ENCRYPTED_SIGNATURE
See Also:
Constant Field Values

METAMERGE_CONFIG_TAG

public static final java.lang.String METAMERGE_CONFIG_TAG
See Also:
Constant Field Values

METAMERGE_VERSION_TAG

public static final java.lang.String METAMERGE_VERSION_TAG
See Also:
Constant Field Values

METAMERGE_CREATED_TAG

public static final java.lang.String METAMERGE_CREATED_TAG
See Also:
Constant Field Values

METAMERGE_CREATEDBY_TAG

public static final java.lang.String METAMERGE_CREATEDBY_TAG
See Also:
Constant Field Values

METAMERGE_MODIFIED_TAG

public static final java.lang.String METAMERGE_MODIFIED_TAG
See Also:
Constant Field Values

METAMERGE_MODIFIEDBY_TAG

public static final java.lang.String METAMERGE_MODIFIEDBY_TAG
See Also:
Constant Field Values

METAMERGE_VERSION_ID

public static final java.lang.String METAMERGE_VERSION_ID
See Also:
Constant Field Values

IDI_VERSION

public static final java.lang.String IDI_VERSION
See Also:
Constant Field Values

IDI_CREATED

public static final java.lang.String IDI_CREATED
See Also:
Constant Field Values
Constructor Detail

MetamergeConfigXML

public MetamergeConfigXML()

MetamergeConfigXML

public MetamergeConfigXML(java.util.Hashtable<java.lang.String,java.lang.Object> env)
                   throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getConfigVersion

public java.lang.String getConfigVersion()
Specified by:
getConfigVersion in interface MetamergeConfig
Overrides:
getConfigVersion in class MetamergeConfigImpl
Returns:
The version of the configuration. e.g. "6.1.1", "7.0", "7.1", etc.

isOldVersion

public boolean isOldVersion()

logmsg

public void logmsg(java.lang.String msg)
Overrides:
logmsg in class MetamergeConfigImpl

debug

public void debug(java.lang.String msg)

isDebugMode

public boolean isDebugMode()
Returns:
true if debug is enabled. Otherwise, false is returned.

initializeConfig

public void initializeConfig()
                      throws java.lang.Exception
Initializes the XML configuration, including the reading and parsing of the XML file.

Specified by:
initializeConfig in interface MetamergeConfig
Overrides:
initializeConfig in class MetamergeConfigImpl
Throws:
java.lang.Exception

internalLookup

protected java.lang.Object internalLookup(java.lang.Object namex)
                                   throws java.lang.Exception
Called by super's lookup

Overrides:
internalLookup in class MetamergeConfigImpl
Throws:
java.lang.Exception

list

public java.util.Enumeration<javax.naming.Binding> list()
                                                 throws java.lang.Exception
This method returns an enumeration with the names in the given folder. If the name does does not name a folder an exception is thrown.

Specified by:
list in interface MetamergeFolder
Overrides:
list in class MetamergeConfigImpl
Returns:
Enumeration of Binding objects
Throws:
java.lang.Exception

list

public java.util.Enumeration<javax.naming.Binding> list(java.lang.Object name)
                                                 throws java.lang.Exception
Description copied from interface: MetamergeConfig
Returns an enumeration of the immediate children of this node

Specified by:
list in interface MetamergeConfig
Overrides:
list in class MetamergeConfigImpl
Parameters:
name - The folder name to list
Returns:
Enumeration object of javax.naming.Binding objects with names and objects.
Throws:
java.lang.Exception

createFolder

public MetamergeFolder createFolder(java.lang.Object name)
                             throws java.lang.Exception
This method creates a folder

Specified by:
createFolder in interface MetamergeFolder
Overrides:
createFolder in class MetamergeConfigImpl
Parameters:
name - Name of sub-folder
Returns:
The MetamergeFolder object representing the new sub-folder
Throws:
java.lang.Exception

findByName

public org.w3c.dom.Element findByName(org.w3c.dom.Element root,
                                      java.lang.Object name)
                               throws java.lang.Exception
This method traverses the document tree searching for an element with an attribute (name) equal to name.

Throws:
java.lang.Exception

findOneByName

public org.w3c.dom.Element findOneByName(org.w3c.dom.Element root,
                                         java.lang.String name)
This method searches the children of an element for an element with an attribute (name) equal to name.


getRootElement

public org.w3c.dom.Element getRootElement()
Returns the root element of the XML document.


getDocument

public org.w3c.dom.Document getDocument()
Returns the XML document object.


bind

public void bind(java.lang.Object name,
                 java.lang.Object obj)
          throws java.lang.Exception
Description copied from interface: MetamergeConfig
Adds a new object to the configuration at the location specified by name

Specified by:
bind in interface MetamergeConfig
Overrides:
bind in class MetamergeConfigImpl
Parameters:
name - Name
obj - Configuration Object
Throws:
java.lang.Exception

rebind

public void rebind(java.lang.Object name,
                   java.lang.Object obj)
            throws java.lang.Exception
Description copied from interface: MetamergeConfig
Adds or replaces a new object to the configuration.

Specified by:
rebind in interface MetamergeConfig
Overrides:
rebind in class MetamergeConfigImpl
Parameters:
name - Name
obj - Configuration Object
Throws:
java.lang.Exception

rename

public void rename(java.lang.Object name,
                   java.lang.Object newname)
            throws java.lang.Exception
Description copied from interface: MetamergeConfig
Renames an object. If new name is a simple name then location is unchanged, otherwise the object is moved.

Specified by:
rename in interface MetamergeConfig
Overrides:
rename in class MetamergeConfigImpl
Parameters:
name - Current Name
newname - New name
Throws:
java.lang.Exception

unbind

public void unbind(java.lang.Object name)
            throws java.lang.Exception
Description copied from interface: MetamergeConfig
Removes a named object from this configuration.

Specified by:
unbind in interface MetamergeConfig
Overrides:
unbind in class MetamergeConfigImpl
Parameters:
name - The object name to remove
Throws:
java.lang.Exception

removeElement

protected void removeElement(java.lang.Object name)
                      throws java.lang.Exception
Throws:
java.lang.Exception

commitChanges

public void commitChanges(java.lang.Object output,
                          boolean isSave)
                   throws java.lang.Exception
Save XML tree to output stream.

Specified by:
commitChanges in interface MetamergeConfig
Overrides:
commitChanges in class MetamergeConfigImpl
Parameters:
output - Null or any object supported by the underlying driver.
isSave - true if this is a permanent save, false if this just saves to e.g. a command window.
Throws:
java.lang.Exception

setOutput

public void setOutput(java.lang.Object output)
               throws java.lang.Exception
Description copied from interface: MetamergeConfig
Changes the output to wich the configuration driver writes its configuration. This is different from calling commitChanges(output, false) where the output parameter is temporary (e.g. SaveCopyAs).

Specified by:
setOutput in interface MetamergeConfig
Overrides:
setOutput in class MetamergeConfigImpl
Parameters:
output - The new output value
Throws:
java.lang.Exception

isCommittable

public boolean isCommittable()
Description copied from interface: MetamergeConfig
Returns true if the configuration driver implements the commitChanges method and the current value for PROVIDER_URL is writable.

Specified by:
isCommittable in interface MetamergeConfig
Overrides:
isCommittable in class MetamergeConfigImpl
Returns:
The committable state

isReadOnly

public boolean isReadOnly()
Description copied from interface: MetamergeConfig
Returns true if this configuration cannot be modified.

Specified by:
isReadOnly in interface MetamergeConfig
Overrides:
isReadOnly in class MetamergeConfigImpl
Returns:
The readOnly value

getModified

public boolean getModified()
XML Doc needs to be saved if we have dirty objects in our cache or if there has been any successful bind/rebind/unbind calls.

Specified by:
getModified in interface BaseConfiguration
Overrides:
getModified in class BaseConfigurationImpl
Returns:
the modified state.

newInstanceOf

public BaseConfiguration newInstanceOf(java.lang.Object typeName)
                                throws java.lang.Exception
Description copied from interface: MetamergeConfig
This method returns a new instance of the object type specified by typeName. Use the default folder names constants to denote the type. The new object is not added to the configuration.

Specified by:
newInstanceOf in interface MetamergeConfig
Overrides:
newInstanceOf in class MetamergeConfigImpl
Parameters:
typeName - The object type to create.
Returns:
The newly created object.
Throws:
java.lang.Exception

getOutputStream

public java.io.OutputStream getOutputStream(java.lang.Object out)
                                     throws java.lang.Exception
Returns the output stream to which the XML document is written. Called by commitChanges.

Throws:
java.lang.Exception

isRemote

public boolean isRemote()
Specified by:
isRemote in interface MetamergeConfig
Overrides:
isRemote in class MetamergeConfigImpl

getShortName

public java.lang.String getShortName()
Description copied from class: BaseConfigurationImpl
Gets the shortName attribute of the BaseConfiguration object. The short name is the last component in a multi component name. E.g.: AssemblyLines/MyName --> "MyName"

Specified by:
getShortName in interface BaseConfiguration
Overrides:
getShortName in class BaseConfigurationImpl
Returns:
The shortName value

getCache

protected ConfigCache getCache()

getDirectory

public java.lang.String getDirectory()
Description copied from interface: MetamergeConfig
Returns the directory this config is placed in. If nothing can be determined, returns "."

Specified by:
getDirectory in interface MetamergeConfig
Overrides:
getDirectory in class MetamergeConfigImpl
Returns:
The directory this config is placed in.

setNoBackupOfOldVersion

public void setNoBackupOfOldVersion()
Sets a flag to prevent an old version of the file to be used as backup.

Since:
7.2