com.metamatrix.common.config.reader
Class PropertiesConfigurationReader

java.lang.Object
  extended by com.metamatrix.common.config.reader.PropertiesConfigurationReader
All Implemented Interfaces:
CurrentConfigurationReader

public class PropertiesConfigurationReader
extends java.lang.Object
implements CurrentConfigurationReader

This class implements a self-contained reader for the current configuration, and should be used only by the CurrentConfiguration framework. As such, this is an extremely low-level implementation that may not use anything but com.metamatrix.common.util components and only components that do not use LogManager.

Each class that implements this interface must supply a no-arg constructor.


Field Summary
static java.lang.String FILENAME
          The environment property name for the property file that contains the configuration.
 
Constructor Summary
PropertiesConfigurationReader()
          Default, no-arg constructor
 
Method Summary
 void close()
          This method should close the connection to the repository that holds the current configuration.
 void connect(java.util.Properties env)
          This method should connect to the repository that holds the current configuration, using the specified properties.
 ConfigurationModelContainer getConfigurationModel()
          Obtain the next startup configuration model.
 void indicateSystemShutdown()
          This will put the system into a state of StartupStateController.STATE_STOPPED.
 void performSystemInitialization(boolean forceInitialization)
          This method should be called only by com.metamatrix.platform.util.MetaMatrixController to initialize the system configurations during bootstrapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILENAME

public static final java.lang.String FILENAME
The environment property name for the property file that contains the configuration.

See Also:
Constant Field Values
Constructor Detail

PropertiesConfigurationReader

public PropertiesConfigurationReader()
Default, no-arg constructor

Method Detail

connect

public void connect(java.util.Properties env)
             throws ConfigurationConnectionException
This method should connect to the repository that holds the current configuration, using the specified properties. The implementation may not use logging but instead should rely upon returning an exception in the case of any errors.

Specified by:
connect in interface CurrentConfigurationReader
Parameters:
env - the environment properties that define the information
Throws:
ConfigurationConnectionException - if there is an error establishing the connection.

close

public void close()
           throws java.lang.Exception
This method should close the connection to the repository that holds the current configuration. The implementation may not use logging but instead should rely upon returning an exception in the case of any errors.

Specified by:
close in interface CurrentConfigurationReader
Throws:
java.lang.Exception - if there is an error establishing the connection.

getConfigurationModel

public ConfigurationModelContainer getConfigurationModel()
                                                  throws ConfigurationException
Obtain the next startup configuration model. The implementation may not use logging but instead should rely upon returning an exception in the case of any errors.

Specified by:
getConfigurationModel in interface CurrentConfigurationReader
Returns:
the serializable Configuration instance
Throws:
ConfigurationException - if an error occurred within or during communication with the repository.

indicateSystemShutdown

public void indicateSystemShutdown()
                            throws ConfigurationException
Description copied from interface: CurrentConfigurationReader
This will put the system into a state of StartupStateController.STATE_STOPPED.

Specified by:
indicateSystemShutdown in interface CurrentConfigurationReader
Throws:
ConfigurationException - if an error occurred in communication with the configuration data source

performSystemInitialization

public void performSystemInitialization(boolean forceInitialization)
                                 throws StartupStateException,
                                        ConfigurationException
Description copied from interface: CurrentConfigurationReader
This method should be called only by com.metamatrix.platform.util.MetaMatrixController to initialize the system configurations during bootstrapping. This method will attempt to put the system state into StartupStateController.STATE_STARTING, and then commence with initialization. If the state is already StartupStateController.STATE_STARTING, then another MetaMatrixController is already currently in the process of starting the system, and a StartupStateException will be thrown. If this method returns without an exception, then the system state will be in state StartupStateController.STATE_STARTING, and the calling code should proceed with startup.

Specified by:
performSystemInitialization in interface CurrentConfigurationReader
Parameters:
forceInitialization - if the system is in a state other than StartupStateController.STATE_STOPPED, and the administrator thinks the system actually crashed and is not really running, he can choose to force the initialization. Otherwise, if the system is in one of these states, an exception will be thrown.
Throws:
StartupStateException - if the system is not in a state in which initialization can proceed. This exception will indicate the current system state.
ConfigurationException - if the current configuration and/or bootstrap properties could not be obtained NOTE: This method replaces the begin... and finish.. SystemInitialization methods for the new configuration implementations.


Copyright © 2009. All Rights Reserved.