com.metamatrix.common.config.xml
Class XMLHelperImpl

java.lang.Object
  extended by com.metamatrix.common.config.xml.XMLHelperImpl
All Implemented Interfaces:
ConfigurationPropertyNames

public class XMLHelperImpl
extends java.lang.Object
implements ConfigurationPropertyNames

This helper class is used to create JDOM XML Elements from configuration objects and to create Configuration objects from JDOM XML Elements. NOTE - The helper cannot have any calls to LogManager because the bootstrapping of the CurrentConfiguration uses this class and the CurrentConfiguration has to come up before logging is available.


Field Summary
 
Fields inherited from interface com.metamatrix.common.config.util.ConfigurationPropertyNames
APPLICATION_CREATED_BY, APPLICATION_VERSION_CREATED_BY, CONFIG_CURR_VERSION, CONFIG_CURR_VERSION_DBL, CONFIGURATION_VERSION, MEMBERSHIP_ADMIN_PASSWORD, MEMBERSHIP_ADMIN_USERNAME, MEMBERSHIP_DOMAIN_ORDER, MEMBERSHIP_SECURITY_ENABLED, SYSTEM_VERSION, TIME, USER_CREATED_BY
 
Constructor Summary
XMLHelperImpl()
           
 
Method Summary
 ComponentObject addProperties(org.jdom.Element propertiesElement, ComponentObject object, ConfigurationObjectEditor editor)
          This method will create a ComponentObject configuration object from an XML element that represents a ComponentObject.
 AuthenticationProvider createAuthenticationProvider(org.jdom.Element element, ConfigurationID configID, ConfigurationObjectEditor editor)
          This method will create a Resource configuration object from an XML element that represents a Resource.
 org.jdom.Element createAuthenticationProviderElement()
           
 org.jdom.Element createAuthenticationProviderElement(AuthenticationProvider defn)
          This method is used to create a ServiceComponentDefn JDOM Element from a ServiceComponentDefn object.
 ComponentType createComponentType(org.jdom.Element element, ConfigurationObjectEditor editor, java.lang.String name, boolean maintainParentID)
          This method will create a ComponentType configuration object from an XML element that represents a ComponentType.
 org.jdom.Element createComponentTypeDefnElement(ComponentTypeDefn defn)
          This method is used to create a ComponentTypeDefn JDOM Element from a ComponentTypeDefn object.
 org.jdom.Element createComponentTypeElement(ComponentType type)
          This method is used to create a ComponentType JDOM Element from a ComponentType object.
 org.jdom.Element createComponentTypesElement()
          This method is used to create a ComponentTypes JDOM Element from a Configuration ID object.
 Configuration createConfiguration(org.jdom.Element element, ConfigurationObjectEditor editor, java.lang.String name)
          This method will create a Configuration configuration object from an XML element that represents a Configuration.
 org.jdom.Element createConfigurationElement(Configuration configuration)
          This method is used to create a Configuration JDOM Element from a Configuration object.
 org.jdom.Element createConfigurationsElement()
          This method is used to create a Configurations JDOM Element from a Configuration ID object.
 ConnectorBinding createConnectorBinding(ConfigurationID configurationID, org.jdom.Element element, ConfigurationObjectEditor editor, java.lang.String name, boolean isImportConfig)
           
 org.jdom.Element createConnectorBindingElement(ConnectorBinding connector, boolean isExportConfig)
           
 org.jdom.Element createConnectorBindingsElement()
           
 DeployedComponent createDeployedServiceComponent(org.jdom.Element element, ConfigurationID configID, HostID hostID, VMComponentDefnID vmID, java.util.Map componentTypeMap, ConfigurationObjectEditor editor)
           
 org.jdom.Element createDeployedServiceElement(DeployedComponent deployedComponent)
          This method is used to create a DeployedComponent JDOM Element from a DeployedComponent object.
 org.jdom.Element createHeaderElement(java.util.Properties props)
          This method is used to create a Header JDOM Element from a Properties object.
 Host createHost(org.jdom.Element element, ConfigurationID configID, ConfigurationObjectEditor editor, java.lang.String name)
          This method will create a Host configuration object from an XML element that represents a Host.
 org.jdom.Element createHostElement(Host host)
          This method is used to create a Host JDOM Element from a Host object.
 org.jdom.Element createIDElement(java.lang.String type, java.lang.String name)
          This method is used to create a Configuration ID JDOM Element from a Configuration ID object.
 BasicVMComponentDefn createProcess(org.jdom.Element element, ConfigurationID configID, HostID hostID, ConfigurationObjectEditor editor, java.lang.String name)
          This method will create a VMComponentDefn configuration object from an XML element that represents a VMComponentDefn.
 org.jdom.Element createProcessElement(VMComponentDefn defn)
          This method is used to create a VMComponentDefn JDOM Element from a VMComponentDefn object.
 org.jdom.Element createPropertiesElement(java.util.Properties props)
          This method is used to create a Properties JDOM Element from a Properties object.
 PropertyDefinition createPropertyDefinition(org.jdom.Element element)
          This method is a helper method to create a PropertyDefinition object from an XML element that represents same.
 org.jdom.Element createPropertyDefinitionElement(PropertyDefinition defn)
          This method is used to create a PropertyDefinition JDOM Element from a PropertyDefinition object.
 org.jdom.Element createRootConfigurationDocumentElement()
          This method is used to create a root JDOM Element.
 ComponentDefn createServiceComponentDefn(org.jdom.Element element, Configuration config, ConfigurationObjectEditor editor, java.lang.String name)
          This method will create a ServiceComponentDefn configuration object from an XML element that represents a ServiceComponentDefn.
 ComponentDefn createServiceComponentDefn(org.jdom.Element element, ConfigurationID configID, ConfigurationObjectEditor editor, java.lang.String name)
           
 org.jdom.Element createServiceComponentDefnElement(ServiceComponentDefn defn)
          This method is used to create a ServiceComponentDefn JDOM Element from a ServiceComponentDefn object.
 org.jdom.Element createServiceComponentDefnsElement()
          This method is used to create a ServiceComponentDefns JDOM Element.
 SharedResource createSharedResource(org.jdom.Element element, ConfigurationObjectEditor editor)
          This method will create a Resource configuration object from an XML element that represents a Resource.
 org.jdom.Element createSharedResourceElement(SharedResource resource)
          This method is used to create a ServiceComponentDefn JDOM Element from a ServiceComponentDefn object.
 org.jdom.Element createSharedResourcesElement()
           
 java.util.Properties getHeaderProperties(org.jdom.Element element)
           
 ComponentType loadComponentType(org.jdom.Element rootElement)
           
 ConnectorBinding loadConnectorBinding(org.jdom.Element rootElement)
           
 void orderComponentTypeElementList(java.util.List componentTypeElements)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLHelperImpl

public XMLHelperImpl()
Method Detail

createConfigurationElement

public org.jdom.Element createConfigurationElement(Configuration configuration)
This method is used to create a Configuration JDOM Element from a Configuration object.

Parameters:
configuration - the Object to be converted to a JDOM XML Element
Returns:
a JDOM XML Element

createDeployedServiceElement

public org.jdom.Element createDeployedServiceElement(DeployedComponent deployedComponent)
This method is used to create a DeployedComponent JDOM Element from a DeployedComponent object.

Parameters:
deployedComponent - the Object to be converted to a JDOM XML Element
Returns:
a JDOM XML Element

createProcessElement

public org.jdom.Element createProcessElement(VMComponentDefn defn)
This method is used to create a VMComponentDefn JDOM Element from a VMComponentDefn object.

Parameters:
defn - the Object to be converted to a JDOM XML Element
Returns:
a JDOM XML Element

createServiceComponentDefnElement

public org.jdom.Element createServiceComponentDefnElement(ServiceComponentDefn defn)
This method is used to create a ServiceComponentDefn JDOM Element from a ServiceComponentDefn object.

Parameters:
defn - the Object to be converted to a JDOM XML Element
Returns:
a JDOM XML Element

createAuthenticationProviderElement

public org.jdom.Element createAuthenticationProviderElement(AuthenticationProvider defn)
This method is used to create a ServiceComponentDefn JDOM Element from a ServiceComponentDefn object.

Parameters:
defn - the Object to be converted to a JDOM XML Element
Returns:
a JDOM XML Element

createComponentTypeElement

public org.jdom.Element createComponentTypeElement(ComponentType type)
This method is used to create a ComponentType JDOM Element from a ComponentType object.

Parameters:
type - the Object to be converted to a JDOM XML Element
Returns:
a JDOM XML Element

createPropertyDefinitionElement

public org.jdom.Element createPropertyDefinitionElement(PropertyDefinition defn)
This method is used to create a PropertyDefinition JDOM Element from a PropertyDefinition object.

Parameters:
defn - the Object to be converted to a JDOM XML Element
Returns:
a JDOM XML Element

createComponentTypeDefnElement

public org.jdom.Element createComponentTypeDefnElement(ComponentTypeDefn defn)
This method is used to create a ComponentTypeDefn JDOM Element from a ComponentTypeDefn object.

Parameters:
defn - the Object to be converted to a JDOM XML Element
Returns:
a JDOM XML Element

createHostElement

public org.jdom.Element createHostElement(Host host)
This method is used to create a Host JDOM Element from a Host object.

Parameters:
host - the Object to be converted to a JDOM XML Element
Returns:
a JDOM XML Element

getHeaderProperties

public java.util.Properties getHeaderProperties(org.jdom.Element element)
                                         throws InvalidConfigurationElementException
Throws:
InvalidConfigurationElementException

createHeaderElement

public org.jdom.Element createHeaderElement(java.util.Properties props)

This method is used to create a Header JDOM Element from a Properties object. The properties object can contain any of the following properties that will be included in the header:

 XMLConfig_ElementNames.Header.ApplicationCreatedDate.ELEMENT
 XMLConfig_ElementNames.Header.ApplicationVersionCreatedBy.ELEMENT
 XMLConfig_ElementNames.Header.UserName.ELEMENT
 XMLConfig_ElementNames.Header.DocumentTypeVersion.ELEMENT
 XMLConfig_ElementNames.Header.MetaMatrixServerVersion.ELEMENT
 XMLConfig_ElementNames.Header.Time.ELEMENT
 
 

Any of these properties that are not included in the properties object will not be included in the header Element that is returned.

Parameters:
props - the properties object that contains the values for the Header
Returns:
a JDOM XML Element

createPropertiesElement

public org.jdom.Element createPropertiesElement(java.util.Properties props)
This method is used to create a Properties JDOM Element from a Properties object.

Parameters:
props - the Object to be converted to a JDOM XML Element
Returns:
a JDOM XML Element

createIDElement

public org.jdom.Element createIDElement(java.lang.String type,
                                        java.lang.String name)
This method is used to create a Configuration ID JDOM Element from a Configuration ID object.

Parameters:
type - the ID type to be created. @see XMLConfig_ElementNames.Configuration.XXXID.ELEMENT for valid values
name - the calue of the name attribute of the ID element to create.
Returns:
a JDOM XML Element

createConfigurationsElement

public org.jdom.Element createConfigurationsElement()
This method is used to create a Configurations JDOM Element from a Configuration ID object. This element is for structural organization only and does not represent any real configuration object.

Returns:
a JDOM XML Element

createServiceComponentDefnsElement

public org.jdom.Element createServiceComponentDefnsElement()
This method is used to create a ServiceComponentDefns JDOM Element. This element is for structural organization only and does not represent any real configuration object.

Returns:
a JDOM XML Element

createComponentTypesElement

public org.jdom.Element createComponentTypesElement()
This method is used to create a ComponentTypes JDOM Element from a Configuration ID object. This element is for structural organization only and does not represent any real configuration object.

Returns:
a JDOM XML Element

createConnectorBindingsElement

public org.jdom.Element createConnectorBindingsElement()

createRootConfigurationDocumentElement

public org.jdom.Element createRootConfigurationDocumentElement()
This method is used to create a root JDOM Element. This element is for structural organization only and does not represent any real configuration object.

Returns:
a JDOM XML Element

createHost

public Host createHost(org.jdom.Element element,
                       ConfigurationID configID,
                       ConfigurationObjectEditor editor,
                       java.lang.String name)
                throws InvalidConfigurationElementException
This method will create a Host configuration object from an XML element that represents a Host.

Parameters:
element - the JDOM element to convert to a configuration object
editor - the editor to use to create the configuration object
name - the name of the returned configuration object. Note this name will override the name in the JDOM element. If the name parameter is null, the name of the object in the JDOM element will be used as the name of the object.
Returns:
the Host configuration object
Throws:
InvalidConfigurationElementException - if the element passed in or its XML structure do not conform to the XML structure specfied in the XMLConfig_ElementNames class.

createAuthenticationProviderElement

public org.jdom.Element createAuthenticationProviderElement()

createAuthenticationProvider

public AuthenticationProvider createAuthenticationProvider(org.jdom.Element element,
                                                           ConfigurationID configID,
                                                           ConfigurationObjectEditor editor)
                                                    throws InvalidConfigurationElementException
This method will create a Resource configuration object from an XML element that represents a Resource.

Parameters:
element - the JDOM element to convert to a configuration object
editor - the editor to use to create the configuration object
name - the name of the returned configuration object. Note this name will override the name in the JDOM element. If the name parameter is null, the name of the object in the JDOM element will be used as the name of the object.
Returns:
the SharedResource configuration object
Throws:
InvalidConfigurationElementException - if the element passed in or its XML structure do not conform to the XML structure specfied in the XMLConfig_ElementNames class.

createSharedResourceElement

public org.jdom.Element createSharedResourceElement(SharedResource resource)
This method is used to create a ServiceComponentDefn JDOM Element from a ServiceComponentDefn object.

Parameters:
defn - the Object to be converted to a JDOM XML Element
Returns:
a JDOM XML Element

createSharedResource

public SharedResource createSharedResource(org.jdom.Element element,
                                           ConfigurationObjectEditor editor)
                                    throws InvalidConfigurationElementException
This method will create a Resource configuration object from an XML element that represents a Resource.

Parameters:
element - the JDOM element to convert to a configuration object
editor - the editor to use to create the configuration object
name - the name of the returned configuration object. Note this name will override the name in the JDOM element. If the name parameter is null, the name of the object in the JDOM element will be used as the name of the object.
Returns:
the SharedResource configuration object
Throws:
InvalidConfigurationElementException - if the element passed in or its XML structure do not conform to the XML structure specfied in the XMLConfig_ElementNames class.

createSharedResourcesElement

public org.jdom.Element createSharedResourcesElement()

createComponentType

public ComponentType createComponentType(org.jdom.Element element,
                                         ConfigurationObjectEditor editor,
                                         java.lang.String name,
                                         boolean maintainParentID)
                                  throws InvalidConfigurationElementException
This method will create a ComponentType configuration object from an XML element that represents a ComponentType.

Parameters:
element - the JDOM element to convert to a configuration object
editor - the editor to use to create the configuration object
name - the name of the returned configuration object. Note this name will override the name in the JDOM element. If the name parameter is null, the name of the object in the JDOM element will be used as the name of the object.
Returns:
the ComponentType configuration object
Throws:
InvalidConfigurationElementException - if the element passed in or its XML structure do not conform to the XML structure specfied in the XMLConfig_ElementNames class.

loadComponentType

public ComponentType loadComponentType(org.jdom.Element rootElement)
                                throws InvalidConfigurationElementException
Throws:
InvalidConfigurationElementException

createConfiguration

public Configuration createConfiguration(org.jdom.Element element,
                                         ConfigurationObjectEditor editor,
                                         java.lang.String name)
                                  throws InvalidConfigurationElementException
This method will create a Configuration configuration object from an XML element that represents a Configuration.

Parameters:
element - the JDOM element to convert to a configuration object
editor - the editor to use to create the configuration object
name - the name of the returned configuration object. Note this name will override the name in the JDOM element. If the name parameter is null, the name of the object in the JDOM element will be used as the name of the object.
Returns:
the Configuration configuration object
Throws:
InvalidConfigurationElementException - if the element passed in or its XML structure do not conform to the XML structure specfied in the XMLConfig_ElementNames class.

createConnectorBindingElement

public org.jdom.Element createConnectorBindingElement(ConnectorBinding connector,
                                                      boolean isExportConfig)

createConnectorBinding

public ConnectorBinding createConnectorBinding(ConfigurationID configurationID,
                                               org.jdom.Element element,
                                               ConfigurationObjectEditor editor,
                                               java.lang.String name,
                                               boolean isImportConfig)
                                        throws InvalidConfigurationElementException
Throws:
InvalidConfigurationElementException

loadConnectorBinding

public ConnectorBinding loadConnectorBinding(org.jdom.Element rootElement)
                                      throws InvalidConfigurationElementException
Throws:
InvalidConfigurationElementException

createServiceComponentDefn

public ComponentDefn createServiceComponentDefn(org.jdom.Element element,
                                                Configuration config,
                                                ConfigurationObjectEditor editor,
                                                java.lang.String name)
                                         throws InvalidConfigurationElementException
This method will create a ServiceComponentDefn configuration object from an XML element that represents a ServiceComponentDefn.

Parameters:
element - the JDOM element to convert to a configuration object
editor - the editor to use to create the configuration object
name - the name of the returned configuration object. Note this name will override the name in the JDOM element. If the name parameter is null, the name of the object in the JDOM element will be used as the name of the object.
Returns:
the ServiceComponentDefn configuration object
Throws:
InvalidConfigurationElementException - if the element passed in or its XML structure do not conform to the XML structure specfied in the XMLConfig_ElementNames class.

createServiceComponentDefn

public ComponentDefn createServiceComponentDefn(org.jdom.Element element,
                                                ConfigurationID configID,
                                                ConfigurationObjectEditor editor,
                                                java.lang.String name)
                                         throws InvalidConfigurationElementException
Throws:
InvalidConfigurationElementException

createDeployedServiceComponent

public DeployedComponent createDeployedServiceComponent(org.jdom.Element element,
                                                        ConfigurationID configID,
                                                        HostID hostID,
                                                        VMComponentDefnID vmID,
                                                        java.util.Map componentTypeMap,
                                                        ConfigurationObjectEditor editor)
                                                 throws InvalidConfigurationElementException
Throws:
InvalidConfigurationElementException

createProcess

public BasicVMComponentDefn createProcess(org.jdom.Element element,
                                          ConfigurationID configID,
                                          HostID hostID,
                                          ConfigurationObjectEditor editor,
                                          java.lang.String name)
                                   throws InvalidConfigurationElementException
This method will create a VMComponentDefn configuration object from an XML element that represents a VMComponentDefn.

Parameters:
element - the JDOM element to convert to a configuration object
editor - the editor to use to create the configuration object
name - the name of the returned configuration object. Note this name will override the name in the JDOM element. If the name parameter is null, the name of the object in the JDOM element will be used as the name of the object.
Returns:
the VMComponentDefn configuration object
Throws:
InvalidConfigurationElementException - if the element passed in or its XML structure do not conform to the XML structure specfied in the XMLConfig_ElementNames class.

createPropertyDefinition

public PropertyDefinition createPropertyDefinition(org.jdom.Element element)
                                            throws InvalidConfigurationElementException
This method is a helper method to create a PropertyDefinition object from an XML element that represents same.

Parameters:
element - the XML element that represents a PropertyDefinition object
Throws:
InvalidConfigurationElementException - if the element passed in or its XML structure do not conform to the XML structure specfied in the XMLConfig_ElementNames class.

addProperties

public ComponentObject addProperties(org.jdom.Element propertiesElement,
                                     ComponentObject object,
                                     ConfigurationObjectEditor editor)
                              throws InvalidConfigurationElementException
This method will create a ComponentObject configuration object from an XML element that represents a ComponentObject.

Parameters:
element - the JDOM element to convert to a configuration object
editor - the editor to use to create the configuration object
name - the name of the returned configuration object. Note this name will override the name in the JDOM element. If the name parameter is null, the name of the object in the JDOM element will be used as the name of the object.
Returns:
the ComponentObject configuration object
Throws:
InvalidConfigurationElementException - if the element passed in or its XML structure do not conform to the XML structure specfied in the XMLConfig_ElementNames class.

orderComponentTypeElementList

public void orderComponentTypeElementList(java.util.List componentTypeElements)


Copyright © 2009. All Rights Reserved.