com.metamatrix.platform.config.spi.xml
Class XMLConfigurationConnector

java.lang.Object
  extended by com.metamatrix.common.connection.BaseTransaction
      extended by com.metamatrix.platform.config.spi.xml.XMLConfigurationConnector
All Implemented Interfaces:
TransactionInterface, ConfigurationTransaction

public class XMLConfigurationConnector
extends BaseTransaction
implements ConfigurationTransaction

JDBCConfigurationTransaction is responsible for executing and managing transactions. History: 12/20/00 vhalbert - when adding/updating property values, the values will be trimmed. This is because the use of the value later is incorrect if the user does not trim. Thereforre, it is easier to do this trimming one time and in one location.

See Also:
and updateProperty()

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.metamatrix.platform.config.spi.ConfigurationTransaction
ConfigurationTransaction.ComponentTypeSearch
 
Method Summary
 void commit()
          Make all changes made during this transaction's lifetime and release any data source locks currently held by the associated Connection.
 boolean doesConfigurationExist(java.lang.String configurationName)
          Returns a boolean indicating if the configuration already exist or not.
 java.util.Set executeActions(boolean doAdjust, java.util.List actions, java.lang.String principalName)
           
 java.util.Set executeActions(java.util.List actions, java.lang.String principalName)
          Execute the specified actions.
 java.util.Collection getAllComponentTypes(boolean includeDeprecated)
          Returns a Map of type ComponentType keyed by ComponentTypeID.
 java.util.Collection getAllObjectsForConfigurationModel(ConfigurationID configID)
          Returns a Collection containing the Configuration object for the specified ConfigurationID id, and also any dependant objects needed to fully define this configuration, such as Host objects, ComponentType objects, and ComponentTypeDefn objects.
 ComponentDefn getComponentDefinition(ComponentDefnID componentID, ConfigurationID configurationID)
          Obtain the component definition
 java.util.Map getComponentDefinitions(ConfigurationID configurationID)
          Obtain the list of component definition instances that makeup the configuration.
 java.lang.String getComponentPropertyValue(ComponentObjectID componentObjectID, ComponentTypeID typeID, java.lang.String propertyName)
          Obtain the value for a specific property name
 ComponentType getComponentType(ComponentTypeID id)
          Returns a ComponentType for the specified ComponentTypeID
 java.util.Collection getComponentTypeDefinitions(ComponentTypeID componentTypeID)
          Returns a Map of component type definitions for the ComponentTypeID specified, keyed by the ComponentTypeDefnID
 Configuration getConfiguration(java.lang.String configurationName)
          Obtain a configuration that contains all its components and the deployed components.
 ConfigurationInfo getConfigurationInfo(java.lang.String configurationName)
          Obtain the configuration info for the specified configuration and version.
 ConfigurationModelContainer getConfigurationModel(java.lang.String configName)
          Returns the configuration model that contains everything a server needs to start.
protected  XMLConfigurationReader getConfigurationReader()
           
protected  XMLConfigurationWriter getConfigurationWriter()
           
 java.util.Collection getConnectionPools(ConfigurationID configurationID)
          Deprecated. 5.5.4
 Configuration getCurrentConfiguration()
          Deprecated. as of v 2.0 beta 1 use getDesignatedConfiguration(java.lang.String)
 ConfigurationID getCurrentConfigurationID()
          Deprecated. as of v 2.0 beta 1 use getDesignatedConfigurationID(java.lang.String)
 DeployedComponent getDeployedComponent(DeployedComponentID deployedComponentID)
          Obtain the deployed component
 java.util.List getDeployedComponents(ConfigurationID configurationID)
          Obtain the list of deployed components that represent the configuration when deployed.
 Configuration getDesignatedConfiguration(java.lang.String designation)
          Returns one of the well-known system configurations, either the operational configuration, the next startup configuration, or the startup configuration.
 ConfigurationID getDesignatedConfigurationID(java.lang.String designation)
          Returns the ID of one of the well-known system configurations, either the operational configuration, the next startup configuration, or the startup configuration.
 java.util.Collection getHosts()
          Obtain the list of registered host
 java.util.Collection getMonitoredComponentTypes(boolean includeDeprecated)
          Returns a Map of type ComponentType keyed by ComponentTypeID that are flagged as being monitored.
 java.util.Collection getProductTypes(boolean includedeprecated)
          Returns a Map of type ProductType keyed by ProductTypeID.
 java.util.Collection getResources()
          Returns a Collection of ResourceDescriptor for all internal resources defined to the system.
 java.util.Collection getResources(ComponentTypeID componentTypeID)
          Returns a Collection of ResourceDescriptor that are of the specified resource type.
 int getServerStartupState()
           
 java.util.Date getServerStartupTime()
          Return the time the server was started.
 ConfigurationID overwriteConfiguration(ConfigurationID configToCopy, ConfigurationID configToOverwrite, java.lang.String principalName)
          Overwrite the specified configuration by copying another configuration over it.
 void rollback()
          Drops all changes made during this transaction's lifetime and release any data source locks currently held by the associated Connection.
 void saveResources(java.util.Collection resourceDescriptors, java.lang.String principalName)
          Save the resource changes based on each ResourceDescriptor in the collection.
 
Methods inherited from class com.metamatrix.common.connection.BaseTransaction
close, finalize, getConnection, getRollbackOnFinalize, isClosed, isEnded, isReadonly, setRollbackOnFinalize
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.metamatrix.common.connection.TransactionInterface
close, isClosed, isReadonly
 

Method Detail

getCurrentConfiguration

public Configuration getCurrentConfiguration()
                                      throws ConfigurationException
Deprecated. as of v 2.0 beta 1 use getDesignatedConfiguration(java.lang.String)

Returns the current deployed Configuration. Note, this configuration may not match the actual configuration the system is currently executing under due to administrative task that can be done to tune the system. Those administrative task do not change the actual Configuration stored in the ConfigurationService.

Specified by:
getCurrentConfiguration in interface ConfigurationTransaction
Returns:
Configuration that is currently in use
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getDesignatedConfiguration

public Configuration getDesignatedConfiguration(java.lang.String designation)
                                         throws ConfigurationException
Returns one of the well-known system configurations, either the operational configuration, the next startup configuration, or the startup configuration. Use SystemConfigurationNames to supply the String parameter.

Specified by:
getDesignatedConfiguration in interface ConfigurationTransaction
Parameters:
designation - String indicating which of the system configurations is desired; use one of the SystemConfigurationNames constants
Returns:
the desired Configuration
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getConfiguration

public Configuration getConfiguration(java.lang.String configurationName)
                               throws ConfigurationException
Obtain a configuration that contains all its components and the deployed components.

Specified by:
getConfiguration in interface ConfigurationTransaction
Parameters:
configurationName -
Returns:
the serializable Configuration instance
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getConfigurationModel

public ConfigurationModelContainer getConfigurationModel(java.lang.String configName)
                                                  throws ConfigurationException
Description copied from interface: ConfigurationTransaction
Returns the configuration model that contains everything a server needs to start. param configName is the name of the configuration model to return

Specified by:
getConfigurationModel in interface ConfigurationTransaction
Returns:
ConfigurationModelContainer
Throws:
ConfigurationException

getConfigurationInfo

public ConfigurationInfo getConfigurationInfo(java.lang.String configurationName)
                                       throws InvalidNameException,
                                              ConfigurationException
Obtain the configuration info for the specified configuration and version.

Parameters:
configurationName -
Returns:
the configuration info instance
Throws:
InvalidNameException - if the configuration does not exist
ConfigurationException - when an error occurred within or during communication with the Configuration Service.

getCurrentConfigurationID

public ConfigurationID getCurrentConfigurationID()
                                          throws ConfigurationException
Deprecated. as of v 2.0 beta 1 use getDesignatedConfigurationID(java.lang.String)

Description copied from interface: ConfigurationTransaction
Returns the current configurationID

Specified by:
getCurrentConfigurationID in interface ConfigurationTransaction
Returns:
ConfigurationID for the current configuration
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getDesignatedConfigurationID

public ConfigurationID getDesignatedConfigurationID(java.lang.String designation)
                                             throws ConfigurationException
Description copied from interface: ConfigurationTransaction
Returns the ID of one of the well-known system configurations, either the operational configuration, the next startup configuration, or the startup configuration. Use SystemConfigurationNames to supply the String parameter.

Specified by:
getDesignatedConfigurationID in interface ConfigurationTransaction
Parameters:
designation - String indicating which of the system configurations is desired; use one of the SystemConfigurationNames constants
Returns:
the desired Configuration
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getComponentDefinitions

public java.util.Map getComponentDefinitions(ConfigurationID configurationID)
                                      throws ConfigurationException
Obtain the list of component definition instances that makeup the configuration.

Specified by:
getComponentDefinitions in interface ConfigurationTransaction
Returns:
the list of Component instances
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getConnectionPools

public java.util.Collection getConnectionPools(ConfigurationID configurationID)
                                        throws ConfigurationException
Deprecated. 5.5.4

Description copied from interface: ConfigurationTransaction
Returns a Collection of ResourceDescriptor for all resource pools defined to the system.

Specified by:
getConnectionPools in interface ConfigurationTransaction
Parameters:
configurationID - is the configuration from which the component defns are to be derived
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getResources

public java.util.Collection getResources()
                                  throws ConfigurationException
Returns a Collection of ResourceDescriptor for all internal resources defined to the system. The internal resources are not managed with the other configuration related information. They are not dictated based on which configuration they will operate (i.e., next startup or operational);

Specified by:
getResources in interface ConfigurationTransaction
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getResources

public java.util.Collection getResources(ComponentTypeID componentTypeID)
                                  throws ConfigurationException
Returns a Collection of ResourceDescriptor that are of the specified resource type.

Specified by:
getResources in interface ConfigurationTransaction
Parameters:
componentType - that identifies the type of resources to be returned
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getComponentPropertyValue

public java.lang.String getComponentPropertyValue(ComponentObjectID componentObjectID,
                                                  ComponentTypeID typeID,
                                                  java.lang.String propertyName)
                                           throws ConfigurationException
Description copied from interface: ConfigurationTransaction
Obtain the value for a specific property name

Specified by:
getComponentPropertyValue in interface ConfigurationTransaction
Parameters:
componentObjectID - is the component for which the value is to be retrieved for
typeID - is the type of the component the object represents
propertyName - is the name of the property to obtain
Returns:
the property value
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getComponentDefinition

public ComponentDefn getComponentDefinition(ComponentDefnID componentID,
                                            ConfigurationID configurationID)
                                     throws ConfigurationException
Obtain the component definition

Specified by:
getComponentDefinition in interface ConfigurationTransaction
Parameters:
componentID - contains all the ids for which componet defns to be returned
configurationID - is the configuration from which the component defns are to be derived; optional, nullalble
Returns:
the ComponentDefn
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getComponentTypeDefinitions

public java.util.Collection getComponentTypeDefinitions(ComponentTypeID componentTypeID)
                                                 throws ConfigurationException
Description copied from interface: ConfigurationTransaction
Returns a Map of component type definitions for the ComponentTypeID specified, keyed by the ComponentTypeDefnID

Specified by:
getComponentTypeDefinitions in interface ConfigurationTransaction
Parameters:
componentTypeID - for the ComponentTypeID that has definitions defined.
Returns:
Collection of component type difinitions
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getDeployedComponents

public java.util.List getDeployedComponents(ConfigurationID configurationID)
                                     throws ConfigurationException
Obtain the list of deployed components that represent the configuration when deployed.

Specified by:
getDeployedComponents in interface ConfigurationTransaction
Returns:
the list of DeployedComponents
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getDeployedComponent

public DeployedComponent getDeployedComponent(DeployedComponentID deployedComponentID)
                                       throws ConfigurationException
Obtain the deployed component

Returns:
the DeployedComponent
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getHosts

public java.util.Collection getHosts()
                              throws ConfigurationException
Obtain the list of registered host

Specified by:
getHosts in interface ConfigurationTransaction
Returns:
Collection of Hosts
Throws:
ConfigurationException - if an error occurred within or during communication with the Metadata Service.

getComponentType

public ComponentType getComponentType(ComponentTypeID id)
                               throws ConfigurationException
Description copied from interface: ConfigurationTransaction
Returns a ComponentType for the specified ComponentTypeID

Specified by:
getComponentType in interface ConfigurationTransaction
Parameters:
id - is for the requested component type.
Returns:
ComponentType based on the id
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getAllComponentTypes

public java.util.Collection getAllComponentTypes(boolean includeDeprecated)
                                          throws ConfigurationException
Description copied from interface: ConfigurationTransaction
Returns a Map of type ComponentType keyed by ComponentTypeID.

Specified by:
getAllComponentTypes in interface ConfigurationTransaction
Parameters:
includeDeprecated - true if class names that have been deprecated should be included in the returned list, or false if only non-deprecated constants should be returned.
Returns:
Collection of type ComponentType
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getProductTypes

public java.util.Collection getProductTypes(boolean includedeprecated)
                                     throws ConfigurationException
Description copied from interface: ConfigurationTransaction
Returns a Map of type ProductType keyed by ProductTypeID.

Specified by:
getProductTypes in interface ConfigurationTransaction
Parameters:
includedeprecated - true if class names that have been deprecated should be included in the returned list, or false if only non-deprecated constants should be returned.
Returns:
Collection of type ComponentType
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getAllObjectsForConfigurationModel

public java.util.Collection getAllObjectsForConfigurationModel(ConfigurationID configID)
                                                        throws ConfigurationException
Description copied from interface: ConfigurationTransaction

Returns a Collection containing the Configuration object for the specified ConfigurationID id, and also any dependant objects needed to fully define this configuration, such as Host objects, ComponentType objects, and ComponentTypeDefn objects.

A Configuration instance contains all of the ComponentDefn objects that "belong" to just that Configuration model: VM component definitions, service component definitions, product service configurations, and deployed components. Objects such as Host objects, ComponentType objects, ComponentTypeDefn, Resources, and ConnectorBinding objects describe or support ComponentDefns, but are not contained by a Configuration. Therefore, they are included in this Collection for convenience.

The Collection will contain instances of BaseObject. Specifically, this Map should contain the objects for: one configuration object, one or more Host objects, one or more ComponentType objects, and one or more ComponentTypeDefn objects.

This method is intended to facilitate exporting a configuration to XML.

Here is what the Collection would contain at runtime:

 Configuration instance
 Host instance1
 Host instance2
 ...
 ConnectorBinding instance1
 ConnectorBinding instance2
 ...
 SharedResource intance1
 SharedResource instance
 ...
 ComponentType instance1
 ComponentType instance2
 ...
 ComponentTypeDefn instance1
 ComponentTypeDefn instance2
 

Specified by:
getAllObjectsForConfigurationModel in interface ConfigurationTransaction
Parameters:
configID - ID Of a Configuration
Returns:
Collection of BaseObject instances
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getMonitoredComponentTypes

public java.util.Collection getMonitoredComponentTypes(boolean includeDeprecated)
                                                throws ConfigurationException
Description copied from interface: ConfigurationTransaction
Returns a Map of type ComponentType keyed by ComponentTypeID that are flagged as being monitored. A component of this type is considered to be available for monitoring statistics.

Specified by:
getMonitoredComponentTypes in interface ConfigurationTransaction
Parameters:
includeDeprecated - true if class names that have been deprecated should be included in the returned list, or false if only non-deprecated constants should be returned.
Returns:
Collection of type ComponentType keyed by ComponentTypeID
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getServerStartupTime

public java.util.Date getServerStartupTime()
                                    throws ConfigurationException
Return the time the server was started. If the state of the server is not "Started" then a null is returned.

Specified by:
getServerStartupTime in interface ConfigurationTransaction
Returns:
Date Time server was started.
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getServerStartupState

public int getServerStartupState()
                          throws ConfigurationException
Throws:
ConfigurationException

doesConfigurationExist

public boolean doesConfigurationExist(java.lang.String configurationName)
                               throws ConfigurationException
Returns a boolean indicating if the configuration already exist or not.

Specified by:
doesConfigurationExist in interface ConfigurationTransaction
Parameters:
configurationName - the identifier of the configuration
Returns:
boolean of false if the configuration is found
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

commit

public void commit()
            throws ManagedConnectionException
Description copied from class: BaseTransaction
Make all changes made during this transaction's lifetime and release any data source locks currently held by the associated Connection. A transaction can be committed or rolled back any number of times throughout its lifetime, and throughout its lifetime the transaction is guaranteed to have the same connection.

Specified by:
commit in interface TransactionInterface
Specified by:
commit in interface ConfigurationTransaction
Overrides:
commit in class BaseTransaction
Throws:
ManagedConnectionException - if an error occurred within or during communication with the associated connection.

rollback

public void rollback()
              throws ManagedConnectionException
Description copied from class: BaseTransaction
Drops all changes made during this transaction's lifetime and release any data source locks currently held by the associated Connection. Once this method is executed, the transaction (after rolling back) becomes invalid, and the connection referenced by this transaction is returned to the pool.

Calling this method on a read-only transaction is unneccessary (and discouraged, since the implementation does nothing in that case anyway).

Specified by:
rollback in interface TransactionInterface
Specified by:
rollback in interface ConfigurationTransaction
Overrides:
rollback in class BaseTransaction
Throws:
ManagedConnectionException - if an error occurred within or during communication with the associated connection.

executeActions

public java.util.Set executeActions(java.util.List actions,
                                    java.lang.String principalName)
                             throws InvalidComponentException,
                                    ConfigurationException
Description copied from interface: ConfigurationTransaction
Execute the specified actions.

Specified by:
executeActions in interface ConfigurationTransaction
principalName - the name of the principal that is requesting the lock
Returns:
the set of BaseID objects denoting which objects were affected by these actions
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.
InvalidComponentException

executeActions

public java.util.Set executeActions(boolean doAdjust,
                                    java.util.List actions,
                                    java.lang.String principalName)
                             throws InvalidComponentException,
                                    ConfigurationException
Throws:
InvalidComponentException
ConfigurationException

overwriteConfiguration

public ConfigurationID overwriteConfiguration(ConfigurationID configToCopy,
                                              ConfigurationID configToOverwrite,
                                              java.lang.String principalName)
                                       throws InvalidConfigurationException,
                                              ConfigurationException
Overwrite the specified configuration by copying another configuration over it. This includes assigning any designations of the configuration to be overwritten to the configuration to be copied. Both configurations must already be in the data source. (This method is needed to implement baselining).

Specified by:
overwriteConfiguration in interface ConfigurationTransaction
Parameters:
configToCopy - the ConfigurationID of the Configuration to be copied
configToCopy - the ConfigurationID of the Configuration to be deleted - the "configToCopy" will be overwritten in its place.
principalName - the name of the principal that is requesting the modification
Returns:
the new ID of the newly-copied Configuration
Throws:
InvalidConfigurationException - if either ConfigurationID is invalid.
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

saveResources

public void saveResources(java.util.Collection resourceDescriptors,
                          java.lang.String principalName)
                   throws ConfigurationException
Save the resource changes based on each ResourceDescriptor in the collection.

Specified by:
saveResources in interface ConfigurationTransaction
Parameters:
resourceDescriptors - for the resources to be changed *
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.

getConfigurationReader

protected XMLConfigurationReader getConfigurationReader()
                                                 throws ConfigurationException
Throws:
ConfigurationException

getConfigurationWriter

protected XMLConfigurationWriter getConfigurationWriter()
                                                 throws ConfigurationException
Throws:
ConfigurationException


Copyright © 2009. All Rights Reserved.