gov.bnl.gums.configuration
Class DBConfigurationStore

java.lang.Object
  extended by gov.bnl.gums.configuration.ConfigurationStore
      extended by gov.bnl.gums.configuration.DBConfigurationStore

public class DBConfigurationStore
extends ConfigurationStore

Implements the logic to store the configuration in a database except for the bare configuration to specify the persistence factory at which to store the configuration.

Author:
Jay Packard

Field Summary
 
Fields inherited from class gov.bnl.gums.configuration.ConfigurationStore
format
 
Constructor Summary
DBConfigurationStore(ConfigurationDB configDB)
           
 
Method Summary
 void deleteBackupConfiguration(String name)
          Delete backup configuration
 Collection getBackupNames()
          Get a list of config date strings that have been backed up
 Date getLastModification()
          Get last modified
 boolean isActive()
          Defines whether a configuration can be retrieved from the store.
 Configuration restoreConfiguration(String name)
          Restores configuration in memory.
 Configuration retrieveConfiguration()
          Loads the configuration in memory if or from storage based on reload.
 void setConfiguration(Configuration conf, boolean backupCopy, String name, Date date)
          Set and store the configuration.
 
Methods inherited from class gov.bnl.gums.configuration.ConfigurationStore
getFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBConfigurationStore

public DBConfigurationStore(ConfigurationDB configDB)
Method Detail

deleteBackupConfiguration

public void deleteBackupConfiguration(String name)
Description copied from class: ConfigurationStore
Delete backup configuration

Specified by:
deleteBackupConfiguration in class ConfigurationStore

isActive

public boolean isActive()
Description copied from class: ConfigurationStore
Defines whether a configuration can be retrieved from the store. This should only check whether configuration information is accessible, not if it is inconsistent. For example, it should check whether the configuration file is present, not if contains valid information.

Specified by:
isActive in class ConfigurationStore
Returns:
true if the store is configured correctly.

getBackupNames

public Collection getBackupNames()
Description copied from class: ConfigurationStore
Get a list of config date strings that have been backed up

Specified by:
getBackupNames in class ConfigurationStore
Returns:
collection of date strings.

getLastModification

public Date getLastModification()
Description copied from class: ConfigurationStore
Get last modified

Specified by:
getLastModification in class ConfigurationStore
Returns:
Date

retrieveConfiguration

public Configuration retrieveConfiguration()
                                    throws Exception
Description copied from class: ConfigurationStore
Loads the configuration in memory if or from storage based on reload. This is useful if needsReload was called previously and you don't want to look it up again for performance's sake. If the configuration cannot be loaded due to an inconsistency in the store, it should throw an exception.

Specified by:
retrieveConfiguration in class ConfigurationStore
Returns:
A configuration object.
Throws:
Exception

restoreConfiguration

public Configuration restoreConfiguration(String name)
                                   throws Exception
Description copied from class: ConfigurationStore
Restores configuration in memory. If the configuration cannot be loaded due to an inconsistency in the store, it should throw an exception.

Specified by:
restoreConfiguration in class ConfigurationStore
Returns:
A configuration object.
Throws:
Exception

setConfiguration

public void setConfiguration(Configuration conf,
                             boolean backupCopy,
                             String name,
                             Date date)
                      throws Exception
Description copied from class: ConfigurationStore
Set and store the configuration. A configuration may specify to store the configuration using another configuration store, so this function also returns itself or a updated configuration store

Specified by:
setConfiguration in class ConfigurationStore
Throws:
Exception


Copyright © 2004-2009. All Rights Reserved.