|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Registry
The Plexus registry is a single source of external configuration for Plexus components and applications. It can be used by components to source configuration, knowing that it can be used from within applications without the information being hard coded into the component.
Field Summary | |
---|---|
static java.lang.String |
ROLE
|
Method Summary | |
---|---|
void |
addChangeListener(RegistryListener listener)
Add a change listener. |
void |
addConfigurationFromFile(java.io.File file)
Load configuration from the given file. |
void |
addConfigurationFromFile(java.io.File file,
java.lang.String prefix)
Load configuration from the given file. |
void |
addConfigurationFromResource(java.lang.String resource)
Load configuration from the given classloader resource. |
void |
addConfigurationFromResource(java.lang.String resource,
java.lang.String prefix)
Load configuration from the given classloader resource. |
java.lang.String |
dump()
Dump the entire registry to a string, for debugging purposes. |
boolean |
getBoolean(java.lang.String key)
Get a boolean value from the registry. |
boolean |
getBoolean(java.lang.String key,
boolean defaultValue)
Get a boolean value from the registry. |
int |
getInt(java.lang.String key)
Get an integer value from the registry. |
int |
getInt(java.lang.String key,
int defaultValue)
Get an integer value from the registry. |
java.util.Collection |
getKeys()
Get all the keys in this registry. |
java.util.List |
getList(java.lang.String key)
Get a list of strings at the given key in the registry. |
java.util.Properties |
getProperties(java.lang.String key)
TODO move to Map which is more generic ? Get the properties at the given key in the registry. |
Registry |
getSection(java.lang.String name)
Get a subsection of the registry, identified by the given name. |
java.lang.String |
getString(java.lang.String key)
Get a string value from the registry. |
java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue)
Get a string value from the registry. |
Registry |
getSubset(java.lang.String key)
Get a subset of the registry, for all keys descended from the given key. |
java.util.List |
getSubsetList(java.lang.String key)
Get a list of subsets of the registry, for all keys descended from the given key. |
boolean |
isEmpty()
Determine if the registry contains any elements. |
void |
remove(java.lang.String key)
Remove a keyed element from the registry. |
void |
removeSubset(java.lang.String key)
Remove a keyed subset of the registry. |
void |
save()
Save any changes to the registry since it was loaded. |
void |
setBoolean(java.lang.String key,
boolean value)
Set a boolean value in the registry. |
void |
setInt(java.lang.String key,
int value)
Set an integer value in the registry. |
void |
setString(java.lang.String key,
java.lang.String value)
Set a string value in the registry. |
Field Detail |
---|
static final java.lang.String ROLE
Method Detail |
---|
java.lang.String dump()
java.lang.String getString(java.lang.String key)
null
is returned.
key
- the key in the registry
java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
key
- the key in the registrydefaultValue
- the default value
void setString(java.lang.String key, java.lang.String value)
key
- the key in the registryvalue
- the value to setint getInt(java.lang.String key)
key
- the key in the registry
java.util.NoSuchElementException
- if the key is not foundint getInt(java.lang.String key, int defaultValue)
key
- the key in the registrydefaultValue
- the default value
void setInt(java.lang.String key, int value)
key
- the key in the registryvalue
- the value to setboolean getBoolean(java.lang.String key)
key
- the key in the registry
java.util.NoSuchElementException
- if the key is not foundboolean getBoolean(java.lang.String key, boolean defaultValue)
key
- the key in the registrydefaultValue
- the default value
void setBoolean(java.lang.String key, boolean value)
key
- the key in the registryvalue
- the value to setvoid addConfigurationFromResource(java.lang.String resource) throws RegistryException
resource
- the location to load the configuration from
RegistryException
- if a problem occurred reading the resource to add to the registryvoid addConfigurationFromResource(java.lang.String resource, java.lang.String prefix) throws RegistryException
resource
- the location to load the configuration fromprefix
- the location to add the configuration at in the registry
RegistryException
- if a problem occurred reading the resource to add to the registryvoid addConfigurationFromFile(java.io.File file) throws RegistryException
file
- the location to load the configuration from
RegistryException
- if a problem occurred reading the resource to add to the registryvoid addConfigurationFromFile(java.io.File file, java.lang.String prefix) throws RegistryException
file
- the location to load the configuration fromprefix
- the location to add the configuration at in the registry
RegistryException
- if a problem occurred reading the resource to add to the registryboolean isEmpty()
java.util.List getList(java.lang.String key)
key
- the key to lookup
java.util.Properties getProperties(java.lang.String key)
key
- the key to lookup
Registry getSubset(java.lang.String key)
key
- the key to take the subset from
java.util.List getSubsetList(java.lang.String key)
key
- the key to take the subsets from
Registry getSection(java.lang.String name)
null
will be
returned.
name
- registry section name
void save() throws RegistryException, java.lang.UnsupportedOperationException
RegistryException
- if there was a problem saving the registry
java.lang.UnsupportedOperationException
- if the registry is not writablevoid addChangeListener(RegistryListener listener)
listener
- the listenerjava.util.Collection getKeys()
void remove(java.lang.String key)
key
- the key to removevoid removeSubset(java.lang.String key)
key
- the subset to remove
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |