messif.utility
Class ExtendedProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<java.lang.Object,java.lang.Object>
          extended by java.util.Properties
              extended by messif.utility.ExtendedProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public class ExtendedProperties
extends java.util.Properties

This class provides getter extension for the basic set of properties. The following features are added:

In addition, a caching facility is provided if the factory method is used, i.e. the same ExtendedProperties instance is returned for the same resource.

See Also:
Serialized Form

Field Summary
protected static java.util.Map<java.lang.Object,ExtendedProperties> cache
          Properties cache
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
ExtendedProperties()
          Creates an empty property list with no default values.
ExtendedProperties(java.util.Properties defaults)
          Creates an empty property list with the specified defaults.
 
Method Summary
 ExtendedProperties clone(java.util.Properties defaults)
          Creates a shallow copy of this properties with the given defaults.
 int fillByMultiProperty(java.lang.String key, java.lang.Object[] parameters, java.lang.Class<?>[] parameterTypes)
          Fill the specified array with property values converted to appropriate types.
 boolean getBoolProperty(java.lang.String key, boolean defaultValue)
          Returns a boolean value from the given property.
 java.lang.Class<?> getClassProperty(java.lang.String key, boolean required)
          Returns a class from the given property.
<E> java.lang.Class<E>
getClassProperty(java.lang.String key, boolean required, java.lang.Class<E> checkClass)
          Returns a generics-safe class from the given property.
<E> java.lang.reflect.Constructor<E>
getConstructor(java.lang.Class<E> objectClass, java.lang.Class<?>... prototype)
          Returns a constructor for a class.
<E> java.lang.reflect.Constructor<E>
getConstructor(java.lang.Class<E> checkClass, java.lang.String classKeyName, java.lang.Class<?>... prototype)
          Returns a constructor for a class.
 java.lang.reflect.Constructor<?> getConstructor(java.lang.String classKeyName, java.lang.Class<?>... prototype)
          Returns a constructor for a class.
 java.sql.Connection getDatabaseConnection(java.lang.String key)
          Returns a data source using either JNDI or DriverManager using the URL specified in the value of the property key.
 java.lang.reflect.Method getFactoryMethod(java.lang.Class<?> factoryClass, java.lang.Class<?> returnType, java.lang.String methodName, java.lang.Class<?>... prototype)
          Returns a className's factory method with the specified name and prototype.
 java.lang.reflect.Method getFactoryMethod(java.lang.Class<?> returnType, java.lang.String classKeyName, java.lang.String methodKeyName, java.lang.Class<?>... prototype)
          Returns a factory method for a class.
 java.lang.reflect.Method getFactoryMethod(java.lang.String classKeyName, java.lang.String methodKeyName, java.lang.Class<?>... prototype)
          Returns a factory method for a class.
 java.lang.String getFormattedProperty(java.lang.String key, java.lang.String defaultValue, java.lang.Object... parameters)
          Formats a message using the property with the specified key in this property list.
 java.net.InetAddress getInetAddressProperty(java.lang.String key, boolean required)
          Returns an inet address from the given property.
 int getIntProperty(java.lang.String key, int defaultValue)
          Returns an integer value from the given property.
 int getIntProperty(java.lang.String key, int defaultValue, int minValue, int maxValue)
          Returns an integer value from the given property.
 java.lang.String[] getMultiProperty(java.lang.String key)
          Returns an array of property values.
 java.lang.Object[] getMultiProperty(java.lang.String key, java.lang.Class<?>... parameterTypes)
          Returns an array of property values converted to appropriate types.
 java.lang.String[] getMultiProperty(java.lang.String key, int count)
          Returns an array of property values.
static ExtendedProperties getProperties(java.lang.Class<?> clazz)
          Returns a cached instance of ExtendedProperties for the specified class.
static ExtendedProperties getProperties(java.lang.String file)
          Returns a cached instance of ExtendedProperties for the specified file.
 boolean getRequiredBoolProperty(java.lang.String key)
          Returns a boolean value from the given property.
 int getRequiredIntProperty(java.lang.String key)
          Returns an integer value from the given property.
 java.lang.String getRequiredProperty(java.lang.String key)
          Searches for the property with the specified key in this property list.
 java.lang.Object getSerializedObject(java.lang.String fileNameProperty, boolean required)
          Reads a serialized object from the file specified by the given property.
 java.sql.PreparedStatement getSQLStatement(java.sql.Connection connection, java.lang.String key)
          Prepare an SQL statement from the configuration.
 java.sql.PreparedStatement getSQLStatement(java.lang.String connectionKey, java.lang.String sqlStatementKey)
          Prepare an SQL statement from the configuration.
 boolean load(java.lang.Class<?> clazz)
          Populate this properties with the data stored in a clazz's property file.
 boolean load(java.lang.ClassLoader loader, java.lang.String resourceName)
          Populate this properties with the data stored in resourceName.
 void load(java.util.Properties properties, java.lang.String prefix)
          Populate this properties with the data stored in another properties.
 void load(java.util.Properties properties, java.lang.String prefix, java.util.Map<java.lang.String,java.lang.String> variables)
          Populate this properties with the data stored in another properties.
 void load(java.util.Properties properties, java.lang.String prefix, java.util.regex.Pattern variableRegex, int variableRegexGroup, int defaultValueRegexGroup, java.util.Map<java.lang.String,java.lang.String> variables)
          Populate this properties with the data stored in another properties.
static ExtendedProperties restrictProperties(java.util.Properties properties, java.lang.String prefix)
          Return ExtendedProperties from the specified properties.
static ExtendedProperties restrictProperties(java.util.Properties properties, java.lang.String prefix, java.util.Map<java.lang.String,java.lang.String> variables)
          Return ExtendedProperties from the specified properties with variable expansion.
static ExtendedProperties restrictProperties(java.util.Properties properties, java.lang.String prefix, java.util.Properties defaultProperties, java.util.Map<java.lang.String,java.lang.String> variables)
          Return ExtendedProperties from the specified properties with variable expansion.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

cache

protected static final java.util.Map<java.lang.Object,ExtendedProperties> cache
Properties cache

Constructor Detail

ExtendedProperties

public ExtendedProperties()
Creates an empty property list with no default values.


ExtendedProperties

public ExtendedProperties(java.util.Properties defaults)
Creates an empty property list with the specified defaults.

Parameters:
defaults - the defaults
Method Detail

clone

public ExtendedProperties clone(java.util.Properties defaults)
                         throws java.lang.IllegalStateException
Creates a shallow copy of this properties with the given defaults. The defaults can be set only if the copied properties have none.

Parameters:
defaults - the defaults
Returns:
a clone of the properties
Throws:
java.lang.IllegalStateException - if the defaults cannot be set

getProperties

public static ExtendedProperties getProperties(java.lang.String file)
                                        throws ExtendedPropertiesException
Returns a cached instance of ExtendedProperties for the specified file. If there is no instance in the cache yet, create a new one, populate it from the property file and cache it.

Parameters:
file - the file to load the properties from
Returns:
a cached instance of ExtendedProperties for the specified file
Throws:
ExtendedPropertiesException - if there was a problem creating properties

getProperties

public static ExtendedProperties getProperties(java.lang.Class<?> clazz)
                                        throws ExtendedPropertiesException
Returns a cached instance of ExtendedProperties for the specified class. If there is no instance in the cache yet, create a new one, populate it from the class's properties and cache it.

Parameters:
clazz - the class to load the properties for
Returns:
a cached instance of ExtendedProperties for the specified class
Throws:
ExtendedPropertiesException - if there was a problem creating properties

restrictProperties

public static ExtendedProperties restrictProperties(java.util.Properties properties,
                                                    java.lang.String prefix,
                                                    java.util.Properties defaultProperties,
                                                    java.util.Map<java.lang.String,java.lang.String> variables)
Return ExtendedProperties from the specified properties with variable expansion. Only keys with the given prefix are copied and the prefix is removed from the keys. A variable substitution is performed on all values (no substitution is done on keys).

Parameters:
properties - the properties to copy from
prefix - the starting prefix on the keys
defaultProperties - the default properties to use (see Properties.Properties(java.util.Properties))
variables - the variable names with their values
Returns:
a new instance of ExtendedProperties populated from properties

restrictProperties

public static ExtendedProperties restrictProperties(java.util.Properties properties,
                                                    java.lang.String prefix,
                                                    java.util.Map<java.lang.String,java.lang.String> variables)
Return ExtendedProperties from the specified properties with variable expansion. Only keys with the given prefix are copied and the prefix is removed from the keys. A variable substitution is performed on all values (no substitution is done on keys).

Parameters:
properties - the properties to copy from
prefix - the starting prefix on the keys
variables - the variable names with their values
Returns:
a new instance of ExtendedProperties populated from properties

restrictProperties

public static ExtendedProperties restrictProperties(java.util.Properties properties,
                                                    java.lang.String prefix)
Return ExtendedProperties from the specified properties. Only keys with the given prefix are copied and the prefix is removed from the keys.

Parameters:
properties - the properties to copy from
prefix - the starting prefix on the keys
Returns:
a new instance of ExtendedProperties populated from properties

load

public boolean load(java.lang.Class<?> clazz)
             throws java.io.IOException,
                    java.lang.IllegalArgumentException
Populate this properties with the data stored in a clazz's property file. That is, the file with the same package, the same name as the clazz and the "properties" extension.

Parameters:
clazz - the class to load the properties for
Returns:
false if the property file was not found
Throws:
java.io.IOException - if an error occurred when reading from the property file
java.lang.IllegalArgumentException - if the property file contains a malformed Unicode escape sequence

load

public boolean load(java.lang.ClassLoader loader,
                    java.lang.String resourceName)
             throws java.io.IOException,
                    java.lang.IllegalArgumentException
Populate this properties with the data stored in resourceName.

Parameters:
loader - the class loader to use to access the resource
resourceName - the name of a resource to load
Returns:
false if the resource was not found
Throws:
java.io.IOException - if an error occurred when reading from the property file
java.lang.IllegalArgumentException - if the property file contains a malformed Unicode escape sequence

load

public void load(java.util.Properties properties,
                 java.lang.String prefix)
          throws java.lang.NullPointerException
Populate this properties with the data stored in another properties.

Parameters:
properties - the propertries to load
prefix - if null, all keys from the properties are copied; otherwise, only the keys that starts with the prefix are copied without the prefix
Throws:
java.lang.NullPointerException - if the properties is null

load

public void load(java.util.Properties properties,
                 java.lang.String prefix,
                 java.util.Map<java.lang.String,java.lang.String> variables)
          throws java.lang.NullPointerException
Populate this properties with the data stored in another properties. Variable substitution is performed on property values (keys are not substituted). Variables have <name:default_value> format, where the :default_value part is optional (empty string will be placed if an unknown variable is encountered). If a prefix is specified, only keys that begins with that prefix are copied and the prefix is removed in the process.

Parameters:
properties - the propertries to load
prefix - if null, all keys from the properties are copied; otherwise, only the keys that starts with the prefix are copied without the prefix
variables - the variable names with their values
Throws:
java.lang.NullPointerException - if the properties is null

load

public void load(java.util.Properties properties,
                 java.lang.String prefix,
                 java.util.regex.Pattern variableRegex,
                 int variableRegexGroup,
                 int defaultValueRegexGroup,
                 java.util.Map<java.lang.String,java.lang.String> variables)
          throws java.lang.NullPointerException
Populate this properties with the data stored in another properties. Variable substitution is performed on property values (keys are not substituted). If a prefix is specified, only keys that begins with that prefix are copied and the prefix is removed in the process.

Parameters:
properties - the propertries to load
prefix - if null, all keys from the properties are copied; otherwise, only the keys that starts with the prefix are copied without the prefix
variableRegex - regular expression that matches variables
variableRegexGroup - parenthesis group within regular expression that holds the variable name
defaultValueRegexGroup - parenthesis group within regular expression that holds the default value for a variable that is not present in the variables map
variables - the variable names with their values
Throws:
java.lang.NullPointerException - if the properties is null

getRequiredProperty

public java.lang.String getRequiredProperty(java.lang.String key)
                                     throws ExtendedPropertiesException
Searches for the property with the specified key in this property list. If the value was not found in property key a ExtendedPropertiesException is thrown instead of returning null.

Parameters:
key - the hashtable key
Returns:
the value for the specified key
Throws:
ExtendedPropertiesException - if the value was not found and default value is null

getFormattedProperty

public java.lang.String getFormattedProperty(java.lang.String key,
                                             java.lang.String defaultValue,
                                             java.lang.Object... parameters)
                                      throws java.lang.IllegalArgumentException
Formats a message using the property with the specified key in this property list. If the value was not found in property key the defaultValue is used. The message is then formatted according to MessageFormat.format(java.lang.Object[], java.lang.StringBuffer, java.text.FieldPosition).

Parameters:
key - the hashtable key of the message
defaultValue - a default value if the property key is null
parameters - an array of objects to be formatted and substituted
Returns:
a formatted message
Throws:
java.lang.IllegalArgumentException - if a parameter in the parameters array is not of the type expected by the format element(s) that use it

getRequiredIntProperty

public int getRequiredIntProperty(java.lang.String key)
                           throws ExtendedPropertiesException
Returns an integer value from the given property. If there is no value for the key, a ExtendedPropertiesException is thrown.

Parameters:
key - the hashtable key
Returns:
an integer value from the given property
Throws:
ExtendedPropertiesException - if the property was not found or its value is not a valid integer

getIntProperty

public int getIntProperty(java.lang.String key,
                          int defaultValue)
                   throws ExtendedPropertiesException
Returns an integer value from the given property. If there is no value for the key, the supplied default value is returned.

Parameters:
key - the hashtable key
defaultValue - a default value if the property key is null
Returns:
an integer value from the given property
Throws:
ExtendedPropertiesException - if the property's value is not a valid integer

getIntProperty

public int getIntProperty(java.lang.String key,
                          int defaultValue,
                          int minValue,
                          int maxValue)
                   throws ExtendedPropertiesException
Returns an integer value from the given property. If there is no value for the key, the supplied default value is returned. The returned value's range is checked. To impose a required check, supply a default value outside the checked range.

Parameters:
key - the hashtable key
defaultValue - a default value if the property key is null
minValue -
maxValue -
Returns:
an integer value from the given property
Throws:
ExtendedPropertiesException - if the property's value is not a valid integer or it is out of range

getRequiredBoolProperty

public boolean getRequiredBoolProperty(java.lang.String key)
                                throws ExtendedPropertiesException
Returns a boolean value from the given property. If there is no value for the key, a ExtendedPropertiesException is thrown.

Parameters:
key - the hashtable key
Returns:
an boolean value from the given property
Throws:
ExtendedPropertiesException - if the property's value is not a valid integer

getBoolProperty

public boolean getBoolProperty(java.lang.String key,
                               boolean defaultValue)
                        throws ExtendedPropertiesException
Returns a boolean value from the given property. If there is no value for the key, the supplied default value is returned.

Parameters:
key - the hashtable key
defaultValue - a default value if the property key is null
Returns:
an boolean value from the given property
Throws:
ExtendedPropertiesException - if the property's value is not a valid integer

getMultiProperty

public java.lang.String[] getMultiProperty(java.lang.String key,
                                           int count)
Returns an array of property values. The array will have exactly count items and each item will be filled with value of the property key#, where # is an index of the respective item starting from 1.

Parameters:
key - the hashtable key (index number will be appended)
count - the number of items to retrieve
Returns:
an array of property values

getMultiProperty

public java.lang.String[] getMultiProperty(java.lang.String key)
                                    throws ExtendedPropertiesException
Returns an array of property values. The array size will be retrieved from property name key. Each item will be filled with value of the property key#, where # is a zero-based index of the respective item.

Parameters:
key - the hashtable key (index number will be appended)
Returns:
an array of property values
Throws:
ExtendedPropertiesException - if the property's value is not a non-negative integer

getMultiProperty

public java.lang.Object[] getMultiProperty(java.lang.String key,
                                           java.lang.Class<?>... parameterTypes)
                                    throws ExtendedPropertiesException
Returns an array of property values converted to appropriate types. The conversion is done by stringToType method. The returned array will have exactly parameterTypes.length items and each item will be filled with value of the property key#, where # is a zero-based index of the respective item.

Parameters:
key - the hashtable key (index number will be appended)
parameterTypes - the parameter types array
Returns:
an array of property values
Throws:
ExtendedPropertiesException - if the array of values for the property cannot be converted to the specified types

fillByMultiProperty

public int fillByMultiProperty(java.lang.String key,
                               java.lang.Object[] parameters,
                               java.lang.Class<?>[] parameterTypes)
                        throws ExtendedPropertiesException
Fill the specified array with property values converted to appropriate types. The conversion is done by stringToType method. Each item of the array will be filled with value of the property key#, where # is a zero-based index of the respective item. If the property does not exist, null value will be placed in the parameters.

Parameters:
key - the hashtable key (index number will be appended)
parameters - the parameter array to fill
parameterTypes - the parameter types array
Returns:
the index of the first null value in the array
Throws:
ExtendedPropertiesException - if the array of values for the property cannot be converted to the specified types

getClassProperty

public <E> java.lang.Class<E> getClassProperty(java.lang.String key,
                                               boolean required,
                                               java.lang.Class<E> checkClass)
                                    throws ExtendedPropertiesException
Returns a generics-safe class from the given property.

Type Parameters:
E - the superclass of the returned class
Parameters:
key - the hashtable key
required - if true the property must exist (and null will be never returned)
checkClass - the superclass of the returned class for the generics check
Returns:
a generics-safe class from the given property
Throws:
ExtendedPropertiesException - if the property was not found or the class with the property's value cannot be resolved

getClassProperty

public java.lang.Class<?> getClassProperty(java.lang.String key,
                                           boolean required)
                                    throws ExtendedPropertiesException
Returns a class from the given property.

Parameters:
key - the hashtable key
required - if true the property must exist (and null will be never returned)
Returns:
a class from the given property
Throws:
ExtendedPropertiesException - if the property was not found or the class with the property's value cannot be resolved

getFactoryMethod

public java.lang.reflect.Method getFactoryMethod(java.lang.Class<?> returnType,
                                                 java.lang.String classKeyName,
                                                 java.lang.String methodKeyName,
                                                 java.lang.Class<?>... prototype)
                                          throws ExtendedPropertiesException
Returns a factory method for a class. The class name is retrieved from this properties using key classKeyName. The static factory method is then searched with the name from this properties using key methodKeyName and the given prototype.

Parameters:
returnType - the superclass (or class itself) of instances returned by the static factory method
classKeyName - the key looked up in this properties to get the class name
methodKeyName - the key looked up in this properties to get the factory method name
prototype - the factory method's prototype
Returns:
a factory method
Throws:
ExtendedPropertiesException - if there was an error resolving the class or the factory method

getFactoryMethod

public java.lang.reflect.Method getFactoryMethod(java.lang.String classKeyName,
                                                 java.lang.String methodKeyName,
                                                 java.lang.Class<?>... prototype)
                                          throws ExtendedPropertiesException
Returns a factory method for a class. The class name is retrieved from this properties using key classKeyName. The static factory method is then searched with the name from this properties using key methodKeyName and the given prototype.

Parameters:
classKeyName - the key looked up in this properties to get the class name
methodKeyName - the key looked up in this properties to get the factory method name
prototype - the factory method's prototype
Returns:
a factory method
Throws:
ExtendedPropertiesException - if there was an error resolving the class or the factory method

getFactoryMethod

public java.lang.reflect.Method getFactoryMethod(java.lang.Class<?> factoryClass,
                                                 java.lang.Class<?> returnType,
                                                 java.lang.String methodName,
                                                 java.lang.Class<?>... prototype)
                                          throws ExtendedPropertiesException
Returns a className's factory method with the specified name and prototype. The factory method must be static and must return the specified returnType. If the returnType is null, the factory method must return factoryClass.

Parameters:
factoryClass - the class the get the factory method for
returnType - the superclass (or class itself) of instances returned by the static factory method
methodName - the factory method name
prototype - the factory method's prototype
Returns:
a factory method
Throws:
ExtendedPropertiesException - if there was an error resolving the class or the factory method

getConstructor

public <E> java.lang.reflect.Constructor<E> getConstructor(java.lang.Class<E> checkClass,
                                                           java.lang.String classKeyName,
                                                           java.lang.Class<?>... prototype)
                                                throws ExtendedPropertiesException
Returns a constructor for a class. The class name is retrieved from this properties using key classKeyName. The constructor is then searched with the given prototype.

Type Parameters:
E - the type of the object for which the constructor is retrieved
Parameters:
classKeyName - the key looked up in this properties to get the class name
checkClass - the superclass (or class itself) of instances created by the constructor
prototype - the factory method's prototype
Returns:
a constructor
Throws:
ExtendedPropertiesException - if there was an error resolving the class or the factory method

getConstructor

public java.lang.reflect.Constructor<?> getConstructor(java.lang.String classKeyName,
                                                       java.lang.Class<?>... prototype)
                                                throws ExtendedPropertiesException
Returns a constructor for a class. The class name is retrieved from this properties using key classKeyName. The constructor is then searched with the given prototype.

Parameters:
classKeyName - the key looked up in this properties to get the class name
prototype - the factory method's prototype
Returns:
a constructor
Throws:
ExtendedPropertiesException - if there was an error resolving the class or the factory method

getConstructor

public <E> java.lang.reflect.Constructor<E> getConstructor(java.lang.Class<E> objectClass,
                                                           java.lang.Class<?>... prototype)
                                                throws ExtendedPropertiesException
Returns a constructor for a class. The class name is retrieved from this properties using key classKeyName. The constructor is then searched with the given prototype.

Type Parameters:
E - the type of the object for which the constructor is retrieved
Parameters:
objectClass - the class the get the constructor for
prototype - the factory method's prototype
Returns:
a constructor
Throws:
ExtendedPropertiesException - if there was an error resolving the class or the factory method

getSerializedObject

public java.lang.Object getSerializedObject(java.lang.String fileNameProperty,
                                            boolean required)
                                     throws ExtendedPropertiesException
Reads a serialized object from the file specified by the given property.

Parameters:
fileNameProperty - the name of the property where the file path is stored
required - if true, the property is required to exist (otherwise and exception is thrown)
Returns:
an object that is read from the serialization
Throws:
ExtendedPropertiesException - if the required property does not exist or there was a problem deserializing the object

getInetAddressProperty

public java.net.InetAddress getInetAddressProperty(java.lang.String key,
                                                   boolean required)
                                            throws ExtendedPropertiesException
Returns an inet address from the given property.

The property value can either be a machine name or a textual representation of its IP address. If a literal IP address is supplied, only the validity of the address format is checked.

Parameters:
key - the hashtable key
required - if true the property must exist (and null will be never returned)
Returns:
an inet address from the given property
Throws:
ExtendedPropertiesException - if the property was not found or the class with the property's value cannot be resolved

getDatabaseConnection

public java.sql.Connection getDatabaseConnection(java.lang.String key)
                                          throws ExtendedPropertiesException,
                                                 java.sql.SQLException
Returns a data source using either JNDI or DriverManager using the URL specified in the value of the property key. If the URL starts with "java:", JNDI is looked up, otherwise the driver manager is used (the driver for the url must be registered in advance).

Parameters:
key - the hashtable key
Returns:
an established database connection
Throws:
ExtendedPropertiesException - if the specified key is not found in the configuration or there is no JNDI data source with the given URL
java.sql.SQLException - if the database connection cannot be established

getSQLStatement

public java.sql.PreparedStatement getSQLStatement(java.lang.String connectionKey,
                                                  java.lang.String sqlStatementKey)
                                           throws ExtendedPropertiesException,
                                                  java.sql.SQLException
Prepare an SQL statement from the configuration. It is prepared on the database connection that is resolved using getDatabaseConnection(java.lang.String).

Parameters:
connectionKey - the hashtable key for the connection URL
sqlStatementKey - the hashtable key for the SQL statement
Returns:
a prepared SQL statement
Throws:
ExtendedPropertiesException - if the specified keys are not found or there is no valid database connection for the connectionKey
java.sql.SQLException - if there was an error preparing the SQL statement

getSQLStatement

public java.sql.PreparedStatement getSQLStatement(java.sql.Connection connection,
                                                  java.lang.String key)
                                           throws java.sql.SQLException
Prepare an SQL statement from the configuration. It is prepared on the specified database connection.

Parameters:
connection - the database connection for which to prepare SQL statement
key - the hashtable key for the SQL statement
Returns:
a prepared SQL statement
Throws:
ExtendedPropertiesException - if the specified key is not found
java.sql.SQLException - if the database connection cannot be established