|
Jumpi v1.2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jumpi.impl.util.ConfigurationHelper
A helper class providing utilities to get and check configuration properties, and to instantiate configurable components.
Field Summary | |
static java.lang.String |
CLASS_KEY_SUFFIX
The property suffix for instantiable classes. |
Constructor Summary | |
ConfigurationHelper()
Create a ConfigurationHelper instance. |
Method Summary | |
static boolean |
getBooleanProperty(java.lang.String key,
Properties props,
boolean def)
Get a boolean property from the property list and provide a default if it is missing. |
static java.util.Vector |
getCommaSeparatedStrings(java.lang.String str)
Parse and return each string from a comma separated list of strings in a Vector. |
static int |
getIntProperty(java.lang.String key,
Properties props,
int def)
Get an integer property from the property list and provide a default if it is missing. |
static int |
getIntProperty(java.lang.String key,
Properties props,
int def,
int lowerbound,
int upperbound)
Get the integer property named by key in the property list or a default if missing. |
static int |
getMandatoryIntProperty(java.lang.String key,
Properties props)
Get the mandatory integer property named by key in the property list. |
static int |
getMandatoryIntProperty(java.lang.String key,
Properties props,
int lowerbound,
int upperbound)
Get the mandatory integer property named by key in the property list. |
static java.lang.String |
getMandatoryProperty(java.lang.String key,
Properties props)
Get the mandatory property named by key in the property list. |
static java.lang.String |
getProperty(java.lang.String key,
Properties props)
Get a property from the property list. |
static java.lang.String |
getProperty(java.lang.String key,
Properties props,
java.lang.String def)
Get a property from the property list and provide a default if it is missing. |
static Configurable |
instantiate(java.lang.String prefix,
java.lang.String propname,
Properties props)
Instantiate a Configurable class and configure it given the properties. |
static Configurable |
instantiate(java.lang.String prefix,
java.lang.String propname,
Properties props,
java.lang.String defaultName,
java.lang.String defaultClassname)
Instantiate a Configurable class and configure it given the properties. |
static java.util.Vector |
instantiateList(java.lang.String prefix,
java.lang.String listname,
Properties props)
Instantiate and configure a list of Configurable instances. |
static Configurable |
instantiateMandatory(java.lang.String prefix,
java.lang.String propname,
Properties props)
Instantiate a Configurable class and configure it given the properties. |
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 CLASS_KEY_SUFFIX
Constructor Detail |
public ConfigurationHelper()
Method Detail |
public static Configurable instantiate(java.lang.String prefix, java.lang.String propname, Properties props) throws java.lang.Exception
Instantiate a Configurable class and configure it given the properties. The prefix + propname property is the property which provides the symbolic name of the configurable instance. If this property does not exist then null is returned.
The property prefix + propname + "." + symbolic-name + ".classname" gives the java classname of the class to instantiate. The instantiated Configurable instance is configured using the prefix + propname + "." + symbolic-name as the fully qualified component name.
prefix
- the property name's prefix.propname
- the property suffix part to find the symbolic-name of
the instance.props
- the list of all properties.
java.lang.Exception
- if any failure condition occurs.Configurable.configure(java.lang.String, org.jumpi.spi.Properties)
public static Configurable instantiate(java.lang.String prefix, java.lang.String propname, Properties props, java.lang.String defaultName, java.lang.String defaultClassname) throws java.lang.Exception
Instantiate a Configurable class and configure it given the properties. The prefix + propname property is the property which provides the symbolic name of the configurable instance. If this property does not exist then use the default classname and component name suffix as provided.
The property prefix + propname + "." + symbolic-name + ".classname" gives the java classname of the class to instantiate. The instantiated Configurable instance is configured using the prefix + propname + "." + symbolic-name as the fully qualified component name.
prefix
- the property name's prefix.propname
- the property suffix part to find the symbolic-name of
the instance.props
- the list of all properties.defaultName
- the default symbolic name.defaultClassname
- the default classname.
java.lang.Exception
- if any failure condition occurs.Configurable.configure(java.lang.String, org.jumpi.spi.Properties)
public static Configurable instantiateMandatory(java.lang.String prefix, java.lang.String propname, Properties props) throws java.lang.Exception
Instantiate a Configurable class and configure it given the properties. The prefix + propname property is the property which provides the symbolic name of the configurable instance. If this property does not exist then an Exception is thrown.
The property prefix + propname + "." + symbolic-name + ".classname" gives the java classname of the class to instantiate. The instantiated Configurable instance is configured using the prefix + propname + "." + symbolic-name as the fully qualified component name.
prefix
- the property name's prefix.propname
- the property suffix part to find the symbolic-name of
the instance.props
- the list of all properties.
java.lang.Exception
- if any failure condition occurs.Configurable.configure(java.lang.String, org.jumpi.spi.Properties)
public static java.util.Vector instantiateList(java.lang.String prefix, java.lang.String listname, Properties props) throws java.lang.Exception
prefix
- the property prefix.listname
- the property suffix to give the comma separated names
list.props
- all properties.
java.lang.Exception
- if any failure condition occurs.
java.lang.IllegalArgumentException
- if any parameters are missing.public static java.util.Vector getCommaSeparatedStrings(java.lang.String str)
str
- the comma separated string to be parsed.
java.lang.IllegalArgumentException
- if str is null.public static java.lang.String getMandatoryProperty(java.lang.String key, Properties props) throws java.lang.Exception
key
- the property key.props
- the list of all properties.
java.lang.Exception
- if the property is not found.
java.lang.IllegalArgumentException
- if missing parameters.public static java.lang.String getProperty(java.lang.String key, Properties props, java.lang.String def) throws java.lang.Exception
key
- the property key.props
- the list of all properties.def
- the default value which is returned if key is not in props.
java.lang.Exception
- if any failure condition occurs.
java.lang.IllegalArgumentException
- if any parameters are missing.public static java.lang.String getProperty(java.lang.String key, Properties props) throws java.lang.Exception
key
- the property key.props
- the list of all properties.
java.lang.Exception
- if any failure condition occurs.
java.lang.IllegalArgumentException
- if any parameters are missing.public static int getMandatoryIntProperty(java.lang.String key, Properties props) throws java.lang.Exception
key
- the property key.props
- the list of all properties.
java.lang.Exception
- if the property is not found.
java.lang.IllegalArgumentException
- if missing parameters.public static int getMandatoryIntProperty(java.lang.String key, Properties props, int lowerbound, int upperbound) throws java.lang.Exception
key
- the property key.props
- the list of all properties.lowerbound
- lower inclusive limit for property value,
Integer.MAX_INT to disable check.upperbound
- higher inclusive limit for property value,
Integer.MIN_INT to disable check.
java.lang.Exception
- if the property is not found.public static int getIntProperty(java.lang.String key, Properties props, int def) throws java.lang.Exception
key
- the property key.props
- the list of all properties.def
- the default value which is returned if key is not in props.
java.lang.Exception
- if any failure condition occurs.public static int getIntProperty(java.lang.String key, Properties props, int def, int lowerbound, int upperbound) throws java.lang.Exception
key
- the property key.props
- the list of all properties.def
- value to take in the absensce of a value.lowerbound
- lower inclusive limit for property value,
Integer.MAX_INT to disable check.upperbound
- higher inclusive limit for property value,
Integer.MIN_INT to disable check.
java.lang.Exception
- if the property is not found.public static boolean getBooleanProperty(java.lang.String key, Properties props, boolean def) throws java.lang.Exception
key
- the property key.props
- the list of all properties.def
- the default value which is returned if key is not in props.
java.lang.Exception
- if any failure condition occurs.
java.lang.IllegalArgumentException
- if any parameters are missing.
|
Jumpi v1.2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |