1 /* 2 * ConfigurationStore.java 3 * 4 * Created on October 20, 2004, 12:47 PM 5 */ 6 7 package gov.bnl.gums.configuration; 8 9 import java.io.IOException; 10 import java.util.Collection; 11 12 /** 13 * Encapsulate the logic of retrieving the configuration from where it is stored. 14 * This will allow to retrieve the configuration from a File, from a database, 15 * or from whenever we will need to. 16 * 17 * @author Gabriele Carcassi, Jay Packard 18 */ 19 public interface ConfigurationStore { 20 21 void deleteBackupConfiguration(String dateStr); 22 23 /** 24 * Defines whether a configuration can be retrieved from the store. 25 * This should only check whether configuration information is accessible, 26 * not if it is inconsistent. For example, it should check whether 27 * the configuration file is present, not if contains valid information. 28 * 29 * @return true if the store is configured correctly. 30 */ 31 boolean isActive(); 32 33 /** 34 * Defines whether the configuration can be changed or not. 35 * 36 * @return true if storeConfiguration is allowed. 37 */ 38 boolean isReadOnly(); 39 40 /** 41 * Get a list of config files that have been backed up 42 * 43 * @return collection of date strings. 44 */ 45 Collection getBackupConfigDates(); 46 47 /** 48 * Loads the configuration in memory. If the configuration cannot be loaded 49 * due to an inconsistency in the store, it should throw an exception. 50 * 51 * @return A configuration object. 52 */ 53 Configuration retrieveConfiguration() throws RuntimeException; 54 55 /** 56 * Restores configuration in memory. If the configuration cannot be loaded 57 * due to an inconsistency in the store, it should throw an exception. 58 * 59 * @return A configuration object. 60 */ 61 Configuration restoreConfiguration(String dateStr) throws RuntimeException; 62 63 /** 64 * Set and store the configuration. 65 * 66 * @param conf 67 */ 68 void setConfiguration(Configuration conf, boolean backupCopy) throws Exception; 69 70 }