com.townleyenterprises.common
Class AppConfig

java.lang.Object
  extended bycom.townleyenterprises.common.AppConfig

public final class AppConfig
extends java.lang.Object

This file provides a generalized mechanism for centralizing access to application configuration information. By default, any system property will override any value provided by the application.

The runtime behavior of this class may be configured using the following properties:

Version:
$Id: AppConfig.java,v 1.9 2004/08/11 13:21:10 atownley Exp $
Author:
Andrew S. Townley

Method Summary
static java.lang.String get(java.lang.String name)
          This method returns the appropriate property value.
static java.lang.String get(java.lang.String prefix, java.lang.String name)
          Alternative method that provides a prefix in addition to the specific parameter to retrieve.
static java.util.List getConfigLoaders()
          This method is used to provide access to the list of registered ConfigLoader instances.
static ConfigSupplier getPersistenceConfigSupplier()
          This method is used to return a reference to the persistence configuration supplier.
static java.util.Properties getProperties()
          This method allows access to all of the property values so that external code can be configured from the unified properties.
static void registerAppSupplier(ConfigSupplier s)
          This method is used to register an ConfigSupplier with the class.
static void registerPersistenceSupplier(ConfigSupplier s)
          This method is used to register a config supplier for the persistence information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

registerAppSupplier

public static void registerAppSupplier(ConfigSupplier s)
                                throws java.io.IOException
This method is used to register an ConfigSupplier with the class. The ConfigSupplier tells the AppConfig where to load the application configuration information.

Throws:
java.io.IOException - if there is a problem accessing the configuration information.

registerPersistenceSupplier

public static void registerPersistenceSupplier(ConfigSupplier s)
This method is used to register a config supplier for the persistence information.


get

public static java.lang.String get(java.lang.String name)
This method returns the appropriate property value.

Parameters:
name - the parameter key
Returns:
the property value

get

public static java.lang.String get(java.lang.String prefix,
                                   java.lang.String name)
Alternative method that provides a prefix in addition to the specific parameter to retrieve.

Parameters:
prefix - the prefix
name - the actual param name
Returns:
the parameter value

getPersistenceConfigSupplier

public static ConfigSupplier getPersistenceConfigSupplier()
This method is used to return a reference to the persistence configuration supplier.

Returns:
ConfigSupplier instance

getProperties

public static java.util.Properties getProperties()
This method allows access to all of the property values so that external code can be configured from the unified properties.

Returns:
a copy of the properties

getConfigLoaders

public static java.util.List getConfigLoaders()
This method is used to provide access to the list of registered ConfigLoader instances.

Returns:
the list


Copyright © 2002-2004, Andrew S. Townley and Townley Enterprises. All Rights Reserved.
This project is hosted on http://te-code.sourceforge.net.