Package org.bedework.util.config
Class ConfigurationFileStore
- java.lang.Object
-
- org.bedework.util.config.ConfigurationFileStore
-
- All Implemented Interfaces:
ConfigurationStore
public class ConfigurationFileStore extends Object implements ConfigurationStore
A configuration file store holds configurations in files within a directory.- Author:
- Mike Douglass douglm
-
-
Constructor Summary
Constructors Constructor Description ConfigurationFileStore(Path dirPath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigBase<?>getConfig(String name)Stored config must indicate class of object as an attributeConfigBase<?>getConfig(String name, Class<?> cl)List<String>getConfigs()List the configurations in the storeFilegetDirFile()PathgetDirPath()ResourceBundlegetResource(String name, String locale)ConfigurationStoregetStore(String name)Get the named store.booleanreadOnly()voidsaveConfiguration(ConfigBase<?> config)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bedework.util.config.ConfigurationStore
ensureDir
-
-
-
-
Constructor Detail
-
ConfigurationFileStore
public ConfigurationFileStore(Path dirPath)
- Parameters:
dirPath- Path object already checked to be a directory
-
-
Method Detail
-
readOnly
public boolean readOnly()
- Specified by:
readOnlyin interfaceConfigurationStore- Returns:
- true for a read-only store.
-
getDirPath
public Path getDirPath()
- Specified by:
getDirPathin interfaceConfigurationStore- Returns:
- path for this store
-
saveConfiguration
public void saveConfiguration(ConfigBase<?> config) throws ConfigException
- Specified by:
saveConfigurationin interfaceConfigurationStore- Parameters:
config- to save- Throws:
ConfigException- on error
-
getConfig
public ConfigBase<?> getConfig(String name) throws ConfigException
Description copied from interface:ConfigurationStoreStored config must indicate class of object as an attribute- Specified by:
getConfigin interfaceConfigurationStore- Parameters:
name- of the object- Returns:
- config or null
- Throws:
ConfigException- on error
-
getConfig
public ConfigBase<?> getConfig(String name, Class<?> cl) throws ConfigException
- Specified by:
getConfigin interfaceConfigurationStore- Parameters:
name- of the objectcl- - class of config object- Returns:
- config or null
- Throws:
ConfigException- on error
-
getDirFile
public File getDirFile()
-
getConfigs
public List<String> getConfigs() throws ConfigException
Description copied from interface:ConfigurationStoreList the configurations in the store- Specified by:
getConfigsin interfaceConfigurationStore- Returns:
- list of configurations
- Throws:
ConfigException- on error
-
getStore
public ConfigurationStore getStore(String name) throws ConfigException
Get the named store. Create it if it does not exist- Specified by:
getStorein interfaceConfigurationStore- Parameters:
name- of config- Returns:
- store
- Throws:
ConfigException
-
getResource
public ResourceBundle getResource(String name, String locale) throws ConfigException
- Specified by:
getResourcein interfaceConfigurationStore- Parameters:
name- of bundlelocale- null for default or a locale String e.g. en_US- Returns:
- a ResourceBundle object or null.
- Throws:
ConfigException- on error
-
-