com.metamatrix.common.config
Class CurrentConfiguration

java.lang.Object
  extended by com.metamatrix.common.config.CurrentConfiguration

public final class CurrentConfiguration
extends java.lang.Object

This class represents a single and universal framework for accessing the current configuration for an application or server VM. The current configuration contains the specification of runtime properties and component deployment information. Depending upon the bootstrap information, this framework may access the configuration information from a central repository or simply from a local file.

This framework can be configured to periodically refresh the cached configuation information, and a separate thread is used to do this in the background. As such, the static shutdown() method should be called by applications when exiting. This method will block until this framework has successfully shutdown and cleaned up all resources, and will return gracefully if the method were already called. Note, however, that any call to this framework to obtain configuration information will restart the framework, requiring another eventual shutdown.


Field Summary
static java.lang.String BOOTSTRAP_FILE_NAME
           
static java.lang.String BOOTSTRAP_FILE_PROPERTY_OVERRIDE
           
static java.lang.String CLUSTER_MEMBERS
           
static java.lang.String CLUSTER_NAME
           
static java.lang.String CONFIGURATION_NAME
           
static java.lang.String CONFIGURATION_READER_CLASS_PROPERTY_NAME
           
 
Method Summary
 java.lang.String getBindAddress()
           
 java.util.Properties getBootStrapProperties()
           
 java.lang.String getClusterName()
           
 java.util.Collection<ComponentType> getComponentTypes(boolean includeDeprecated)
          Returns a Collection of type ComponentType that represent all the ComponentTypes defined.
 Configuration getConfiguration()
          Get the current configuration that is to be used for deployment.
 ConfigurationModelContainer getConfigurationModel()
          Get the current configuration that is to be used for deployment.
 java.lang.String getConfigurationName()
           
 Host getDefaultHost()
          Returns the Host based on the current running machine.
 java.net.InetAddress getHostAddress()
           
 java.lang.String getHostInfo()
          Return the stringified representation of this application information object.
static CurrentConfiguration getInstance()
           
 java.lang.String getProcessName()
           
 java.util.Properties getProperties()
          Get all of the configuration properties.
 java.util.Properties getResourceProperties(java.lang.String resourceName)
          Get the connection properties for the specified resource.
 java.util.Properties getSystemBootStrapProperties()
           
 boolean isAvailable()
           
static void reset()
          Reset causes not just a refresh, but the bootstrapping process to occur again.
 void setProcessName(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOOTSTRAP_FILE_PROPERTY_OVERRIDE

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

BOOTSTRAP_FILE_NAME

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

CONFIGURATION_READER_CLASS_PROPERTY_NAME

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

CLUSTER_NAME

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

CONFIGURATION_NAME

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

CLUSTER_MEMBERS

public static final java.lang.String CLUSTER_MEMBERS
See Also:
Constant Field Values
Method Detail

getInstance

public static CurrentConfiguration getInstance()

isAvailable

public boolean isAvailable()

getHostInfo

public java.lang.String getHostInfo()
Return the stringified representation of this application information object.

Returns:
the string form of this object; never null

setProcessName

public void setProcessName(java.lang.String name)

getBindAddress

public java.lang.String getBindAddress()

getHostAddress

public java.net.InetAddress getHostAddress()

getConfigurationName

public java.lang.String getConfigurationName()

getProcessName

public java.lang.String getProcessName()

getClusterName

public java.lang.String getClusterName()
                                throws ConfigurationException
Throws:
ConfigurationException

getProperties

public java.util.Properties getProperties()
Get all of the configuration properties. The properties that are returned have default properties that are the bootstrap properties.

Returns:
the immutable properties; never null
Throws:
ConfigurationException - if the current configuration and/or bootstrap properties could not be obtained

getResourceProperties

public java.util.Properties getResourceProperties(java.lang.String resourceName)
                                           throws ConfigurationException
Get the connection properties for the specified resource. The resourse name is dependent on the type of resource. For services, excluding connectors, the resource name will be the component type name ComponentType. For other types, they will generally have a predefined static variable called RESOURCE_NAME that will be used to ask for its properties.

Parameters:
resourceName - is the name of the resource to obtain properties for.
Returns:
the immutable properties; never null
Throws:
ConfigurationException - if the current configuration and/or bootstrap properties could not be obtained

getConfiguration

public Configuration getConfiguration()
                               throws ConfigurationException
Get the current configuration that is to be used for deployment.

Returns:
the Configuration used for deployment
Throws:
ConfigurationException - if the current configuration could not be obtained

getConfigurationModel

public ConfigurationModelContainer getConfigurationModel()
                                                  throws ConfigurationException
Get the current configuration that is to be used for deployment.

Returns:
the Configuration used for deployment
Throws:
ConfigurationException - if the current configuration could not be obtained

getComponentTypes

public java.util.Collection<ComponentType> getComponentTypes(boolean includeDeprecated)
                                                      throws ConfigurationException
Returns a Collection of type ComponentType that represent all the ComponentTypes defined.

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:
List of type ComponentType
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service.
See Also:
com.metamatrix.common.api.ComponentType

getDefaultHost

public Host getDefaultHost()
Returns the Host based on the current running machine.

Returns:
the full Host object
Throws:
ConfigurationException - if an error occurred within or during communication with the Configuration Service, or if there is no object for the given ID.

reset

public static void reset()
Reset causes not just a refresh, but the bootstrapping process to occur again.


getBootStrapProperties

public java.util.Properties getBootStrapProperties()

getSystemBootStrapProperties

public final java.util.Properties getSystemBootStrapProperties()


Copyright © 2009. All Rights Reserved.