org.jboss.util.property
Class PropertyManager

java.lang.Object
  extended byorg.jboss.util.property.PropertyManager

public final class PropertyManager
extends java.lang.Object

A more robust replacement of java.lang.System for property access.


Field Summary
static java.lang.String DEFAULT_PROPERTY_READER_TOKEN
          Token which specifies the default property reader
static java.lang.String READER_PROPERTY_NAME
          Property reader list property name
 
Method Summary
static void addPropertyListener(PropertyListener (src)  listener)
          Add a property listener.
static void addPropertyListeners(PropertyListener (src) [] listeners)
          Add an array of property listeners.
static boolean containsProperty(java.lang.String name)
          Check if this map contains a given property.
static java.lang.String[] getArrayProperty(java.lang.String name)
          Get an array style property.
static java.lang.String[] getArrayProperty(java.lang.String base, java.lang.String[] defaultValues)
          Get an array style property.
static PropertyMap (src) getDefaultPropertyMap()
          Get the default PropertyMap.
static java.lang.String getProperty(java.lang.String name)
          Get a property.
static java.lang.String getProperty(java.lang.String name, java.lang.String defaultValue)
          Get a property.
static PropertyGroup (src) getPropertyGroup(java.lang.String basename)
          Get a property group for the given property base.
static PropertyGroup (src) getPropertyGroup(java.lang.String basename, int index)
          Get a property group for the given property base at the given index.
static void load(java.util.Map map)
          Load properties from a map.
static void load(PropertyReader (src)  reader)
          Load properties from a PropertyReader.
static void load(java.lang.String classname)
          Load properties from a PropertyReader specifed by the given class name.
static void load(java.lang.String prefix, java.util.Map map)
          Load properties from a map.
static java.util.Iterator names()
          Return an iterator over all contained property names.
static java.lang.String removeProperty(java.lang.String name)
          Remove a property.
static boolean removePropertyListener(PropertyListener (src)  listener)
          Remove a property listener.
static java.lang.String setProperty(java.lang.String name, java.lang.String value)
          Set a property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

READER_PROPERTY_NAME

public static final java.lang.String READER_PROPERTY_NAME
Property reader list property name

See Also:
Constant Field Values (src)

DEFAULT_PROPERTY_READER_TOKEN

public static final java.lang.String DEFAULT_PROPERTY_READER_TOKEN
Token which specifies the default property reader

See Also:
Constant Field Values (src)
Method Detail

getDefaultPropertyMap

public static PropertyMap (src)  getDefaultPropertyMap()
Get the default PropertyMap.

Returns:
Default PropertyMap.

addPropertyListener

public static void addPropertyListener(PropertyListener (src)  listener)
Add a property listener.

Parameters:
listener - Property listener to add.

addPropertyListeners

public static void addPropertyListeners(PropertyListener (src) [] listeners)
Add an array of property listeners.

Parameters:
listeners - Array of property listeners to add.

removePropertyListener

public static boolean removePropertyListener(PropertyListener (src)  listener)
Remove a property listener.

Parameters:
listener - Property listener to remove.
Returns:
True if listener was removed.

load

public static void load(java.lang.String prefix,
                        java.util.Map map)
                 throws PropertyException (src) 
Load properties from a map.

Parameters:
prefix - Prefix to append to all map keys (or null).
map - Map containing properties to load.
Throws:
PropertyException (src)

load

public static void load(java.util.Map map)
                 throws PropertyException (src) ,
                        java.io.IOException
Load properties from a map.

Parameters:
map - Map containing properties to load.
Throws:
PropertyException (src)
java.io.IOException

load

public static void load(PropertyReader (src)  reader)
                 throws PropertyException (src) ,
                        java.io.IOException
Load properties from a PropertyReader.

Parameters:
reader - PropertyReader to read properties from.
Throws:
PropertyException (src)
java.io.IOException

load

public static void load(java.lang.String classname)
                 throws PropertyException (src) ,
                        java.io.IOException
Load properties from a PropertyReader specifed by the given class name.

Parameters:
classname - Class name of a PropertyReader to read from.
Throws:
PropertyException (src)
java.io.IOException

setProperty

public static java.lang.String setProperty(java.lang.String name,
                                           java.lang.String value)
Set a property.

Parameters:
name - Property name.
value - Property value.
Returns:
Previous property value or null.

removeProperty

public static java.lang.String removeProperty(java.lang.String name)
Remove a property.

Parameters:
name - Property name.
Returns:
Removed property value or null.

getProperty

public static java.lang.String getProperty(java.lang.String name,
                                           java.lang.String defaultValue)
Get a property.

Parameters:
name - Property name.
defaultValue - Default property value.
Returns:
Property value or default.

getProperty

public static java.lang.String getProperty(java.lang.String name)
Get a property.

Parameters:
name - Property name.
Returns:
Property value or null.

getArrayProperty

public static java.lang.String[] getArrayProperty(java.lang.String base,
                                                  java.lang.String[] defaultValues)
Get an array style property.

Parameters:
base - Base property name.
defaultValues - Default property values.
Returns:
Array of property values or default.

getArrayProperty

public static java.lang.String[] getArrayProperty(java.lang.String name)
Get an array style property.

Parameters:
name - Property name.
Returns:
Array of property values or empty array.

names

public static java.util.Iterator names()
Return an iterator over all contained property names.

Returns:
Property name iterator.

containsProperty

public static boolean containsProperty(java.lang.String name)
Check if this map contains a given property.

Parameters:
name - Property name.
Returns:
True if contains property.

getPropertyGroup

public static PropertyGroup (src)  getPropertyGroup(java.lang.String basename)
Get a property group for the given property base.

Parameters:
basename - Base property name.
Returns:
Property group.

getPropertyGroup

public static PropertyGroup (src)  getPropertyGroup(java.lang.String basename,
                                             int index)
Get a property group for the given property base at the given index.

Parameters:
basename - Base property name.
index - Array property index.
Returns:
Property group.