Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.scopemvc.util
Class ScopeConfig  view ScopeConfig download ScopeConfig.java

java.lang.Object
  extended byorg.scopemvc.util.ScopeConfig

public final class ScopeConfig
extends java.lang.Object

Loads the Scope config in such a way that custom properties can be set from the Java command line (-D switch) or from a custom ResourceBundle. Any properties not supplied are loaded with the default settings in DefaultScopeConfig.

A custom ResourceBundle name can be specified with setPropertiesName(java.lang.String) 55 during application initialisation, although the default "scope.config" resource is always loaded if it can be found.

Property definitions have the following priority (from highest to lowest):

  1. System properties
  2. setPropertiesName() properties
  3. scope.properties
  4. DefaultScopeConfig

Version:
$Revision: 1.6 $ $Date: 2002/05/26 10:30:54 $

Field Summary
private static java.lang.String DEFAULT_CONFIG_NAME
           
private static java.lang.String DEFAULT_CUSTOM_CONFIG_NAME
           
private static java.lang.String DEFAULT_PROPERTY_PREFIX
           
private static ScopeConfig instance
           
private static org.apache.commons.logging.Log LOG
           
private  java.util.HashMap properties
          The Scope config properties loaded at first access of config.
 
Constructor Summary
private ScopeConfig()
           
 
Method Summary
static char getChar(java.lang.String inKey)
           
static java.lang.Class getClass(java.lang.String inKey)
           
protected  java.lang.String getDefaultConfigName()
          Returns the name of the default configuration bundle.
protected  java.lang.String getDefaultCustomConfigName()
          Returns the name of the default custom configuration bundle.
static ScopeConfig getInstance()
           
static java.lang.Integer getInteger(java.lang.String inKey)
           
static java.util.Iterator getKeysMatching(java.lang.String inKeyPrefix)
           
static java.lang.Object getObject(java.lang.String inKey)
           
protected static java.util.HashMap getProperties()
           
private  java.util.ResourceBundle getProperties(java.lang.String inPropertiesName)
          Try to return a ResourceBundle loaded from the named resource, or null if can't load.
protected  java.lang.String getPropertyPrefix()
          Returns the property name prefix.
static java.lang.String getString(java.lang.String inKey)
           
protected  void initialise()
          Initialises the class by loading in the configuration.
private  void loadCustomConfig()
          Attempt to load a custom ResourceBundle called "scope.properties" if it can be found.
private  void loadDefaultConfig()
          Load the default config.
private  void loadSystemConfig()
          Load Scope config properties from System properties.
private  void putAll(java.util.ResourceBundle inBundle)
          Put properties from the ResourceBundle.
static void setPropertiesName(java.lang.String inName)
          Set name of custom properties that will override the DefaultScopeConfig and "scope.properties", but not override any System properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.commons.logging.Log LOG

properties

private java.util.HashMap properties
The Scope config properties loaded at first access of config.


instance

private static ScopeConfig instance

DEFAULT_CUSTOM_CONFIG_NAME

private static final java.lang.String DEFAULT_CUSTOM_CONFIG_NAME
See Also:
Constant Field Values

DEFAULT_CONFIG_NAME

private static final java.lang.String DEFAULT_CONFIG_NAME
See Also:
Constant Field Values

DEFAULT_PROPERTY_PREFIX

private static final java.lang.String DEFAULT_PROPERTY_PREFIX
See Also:
Constant Field Values
Constructor Detail

ScopeConfig

private ScopeConfig()
Method Detail

getInstance

public static ScopeConfig getInstance()

getDefaultCustomConfigName

protected java.lang.String getDefaultCustomConfigName()
Returns the name of the default custom configuration bundle.


getDefaultConfigName

protected java.lang.String getDefaultConfigName()
Returns the name of the default configuration bundle.


getPropertyPrefix

protected java.lang.String getPropertyPrefix()
Returns the property name prefix.


initialise

protected void initialise()
Initialises the class by loading in the configuration.


loadSystemConfig

private void loadSystemConfig()
Load Scope config properties from System properties.


loadCustomConfig

private void loadCustomConfig()
Attempt to load a custom ResourceBundle called "scope.properties" if it can be found.


loadDefaultConfig

private void loadDefaultConfig()
Load the default config.


putAll

private void putAll(java.util.ResourceBundle inBundle)
Put properties from the ResourceBundle.


getProperties

private java.util.ResourceBundle getProperties(java.lang.String inPropertiesName)
Try to return a ResourceBundle loaded from the named resource, or null if can't load.


setPropertiesName

public static void setPropertiesName(java.lang.String inName)
Set name of custom properties that will override the DefaultScopeConfig and "scope.properties", but not override any System properties.


getProperties

protected static java.util.HashMap getProperties()

getString

public static java.lang.String getString(java.lang.String inKey)

getObject

public static java.lang.Object getObject(java.lang.String inKey)

getChar

public static char getChar(java.lang.String inKey)

getClass

public static java.lang.Class getClass(java.lang.String inKey)

getInteger

public static java.lang.Integer getInteger(java.lang.String inKey)

getKeysMatching

public static java.util.Iterator getKeysMatching(java.lang.String inKeyPrefix)