helma.util
Class SystemProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<java.lang.Object,java.lang.Object>
          extended by java.util.Properties
              extended by helma.util.SystemProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public final class SystemProperties
extends java.util.Properties

A property dictionary that is updated from a property file each time the file is modified. It is also case insensitive.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
SystemProperties()
          Construct an empty properties object.
SystemProperties(java.lang.String filename)
          Construct a properties object from a properties file.
SystemProperties(java.lang.String filename, SystemProperties defaultProps)
          Construct a properties object from a file name with the given default properties (ignoring case)
SystemProperties(SystemProperties defaultProps)
          Contstruct a properties object with the given default properties.
 
Method Summary
 void addProps(java.lang.String key, java.io.InputStream in)
          Similar to load(), but adds to the existing properties instead of discarding them.
 boolean contains(java.lang.Object obj)
          Overrides method to act on the wrapped properties object.
 boolean containsKey(java.lang.Object key)
          Overrides method to act on the wrapped properties object.
 java.util.Enumeration elements()
          Overrides method to act on the wrapped properties object.
 java.lang.Object get(java.lang.Object key)
          Overrides method to act on the wrapped properties object.
 long getChecksum()
          Return a checksum that changes when something in the properties changes.
 java.io.File getFile()
          Get the properties file
 java.lang.String getProperty(java.lang.String name)
          Overrides method to act on the wrapped properties object.
 java.lang.String getProperty(java.lang.String name, java.lang.String defaultValue)
          Overrides method to act on the wrapped properties object.
 boolean isEmpty()
          Overrides method to act on the wrapped properties object.
 boolean isIgnoreCase()
          Returns true if this property map ignores key case
 java.util.Enumeration keys()
          Overrides method to act on the wrapped properties object.
 java.util.Set keySet()
          Overrides method to act on the wrapped properties object.
 long lastModified()
          Return the modify-time of the underlying properties file.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 java.lang.Object remove(java.lang.Object key)
          Overrides method to act on the wrapped properties object.
 void removeProps(java.lang.String key)
          Remove an additional properties dictionary.
 void setIgnoreCase(boolean ignore)
          Turns case sensitivity for keys in this Map on or off.
 int size()
          Overrides method to act on the wrapped properties object.
 java.lang.String toString()
          Overrides method to act on the wrapped properties object.
 void update()
          Update/re-read the properties from file if necessary.
 
Methods inherited from class java.util.Properties
list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, clone, containsValue, entrySet, equals, hashCode, putAll, rehash, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SystemProperties

public SystemProperties()
Construct an empty properties object.


SystemProperties

public SystemProperties(java.lang.String filename)
Construct a properties object from a properties file.


SystemProperties

public SystemProperties(SystemProperties defaultProps)
Contstruct a properties object with the given default properties.


SystemProperties

public SystemProperties(java.lang.String filename,
                        SystemProperties defaultProps)
Construct a properties object from a file name with the given default properties (ignoring case)

Method Detail

lastModified

public long lastModified()
Return the modify-time of the underlying properties file.


update

public void update()
Update/re-read the properties from file if necessary.


getChecksum

public long getChecksum()
Return a checksum that changes when something in the properties changes.


getFile

public java.io.File getFile()
Get the properties file

Returns:
the properties file

addProps

public void addProps(java.lang.String key,
                     java.io.InputStream in)
              throws java.io.IOException
Similar to load(), but adds to the existing properties instead of discarding them.

Throws:
java.io.IOException

removeProps

public void removeProps(java.lang.String key)
Remove an additional properties dictionary.


put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
put in class java.util.Hashtable<java.lang.Object,java.lang.Object>

get

public java.lang.Object get(java.lang.Object key)
Overrides method to act on the wrapped properties object.

Specified by:
get in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
get in class java.util.Hashtable<java.lang.Object,java.lang.Object>

remove

public java.lang.Object remove(java.lang.Object key)
Overrides method to act on the wrapped properties object.

Specified by:
remove in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
remove in class java.util.Hashtable<java.lang.Object,java.lang.Object>

contains

public boolean contains(java.lang.Object obj)
Overrides method to act on the wrapped properties object.

Overrides:
contains in class java.util.Hashtable<java.lang.Object,java.lang.Object>

containsKey

public boolean containsKey(java.lang.Object key)
Overrides method to act on the wrapped properties object.

Specified by:
containsKey in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
containsKey in class java.util.Hashtable<java.lang.Object,java.lang.Object>

isEmpty

public boolean isEmpty()
Overrides method to act on the wrapped properties object.

Specified by:
isEmpty in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
isEmpty in class java.util.Hashtable<java.lang.Object,java.lang.Object>

getProperty

public java.lang.String getProperty(java.lang.String name)
Overrides method to act on the wrapped properties object.

Overrides:
getProperty in class java.util.Properties

getProperty

public java.lang.String getProperty(java.lang.String name,
                                    java.lang.String defaultValue)
Overrides method to act on the wrapped properties object.

Overrides:
getProperty in class java.util.Properties

keys

public java.util.Enumeration keys()
Overrides method to act on the wrapped properties object.

Overrides:
keys in class java.util.Hashtable<java.lang.Object,java.lang.Object>

keySet

public java.util.Set keySet()
Overrides method to act on the wrapped properties object.

Specified by:
keySet in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
keySet in class java.util.Hashtable<java.lang.Object,java.lang.Object>

elements

public java.util.Enumeration elements()
Overrides method to act on the wrapped properties object.

Overrides:
elements in class java.util.Hashtable<java.lang.Object,java.lang.Object>

size

public int size()
Overrides method to act on the wrapped properties object.

Specified by:
size in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
size in class java.util.Hashtable<java.lang.Object,java.lang.Object>

toString

public java.lang.String toString()
Overrides method to act on the wrapped properties object.

Overrides:
toString in class java.util.Hashtable<java.lang.Object,java.lang.Object>

setIgnoreCase

public void setIgnoreCase(boolean ignore)
Turns case sensitivity for keys in this Map on or off.


isIgnoreCase

public boolean isIgnoreCase()
Returns true if this property map ignores key case



Copyright © 1998-1998-${year} Helma.org. All Rights Reserved.