org.apache.cocoon.taglib
Class TagSupport

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.taglib.TagSupport
All Implemented Interfaces:
Poolable, Recyclable, Component, LogEnabled, Tag
Direct Known Subclasses:
ActionListenerTag, AttributeTag, ConverterTag, FacetTag, IterationTestTag, LoadBundleTag, LocaleTag, TransformerTagSupport, ValidatorTag, ValueChangeListenerTag, VarTagSupport, XMLProducerTagSupport

public abstract class TagSupport
extends AbstractLogEnabled
implements Tag, Recyclable

Abstract implementation for all Tags

Version:
CVS $Id: TagSupport.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Volker Schmitt

Field Summary
protected  Map objectModel
           
protected  Parameters parameters
           
protected  Tag parent
           
protected  SourceResolver resolver
           
 
Fields inherited from interface org.apache.cocoon.taglib.Tag
EVAL_BODY, EVAL_PAGE, ROLE, SKIP_BODY
 
Constructor Summary
TagSupport()
           
 
Method Summary
 int doEndTag(String namespaceURI, String localName, String qName)
          Process the end tag for this instance.
 int doStartTag(String namespaceURI, String localName, String qName, Attributes atts)
          Process the start tag for this instance.
static Tag findAncestorWithClass(Tag from, Class klass)
          Find the instance of a given class type that is closest to a given instance.
 Object findAttribute(String name)
          Searches for the named attribute in request, session (if valid), and application scope(s) in order and returns the value associated or null.
 Tag getParent()
          Get the parent (closest enclosing tag handler) for this tag handler.
 void recycle()
           
 void setParent(Tag parent)
          Set the parent (closest enclosing tag handler) of this tag handler.
 void setup(SourceResolver resolver, Map objectModel, Parameters parameters)
          Set the SourceResolver, objectModel Map and sitemap Parameters used to process the request.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected Tag parent

resolver

protected SourceResolver resolver

objectModel

protected Map objectModel

parameters

protected Parameters parameters
Constructor Detail

TagSupport

public TagSupport()
Method Detail

findAncestorWithClass

public static final Tag findAncestorWithClass(Tag from,
                                              Class klass)
Find the instance of a given class type that is closest to a given instance. This method uses the getParent method from the Tag interface. This method is used for coordination among cooperating tags.

Parameters:
from - The instance from where to start looking.
klass - The subclass of Tag or interface to be matched
Returns:
the nearest ancestor that implements the interface or is an instance of the class specified

doEndTag

public int doEndTag(String namespaceURI,
                    String localName,
                    String qName)
             throws SAXException
Process the end tag for this instance.

Specified by:
doEndTag in interface Tag
Returns:
EVAL_PAGE.
Throws:
SAXException

doStartTag

public int doStartTag(String namespaceURI,
                      String localName,
                      String qName,
                      Attributes atts)
               throws SAXException
Process the start tag for this instance.

The doStartTag method assumes that pageContext and parent have been set. It also assumes that any properties exposed as attributes have been set too. When this method is invoked, the body has not yet been evaluated.

Specified by:
doStartTag in interface Tag
Returns:
EVAL_BODY or SKIP_BODY.
Throws:
SAXException

findAttribute

public final Object findAttribute(String name)
Searches for the named attribute in request, session (if valid), and application scope(s) in order and returns the value associated or null.

Returns:
the value associated or null

getParent

public final Tag getParent()
Get the parent (closest enclosing tag handler) for this tag handler.

Specified by:
getParent in interface Tag
Returns:
the current parent, or null if none.

recycle

public void recycle()
Specified by:
recycle in interface Recyclable

setParent

public final void setParent(Tag parent)
Set the parent (closest enclosing tag handler) of this tag handler. Invoked by the TagTransformer prior to doStartTag().

This value is *not* reset by doEndTag() and must be explicitly reset by a Tag implementation.

Specified by:
setParent in interface Tag
Parameters:
parent - the parent tag, or null.

setup

public void setup(SourceResolver resolver,
                  Map objectModel,
                  Parameters parameters)
           throws SAXException,
                  IOException
Set the SourceResolver, objectModel Map and sitemap Parameters used to process the request.

Specified by:
setup in interface Tag
Throws:
SAXException
IOException


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.