org.apache.lenya.cms.cocoon.transformation
Class UsecaseMenuTransformer

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.xml.AbstractXMLPipe
              extended by org.apache.cocoon.transformation.AbstractTransformer
                  extended by org.apache.cocoon.transformation.AbstractSAXTransformer
                      extended by org.apache.lenya.cms.cocoon.transformation.UsecaseMenuTransformer
All Implemented Interfaces:
org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.cocoon.sitemap.SitemapModelComponent, org.apache.cocoon.transformation.Transformer, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer, org.apache.excalibur.xml.sax.XMLConsumer, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler

public class UsecaseMenuTransformer
extends org.apache.cocoon.transformation.AbstractSAXTransformer
implements org.apache.avalon.framework.activity.Disposable

This transformer disables menu items (by removing the href attribute) which are not allowed with respect to the usecase policies.


Field Summary
static java.lang.String HREF_ATTRIBUTE
          Comment for HREF_ATTRIBUTE The href attribute
static java.lang.String ITEM_ELEMENT
          ITEM_ELEMENT The item element
static java.lang.String MENU_ELEMENT
          MENU_ELEMENT The menu element
static java.lang.String MENU_NAMESPACE
          The menu namespace.
static java.lang.String NAMESPACE
          NAMESPACE The usecase namespace
static java.lang.String USECASE_ATTRIBUTE
          USECASE_ATTRIBUTE The usecase attribute
 
Fields inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
context, defaultNamespaceURI, EMPTY_ATTRIBUTES, emptyAttributes, ignoreEmptyCharacters, ignoreEventsCount, ignoreHooksCount, ignoreWhitespaces, manager, namespaceURI, objectModel, parameters, recorderStack, request, resolver, response, source, stack
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.transformation.Transformer
ROLE
 
Constructor Summary
UsecaseMenuTransformer()
           
 
Method Summary
protected  void addMessages(java.util.List messages)
           
 void dispose()
           
protected  org.xml.sax.Attributes removeHrefAttribute(org.xml.sax.Attributes attr)
          Removes the href attribute.
 void setup(org.apache.cocoon.environment.SourceResolver _resolver, java.util.Map _objectModel, java.lang.String src, org.apache.avalon.framework.parameters.Parameters _parameters)
           
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String raw, org.xml.sax.Attributes attr)
          (non-Javadoc)
 
Methods inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
addRecorder, characters, comment, configure, endCDATA, endDocument, endDTD, endElement, endEntity, endParametersRecording, endParametersRecording, endPrefixMapping, endRecording, endSAXRecording, endSerializedXMLRecording, endTextRecording, endTransformingElement, findPrefixMapping, getMutableAttributes, ignorableWhitespace, processingInstruction, recycle, removeRecorder, sendEndElementEvent, sendEndElementEventNS, sendEndPrefixMapping, sendEvents, sendParametersEvents, sendStartElementEvent, sendStartElementEvent, sendStartElementEventNS, sendStartElementEventNS, sendStartPrefixMapping, sendTextEvent, service, setDocumentLocator, setupTransforming, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startParametersRecording, startPrefixMapping, startRecording, startSAXRecording, startSerializedXMLRecording, startTextRecording, startTransformingElement
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
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
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

MENU_ELEMENT

public static final java.lang.String MENU_ELEMENT
MENU_ELEMENT The menu element

See Also:
Constant Field Values

MENU_NAMESPACE

public static final java.lang.String MENU_NAMESPACE
The menu namespace.

See Also:
Constant Field Values

ITEM_ELEMENT

public static final java.lang.String ITEM_ELEMENT
ITEM_ELEMENT The item element

See Also:
Constant Field Values

USECASE_ATTRIBUTE

public static final java.lang.String USECASE_ATTRIBUTE
USECASE_ATTRIBUTE The usecase attribute

See Also:
Constant Field Values

HREF_ATTRIBUTE

public static final java.lang.String HREF_ATTRIBUTE
Comment for HREF_ATTRIBUTE The href attribute

See Also:
Constant Field Values

NAMESPACE

public static final java.lang.String NAMESPACE
NAMESPACE The usecase namespace

See Also:
Constant Field Values
Constructor Detail

UsecaseMenuTransformer

public UsecaseMenuTransformer()
Method Detail

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String raw,
                         org.xml.sax.Attributes attr)
                  throws org.xml.sax.SAXException
(non-Javadoc)

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.apache.cocoon.transformation.AbstractSAXTransformer
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

removeHrefAttribute

protected org.xml.sax.Attributes removeHrefAttribute(org.xml.sax.Attributes attr)
Removes the href attribute.

Parameters:
attr - The original attributes.
Returns:
An attributes object.

addMessages

protected void addMessages(java.util.List messages)
                    throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

setup

public void setup(org.apache.cocoon.environment.SourceResolver _resolver,
                  java.util.Map _objectModel,
                  java.lang.String src,
                  org.apache.avalon.framework.parameters.Parameters _parameters)
           throws org.apache.cocoon.ProcessingException,
                  org.xml.sax.SAXException,
                  java.io.IOException
Specified by:
setup in interface org.apache.cocoon.sitemap.SitemapModelComponent
Overrides:
setup in class org.apache.cocoon.transformation.AbstractSAXTransformer
Throws:
org.apache.cocoon.ProcessingException
org.xml.sax.SAXException
java.io.IOException
See Also:
SitemapModelComponent.setup(org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
Overrides:
dispose in class org.apache.cocoon.transformation.AbstractSAXTransformer
See Also:
Disposable.dispose()


Copyright $ Apache Software Foundation. All Rights Reserved.