com.ibm.adt.topology.object.properties
Class PropertyList

java.lang.Object
  extended by com.ibm.adt.topology.object.properties.PropertyObject
      extended by com.ibm.adt.topology.object.properties.PropertyList
All Implemented Interfaces:
java.io.Serializable

public class PropertyList
extends PropertyObject

PropertyList is a component of the TopologyObject properties heirachy. It serves as the root PropertyObject in a TopologyObjects' property heirarchy, and provides the basis for building a navigable property structure that can be queried. PropertyList can contain any number of named properties encapsulated in a Property object. A Property object serves as the anchor for an individual named property, and it's value can be basic strings, other PropertyLists, PropertyArrays, or any other serializeable Java object. Using these PropertyObjects, a very complex property heiarchy can be constructed.

The format of a TopologyObject property heirarchy is as follows:

 TopologyObject (must contain only one root PropertyList)
     PropertyList (may contain any number of Property objects)
         Property (value will contain one of the following...)
             PropertyArray (contains any number of one of the following...) 
                 PropertyList (may nest other Property objects)
                 PropertyValue (encapsulates Object)
             PropertyList (may nest other Property objects)
             PropertyValue (encapsulates Object)
 
PropertyObject instances may be nested any number of layers deep to create the specific property heirarchy that is desired. Once the root PropertyList is constructed, the PropertyList is finalized using the finalizePropertyTree() method.

See Also:
Property, PropertyValue, PropertyArray, Serialized Form

Field Summary
static int DEFAULT_COMPARATOR_KEY
          Default comparator key value that can be specified when custom comparators are not required.
static int IGNORE_COMPARATOR_KEY
          Comparator key value that can be specified when a comparator should ignore the values of this PropertyList.
 
Fields inherited from class com.ibm.adt.topology.object.properties.PropertyObject
hashCode, name
 
Constructor Summary
PropertyList()
          Creates a PropertyList object.
PropertyList(int comparatorKey)
          Creates a PropertyList object with the specified comparatorKey.
 
Method Summary
(package private)  void add(Property property)
          Adds Property to Property without enforcing unique name requirements.
 void addAll(PropertyList properties)
          Adds a collection of Property(s) to add to this PropertyList.
 void addProperty(Property property)
          Adds a Property to the PropertyList.
 void copyAll(PropertyList properties, boolean overwrite)
          Copies a collection of Property(s) to this PropertyList.
 boolean equals(java.lang.Object o)
           
(package private)  void finalizeProperty()
          Finalizes the PropertyObject structure.
 void finalizePropertyTree(TopologyObject topologyObject)
          Finalizes the property tree structure and makes it navigable and queryable.
 PropertyList findProperties(java.lang.String searchText, boolean isCaseSensitive, boolean isCollectionName, boolean isPropertyName, boolean isPropertyValue)
          Search the PropertyList for occurrences of properties that match the specified criteria and return the matches in the form of a PropertyList.
 int getComparatorKey()
          Returns the comparator key for this PropertyList.
 Property getProperty(java.lang.String name)
          Get the Property object with the specified name.
 java.util.Collection getPropertyKeys()
          Returns a collection of all keys contained in this PropertyList.
 PropertyObject getPropertyValue(java.lang.String key)
          Retreive the Property value associated with the specified property key.
 int hashCode()
           
 boolean isEmpty()
          Test whether the PropertyList is empty.
 java.util.Iterator iterator()
          Returns an Iterator for the PropertyList.
 java.lang.String peek()
          Returns string that peeks the property value.
 boolean remove(Property property)
          Removes the specified Property object from this PropertyList.
 void setComparatorKey(int comparatorKey)
          Sets the comparator key for this PropertyList or overrides the comparatorKey specified in the constructor.
 int size()
          Returns the size of the PropertyList.
 java.lang.Object[] toArray()
          Returns the PropertyList as an array of Property objects.
 java.lang.String toString()
          Returns the PropertyList formatted as a String.
 java.io.OutputStream toXML()
          Returns the PropertyList in XML format as defined by TopologyObjectProperties.xsd.
 
Methods inherited from class com.ibm.adt.topology.object.properties.PropertyObject
getKey, getName, getOrdinal, getParent, getRoot, setParent, setRoot
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_COMPARATOR_KEY

public static final int DEFAULT_COMPARATOR_KEY
Default comparator key value that can be specified when custom comparators are not required.

See Also:
Constant Field Values

IGNORE_COMPARATOR_KEY

public static final int IGNORE_COMPARATOR_KEY
Comparator key value that can be specified when a comparator should ignore the values of this PropertyList.

See Also:
Constant Field Values
Constructor Detail

PropertyList

public PropertyList(int comparatorKey)
Creates a PropertyList object with the specified comparatorKey. Use this constructor when the PropertyList object will be anchored within a PropertyArray object and a unique comparator key is required.

Parameters:
comparatorKey -

PropertyList

public PropertyList()
Creates a PropertyList object. PropertyList acts as the anchor object for a TopologyObject's property tree, but can also exist as a child of Property. This constructor creates a PropertyList object with a default comparator key.

Method Detail

getPropertyKeys

public final java.util.Collection getPropertyKeys()
Returns a collection of all keys contained in this PropertyList.

Returns:

getProperty

public final Property getProperty(java.lang.String name)
Get the Property object with the specified name.

Parameters:
name -
Returns:
the Property

findProperties

public final PropertyList findProperties(java.lang.String searchText,
                                         boolean isCaseSensitive,
                                         boolean isCollectionName,
                                         boolean isPropertyName,
                                         boolean isPropertyValue)
                                  throws TopologyException
Search the PropertyList for occurrences of properties that match the specified criteria and return the matches in the form of a PropertyList.

Parameters:
searchText - - a regular expression string to match against
isCaseSensitive - - true to search with case sensitivity
isCollectionName - - true to return property collections if property name matches a collection property
isPropertyName - - true to search property names
isPropertyValue - - true to search property values
Returns:
a PropertyList object containing Property objects which encapsulate the search hits.
Throws:
TopologyException

getPropertyValue

public final PropertyObject getPropertyValue(java.lang.String key)
                                      throws TopologyException
Retreive the Property value associated with the specified property key.

Parameters:
key - - The key of the property
Returns:
the value as a PropertyObject
Throws:
TopologyException - if invalid key is specified

toXML

public final java.io.OutputStream toXML()
                                 throws TopologyException
Returns the PropertyList in XML format as defined by TopologyObjectProperties.xsd.

Returns:
XML formatted string
Throws:
TopologyException

addAll

public final void addAll(PropertyList properties)
Adds a collection of Property(s) to add to this PropertyList.

Parameters:
properties -

copyAll

public final void copyAll(PropertyList properties,
                          boolean overwrite)
                   throws TopologyException
Copies a collection of Property(s) to this PropertyList.

Parameters:
properties -
overwrite -
Throws:
TopologyException

remove

public final boolean remove(Property property)
Removes the specified Property object from this PropertyList.

Parameters:
property -

toArray

public final java.lang.Object[] toArray()
Returns the PropertyList as an array of Property objects.

Returns:

iterator

public final java.util.Iterator iterator()
Returns an Iterator for the PropertyList.

Returns:
the iterator

isEmpty

public final boolean isEmpty()
Test whether the PropertyList is empty.

Returns:
true if empty

size

public final int size()
Returns the size of the PropertyList.

Returns:
number of Property objects contained in the list

addProperty

public final void addProperty(Property property)
                       throws TopologyException
Adds a Property to the PropertyList. Property must have unique name relative to this PropertyList.

Parameters:
property - - Property to add to this PropertyList.
Throws:
TopologyException - if name is not unique

toString

public final java.lang.String toString()
Returns the PropertyList formatted as a String.

Overrides:
toString in class java.lang.Object
Returns:
a string

equals

public final boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object

getComparatorKey

public final int getComparatorKey()
Returns the comparator key for this PropertyList.

Returns:
the comparator key

setComparatorKey

public final void setComparatorKey(int comparatorKey)
Sets the comparator key for this PropertyList or overrides the comparatorKey specified in the constructor.

Parameters:
comparatorKey - the comparator key to set

finalizePropertyTree

public final void finalizePropertyTree(TopologyObject topologyObject)
Finalizes the property tree structure and makes it navigable and queryable. This method should only be called to set this PropertyList instance as the root PropertyObject for the given TopologyObject. Note that this method is called automatically from within the default TopologyProvider implementation whenever a TopologyObjects' properties are cached.


peek

public final java.lang.String peek()
Description copied from class: PropertyObject
Returns string that peeks the property value.

Specified by:
peek in class PropertyObject
Returns:

add

final void add(Property property)
Adds Property to Property without enforcing unique name requirements. Note: This method is not externalized by design.

Parameters:
property - Property to add to this PropertyList.

finalizeProperty

final void finalizeProperty()
Description copied from class: PropertyObject
Finalizes the PropertyObject structure.

Specified by:
finalizeProperty in class PropertyObject


© Copyright 2006 IBM Corp. 2006 All Rights Reserved