com.edustructures.sifworks
Class ADKProperties

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 com.edustructures.sifworks.ADKProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>
Direct Known Subclasses:
AgentProperties, TransportProperties

public class ADKProperties
extends java.util.Properties

The abstract base class for agent and zone properties.

ADKProperties adds convenience methods to the java.util.Properties class for getting and setting property values by data type. In addition, it overrides the getProperty method to inherit the property value from its parent if not defined locally. In the ADK, the properties of a zone are always inherited from the default properties of the agent.

Note that property inheritance is only provided by the getProperty method; no other superclass methods support inheritance. Thus, calling enumerating property elements does not include the properties of the parent object. Similarly, saving an ADKProperties to disk with the store method only writes the properties that are defined locally. When the properties are subsequently read from disk, they will not include the inherited properties of the parent object, nor will the object's relationship with its parent be re-established.

Version:
1.0
See Also:
Serialized Form

Constructor Summary
ADKProperties(ADKProperties inherit)
          Creates a properties object that inherits values from a parent
 
Method Summary
 ADKProperties getParent()
          Gets the parent object from which properties are inherited
 java.lang.String getProperty(java.lang.String name)
          Overridden to inherit properties from parent
 boolean getProperty(java.lang.String prop, boolean def)
          Gets a property value as a boolean.
 int getProperty(java.lang.String prop, int defaultValue)
          Gets a property value as an int.
 java.lang.String getProperty(java.lang.String prop, java.lang.String defaultValue)
          Gets a property value as a String.
 void setProperty(java.lang.String prop, boolean value)
          Sets a boolean property
 void setProperty(java.lang.String prop, int value)
          Sets an int property
 java.lang.Object setProperty(java.lang.String name, java.lang.String value)
          Sets the value of a string property
 
Methods inherited from class java.util.Properties
list, list, load, loadFromXML, propertyNames, save, store, storeToXML, storeToXML
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ADKProperties

public ADKProperties(ADKProperties inherit)
Creates a properties object that inherits values from a parent

Parameters:
inherit - The parent ADKProperties object
Method Detail

getParent

public ADKProperties getParent()
Gets the parent object from which properties are inherited


getProperty

public java.lang.String getProperty(java.lang.String prop,
                                    java.lang.String defaultValue)
Gets a property value as a String. The property is inherited from this object's parent if not defined locally.

Overrides:
getProperty in class java.util.Properties
Parameters:
prop - The name of the property
defaultValue - The default value to return when the proprety is undefined
Returns:
The value of the property, or defaultValue if undefined

getProperty

public int getProperty(java.lang.String prop,
                       int defaultValue)
Gets a property value as an int. The property is inherited from this object's parent if not defined locally.

Parameters:
prop - The name of the property
defaultValue - The default value to return when the proprety is undefined or is not an integer
Returns:
The value of the property, or defaultValue if undefined or not an integer

getProperty

public boolean getProperty(java.lang.String prop,
                           boolean def)
Gets a property value as a boolean. The property is inherited from this object's parent if not defined.

Parameters:
prop - The name of the property
defaultValue - The default value to return when the proprety is undefined or is not set to "true"
Returns:
The value of the property, or defaultValue if undefined or is not set to "true"

setProperty

public void setProperty(java.lang.String prop,
                        int value)
Sets an int property

Parameters:
prop - The name of the property
value - The property value

setProperty

public void setProperty(java.lang.String prop,
                        boolean value)
Sets a boolean property

Parameters:
prop - The name of the property
value - The property value

setProperty

public java.lang.Object setProperty(java.lang.String name,
                                    java.lang.String value)
Sets the value of a string property

Overrides:
setProperty in class java.util.Properties
Parameters:
name - The name of the property
value - The property value

getProperty

public java.lang.String getProperty(java.lang.String name)
Overridden to inherit properties from parent

Overrides:
getProperty in class java.util.Properties
Parameters:
name - The property name
Returns:
The value of the property if defined by this object or by its parent


Copyright © 2001-2007 Edustructures LLC. All Rights Reserved. SIFWorks® and ADK® are registered trademarks of Edustructures LLC. SIF™ and Schools Interoperability Framework are trademarks of the Schools Interoperability Framework Association.