|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The ConfigurationService
provides access to a heirarchy of nodes
that contain Configuration
data. The main purpose of
implementations of this class is to encapsulate the traversal of the
hierachy.
The name of a configuration is the name of each node in the path through the node hierachy to locate the configuration, each node name starting with '/'. For example, NodeA contains NodeB which contains NodeC which contains configuration data. The name of the configuration object contained within NodeC is /NodeA/NodeB/NodeC.
Copyright 2002 Sapient
Node
Method Summary | |
void |
addNodeListener(String nodeName,
ConfigurationEventListener listener)
Adds a listener to the specified node. |
void |
addNodeListener(String nodeName,
NodeEventListener listener)
Deprecated. use addNodeListener(String nodeName, ConfigurationEventListener listener) instead |
Configuration |
createConfiguration(Class configurationType)
This method is the primary interface to create new instances of Configuration Objects. |
Configuration |
fetchConfiguration(String configurationName)
Returns a Configuration object that contains all of the
configuration data in the ConfigurationDocument located by
configurationName . |
Node |
fetchNode(String nodeName)
Traverses the internal node hierachy and returns the named node |
Configuration |
fetchWritableConfiguration(String configurationName)
Returns a Configuration object that contains all of the
configuration data in the ConfigurationDocument located by
configurationName . |
boolean |
nodeExists(String nodeName)
Returns true if the node exists in the configuration repository and false if it does not exist. |
void |
storeConfiguration(String configurationName,
Configuration config)
The storeConfiguration method persists configuration data
contained in config to the underlying
ConfigurationDocument named by
configurationName . |
Method Detail |
public Configuration fetchConfiguration(String configurationName)
Returns a Configuration
object that contains all of the
configuration data in the ConfigurationDocument
located by
configurationName
.
The returned configuration may be a shared object that is read-only. If it is, the configuration's writable flag is set to false and exceptions will be thrown if an attempt is made to modify the object.
configurationName
- The name of the requested configuration
InvalidParameterException
- when the configurationName
does not contain configuration data or does not start with /.
ConfigurationAccessException
- when the configuration data
can not be read.
ConfigurationNotFoundException
- when the configuration data
can not be read.public Configuration fetchWritableConfiguration(String configurationName)
Returns a Configuration
object that contains all of the
configuration data in the ConfigurationDocument
located by
configurationName
.
The returned configuration is a mutable object and not thread-safe. All access to this object should be in a single threaded or synchronized context. To commit the changes that have been made to this object use the storeConfiguration method.
configurationName
- The name of the requested configuration
InvalidParameterException
- when the configurationName
does not contain configuration data or does not start with /.
ConfigurationAccessException
- when the configuration data
can not be read.
ConfigurationNotFoundException
- when the configuration data
can not be read.public void storeConfiguration(String configurationName, Configuration config) throws ConfigurationStoreException
The storeConfiguration
method persists configuration data
contained in config
to the underlying
ConfigurationDocument
named by
configurationName
. If the
ConfigurationDocument
does not exist, it is created
along with all of its parent Node
s.
configurationName
- The name of the Configuration Document
where the configuration data should be stored.config
- Configuration data to be persisted to the underlying
data store.
InvalidParameterException
- when the
configurationName can not contain configuration data or does
not start with /.
ConfigurationStoreException
- data can not be written to the
backing store.public Configuration createConfiguration(Class configurationType)
This method is the primary interface to create new instances of
Configuration
Objects. This method is capable of creating an empty configuration object
for an interface that extends the
Configuration
interface.
configurationType
- The Class of the configuration type to be
created
public Node fetchNode(String nodeName) throws NodeNotFoundException
nodeName
- the '/' delimeted path to the node
NodeNotFoundException
- when the cannot be found.public void addNodeListener(String nodeName, NodeEventListener listener) throws NodeNotFoundException
nodeName
- the '/' delimeted path to the nodelistener
- the object that will be notified of NodeEvents
NodeNotFoundException
- if nodeName does not existpublic void addNodeListener(String nodeName, ConfigurationEventListener listener) throws NodeNotFoundException
nodeName
- the '/' delimeted path to the nodelistener
- the object that will be notified of NodeEvents
NodeNotFoundException
- if nodeName does not existpublic boolean nodeExists(String nodeName)
nodeName
- the '/' delimeted path to the node
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |