org.stagemonitor.configuration.source.ConfigurationSource Maven / Gradle / Ivy
package org.stagemonitor.configuration.source;
import java.io.IOException;
public interface ConfigurationSource {
/**
* Gets the value for a property key
*
* @param key the property key
* @return the value for the key or null
if not found
*/
String getValue(String key);
/**
* Reloads the configuration to pick up the latest changes
*/
void reload() throws IOException;
/**
* Returns the name of the configuration source.
* For a properties file 'name.properties' could be returned.
*
* @return the name of the configuration source
*/
String getName();
/**
* Returns whether or not it is possible to save values with the {@link #save(String, String)} method.
*
* If this method returns false, {@link #save(String, String)} must throw a {@link UnsupportedOperationException}
*
* @return true
, if saving is possible, false
otherwise
*/
boolean isSavingPossible();
/**
*
*
* @return true
, if saving to this configuration source is persistent, false
otherwise
*/
boolean isSavingPersistent();
/**
* Directly saves the value to the configuration source without checking passwords
*
* @param key a existing config key
* @param value a valid value to save
* @throws IOException if there was an error saving the key to the configuration source
*/
void save(String key, String value) throws IOException;
}