com.rhi.architecture.batch
Class HierarchicalDBConfigMixin

java.lang.Object
  extended bycom.rhi.architecture.batch.HierarchicalDBConfigMixin
All Implemented Interfaces:
ConfigMixin

public class HierarchicalDBConfigMixin
extends java.lang.Object
implements ConfigMixin

Loads configuration information from a database table and adds it to the property information.

Since:
1.0
Author:
Josh Tolle

Field Summary
static java.lang.String BASE_ENV
          The base value for the second bindable value of the SQL statement
static java.lang.String DB_DRIVER_PROPERTY_NAME
          The name of the property that defines the driver to use when connecting to the database from which properties are retrieved.
static java.lang.String DB_PASSWORD_PROPERTY_NAME
          The name of the property that defines the password for the database from which properties are retrieved.
static java.lang.String DB_URL_PROPERTY_NAME
          The name of the property that defines the URL to the database from which properties are retrieved.
static java.lang.String DB_USER_PROPERTY_NAME
          The name of the property that defines the user for the database from which properties are retrieved.
static java.lang.String[] DEFAULT_COLUMNS
          The default column names for retrieving properties from the database.
static java.lang.String DEFAULT_SQL
          The SQL statement that is used by default is the SQL_QUERY_PROPERTY_NAME is not defined.
static java.lang.String PARENT_PROPERTY_NAME
          The name of the property that defines the name of the application that should be used to load baseline properties.
static java.lang.String PROP_SEPARATOR
          Separator between heirerarchical properties.
static java.lang.String SCHEMA_PROPERTY_NAME
          The name of the property that defines the schema in the database in which the properties table resides.
static java.lang.String SQL_QUERY_PROPERTY_NAME
          The name of the property that defines SQL query to use when retrieving properties from the database.
 
Constructor Summary
HierarchicalDBConfigMixin()
           
 
Method Summary
 void loadConfiguration(java.util.Properties props)
          Retrieve property values and append them to the provided default application properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQL_QUERY_PROPERTY_NAME

public static final java.lang.String SQL_QUERY_PROPERTY_NAME
The name of the property that defines SQL query to use when retrieving properties from the database.

See Also:
Constant Field Values

DB_PASSWORD_PROPERTY_NAME

public static final java.lang.String DB_PASSWORD_PROPERTY_NAME
The name of the property that defines the password for the database from which properties are retrieved.

See Also:
Constant Field Values

DB_USER_PROPERTY_NAME

public static final java.lang.String DB_USER_PROPERTY_NAME
The name of the property that defines the user for the database from which properties are retrieved.

See Also:
Constant Field Values

DB_URL_PROPERTY_NAME

public static final java.lang.String DB_URL_PROPERTY_NAME
The name of the property that defines the URL to the database from which properties are retrieved.

See Also:
Constant Field Values

DB_DRIVER_PROPERTY_NAME

public static final java.lang.String DB_DRIVER_PROPERTY_NAME
The name of the property that defines the driver to use when connecting to the database from which properties are retrieved.

See Also:
Constant Field Values

PARENT_PROPERTY_NAME

public static final java.lang.String PARENT_PROPERTY_NAME
The name of the property that defines the name of the application that should be used to load baseline properties.

See Also:
Constant Field Values

SCHEMA_PROPERTY_NAME

public static final java.lang.String SCHEMA_PROPERTY_NAME
The name of the property that defines the schema in the database in which the properties table resides. This is used by a call to MessageFormat to replace the {0} in the SQL statement.

See Also:
Constant Field Values

DEFAULT_COLUMNS

public static final java.lang.String[] DEFAULT_COLUMNS
The default column names for retrieving properties from the database.


DEFAULT_SQL

public static final java.lang.String DEFAULT_SQL
The SQL statement that is used by default is the SQL_QUERY_PROPERTY_NAME is not defined. The SQL statement, be it this default one or one passed in viat the SQL_QUERY_PROPERTY_NAME property, needs to have a {0} prior to any table names for formatting; if there is a SCHEMA_PROPERTY_NAME propery set, this will be replaced with the value therein, otherwise it is discarded.

See Also:
Constant Field Values

PROP_SEPARATOR

public static final java.lang.String PROP_SEPARATOR
Separator between heirerarchical properties.

See Also:
Constant Field Values

BASE_ENV

public static final java.lang.String BASE_ENV
The base value for the second bindable value of the SQL statement

See Also:
Constant Field Values
Constructor Detail

HierarchicalDBConfigMixin

public HierarchicalDBConfigMixin()
Method Detail

loadConfiguration

public void loadConfiguration(java.util.Properties props)
                       throws InitializationException
Retrieve property values and append them to the provided default application properties.

This method also has a recursive ability to load parent properties. It does this by looking for a property (PARENT_PROPERTY_NAME) to be set at the level at which it is looking; it will do this a far back as there are parent property values set. The recursion is done by replacing the first bindable value with the value found in PARENT_PROPERTY_NAME each time such a property is found.

If there is no SQL_QUERY_PROPERTY_NAME property found, the default properties SQL statement is set to DEFAULT_SQL. If a SQL statement is set, then the names of the columns to get from the result set as the properties "DatabaseConfigMixin.col0" and quotDatabaseConfigMixin.col1" (if these are not found, the values default to DEFAULT_COLUMNS), and the bindable values in the properties "DatabaseConfigMixin.val0" (used as the heirerarchical key) through "DatabaseConfigMixin.valN". Also, the value in the SCHEMA_PROPERTY_NAME, if it exists, will replace any instances of {0} in any SQL statement passed.

The properties in DB_DRIVER_PROPERTY_NAME, DB_PASSWORD_PROPERTY_NAME, DB_USER_PROPERTY_NAME, and DB_URL_PROPERTY_NAME are all required for this method to work.

Specified by:
loadConfiguration in interface ConfigMixin
Parameters:
props - - the properties used to access the database
Throws:
InitializationException - if there is any problem loading properties
Since:
1.1


Copyright © 2002-2004 Robert Half International. All Rights Reserved.