|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.configuration.AbstractConfiguration
org.apache.commons.configuration.BaseConfiguration
org.apache.commons.configuration.JNDIConfiguration
This Configuration class allows you to interface with a JNDI datasource.
| Nested Class Summary |
| Nested classes inherited from class org.apache.commons.configuration.AbstractConfiguration |
AbstractConfiguration.Container, AbstractConfiguration.PropertiesTokenizer |
| Field Summary | |
private java.util.List |
clearedProperties
|
private javax.naming.Context |
envCtx
|
private static org.apache.commons.logging.Log |
log
|
private java.lang.String |
prefix
|
| Fields inherited from class org.apache.commons.configuration.BaseConfiguration |
|
| Fields inherited from class org.apache.commons.configuration.AbstractConfiguration |
defaults, END_TOKEN, START_TOKEN |
| Constructor Summary | |
JNDIConfiguration()
Creates an empty JNDIConfiguration object which can then be added some other Configuration files |
|
| Method Summary | |
void |
addProperty(java.lang.String key,
java.lang.Object token)
JNDIConfigurations can not be added to |
void |
clearProperty(java.lang.String key)
Clear a property in the configuration. |
boolean |
containsKey(java.lang.String key)
check if the configuration contains the key, or the key has been removed. |
java.lang.Boolean |
getBoolean(java.lang.String key,
java.lang.Boolean defaultValue)
Get a boolean associated with the given configuration key. |
java.lang.Byte |
getByte(java.lang.String key,
java.lang.Byte defaultValue)
Get a byte associated with the given configuration key. |
private javax.naming.Context |
getContext()
|
java.lang.Double |
getDouble(java.lang.String key,
java.lang.Double defaultValue)
Get a double associated with the given configuration key. |
java.lang.Float |
getFloat(java.lang.String key,
java.lang.Float defaultValue)
Get a float associated with the given configuration key. |
java.lang.Integer |
getInteger(java.lang.String key,
java.lang.Integer defaultValue)
Get a int associated with the given configuration key. |
java.util.Iterator |
getKeys()
Get the list of the keys contained in the configuration repository. |
java.util.Iterator |
getKeys(java.lang.String key)
Get the list of the keys contained in the configuration repository that match a passed in beginning pattern. |
java.util.List |
getList(java.lang.String key,
java.util.List defaultValue)
Get a List of strings associated with the given configuration key. |
java.lang.Long |
getLong(java.lang.String key,
java.lang.Long defaultValue)
Get a long associated with the given configuration key. |
java.lang.String |
getPrefix()
|
java.util.Properties |
getProperties(java.lang.String key)
Get a list of properties associated with the given configuration key. |
java.lang.Object |
getProperty(java.lang.String key)
Gets a property from the configuration. |
java.lang.Short |
getShort(java.lang.String key,
java.lang.Short defaultValue)
Get a short associated with the given configuration key. |
private javax.naming.Context |
getStartingContextPoint(java.util.List keys,
javax.naming.NamingEnumeration enum)
Because JNDI is based on a tree configuration, we need to filter down the tree, till we find the Context specified by the key to start from. |
java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue)
Get a string associated with the given configuration key. |
java.lang.String[] |
getStringArray(java.lang.String key)
Get an array of strings associated with the given configuration key. |
private java.lang.Object |
getValueFromJNDI(java.lang.String key)
|
boolean |
isEmpty()
Check if the configuration is empty. |
private void |
recursiveGetKeys(java.util.List keys,
javax.naming.NamingEnumeration enum,
java.lang.String key)
This method recursive traverse the JNDI tree, looking for Context objects. |
void |
setPrefix(java.lang.String prefix)
Sets the prefix. |
void |
setProperty(java.lang.String key,
java.lang.Object value)
Set a property, this will replace any previously set values. |
Configuration |
subset(java.lang.String prefix)
Create an ExtendedProperties object that is a subset of this one. |
| Methods inherited from class org.apache.commons.configuration.BaseConfiguration |
addPropertyDirect, getPropertyDirect |
| Methods inherited from class org.apache.commons.configuration.AbstractConfiguration |
getBoolean, getBoolean, getByte, getByte, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getList, getLong, getLong, getProperties, getShort, getShort, getString, interpolate, interpolateHelper, processString, testBoolean |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.commons.configuration.Configuration |
getBoolean, getBoolean, getByte, getByte, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getList, getLong, getLong, getShort, getShort, getString |
| Field Detail |
private static org.apache.commons.logging.Log log
private java.lang.String prefix
private javax.naming.Context envCtx
private java.util.List clearedProperties
| Constructor Detail |
public JNDIConfiguration()
| Method Detail |
public void addProperty(java.lang.String key,
java.lang.Object token)
addProperty in interface ConfigurationaddProperty in class AbstractConfigurationkey - The Key to add the property to.token - The Value to add.
private void recursiveGetKeys(java.util.List keys,
javax.naming.NamingEnumeration enum,
java.lang.String key)
throws javax.naming.NamingException
keys - All the keys that have been found.enum - An enumeration of all the elements found at a specific contextkey - What key we are building on.
javax.naming.NamingException - If JNDI has an issue.public java.util.Iterator getKeys()
getKeys in interface ConfigurationgetKeys in class BaseConfigurationpublic java.util.Iterator getKeys(java.lang.String key)
getKeys in interface ConfigurationgetKeys in class AbstractConfigurationkey - the key pattern to match on.
private javax.naming.Context getStartingContextPoint(java.util.List keys,
javax.naming.NamingEnumeration enum)
throws javax.naming.NamingException
javax.naming.NamingException - if JNDI has an issuepublic java.util.Properties getProperties(java.lang.String key)
getProperties in interface ConfigurationgetProperties in class AbstractConfigurationkey - The configuration key.
java.lang.ClassCastException - is thrown if the key maps to an
object that is not a String/List.
java.lang.IllegalArgumentException - if one of the tokens is
malformed (does not contain an equals sign).AbstractConfiguration.getProperties(String, Properties)public boolean isEmpty()
Configuration
isEmpty in interface ConfigurationisEmpty in class BaseConfigurationtrue if Configuration is empty,
false otherwise.public java.lang.Object getProperty(java.lang.String key)
getProperty in interface ConfigurationgetProperty in class AbstractConfigurationkey - property to retrieve
public void setProperty(java.lang.String key,
java.lang.Object value)
setProperty in interface ConfigurationsetProperty in class AbstractConfigurationkey - value - public void clearProperty(java.lang.String key)
clearProperty in interface ConfigurationclearProperty in class BaseConfigurationkey - the key to remove along with corresponding value.public boolean containsKey(java.lang.String key)
containsKey in interface ConfigurationcontainsKey in class BaseConfigurationkey - the configuration key
true if Configuration contain given key,
false otherwise.public Configuration subset(java.lang.String prefix)
subset in interface Configurationsubset in class AbstractConfigurationprefix -
null if there is no such keys.
public java.lang.Boolean getBoolean(java.lang.String key,
java.lang.Boolean defaultValue)
getBoolean in interface ConfigurationgetBoolean in class AbstractConfigurationkey - The configuration key.defaultValue - The default value.
java.lang.ClassCastException - is thrown if the key maps to an
object that is not a Boolean.
public java.lang.Byte getByte(java.lang.String key,
java.lang.Byte defaultValue)
getByte in interface ConfigurationgetByte in class AbstractConfigurationkey - The configuration key.defaultValue - The default value.
java.lang.ClassCastException - is thrown if the key maps to an object that
is not a Byte.
java.lang.NumberFormatException - is thrown if the value mapped by the key
has not a valid number format.
public java.lang.Double getDouble(java.lang.String key,
java.lang.Double defaultValue)
getDouble in interface ConfigurationgetDouble in class AbstractConfigurationkey - The configuration key.defaultValue - The default value.
java.lang.ClassCastException - is thrown if the key maps to an
object that is not a Double.
java.lang.NumberFormatException - is thrown if the value mapped
by the key has not a valid number format.
public java.lang.Float getFloat(java.lang.String key,
java.lang.Float defaultValue)
getFloat in interface ConfigurationgetFloat in class AbstractConfigurationkey - The configuration key.defaultValue - The default value.
java.lang.ClassCastException - is thrown if the key maps to an
object that is not a Float.
java.lang.NumberFormatException - is thrown if the value mapped
by the key has not a valid number format.
public java.lang.Integer getInteger(java.lang.String key,
java.lang.Integer defaultValue)
getInteger in interface ConfigurationgetInteger in class AbstractConfigurationkey - The configuration key.defaultValue - The default value.
java.lang.ClassCastException - is thrown if the key maps to an object that
is not a Integer.
java.lang.NumberFormatException - is thrown if the value mapped by the key
has not a valid number format.
public java.lang.Long getLong(java.lang.String key,
java.lang.Long defaultValue)
getLong in interface ConfigurationgetLong in class AbstractConfigurationkey - The configuration key.defaultValue - The default value.
java.lang.ClassCastException - is thrown if the key maps to an
object that is not a Long.
java.lang.NumberFormatException - is thrown if the value mapped
by the key has not a valid number format.
public java.lang.Short getShort(java.lang.String key,
java.lang.Short defaultValue)
getShort in interface ConfigurationgetShort in class AbstractConfigurationkey - The configuration key.defaultValue - The default value.
java.lang.ClassCastException - is thrown if the key maps to an
object that is not a Short.
java.lang.NumberFormatException - is thrown if the value mapped
by the key has not a valid number format.
public java.lang.String getString(java.lang.String key,
java.lang.String defaultValue)
getString in interface ConfigurationgetString in class AbstractConfigurationkey - The configuration key.defaultValue - The default value.
java.lang.ClassCastException - is thrown if the key maps to an object that
is not a String.public java.lang.String[] getStringArray(java.lang.String key)
getStringArray in interface ConfigurationgetStringArray in class AbstractConfigurationkey - The configuration key.
java.lang.ClassCastException - is thrown if the key maps to an
object that is not a String/List of Strings.
public java.util.List getList(java.lang.String key,
java.util.List defaultValue)
getList in interface ConfigurationgetList in class AbstractConfigurationkey - The configuration key.defaultValue - The default value.
public java.lang.String getPrefix()
public void setPrefix(java.lang.String prefix)
prefix - The prefix to setprivate java.lang.Object getValueFromJNDI(java.lang.String key)
private javax.naming.Context getContext()
throws javax.naming.NamingException
javax.naming.NamingException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||