gov.bnl.gums.configuration
Class ConfigurationStore

java.lang.Object
  extended by gov.bnl.gums.configuration.ConfigurationStore
Direct Known Subclasses:
DBConfigurationStore, FileConfigurationStore

public abstract class ConfigurationStore
extends Object

Encapsulate the logic of retrieving the configuration from where it is stored. This will allow to retrieve the configuration from a File, from a database, or from whenever we will need to.

Author:
Gabriele Carcassi, Jay Packard

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

Field Detail

format

protected static DateFormat format
Constructor Detail

ConfigurationStore

public ConfigurationStore()
Method Detail

deleteBackupConfiguration

public abstract void deleteBackupConfiguration(String name)
Delete backup configuration

Parameters:
A - date string

getBackupNames

public abstract Collection getBackupNames()
Get a list of config date strings that have been backed up

Returns:
collection of date strings.

getLastModification

public abstract Date getLastModification()
Get last modified

Returns:
Date

isActive

public abstract boolean isActive()
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.

Returns:
true if the store is configured correctly.

restoreConfiguration

public abstract Configuration restoreConfiguration(String dateStr)
                                            throws Exception
Restores configuration in memory. If the configuration cannot be loaded due to an inconsistency in the store, it should throw an exception.

Parameters:
A - date string
Returns:
A configuration object.
Throws:
Exception

retrieveConfiguration

public abstract Configuration retrieveConfiguration()
                                             throws Exception
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.

Returns:
A configuration object.
Throws:
Exception

setConfiguration

public abstract void setConfiguration(Configuration conf,
                                      boolean backupCopy,
                                      String name,
                                      Date date)
                               throws Exception
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

Parameters:
conf -
backupCopy -
Throws:
Exception

getFormat

public static DateFormat getFormat()


Copyright © 2004-2009. All Rights Reserved.