org.oddjob.arooa
Class ArooaHandler

java.lang.Object
  extended byorg.oddjob.arooa.ArooaHandler
Direct Known Subclasses:
AntElementHandler, AntJobComponentHandler, DesignComponentHandler, DesignElementHandler, DesignSkipHandler, DesignStartHandler, DesignValueHandler, DualHandler, MainHandler, MappedPropertyHandler, Oddjob.OddjobHandler, SerializedComponentHandler, SkipLevelHandler, TypicalElementHandler, XmlHandler

public class ArooaHandler
extends java.lang.Object

The common superclass for all SAX event handlers used to parse the configuration file.

The context will hold all state information. At each time there is one active handler for the current element. It can use onStartChild() to set an alternate handler for the child.

Based on the original by duncan@x180.com and Costin Manolache.


Constructor Summary
ArooaHandler()
           
 
Method Summary
 void characters(char[] buf, int start, int count, ArooaContext context)
          Handles text within an element.
protected  void checkNamespace(java.lang.String uri)
          Will be called every time a namespace is reached.
 void onEndChild(java.lang.String uri, java.lang.String tag, java.lang.String qname, ArooaContext context)
          Handle the end of a element.
 void onEndElement(java.lang.String uri, java.lang.String tag, ArooaContext context)
          Called when this element and all elements nested into it have been handled (i.e.
 ArooaHandler onStartChild(java.lang.String uri, java.lang.String tag, java.lang.String qname, org.xml.sax.Attributes attrs, ArooaContext context)
          Handles the start of an element.
 void onStartElement(java.lang.String uri, java.lang.String tag, java.lang.String qname, org.xml.sax.Attributes attrs, ArooaContext context)
          Handles the start of an element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArooaHandler

public ArooaHandler()
Method Detail

onStartElement

public void onStartElement(java.lang.String uri,
                           java.lang.String tag,
                           java.lang.String qname,
                           org.xml.sax.Attributes attrs,
                           ArooaContext context)
                    throws org.xml.sax.SAXParseException
Handles the start of an element. This base implementation does nothing.

Parameters:
uri - the namespace URI for the tag
tag - The name of the element being started. Will not be null.
qname - The qualified name of the element.
attrs - Attributes of the element being started. Will not be null.
context - The context that this element is in.
Throws:
org.xml.sax.SAXParseException - if this method is not overridden, or in case of error in an overridden version

onStartChild

public ArooaHandler onStartChild(java.lang.String uri,
                                 java.lang.String tag,
                                 java.lang.String qname,
                                 org.xml.sax.Attributes attrs,
                                 ArooaContext context)
                          throws org.xml.sax.SAXParseException
Handles the start of an element. This base implementation just throws an exception - you must override this method if you expect child elements.

Parameters:
uri - The namespace uri for this element.
tag - The name of the element being started. Will not be null.
qname - The qualified name for this element.
attrs - Attributes of the element being started. Will not be null.
context - The current context.
Returns:
a handler (in the derived classes)
Throws:
org.xml.sax.SAXParseException - if this method is not overridden, or in case of error in an overridden version

onEndChild

public void onEndChild(java.lang.String uri,
                       java.lang.String tag,
                       java.lang.String qname,
                       ArooaContext context)
                throws org.xml.sax.SAXParseException
Handle the end of a element.

Parameters:
uri - the namespace uri of the element
tag - the tag of the element
qname - the qualified name of the element
context - the current context
Throws:
org.xml.sax.SAXParseException - if an error occurs

onEndElement

public void onEndElement(java.lang.String uri,
                         java.lang.String tag,
                         ArooaContext context)
Called when this element and all elements nested into it have been handled (i.e. at the ).

Parameters:
uri - the namespace uri for this element
tag - the element name
context - the current context

characters

public void characters(char[] buf,
                       int start,
                       int count,
                       ArooaContext context)
                throws org.xml.sax.SAXParseException
Handles text within an element. This base implementation just throws an exception, you must override it if you expect content.

Parameters:
buf - A character array of the text within the element. Will not be null.
start - The start element in the array.
count - The number of characters to read from the array.
context - The current context.
Throws:
org.xml.sax.SAXParseException - if this method is not overridden, or in case of error in an overridden version

checkNamespace

protected void checkNamespace(java.lang.String uri)
Will be called every time a namespace is reached. It'll verify if the ns was processed, and if not load the task definitions.

Parameters:
uri - The namespace uri.