|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.geeboss.util.ConfigurationUtil
public class ConfigurationUtil
Utility methods for Configurations
Field Summary | |
---|---|
static java.lang.String |
CONFIG_DIR_ATTRIBUTE
config dir attribute |
static java.lang.String |
CONFIG_DIR_PATH_ATTRIBUTE
config dir path attribute |
static java.lang.String |
CONFIG_FILE_ATTRIBUTE
config path attribute |
static java.lang.String |
CONFIG_FILE_PATH_ATTRIBUTE
config file path attribute |
Constructor Summary | |
---|---|
ConfigurationUtil()
|
Method Summary | |
---|---|
static org.apache.avalon.framework.configuration.Configuration |
buildFromFile(java.io.File file)
Build a configuration from a file |
static org.apache.avalon.framework.configuration.Configuration |
buildFromStream(java.io.InputStream stream)
Build a configuration from a stream |
static org.apache.avalon.framework.configuration.Configuration |
buildFromString(java.lang.String configurationString)
Build a configuration from a string |
static java.lang.String |
checkAndGetAttribute(org.apache.avalon.framework.configuration.Configuration config,
java.lang.String attributeName)
Check and Get a configuration's attribute value |
static java.lang.Double |
checkAndGetAttributeAsDouble(org.apache.avalon.framework.configuration.Configuration config,
java.lang.String attributeName)
Check and Get a configuration's attribute value as a Double |
static org.apache.avalon.framework.configuration.Configuration |
checkAndGetElement(org.apache.avalon.framework.configuration.Configuration config,
java.lang.String elementName)
Check and Get a configuration's child element |
static java.lang.String |
checkAndGetElementValue(org.apache.avalon.framework.configuration.Configuration config,
java.lang.String elementName)
Check and Get a configuration's element value |
static java.lang.String |
checkAndGetElementValue(org.apache.avalon.framework.configuration.Configuration config,
java.lang.String elementName,
java.lang.String defaultValue)
Check and Get a configuration's element value |
static long |
checkAndGetHexElementValue(org.apache.avalon.framework.configuration.Configuration config,
java.lang.String elementName)
Check and Get a configuration's element hex value |
static int |
checkAndGetIntElementValue(org.apache.avalon.framework.configuration.Configuration config,
java.lang.String elementName)
Check and Get a configuration's element int value |
static void |
checkElementName(org.apache.avalon.framework.configuration.Configuration config,
java.lang.String name)
Check configuration's name |
static org.apache.avalon.framework.configuration.Configuration |
createDateElement(java.lang.String elementName,
java.lang.String valueAttributeName,
java.util.Date date)
Create a configuration element hodling a date value attribute according to the sepcified Date |
static org.apache.avalon.framework.configuration.Configuration |
createIdElement(java.lang.String elementName,
java.lang.String idAttributeName,
java.lang.String id)
Create a configuration element hodling an id attribute |
static org.apache.avalon.framework.configuration.Configuration |
createValueElement(java.lang.String elementName,
java.lang.String valueAttributeName,
java.lang.Number value)
Create a configuration element hodling a value attribute according to the sepcified number |
static java.lang.Double |
getAttributeAsDouble(org.apache.avalon.framework.configuration.Configuration configuration,
java.lang.String attributeName,
double defaultValue)
Get the Double value of an attribute. |
static java.lang.Double |
getAttributeAsDouble(org.apache.avalon.framework.configuration.Configuration configuration,
java.lang.String attributeName,
java.lang.Double defaultValue)
Get the Double value of an attribute |
static java.lang.String |
getChildValue(org.apache.avalon.framework.configuration.Configuration configuration,
java.lang.String elementName,
java.lang.String defaultValue)
Get the value (text content) of an child element within a configuration |
static int[] |
getRange(org.apache.avalon.framework.configuration.Configuration configuration)
Get the range from a configuration |
static java.util.Date |
readDateElement(org.apache.avalon.framework.configuration.Configuration configuration,
java.lang.String dateAttributeName)
Read a date element |
static void |
serializeToStream(org.apache.avalon.framework.configuration.Configuration configuration,
java.io.OutputStream stream)
Serialize a given condiguration to a Stream |
static java.lang.String |
serializeToString(org.apache.avalon.framework.configuration.Configuration configuration)
Serialize a given condiguration to a String |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CONFIG_DIR_PATH_ATTRIBUTE
public static final java.lang.String CONFIG_DIR_ATTRIBUTE
public static final java.lang.String CONFIG_FILE_PATH_ATTRIBUTE
public static final java.lang.String CONFIG_FILE_ATTRIBUTE
Constructor Detail |
---|
public ConfigurationUtil()
Method Detail |
---|
public static org.apache.avalon.framework.configuration.Configuration buildFromFile(java.io.File file) throws org.apache.avalon.framework.configuration.ConfigurationException
file
- the file to load
org.apache.avalon.framework.configuration.ConfigurationException
- if an error occured while reading filepublic static org.apache.avalon.framework.configuration.Configuration buildFromStream(java.io.InputStream stream) throws org.apache.avalon.framework.configuration.ConfigurationException
stream
- to load
org.apache.avalon.framework.configuration.ConfigurationException
- if an error occured while reading the streampublic static org.apache.avalon.framework.configuration.Configuration buildFromString(java.lang.String configurationString) throws org.apache.avalon.framework.configuration.ConfigurationException
configurationString
- the String to read
org.apache.avalon.framework.configuration.ConfigurationException
- if an error occured while reading filepublic static java.lang.String serializeToString(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
configuration
- the Configuration to serialize
org.apache.avalon.framework.configuration.ConfigurationException
- if an error occured while seriliazing configurationpublic static void serializeToStream(org.apache.avalon.framework.configuration.Configuration configuration, java.io.OutputStream stream) throws org.apache.avalon.framework.configuration.ConfigurationException, java.io.IOException
configuration
- the Configuration to serializestream
- the stream to serialize the configuration to
org.apache.avalon.framework.configuration.ConfigurationException
- if an error occured while seriliazing configuration
java.io.IOException
public static void checkElementName(org.apache.avalon.framework.configuration.Configuration config, java.lang.String name) throws org.apache.avalon.framework.configuration.ConfigurationException
config
- the configurationname
- the name
org.apache.avalon.framework.configuration.ConfigurationException
- the name is not the one expcetedpublic static java.lang.String checkAndGetAttribute(org.apache.avalon.framework.configuration.Configuration config, java.lang.String attributeName) throws org.apache.avalon.framework.configuration.ConfigurationException
config
- the configurationattributeName
- the name of the attribute to check
org.apache.avalon.framework.configuration.ConfigurationException
- if attribute is not presentpublic static java.lang.Double checkAndGetAttributeAsDouble(org.apache.avalon.framework.configuration.Configuration config, java.lang.String attributeName) throws org.apache.avalon.framework.configuration.ConfigurationException
config
- the configurationattributeName
- the name of the attribute to check
org.apache.avalon.framework.configuration.ConfigurationException
- if attribute is not presentpublic static long checkAndGetHexElementValue(org.apache.avalon.framework.configuration.Configuration config, java.lang.String elementName) throws org.apache.avalon.framework.configuration.ConfigurationException
config
- the configurationelementName
- the name of the element to check
org.apache.avalon.framework.configuration.ConfigurationException
- if element is not presentpublic static int checkAndGetIntElementValue(org.apache.avalon.framework.configuration.Configuration config, java.lang.String elementName) throws org.apache.avalon.framework.configuration.ConfigurationException
config
- the configurationelementName
- the name of the element to check
org.apache.avalon.framework.configuration.ConfigurationException
- if element is not presentpublic static java.lang.String checkAndGetElementValue(org.apache.avalon.framework.configuration.Configuration config, java.lang.String elementName) throws org.apache.avalon.framework.configuration.ConfigurationException
config
- the configurationelementName
- the name of the element to check
org.apache.avalon.framework.configuration.ConfigurationException
- if element is not presentpublic static java.lang.String checkAndGetElementValue(org.apache.avalon.framework.configuration.Configuration config, java.lang.String elementName, java.lang.String defaultValue) throws org.apache.avalon.framework.configuration.ConfigurationException
config
- the configurationelementName
- the name of the element to checkdefaultValue
- the default value
org.apache.avalon.framework.configuration.ConfigurationException
- if element is not presentpublic static org.apache.avalon.framework.configuration.Configuration checkAndGetElement(org.apache.avalon.framework.configuration.Configuration config, java.lang.String elementName) throws org.apache.avalon.framework.configuration.ConfigurationException
config
- the configurationelementName
- the name of the element to check
org.apache.avalon.framework.configuration.ConfigurationException
- if element is not presentpublic static int[] getRange(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
configuration
- the configuration containing the range
org.apache.avalon.framework.configuration.ConfigurationException
public static java.lang.String getChildValue(org.apache.avalon.framework.configuration.Configuration configuration, java.lang.String elementName, java.lang.String defaultValue)
configuration
- the configuration to search the element forelementName
- the name of the element we want the value fordefaultValue
- the default value
public static java.lang.Double getAttributeAsDouble(org.apache.avalon.framework.configuration.Configuration configuration, java.lang.String attributeName, java.lang.Double defaultValue) throws org.apache.avalon.framework.configuration.ConfigurationException
configuration
- the configuration to search the attribute fordefaultValue
- the default value
org.apache.avalon.framework.configuration.ConfigurationException
public static java.lang.Double getAttributeAsDouble(org.apache.avalon.framework.configuration.Configuration configuration, java.lang.String attributeName, double defaultValue)
configuration
- the configuration to search the attribute fordefaultValue
- the default value
public static org.apache.avalon.framework.configuration.Configuration createValueElement(java.lang.String elementName, java.lang.String valueAttributeName, java.lang.Number value)
elementName
- the name of the element to createvalueAttributeName
- the name of the value attributevalue
- the value
public static org.apache.avalon.framework.configuration.Configuration createIdElement(java.lang.String elementName, java.lang.String idAttributeName, java.lang.String id)
elementName
- the name of the element to createidAttributeName
- the name of the value attributeid
- the id
public static org.apache.avalon.framework.configuration.Configuration createDateElement(java.lang.String elementName, java.lang.String valueAttributeName, java.util.Date date)
elementName
- the name of the element to createvalueAttributeName
- the name of the value attributedate
- the date
public static java.util.Date readDateElement(org.apache.avalon.framework.configuration.Configuration configuration, java.lang.String dateAttributeName) throws org.apache.avalon.framework.configuration.ConfigurationException
configuration
- the date elementdateAttributeName
- the date attribute name
org.apache.avalon.framework.configuration.ConfigurationException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |