org.apache.cocoon.portal.transformation
Class HTMLEventLinkTransformer

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.xml.AbstractXMLPipe
              extended byorg.apache.cocoon.transformation.AbstractTransformer
                  extended byorg.apache.cocoon.transformation.AbstractSAXTransformer
                      extended byorg.apache.cocoon.portal.transformation.AbstractCopletTransformer
                          extended byorg.apache.cocoon.portal.transformation.HTMLEventLinkTransformer
All Implemented Interfaces:
Configurable, ContentHandler, Disposable, LexicalHandler, LogEnabled, Poolable, Recyclable, Serviceable, SitemapModelComponent, Transformer, XMLConsumer, XMLConsumer, XMLPipe, XMLProducer

public class HTMLEventLinkTransformer
extends AbstractCopletTransformer

This transformer transforms html actions into events. The transformer listens for the element a and form. Links that only contain an anchor are ignored. In addition if a link has the attribute "external" with the value "true", the link is also ignored. TODO: Support target attribute

Version:
$Id: HTMLEventLinkTransformer.java 325891 2005-10-17 13:45:43Z cziegeler $

Field Summary
protected  String attributeName
          The temporary attribute used to store the uri
protected  String jxPath
          The jxpath for the attribute
 
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, 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
HTMLEventLinkTransformer()
           
 
Method Summary
protected  void createAnchorEvent(Attributes attributes)
           
protected  void createFormEvent(Attributes attributes)
           
 void endElement(String uri, String name, String raw)
          Process the SAX event.
protected  String getLink(String base, String link)
           
protected  boolean isRemoteAnchor(Attributes attributes)
          Determine if the element is an url and if the url points to some remote source.
 void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
          The Sitemap will call the setup() method to prepare the component for use.
 void startElement(String uri, String name, String raw, Attributes attr)
          Process the SAX event.
 
Methods inherited from class org.apache.cocoon.portal.transformation.AbstractCopletTransformer
dispose, getCopletInstanceData, getCopletInstanceData, 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, recycle, removeRecorder, sendEndElementEvent, sendEndElementEventNS, sendEndPrefixMapping, sendEvents, sendParametersEvents, sendStartElementEvent, sendStartElementEvent, sendStartElementEventNS, sendStartElementEventNS, sendStartPrefixMapping, sendTextEvent, 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

attributeName

protected String attributeName
The temporary attribute used to store the uri


jxPath

protected String jxPath
The jxpath for the attribute

Constructor Detail

HTMLEventLinkTransformer

public HTMLEventLinkTransformer()
Method Detail

setup

public void setup(SourceResolver resolver,
                  Map objectModel,
                  String src,
                  Parameters par)
           throws ProcessingException,
                  SAXException,
                  IOException
Description copied from interface: SitemapModelComponent
The Sitemap will call the setup() method to prepare the component for use. This is where you start the process of getting your information ready to generate your results. See ObjectModelHelper for help with the objectModel.

Specified by:
setup in interface SitemapModelComponent
Overrides:
setup in class AbstractSAXTransformer
Throws:
ProcessingException
SAXException
IOException

startElement

public void startElement(String uri,
                         String name,
                         String raw,
                         Attributes attr)
                  throws SAXException
Description copied from class: AbstractSAXTransformer
Process the SAX event. The namespace of the event is checked. If it is the defined namespace for this transformer, the AbstractSAXTransformer.startTransformingElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) hook is called.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class AbstractSAXTransformer
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
Description copied from class: AbstractSAXTransformer
Process the SAX event. The namespace of the event is checked. If it is the defined namespace for this transformer, the AbstractSAXTransformer.endTransformingElement(java.lang.String, java.lang.String, java.lang.String) hook is called.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class AbstractSAXTransformer
Throws:
SAXException
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

createAnchorEvent

protected void createAnchorEvent(Attributes attributes)
                          throws SAXException
Throws:
SAXException

createFormEvent

protected void createFormEvent(Attributes attributes)
                        throws SAXException
Throws:
SAXException

getLink

protected String getLink(String base,
                         String link)

isRemoteAnchor

protected boolean isRemoteAnchor(Attributes attributes)
Determine if the element is an url and if the url points to some remote source.

Parameters:
attributes - the attributes of the element
Returns:
true if the href url is an anchor pointing to a remote source


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.