org.scopemvc.util
Class ScopeConfig

java.lang.Object
  |
  +--org.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) 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.12 $ $Date: 2002/09/12 10:51:34 $
Author:
Steve Meyfroidt
See Also:
DefaultScopeConfig

Method Summary
static char getChar(java.lang.String inKey)
          Gets the char value of the property
static java.lang.Class getClass(java.lang.String inKey)
          Gets the class value of the property
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()
          Gets the instance of the Scope config
static java.lang.Integer getInteger(java.lang.String inKey)
          Gets the integer value of the property
static java.util.Iterator getKeysMatching(java.lang.String inKeyPrefix)
          Gets the keys starting with the prefix
static java.lang.Object getObject(java.lang.String inKey)
          Gets the object value of the property
protected static java.util.HashMap getProperties()
          Gets the properties
protected  java.lang.String getPropertyPrefix()
          Returns the property name prefix.
static java.lang.String getString(java.lang.String inKey)
          Gets the string value of the property
protected  void initialise()
          Initialises the class by loading in the configuration.
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
 

Method Detail

getInstance

public static ScopeConfig getInstance()
Gets the instance of the Scope config

Returns:
The singleton of the ScopeConfig

getString

public static java.lang.String getString(java.lang.String inKey)
Gets the string value of the property

Parameters:
inKey - The property name
Returns:
The string value of the property

getObject

public static java.lang.Object getObject(java.lang.String inKey)
Gets the object value of the property

Parameters:
inKey - The property name
Returns:
The object value of the property

getChar

public static char getChar(java.lang.String inKey)
Gets the char value of the property

Parameters:
inKey - The property name
Returns:
The char value of the property

getClass

public static java.lang.Class getClass(java.lang.String inKey)
Gets the class value of the property

Parameters:
inKey - The property name
Returns:
The class value of the property

getInteger

public static java.lang.Integer getInteger(java.lang.String inKey)
Gets the integer value of the property

Parameters:
inKey - The property name
Returns:
The integer value of the property

getKeysMatching

public static java.util.Iterator getKeysMatching(java.lang.String inKeyPrefix)
Gets the keys starting with the prefix

Parameters:
inKeyPrefix - The prefix of the keys to match
Returns:
an Iterator over the matching keys

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.

Parameters:
inName - The new propertiesName value

getProperties

protected static java.util.HashMap getProperties()
Gets the properties

Returns:
The properties value

getDefaultCustomConfigName

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

Returns:
The defaultCustomConfigName value

getDefaultConfigName

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

Returns:
The defaultConfigName value

getPropertyPrefix

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

Returns:
The propertyPrefix value

initialise

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



Copyright © 2000-2002 The Scope Team. All Rights Reserved.