|
|||||||||||
| 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.jdom.JDOMPropertyConfiguration
This is an implementation of the string based attribute lookup PropertyConfiguration.
Copyright 2001 Sapient
| Field Summary | |
private static String |
COMMA_DELIMITER
Comma delimiter: , |
private org.jdom.Document |
document
The JDOM document that holds the root element. |
private PropertyConfiguration |
extendedConfig
Holds a reference to the configuration this extends. |
private String |
name
Name of the configuration. |
private static String |
NAME_DELIMITER
Name delimiter: space |
private Map |
propertyCache
cache of text values contained in document keyed by property name |
private org.jdom.Element |
rootElement
Holds the root element of the JDOM document. |
private ConfigurationTypeService |
typeService
Holds a reference to the type config service. |
private static String |
WHITE_SPACE_INPUT_DELIMITERS
Deletermins for whitespace input. |
private static String |
WHITE_SPACE_OUTPUT_DELIMITER
Whitespace output delimiter. |
private boolean |
writable
True if this object may be altered, false if it should throw exceptions when attempts are made to alter it. |
| Constructor Summary | |
JDOMPropertyConfiguration()
Creates a new empty configruation that extends nothing. |
|
JDOMPropertyConfiguration(org.jdom.Document document)
Constructs a JDOMConfigurationProxy for the specified class type. |
|
JDOMPropertyConfiguration(org.jdom.Document document,
PropertyConfiguration extendedConfig)
Constructs a new configruation that extends another configuration. |
|
JDOMPropertyConfiguration(PropertyConfiguration extendedConfig)
Constructs a new blank configruation that extends another configuration. |
|
| Method Summary | |
private String |
arrayToDelimitedString(String[] values,
String delimiter)
Serializes an array of Strings into a single String with values delimited by delimiter |
Object |
clone()
This method makes a deep-copy of the underlying data structure for this configuration |
private String[] |
delimitedStringToArray(String delimitedValues,
String delimiters)
Converts a String with values delimted by delimiters to an array of Strings. |
boolean |
getBooleanProperty(String propertyName)
Retrieves a configured boolean values |
boolean |
getBooleanProperty(String propertyName,
boolean defaultValue)
Retrieves a configured boolean values |
byte |
getByteProperty(String propertyName)
Retrieves a configured byte property. |
byte |
getByteProperty(String propertyName,
byte defaultValue)
Retrieves a configured byte property. |
Class |
getClassProperty(String propertyName)
Retrieves a configured class object |
Class |
getClassProperty(String propertyName,
Class defaultValue)
Retrieves a configured Class values |
Class |
getConfigurationInterface()
Returns the interface of the configuration. |
String |
getConfigurationName()
Returns the name of this configuration in the backing store, but may be null if the Configuration has not yet been saved to the backing store. |
String[] |
getCSVProperty(String propertyName)
Retrieves an array of string values that are retrieved from the configuration document at the supplied key. |
org.jdom.Document |
getDataStructure()
Gets the document containing the root element. |
Date |
getDateProperty(String propertyName)
Retrieves a configured class object |
Date |
getDateProperty(String propertyName,
Date defaultValue)
Retrieves a configured Class values |
double |
getDoubleProperty(String propertyName)
Retrieves a configured double value |
double |
getDoubleProperty(String propertyName,
double defaultValue)
Retrieves a configured double values |
float |
getFloatProperty(String propertyName)
Retrieves a configured float value. |
float |
getFloatProperty(String propertyName,
float defaultValue)
Retrieves a configured float values |
int |
getIntProperty(String propertyName)
Retrieves a configured int value |
int |
getIntProperty(String propertyName,
int defaultValue)
Retrieves a configured int values |
long |
getLongProperty(String propertyName)
Retrieves a configured long property. |
long |
getLongProperty(String propertyName,
long defaultValue)
Retrieves a configured long values |
String |
getProperty(String propertyName)
Retrieves a string property configuration |
private Object |
getProperty(String propertyName,
Object defaultValue,
Class type)
Centralized method for property lookup. |
String |
getProperty(String propertyName,
String defaultValue)
Retrieves a string property configuration or returns the supplied default if none is found. |
org.jdom.Element |
getRootElement()
Gets the root element of the configuration. |
short |
getShortProperty(String propertyName)
Retrieves a configured short value |
short |
getShortProperty(String propertyName,
short defaultValue)
Retrieves a configured short values |
String[] |
getWSVProperty(String propertyName)
Retrieves an array of string values that are retrieved from the configuration document at the supplied key. |
boolean |
isConfigurationWritable()
Is this configuration document writable or is it read-only. |
private void |
preloadProperyCache(org.jdom.Element parentElement,
String parentElementName)
Loads up the property cache with all the values. |
void |
setBooleanProperty(String propertyName,
boolean value)
Sets the property named by propertyName to the value specified by value as a boolean |
void |
setByteProperty(String propertyName,
byte value)
Sets the property named by propertyName to the value specified by value as a byte |
void |
setClassProperty(String propertyName,
Class value)
Sets the property named by propertyName to the value specified by value as a Class |
void |
setConfigurationName(String name)
Alters the name of this configuration document |
void |
setConfigurationReadOnly()
Sets whether this configuration may be altered. |
void |
setCSVProperty(String propertyName,
String[] values)
Sets the property named by propertyName to the value specified by value as a comma separated list of strings |
void |
setDateProperty(String propertyName,
Date value)
Sets the property named by propertyName to the value specified by value as a Class |
void |
setDoubleProperty(String propertyName,
double value)
Sets the property named by propertyName to the value specified by value as a double |
void |
setFloatProperty(String propertyName,
float value)
Sets the property named by propertyName to the value specified by value as a float |
void |
setIntProperty(String propertyName,
int value)
Sets the property named by propertyName to the value specified by value as a int |
void |
setLongProperty(String propertyName,
long value)
Sets the property named by propertyName to the value specified by value as a long |
void |
setProperty(String propertyName,
String value)
Sets the property named by propertyName to the value specified by value as a String |
void |
setShortProperty(String propertyName,
short value)
Sets the property named by propertyName to the value specified by value as a short |
void |
setWSVProperty(String propertyName,
String[] values)
Sets the property named by propertyName to the value specified by value as a white-space separated list of strings |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final String NAME_DELIMITER
private static final String COMMA_DELIMITER
private static final String WHITE_SPACE_OUTPUT_DELIMITER
private static final String WHITE_SPACE_INPUT_DELIMITERS
private String name
private org.jdom.Document document
private org.jdom.Element rootElement
private PropertyConfiguration extendedConfig
private ConfigurationTypeService typeService
private Map propertyCache
private boolean writable
| Constructor Detail |
public JDOMPropertyConfiguration(org.jdom.Document document)
Configuration object.
The supplied document is used as the backing store for
this configuration object's data.
document - The JDOM Document object representing a configurations
datapublic JDOMPropertyConfiguration()
public JDOMPropertyConfiguration(org.jdom.Document document,
PropertyConfiguration extendedConfig)
document - configuration documentextendedConfig - the configuration being extended.public JDOMPropertyConfiguration(PropertyConfiguration extendedConfig)
extendedConfig - the configuration being extended.| Method Detail |
public Class getConfigurationInterface()
getConfigurationInterface in interface Configurationpublic org.jdom.Document getDataStructure()
getDataStructure in interface Configurationpublic org.jdom.Element getRootElement()
getRootElement in interface Configurationpublic String getConfigurationName()
ConfigurationReturns the name of this configuration in the backing store, but may be null if the Configuration has not yet been saved to the backing store.
getConfigurationName in interface ConfigurationConfiguration.getConfigurationName()public void setConfigurationName(String name)
Configuration
setConfigurationName in interface Configurationname - the new name of this configuration documentConfiguration.setConfigurationName(java.lang.String)public Object clone()
ConfigurationThis method makes a deep-copy of the underlying data structure for this configuration
clone in interface Configurationclone in class ObjectConfiguration.clone()public boolean getBooleanProperty(String propertyName)
PropertyConfiguration
getBooleanProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getBooleanProperty(java.lang.String)
public boolean getBooleanProperty(String propertyName,
boolean defaultValue)
PropertyConfiguration
getBooleanProperty in interface PropertyConfigurationdefaultValue - the default boolean to be returned if
none is configuredpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getBooleanProperty(java.lang.String)public byte getByteProperty(String propertyName)
PropertyConfiguration
getByteProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getByteProperty(java.lang.String)
public byte getByteProperty(String propertyName,
byte defaultValue)
PropertyConfiguration
getByteProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration valuedefaultValue - the byte to be returned if none is configured
PropertyConfiguration.getByteProperty(java.lang.String)public String[] getCSVProperty(String propertyName)
PropertyConfiguration
getCSVProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getCSVProperty(java.lang.String)public short getShortProperty(String propertyName)
PropertyConfiguration
getShortProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getShortProperty(java.lang.String)
public short getShortProperty(String propertyName,
short defaultValue)
PropertyConfiguration
getShortProperty in interface PropertyConfigurationdefaultValue - the default short to be returned if
none is configuredpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getShortProperty(java.lang.String)public double getDoubleProperty(String propertyName)
PropertyConfiguration
getDoubleProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getDoubleProperty(java.lang.String)
public double getDoubleProperty(String propertyName,
double defaultValue)
PropertyConfiguration
getDoubleProperty in interface PropertyConfigurationdefaultValue - the default double to be returned if
none is configuredpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getDoubleProperty(java.lang.String)public float getFloatProperty(String propertyName)
PropertyConfiguration
getFloatProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getFloatProperty(java.lang.String)
public float getFloatProperty(String propertyName,
float defaultValue)
PropertyConfiguration
getFloatProperty in interface PropertyConfigurationdefaultValue - the default float to be returned if
none is configuredpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getFloatProperty(java.lang.String)public int getIntProperty(String propertyName)
PropertyConfiguration
getIntProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getIntProperty(java.lang.String)
public int getIntProperty(String propertyName,
int defaultValue)
PropertyConfiguration
getIntProperty in interface PropertyConfigurationdefaultValue - the default int to be returned if none is configuredpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getIntProperty(java.lang.String)public long getLongProperty(String propertyName)
PropertyConfiguration
getLongProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getLongProperty(java.lang.String)
public long getLongProperty(String propertyName,
long defaultValue)
PropertyConfiguration
getLongProperty in interface PropertyConfigurationdefaultValue - the default long to be returned if none is configuredpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getLongProperty(java.lang.String)public String getProperty(String propertyName)
PropertyConfiguration
getProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getProperty(java.lang.String)
public String getProperty(String propertyName,
String defaultValue)
PropertyConfiguration
getProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration valuedefaultValue - the value to be returned if not configured
PropertyConfiguration.getProperty(java.lang.String)public String[] getWSVProperty(String propertyName)
PropertyConfiguration
getWSVProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getWSVProperty(java.lang.String)public Class getClassProperty(String propertyName)
PropertyConfiguration
getClassProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getClassProperty(java.lang.String)
public Class getClassProperty(String propertyName,
Class defaultValue)
PropertyConfiguration
getClassProperty in interface PropertyConfigurationdefaultValue - a fully qualified class name to be
returned if none is configuredpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getClassProperty(java.lang.String)
public Date getDateProperty(String propertyName,
Date defaultValue)
PropertyConfiguration
getDateProperty in interface PropertyConfigurationdefaultValue - a fully qualified class name to be returned
if none is configuredpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getDateProperty(java.lang.String)public Date getDateProperty(String propertyName)
PropertyConfiguration
getDateProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration value
PropertyConfiguration.getDateProperty(java.lang.String)
public void setBooleanProperty(String propertyName,
boolean value)
PropertyConfiguration
setBooleanProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration valuevalue - the new valuePropertyConfiguration.setBooleanProperty(java.lang.String, boolean)
public void setByteProperty(String propertyName,
byte value)
PropertyConfiguration
setByteProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration valuevalue - the new valuePropertyConfiguration.setByteProperty(java.lang.String, byte)
public void setClassProperty(String propertyName,
Class value)
PropertyConfiguration
setClassProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration valuevalue - the new valuePropertyConfiguration.setClassProperty(java.lang.String, java.lang.Class)
public void setCSVProperty(String propertyName,
String[] values)
PropertyConfiguration
setCSVProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration valuevalues - array of the new values that will be serialized, separated
by commasPropertyConfiguration.setCSVProperty(java.lang.String, java.lang.String[])
public void setDateProperty(String propertyName,
Date value)
PropertyConfiguration
setDateProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration valuevalue - the new valuePropertyConfiguration.setDateProperty(java.lang.String, java.util.Date)
public void setDoubleProperty(String propertyName,
double value)
PropertyConfiguration
setDoubleProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration valuevalue - the new valuePropertyConfiguration.setDoubleProperty(java.lang.String, double)
public void setFloatProperty(String propertyName,
float value)
PropertyConfiguration
setFloatProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration valuevalue - the new valuePropertyConfiguration.setFloatProperty(java.lang.String, float)
public void setIntProperty(String propertyName,
int value)
PropertyConfiguration
setIntProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration valuevalue - the new valuePropertyConfiguration.setIntProperty(java.lang.String, int)
public void setLongProperty(String propertyName,
long value)
PropertyConfiguration
setLongProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration valuevalue - the new valuePropertyConfiguration.setLongProperty(java.lang.String, long)
public void setProperty(String propertyName,
String value)
PropertyConfiguration
setProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration valuevalue - the new valuePropertyConfiguration.setProperty(java.lang.String, java.lang.String)
public void setShortProperty(String propertyName,
short value)
PropertyConfiguration
setShortProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration valuevalue - the new valuePropertyConfiguration.setShortProperty(java.lang.String, short)
public void setWSVProperty(String propertyName,
String[] values)
PropertyConfiguration
setWSVProperty in interface PropertyConfigurationpropertyName - a dot ('.') delimeted path/key to the requested
configuration valuevalues - array of the new values that will be serialized, separated
by spaces.PropertyConfiguration.setWSVProperty(java.lang.String, java.lang.String[])
private Object getProperty(String propertyName,
Object defaultValue,
Class type)
propertyName - the name of the property to retreive a value fordefaultValue - the default value that will be returned if no value
can be foundtype - type of object to format the property text into and return
private String[] delimitedStringToArray(String delimitedValues,
String delimiters)
delimitedValues - string to convert to string arraydelimiters - delimiters to use in string conversion
private String arrayToDelimitedString(String[] values,
String delimiter)
values - the array of values to delimitdelimiter - the delimiter to place between the values
public boolean isConfigurationWritable()
isConfigurationWritable in interface Configurationpublic void setConfigurationReadOnly()
setConfigurationReadOnly in interface Configuration
private void preloadProperyCache(org.jdom.Element parentElement,
String parentElementName)
parentElement - the parent element.parentElementName - the name of the parent element.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||