org.peace_tools.workspace
Class ClassifierList

java.lang.Object
  extended by org.peace_tools.workspace.ClassifierList

public class ClassifierList
extends java.lang.Object

A class to encapsulate information about a list of DBClassifier entries that have already been configured in this work space. This class is instantiated from the Work space class. This class is relatively straightforward in that it merely contains a list of DBClassifier entires. In addition, it facilitates marshalling and unmarshalling of data and handling generation of notification events on change.


Field Summary
private  java.util.ArrayList<DBClassifier> classifiers
          The list of DB classifier objects that have been configured and added to this list.
 
Constructor Summary
ClassifierList()
          The default constructor.
 
Method Summary
static ClassifierList create(org.w3c.dom.Element dbClassListNode)
          Helper method to utilize data from a DOM tree to create a suitable ClassifierList entry.
 java.util.ArrayList<DBClassifier> getClassifiers()
          Obtain reference to a clone of list of classifiers.
 int getSize()
          Convenience method to determine the number of classifiers in this list.
 void marshall(org.w3c.dom.Element workspace)
          Method to marshall the data stored in this object to become part of a DOM tree element passed in.
 void marshall(java.io.PrintWriter out)
          Method to marshall the data stored in this object directly to a XML fragement.
 void set(java.util.ArrayList<DBClassifier> classifierList)
          Method to set a new set of classifier entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classifiers

private java.util.ArrayList<DBClassifier> classifiers
The list of DB classifier objects that have been configured and added to this list. This list is populated either via the create method or new entries are set via the setClassifiers() method in this class.

Constructor Detail

ClassifierList

public ClassifierList()
The default constructor. It merely initializes all the instance variables to their default initial value. This creates an empty DBClassifier list.

Method Detail

create

public static ClassifierList create(org.w3c.dom.Element dbClassListNode)
                             throws java.lang.Exception
Helper method to utilize data from a DOM tree to create a suitable ClassifierList entry. This method is typically used to create a suitable ClassifierList entry using data from a given DOM element. For each DBClassifier entry this method uses the DBClassifier.create method to create suitable entries.

Parameters:
dbClassListNode - The DOM element to be used for creating the list and to be used for creating the DBClassifier entries.
Returns:
The newly created ClassifierList entry based on the DOM data.
Throws:
java.lang.Exception - This method throws an exception when errors occur during reading and processing elements from the DOM node.

set

public void set(java.util.ArrayList<DBClassifier> classifierList)
Method to set a new set of classifier entries. This method sets a new set of classifiers to be used for classifying ESTs based on their data base source information. If the supplied list is empty then all classifiers are cleared.

Parameters:
classifierList - The new list of classifier entries to be set for classifiying EST entries based on their origin data base names.

getClassifiers

public java.util.ArrayList<DBClassifier> getClassifiers()
Obtain reference to a clone of list of classifiers. This method must be used to obtain the list of classifiers currently configured for this work space. This method makes a copy of the classifiers and returns the copy. Consequently, the actual classifier list cannot be directly modified. Instead, the set() method must be used to actually udpate the list of entries.

Note: The list of classifiers returned by this method is a clone and modifying them does not modify the classifiers in this class.

Returns:
A copy of the list of classifiers associated with this work space.

getSize

public int getSize()
Convenience method to determine the number of classifiers in this list. This method returns the number of classifiers currently configured in this list.

Returns:
The number of classifiers currently in the classifier list.

marshall

public final void marshall(org.w3c.dom.Element workspace)
Method to marshall the data stored in this object to become part of a DOM tree element passed in. This method assumes that the element passed in corresponds to the parent Workspace node in the DOM tree.

Parameters:
workspace - The DOM element corresponding to the Workspace node that contains this entry.

marshall

public final void marshall(java.io.PrintWriter out)
Method to marshall the data stored in this object directly to a XML fragement. The XML fragement is guaranteed to be compatible with the PEACE work space configuration data. This method provides better control on the XML formatting to generate a more readable XML output when compared to the DOM tree.

Parameters:
out - The stream to which the XML must be serialized.