|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.sape.carbon.core.config.format.DefaultConfigurationFormatService
This default implementation of the configuration format serivce provides an XML based configuration to implemented interface form of configurations.
Copyright 2002 Sapient
Field Summary | |
private org.apache.commons.logging.Log |
log
Provides a handle to Apache-commons logger |
Constructor Summary | |
DefaultConfigurationFormatService()
|
Method Summary | |
void |
alterChildConfiguration(Configuration parentConfig,
String childName,
Configuration newConfig)
Alters the configuration named by childName within parentConfig, setting it to the value of newConfig. |
protected String |
constructIndexedName(String parentName,
String name,
int index)
Creates an indexed name for use within the format service. |
protected String |
constructMapName(String parentName,
String name,
String key)
Creates an indexed name for use within the format service. |
Configuration |
getChildConfiguration(Configuration parentConfig,
String childName)
Gets the child Configuration object of parentConfig
that is named by the childName . |
Set |
getChildConfigurationNames(Configuration parentConfig)
This implementation uses Introspection to determine the list of all attributes the parentConfig contains. |
private Class |
getContentType(Class configurationType,
String attrName)
Gets the type of class contained within the given map. |
Configuration |
newConfiguration(Class configurationClass)
Creates a new configuration object of the type specified. |
Configuration |
readConfigurationStream(String name,
InputStream in)
Loads a Configuration object from the given
InputStream . |
void |
writeConfigurationStream(Configuration configuration,
OutputStream out)
Stores the raw version of the provided Configuration
object in the format that this format service implementation
understands. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private org.apache.commons.logging.Log log
Constructor Detail |
public DefaultConfigurationFormatService()
Method Detail |
public Configuration newConfiguration(Class configurationClass)
Creates a new configuration object of the type specified.
newConfiguration
in interface ConfigurationFormatService
configurationClass
- type of the configuration object to build
public Configuration readConfigurationStream(String name, InputStream in) throws ConfigurationFormatException
Loads a Configuration
object from the given
InputStream
. This Configuration object will represent
the full object-graph depiction of a live configuration.
readConfigurationStream
in interface ConfigurationFormatService
name
- The name of the configuration nodein
- the InputStream
from which
the configuration will be read
ConfigurationFormatException
- when there is a formatting error
with the input streampublic void writeConfigurationStream(Configuration configuration, OutputStream out) throws ConfigurationFormatException
Stores the raw version of the provided Configuration
object in the format that this format service implementation
understands.
writeConfigurationStream
in interface ConfigurationFormatService
out
- The output stream to which the raw configuration
data should be writtenconfiguration
- The Configuration object to be stored; may be any
subclass of Configuration
ConfigurationFormatException
- When unable to write a
configuration's raw format to the output streamprotected String constructIndexedName(String parentName, String name, int index)
parentName
- for use when creating absolute indexed names, can be
null for creating local namesname
- name of indexed attribute, cannot be nullindex
- cannot be negative
protected String constructMapName(String parentName, String name, String key)
parentName
- for use when creating absolute indexed names, can be
null for creating local namesname
- name of indexed attribute, cannot be nullkey
- they lookup key for the map attribute
public Configuration getChildConfiguration(Configuration parentConfig, String childName)
ConfigurationFormatService
parentConfig
that is named by the childName
. childName
may
be an indexed (see constructIndexedName).
Returns null if it does not exist.
getChildConfiguration
in interface ConfigurationFormatService
parentConfig
- parent of requested child configurationchildName
- child configuration name
ConfigurationFormatService.getChildConfiguration(org.sape.carbon.core.config.Configuration, java.lang.String)
public Set getChildConfigurationNames(Configuration parentConfig)
getChildConfigurationNames
in interface ConfigurationFormatService
parentConfig
- parent of requested child configuration names
ConfigurationFormatService.getChildConfigurationNames(org.sape.carbon.core.config.Configuration)
public void alterChildConfiguration(Configuration parentConfig, String childName, Configuration newConfig)
ConfigurationFormatService
alterChildConfiguration
in interface ConfigurationFormatService
parentConfig
- the parent containing childNamechildName
- the child to be alterednewConfig
- the new value for the child configConfigurationFormatService.alterChildConfiguration(org.sape.carbon.core.config.Configuration, java.lang.String, org.sape.carbon.core.config.Configuration)
private Class getContentType(Class configurationType, String attrName)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |