Jumpi v1.2.0

org.jumpi.impl
Class AbstractConfigurationLoader

java.lang.Object
  |
  +--org.jumpi.impl.AbstractConfigurationLoader
All Implemented Interfaces:
ConfigurationLoader
Direct Known Subclasses:
ConfigurationLoader

public abstract class AbstractConfigurationLoader
extends java.lang.Object
implements ConfigurationLoader

Provides a mechanism to load and customize configuration properties.


Field Summary
static java.lang.String PROPERTY_SET_KEY
          Property key determining property set to load.
static java.lang.String PROPERTY_SYSTEM_PREFIX
          Prefix used to identify system properties.
static java.lang.String REMOVE_PROPERTY
          Property value to indicate removal.
 
Constructor Summary
AbstractConfigurationLoader()
           
 
Method Summary
protected abstract  void addSystemProperties(java.util.Hashtable props)
          Add any System properties to the list of properties.
 Properties getConfiguration(java.util.Hashtable parameters)
          Gets the named property set using loadPropertySet(java.lang.String, java.util.Hashtable, java.util.Hashtable).
 java.lang.String getJumpiClassname(java.util.Hashtable parameters)
          Get the classname of the Jumpi instance.
protected abstract  void loadPropertySet(java.lang.String propertySetName, java.util.Hashtable props, java.util.Hashtable parameters)
          Load a property set into the props Properties container, given a set name, and customization parameters.
protected  void replaceCustomProperties(java.util.Hashtable props, java.util.Hashtable parameters)
          Replace loaded property values with client provided alternatives.
protected  void replaceSystemProperties(java.util.Hashtable props)
          Replace any property values beginning with $ with the corresponding system environment variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_SET_KEY

public static final java.lang.String PROPERTY_SET_KEY
Property key determining property set to load. Value: org.jumpi.configurationloader.property-set.

See Also:
Constant Field Values

REMOVE_PROPERTY

public static final java.lang.String REMOVE_PROPERTY
Property value to indicate removal. Value: org.jumpi.configurationloader.remove-property.

See Also:
Constant Field Values

PROPERTY_SYSTEM_PREFIX

public static final java.lang.String PROPERTY_SYSTEM_PREFIX
Prefix used to identify system properties. Value: $

See Also:
Constant Field Values
Constructor Detail

AbstractConfigurationLoader

public AbstractConfigurationLoader()
Method Detail

getConfiguration

public Properties getConfiguration(java.util.Hashtable parameters)
                            throws java.lang.Exception
Gets the named property set using loadPropertySet(java.lang.String, java.util.Hashtable, java.util.Hashtable). All system properties are then added to the properties. Thereafter any additional properties in parameters are added and any properties to be deleted are deleted. Expansion of system variables then takes place over all remaining properties.

Specified by:
getConfiguration in interface ConfigurationLoader
Parameters:
parameters - read-only customization parameters.
Returns:
a complete set of Jumpi configuration properties.
Throws:
java.lang.Exception - for any failure condition.
java.lang.IllegalArgumentException - if parameters is null.
See Also:
ConfigurationLoader.getConfiguration(java.util.Hashtable)

getJumpiClassname

public java.lang.String getJumpiClassname(java.util.Hashtable parameters)
                                   throws java.lang.Exception
Get the classname of the Jumpi instance.

Specified by:
getJumpiClassname in interface ConfigurationLoader
Parameters:
parameters - read-only customization parameters - not used.
Returns:
org.jumpi.impol.JumpiImpl always.
Throws:
java.lang.Exception - when any error condition occurs.
See Also:
ConfigurationLoader.getJumpiClassname(java.util.Hashtable)

loadPropertySet

protected abstract void loadPropertySet(java.lang.String propertySetName,
                                        java.util.Hashtable props,
                                        java.util.Hashtable parameters)
                                 throws java.lang.Exception
Load a property set into the props Properties container, given a set name, and customization parameters.

Parameters:
propertySetName - the property set to load.
props - the container for the loaded properties.
parameters - customization properties to change loading behaviour or results.
Throws:
java.lang.Exception - if any failure condition occurs.

replaceCustomProperties

protected void replaceCustomProperties(java.util.Hashtable props,
                                       java.util.Hashtable parameters)
Replace loaded property values with client provided alternatives. If the replacement value has the special value REMOVE_PROPERTY, then the property will be removed.

Parameters:
props - loaded properties to be changed.
parameters - client provided properties to replace loaded properties.

addSystemProperties

protected abstract void addSystemProperties(java.util.Hashtable props)
Add any System properties to the list of properties. Abstract since MIDP API does not support listing of System properties. Replace any existing property with the system property name with the system property.

Parameters:
props - the Properties where to place any system properties.

replaceSystemProperties

protected void replaceSystemProperties(java.util.Hashtable props)
Replace any property values beginning with $ with the corresponding system environment variable.

Parameters:
props - the properties to have system variables replaced.

Jumpi v1.2.0

Copyright 2003, Peter Jonathan Klauser.