com.metamatrix.platform.config.persistence.impl.file
Class FilePersistentConnection

java.lang.Object
  extended by com.metamatrix.platform.config.persistence.impl.file.FilePersistentConnection
All Implemented Interfaces:
PersistentConnection

public class FilePersistentConnection
extends java.lang.Object
implements PersistentConnection


Field Summary
static java.lang.String CONFIG_FILE_PATH_PROPERTY
          Defines the path location for the configuration files.
static java.lang.String CONFIG_NS_FILE_NAME_PROPERTY
          Defines the configuration file override to be used as NextStartup
static java.lang.String NEXT_STARTUP_FILE_NAME
          The actual name of the NextStart Configuration.
 
Constructor Summary
FilePersistentConnection(java.util.Properties props, ConfigurationModelContainerAdapter adapter)
           
 
Method Summary
 void beginTransaction()
           
 void close()
          call close when the connection is no longer needed.
 void commit()
           
 void delete(ConfigurationID configID, java.lang.String principal)
          Writes the collection of models to its persistent store based on the implementation of the persistent connection.
 int getServerState()
          Call to get the current state
 java.util.Date getStartupTime()
          Call to get the current state
 boolean isClosed()
          call to determine is the connection is still available.
 ConfigurationModelContainer read(ConfigurationID configID)
          Returns an ConfigurationModelContainer based on how the implementation read configuation information
 void rollback()
           
 void setServerStarted()
          Call to set the startup state to @see {StartupStateController.STARTED Started}.
 void setServerStarting()
          Call to set the startup state to @see {StartupStateController.STARTING Starting}.
 void setServerStarting(boolean force)
          Call to forcibly set the startup state to @see {StartupStateController.STARTING Starting}, regardless of the current state of the server.
 void setServerStopped()
          Call to set the startup state to @see {StartupStateController.STOPPED Stopped}.
 void write(ConfigurationModelContainer model, java.lang.String principal)
          Writes the model to its persistent store based on the implementation of the persistent connection.
 void write(ConfigurationModelContainer model, java.lang.String fileName, java.lang.String principal)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_NS_FILE_NAME_PROPERTY

public static final java.lang.String CONFIG_NS_FILE_NAME_PROPERTY
Defines the configuration file override to be used as NextStartup

See Also:
Constant Field Values

CONFIG_FILE_PATH_PROPERTY

public static final java.lang.String CONFIG_FILE_PATH_PROPERTY
Defines the path location for the configuration files. If null then no path will be used and it assumed the file is in the classpath.

See Also:
Constant Field Values

NEXT_STARTUP_FILE_NAME

public static final java.lang.String NEXT_STARTUP_FILE_NAME
The actual name of the NextStart Configuration. If the user provides an override @see {#CONFIG_NS_FILE_NAME_PROPERTY}, then it will be copied to this name.

See Also:
Constant Field Values
Constructor Detail

FilePersistentConnection

public FilePersistentConnection(java.util.Properties props,
                                ConfigurationModelContainerAdapter adapter)
Method Detail

close

public void close()
call close when the connection is no longer needed. This resource will be cleaned up.

Specified by:
close in interface PersistentConnection
Throws:
ConfigurationException

isClosed

public boolean isClosed()
call to determine is the connection is still available.

Specified by:
isClosed in interface PersistentConnection
Returns:
boolean true if the connection is available

read

public ConfigurationModelContainer read(ConfigurationID configID)
                                 throws ConfigurationException
Description copied from interface: PersistentConnection
Returns an ConfigurationModelContainer based on how the implementation read configuation information

Specified by:
read in interface PersistentConnection
Parameters:
configID - indicates which configuration to read
Returns:
ConfigurationModel
Throws:
ConfigurationException - if an error occurs

setServerStarting

public void setServerStarting()
                       throws StartupStateException,
                              ConfigurationException
Call to set the startup state to @see {StartupStateController.STARTING Starting}. The server must be in the STOPPED state in order for this to work. Otherwise, a StartpStateException will be thrown.

Specified by:
setServerStarting in interface PersistentConnection
Throws:
StartupStateException - is thrown if the server state is not currently set to STOPPED.
ConfigurationException

setServerStarting

public void setServerStarting(boolean force)
                       throws StartupStateException,
                              ConfigurationException
Call to forcibly set the startup state to @see {StartupStateController.STARTING Starting}, regardless of the current state of the server.

Specified by:
setServerStarting in interface PersistentConnection
Throws:
StartupStateException - is thrown if the server state cannot be set.
ConfigurationException

setServerStarted

public void setServerStarted()
                      throws StartupStateException,
                             ConfigurationException
Call to set the startup state to @see {StartupStateController.STARTED Started}. The server must be in the STARTING state in order for this to work. Otherwise, a StartpStateException will be thrown.

Specified by:
setServerStarted in interface PersistentConnection
Throws:
StartupStateException - is thrown if the server state cannot be set.
ConfigurationException

setServerStopped

public void setServerStopped()
                      throws StartupStateException,
                             ConfigurationException
Call to set the startup state to @see {StartupStateController.STOPPED Stopped}. This is normally called when the system is shutdown.

Specified by:
setServerStopped in interface PersistentConnection
Throws:
StartupStateException - is thrown if the server state cannot be set.
ConfigurationException

getServerState

public int getServerState()
                   throws ConfigurationException
Call to get the current state

Specified by:
getServerState in interface PersistentConnection
Returns:
int state @see {StartupStateController Controller}
Throws:
ConfigurationException - if an error occurs

getStartupTime

public java.util.Date getStartupTime()
                              throws ConfigurationException
Call to get the current state

Specified by:
getStartupTime in interface PersistentConnection
Returns:
int state @see {StartupStateController Controller}
Throws:
ConfigurationException - if an error occurs

write

public void write(ConfigurationModelContainer model,
                  java.lang.String principal)
           throws ConfigurationException
Description copied from interface: PersistentConnection
Writes the model to its persistent store based on the implementation of the persistent connection.

Specified by:
write in interface PersistentConnection
Parameters:
model - to be writen to output
principal - is the user executing the write
Throws:
ConfigurationException - if an error occurs

write

public void write(ConfigurationModelContainer model,
                  java.lang.String fileName,
                  java.lang.String principal)
           throws ConfigurationException
Throws:
ConfigurationException

delete

public void delete(ConfigurationID configID,
                   java.lang.String principal)
            throws ConfigurationException
Description copied from interface: PersistentConnection
Writes the collection of models to its persistent store based on the implementation of the persistent connection.

Specified by:
delete in interface PersistentConnection
principal - is the user executing the write
Throws:
ConfigurationException - if an error occurs

beginTransaction

public void beginTransaction()
                      throws ConfigurationException
Specified by:
beginTransaction in interface PersistentConnection
Throws:
ConfigurationException

commit

public void commit()
            throws ConfigurationException
Specified by:
commit in interface PersistentConnection
Throws:
ConfigurationException

rollback

public void rollback()
              throws ConfigurationException
Specified by:
rollback in interface PersistentConnection
Throws:
ConfigurationException


Copyright © 2009. All Rights Reserved.