Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.milligan.eccles
Class Tag  view Tag download Tag.java

java.lang.Object
  extended byorg.milligan.eccles.Tag
Direct Known Subclasses:
ReportingTag

public abstract class Tag
extends java.lang.Object

Base implementation of a Tag.

NOTE Can be called by multiple threads at once, so only use member variables when you are aware they are going to be shared between instances

When executing the following methods are called in sequence

 doStartTag
     doInitChildren
             ...child tags executed...   ] For as many times
         doAfterChildren                 ] as required
     doFinishChildren
 doEndTag 


Field Summary
private  java.util.ArrayList children
           
static EcclesReturnValue CONTINUE_PROCESSING
          Contine processing with the next sibling
(package private) static java.lang.String[] defaultProperties
          Default property names to be displayed
static java.lang.String EXCEPTION_PROPERTY
          Property to hold an exception within a try-catch block
private  java.lang.String id
           
protected static org.apache.log4j.Category log
           
private  java.lang.String name
           
private  Tag parent
          Reference to the parent instance
static EcclesReturnValue PROCESS_CHILDREN
          Continue and process children
static EcclesReturnValue SIMPLE_BREAK
          Break processing and return to a parent tag
static EcclesReturnValue SKIP_CHILDREN
          Do not process children
static java.lang.String UNDERLYING_EXCEPTION_PROPERTY
          Property to hold the underlying exception within a try-catch block
 
Constructor Summary
Tag()
           
 
Method Summary
 void addChildTag(Tag child)
          Add a child tag
 EcclesReturnValue doAfterChildren(RunState state)
          Called after children have been processed.
 EcclesReturnValue doEndTag(RunState state)
          Called at the end of the tag, after children have finished being processed.
 void doFinishChildren(RunState state)
          Called after the children have been processed.
 void doInitChildren(RunState state)
          Called before children are processed
 EcclesReturnValue doStartTag(RunState state)
          Called at the start of tag processing.
 java.util.ArrayList getChildren()
           
 java.lang.String getId()
           
 java.lang.String getName()
           
 Tag getParent()
          Get the parent tag
(package private)  java.lang.String getPropertiesForDisplay()
          Retrieve a list of properties for output.
 java.lang.String getPropertiesString(java.lang.String[] properties)
          Get the named properties (via introspection) and return them in an xml type properties string
abstract  java.lang.String getTagName()
          Name of the tag as it appears in the config file.
 java.lang.String[] getTagPropertiesForDisplay()
          Tags should override this value to display their property values for exceptions or output events
 boolean hasChildren()
          Returns true if the tag has any children
 boolean isEmpty(java.lang.String s)
          Test string for null or zero length
 boolean isReportingTag()
          Should this tag report if one of it's children reports?
 void populateElement(org.w3c.dom.Element element)
          Called when the element for this tag is created.
protected  void populateElementPropertiesFromTag(org.w3c.dom.Element outputElement, java.lang.String[] properties)
          Add properties from tag into the output element Element
 void setChildren(java.util.ArrayList children)
           
 void setId(java.lang.String id)
           
 void setName(java.lang.String name)
           
private  void setParent(Tag parent)
          Set the parent Tag
 void validate()
          Called upon tag creation during script reading.
 void validateHasNoChildren()
          Throw an exception if the tag has children
 void validateNotEmptyProperties(java.lang.String[] propertyNames)
          Helper function for making sure properties exist in this tag, and that if they are strings, then they are not empty
 void validateNotEmptyProperties(java.lang.String prop1, java.lang.String prop2)
           
 void validateNotEmptyProperties(java.lang.String prop1, java.lang.String prop2, java.lang.String prop3)
           
 void validateNotEmptyProperty(java.lang.String prop1)
           
 void validateProperties(java.lang.String[] propertyNames)
          Helper function for making sure properties exist in this tag.
 void validateProperties(java.lang.String prop1, java.lang.String prop2)
           
 void validateProperties(java.lang.String prop1, java.lang.String prop2, java.lang.String prop3)
           
 void validateProperty(java.lang.String prop1)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Category log

SKIP_CHILDREN

public static final EcclesReturnValue SKIP_CHILDREN
Do not process children


PROCESS_CHILDREN

public static final EcclesReturnValue PROCESS_CHILDREN
Continue and process children


CONTINUE_PROCESSING

public static final EcclesReturnValue CONTINUE_PROCESSING
Contine processing with the next sibling


SIMPLE_BREAK

public static final EcclesReturnValue SIMPLE_BREAK
Break processing and return to a parent tag


EXCEPTION_PROPERTY

public static final java.lang.String EXCEPTION_PROPERTY
Property to hold an exception within a try-catch block

See Also:
Constant Field Values

UNDERLYING_EXCEPTION_PROPERTY

public static final java.lang.String UNDERLYING_EXCEPTION_PROPERTY
Property to hold the underlying exception within a try-catch block

See Also:
Constant Field Values

defaultProperties

static final java.lang.String[] defaultProperties
Default property names to be displayed


name

private java.lang.String name

id

private java.lang.String id

children

private java.util.ArrayList children

parent

private Tag parent
Reference to the parent instance

Constructor Detail

Tag

public Tag()
Method Detail

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

setId

public void setId(java.lang.String id)

getId

public java.lang.String getId()

setChildren

public void setChildren(java.util.ArrayList children)

getChildren

public java.util.ArrayList getChildren()

hasChildren

public boolean hasChildren()
Returns true if the tag has any children


getParent

public Tag getParent()
Get the parent tag


setParent

private void setParent(Tag parent)
Set the parent Tag


addChildTag

public void addChildTag(Tag child)
                 throws EcclesException
Add a child tag


validate

public void validate()
              throws EcclesException
Called upon tag creation during script reading. Perform extra validation that cannot be handled by the schema


validateHasNoChildren

public void validateHasNoChildren()
                           throws EcclesException
Throw an exception if the tag has children


doStartTag

public EcclesReturnValue doStartTag(RunState state)
                             throws EcclesException
Called at the start of tag processing. Return either PROCESS_CHILDREN (to process the children) or SKIP_CHILDREN


doEndTag

public EcclesReturnValue doEndTag(RunState state)
                           throws EcclesException
Called at the end of the tag, after children have finished being processed. Return either CONTINUE_PROCESSING or BREAK


doInitChildren

public void doInitChildren(RunState state)
                    throws EcclesException
Called before children are processed


doFinishChildren

public void doFinishChildren(RunState state)
Called after the children have been processed. Called even if a break or exception happens in a child. If doInitChildren is called successfully, then this method will be called.


doAfterChildren

public EcclesReturnValue doAfterChildren(RunState state)
                                  throws EcclesException
Called after children have been processed. Valid return values are PROCESS_CHILDREN (to go through the loop and process the children again) or SKIP_CHILDREN


validateProperties

public void validateProperties(java.lang.String[] propertyNames)
                        throws EcclesException
Helper function for making sure properties exist in this tag.


validateProperty

public void validateProperty(java.lang.String prop1)
                      throws EcclesException

validateProperties

public void validateProperties(java.lang.String prop1,
                               java.lang.String prop2)
                        throws EcclesException

validateProperties

public void validateProperties(java.lang.String prop1,
                               java.lang.String prop2,
                               java.lang.String prop3)
                        throws EcclesException

validateNotEmptyProperties

public void validateNotEmptyProperties(java.lang.String[] propertyNames)
                                throws EcclesException
Helper function for making sure properties exist in this tag, and that if they are strings, then they are not empty


validateNotEmptyProperty

public void validateNotEmptyProperty(java.lang.String prop1)
                              throws EcclesException

validateNotEmptyProperties

public void validateNotEmptyProperties(java.lang.String prop1,
                                       java.lang.String prop2)
                                throws EcclesException

validateNotEmptyProperties

public void validateNotEmptyProperties(java.lang.String prop1,
                                       java.lang.String prop2,
                                       java.lang.String prop3)
                                throws EcclesException

getTagName

public abstract java.lang.String getTagName()
Name of the tag as it appears in the config file. Used for exception & status reporting


getPropertiesString

public java.lang.String getPropertiesString(java.lang.String[] properties)
Get the named properties (via introspection) and return them in an xml type properties string


getPropertiesForDisplay

java.lang.String getPropertiesForDisplay()
Retrieve a list of properties for output.


getTagPropertiesForDisplay

public java.lang.String[] getTagPropertiesForDisplay()
Tags should override this value to display their property values for exceptions or output events


isEmpty

public boolean isEmpty(java.lang.String s)
Test string for null or zero length


isReportingTag

public boolean isReportingTag()
Should this tag report if one of it's children reports?


populateElement

public void populateElement(org.w3c.dom.Element element)
Called when the element for this tag is created. Insert attributes and children as required. The default implementation will fill the properties from the tag properties defined in the call to getTagPropertiesForDisplay(). Default tag properties (i.e. name and id ) are automatically filled before the code reaches here


populateElementPropertiesFromTag

protected void populateElementPropertiesFromTag(org.w3c.dom.Element outputElement,
                                                java.lang.String[] properties)
Add properties from tag into the output element Element