public class ConfigurationManager extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected ConfigurationReader |
configReader |
protected ConfigurationWriter |
configWriter |
static java.lang.String |
dotKeplerConfigurationsDir |
Modifier and Type | Method and Description |
---|---|
void |
addConfigurationListener(ConfigurationEventListener listener)
add a configuration listener
|
void |
addProperties(java.util.List<RootConfigurationProperty> propertyList)
set a list of properties all at once
|
void |
addProperty(RootConfigurationProperty property)
add a property to the manager
|
protected void |
clearConfigurations()
remove all configurations currently listed and reset the configuration
manager back to its un-initialized state.
|
static ConfigurationManager |
getInstance()
singleton accessor
|
protected static ConfigurationManager |
getInstance(boolean loadConfiguration)
singleton accessor. set loadConfiguration to true if you want to
load the configuration automatically.
|
static org.kepler.build.modules.Module |
getModule(java.lang.String name)
get a module by name. return null if not found
|
static java.io.File |
getOverwriteFile(org.kepler.build.modules.Module m,
java.io.File f)
returns the file from the .kepler directory if it exists, returns f if
it doesn't.
|
java.util.List<ConfigurationProperty> |
getProperties()
return all properties handled by the manager
|
java.util.List<ConfigurationProperty> |
getProperties(org.kepler.build.modules.Module module)
get a list of properties that belong to a module
|
java.util.List<ConfigurationProperty> |
getProperties(org.kepler.build.modules.Module module,
ConfigurationNamespace namespace)
get a list of properties that belong to a certain module within a specific
namespace
|
java.util.List<ConfigurationProperty> |
getProperties(org.kepler.build.modules.Module module,
ConfigurationNamespace namespace,
java.lang.String name)
get a list of properties that belong to a certain module with a specific
name within a namespace
|
java.util.List<ConfigurationProperty> |
getProperties(org.kepler.build.modules.Module module,
java.lang.String name)
get a list of properties that belong to a certain module with a specific
name.
|
ConfigurationProperty |
getProperty(org.kepler.build.modules.Module module)
Returns the root property of the default configuration for a module.
|
ConfigurationProperty |
getProperty(org.kepler.build.modules.Module module,
ConfigurationNamespace namespace)
return the root ConfigurationProperty of the namespace.
|
ConfigurationProperty |
getProperty(org.kepler.build.modules.Module module,
ConfigurationNamespace namespace,
java.lang.String name)
return a single property from a module with a specific name in a specific
namespace.
|
ConfigurationProperty |
getProperty(org.kepler.build.modules.Module module,
java.lang.String name)
get a property from the module's default namespace configuration with
a given name
|
protected void |
loadConfiguration()
deserialize the configuration
|
protected void |
notifyListeners(ConfigurationProperty property)
notify any listeners that a configuration event has occured
|
void |
removeConfigurationListener(ConfigurationEventListener listener)
remove a listener
|
protected static java.lang.String |
removeFileExtension(java.lang.String filename)
utility method to remove the file extension from the filename
|
protected static java.lang.String |
removeLocaleDesignator(java.lang.String filename)
remove the locale designator from a filename. this works with
or without a file extension (i.e. .xml).
|
void |
saveConfiguration()
serialize the entire configuration
|
protected ConfigurationWriter configWriter
protected ConfigurationReader configReader
public static final java.lang.String dotKeplerConfigurationsDir
public static ConfigurationManager getInstance()
protected static ConfigurationManager getInstance(boolean loadConfiguration)
public void addProperty(RootConfigurationProperty property) throws NamespaceException
property
- the property to addNamespaceException
public void addProperties(java.util.List<RootConfigurationProperty> propertyList) throws NamespaceException
propertyList
- the list of properties to addNamespaceException
public java.util.List<ConfigurationProperty> getProperties()
public java.util.List<ConfigurationProperty> getProperties(org.kepler.build.modules.Module module)
module
- the module to get the property list forpublic java.util.List<ConfigurationProperty> getProperties(org.kepler.build.modules.Module module, ConfigurationNamespace namespace)
module
- namespace
- namespace within the module to get a property list forpublic java.util.List<ConfigurationProperty> getProperties(org.kepler.build.modules.Module module, ConfigurationNamespace namespace, java.lang.String name)
module
- namespace
- namespace within the modulename
- name of the property to getpublic java.util.List<ConfigurationProperty> getProperties(org.kepler.build.modules.Module module, java.lang.String name)
module
- name
- the name of the property to getpublic ConfigurationProperty getProperty(org.kepler.build.modules.Module module)
module
- the module to get the default configuration for.public ConfigurationProperty getProperty(org.kepler.build.modules.Module module, ConfigurationNamespace namespace)
module
- the module to get the property fromnamespace
- the namespace to get the property frompublic ConfigurationProperty getProperty(org.kepler.build.modules.Module module, java.lang.String name)
module
- the module to get the property fromname
- the name of the property to get.public ConfigurationProperty getProperty(org.kepler.build.modules.Module module, ConfigurationNamespace namespace, java.lang.String name)
module
- the module to get the property fromnamespace
- the namespace to get the property fromname
- the name of the property to getpublic void saveConfiguration() throws ConfigurationManagerException
ConfigurationManagerException
public void addConfigurationListener(ConfigurationEventListener listener)
listener
- the listener to addpublic void removeConfigurationListener(ConfigurationEventListener listener)
listener
- the listener to removepublic static java.io.File getOverwriteFile(org.kepler.build.modules.Module m, java.io.File f)
m
- the module to get the overwrite file fromf
- the file to getpublic static org.kepler.build.modules.Module getModule(java.lang.String name)
name
- the name of the module to getprotected void notifyListeners(ConfigurationProperty property)
property
- the property that changed to send to the listenersprotected void loadConfiguration() throws ConfigurationManagerException
ConfigurationManagerException
protected void clearConfigurations()
protected static java.lang.String removeFileExtension(java.lang.String filename)
filename
- the filename to remove the extension fromprotected static java.lang.String removeLocaleDesignator(java.lang.String filename)