org.apache.cocoon.portal.transformation
Class EventLinkTransformer

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.cocoon.portal.transformation.AbstractCopletTransformer
                          extended by org.apache.cocoon.portal.transformation.EventLinkTransformer
All Implemented Interfaces:
Poolable, Recyclable, Disposable, Component, Configurable, LogEnabled, Serviceable, SitemapModelComponent, Transformer, XMLPipe, XMLProducer, XMLConsumer, ContentHandler, LexicalHandler

public class EventLinkTransformer
extends AbstractCopletTransformer

This transformer searches for event descriptions in the XML. For each one an event is created and the event link is inserted into the XML instead of the description.

Example:

<root xmlns:event="http://apache.org/cocoon/portal/eventlink/1.0">
        <event:event attribute="href">
                <a href="http://eventlinkexample"/>
        </event:event>
        <event:event element="uri">
                <link><uri>http://eventlinkexample</uri></link>
        </event:event>
 </root>
The transformer will create two CopletLinkEvents and insert corresponding links to them to the XML instead of "http://eventlinkexample". If such a link is pressed the corresponding CopletLinkEvent is sent to the Subscribers to be handled.
Please see also the documentation of superclass AbstractCopletTransformer for how the coplet instance data are acquired.

Version:
$Id: EventLinkTransformer.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Björn Lütkemeier

Field Summary
static String ATTRIBUTE_ATTR
          An attribute's name of EVENT_ELEMENT.
static String ELEMENT_ATTR
          An attribute's name of EVENT_ELEMENT.
static String EVENT_ELEM
          The XML element name to listen for.
static String NAMESPACE_URI
          The namespace URI to listen for.
 
Fields inherited from class org.apache.cocoon.portal.transformation.AbstractCopletTransformer
COPLET_ID_PARAM, portalService
 
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
EventLinkTransformer()
           
 
Method Summary
 void endElement(String uri, String name, String raw)
          Overridden from superclass.
 void recycle()
          Overridden from superclass.
 void startElement(String uri, String name, String raw, Attributes attr)
          Overridden from superclass.
 
Methods inherited from class org.apache.cocoon.portal.transformation.AbstractCopletTransformer
dispose, getCopletInstanceData, getCopletInstanceData, getPortalService, service
 
Methods inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
addRecorder, characters, comment, configure, endCDATA, endDocument, endDTD, endEntity, endParametersRecording, endParametersRecording, endPrefixMapping, endRecording, endSAXRecording, endSerializedXMLRecording, endTextRecording, endTransformingElement, findPrefixMapping, getMutableAttributes, ignorableWhitespace, processingInstruction, removeRecorder, sendEndElementEvent, sendEndElementEventNS, sendEndPrefixMapping, sendEvents, sendParametersEvents, sendStartElementEvent, sendStartElementEvent, sendStartElementEventNS, sendStartElementEventNS, sendStartPrefixMapping, sendTextEvent, setDocumentLocator, setup, 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

NAMESPACE_URI

public static final String NAMESPACE_URI
The namespace URI to listen for.

See Also:
Constant Field Values

EVENT_ELEM

public static final String EVENT_ELEM
The XML element name to listen for.

See Also:
Constant Field Values

ATTRIBUTE_ATTR

public static final String ATTRIBUTE_ATTR
An attribute's name of EVENT_ELEMENT.

See Also:
Constant Field Values

ELEMENT_ATTR

public static final String ELEMENT_ATTR
An attribute's name of EVENT_ELEMENT.

See Also:
Constant Field Values
Constructor Detail

EventLinkTransformer

public EventLinkTransformer()
Method Detail

recycle

public void recycle()
Overridden from superclass.

Specified by:
recycle in interface Recyclable
Overrides:
recycle in class AbstractSAXTransformer

startElement

public void startElement(String uri,
                         String name,
                         String raw,
                         Attributes attr)
                  throws SAXException
Overridden from superclass.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class AbstractSAXTransformer
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
name - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
attr - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
SAXException
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public void endElement(String uri,
                       String name,
                       String raw)
                throws SAXException
Overridden from superclass.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class AbstractSAXTransformer
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
name - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
Throws:
SAXException
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)


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