org.apache.cocoon.transformation
Class AbstractDOMTransformer
java.lang.Object
|
+--org.apache.avalon.framework.logger.AbstractLoggable
|
+--org.apache.cocoon.xml.AbstractXMLProducer
|
+--org.apache.cocoon.xml.AbstractXMLPipe
|
+--org.apache.cocoon.xml.dom.DOMBuilder
|
+--org.apache.cocoon.transformation.AbstractDOMTransformer
- All Implemented Interfaces:
- org.apache.avalon.framework.component.Component, org.apache.avalon.framework.component.Composable, org.xml.sax.ContentHandler, org.apache.avalon.framework.activity.Disposable, DOMBuilder.Listener, org.xml.sax.ext.LexicalHandler, org.apache.avalon.framework.logger.Loggable, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, SitemapModelComponent, Transformer, XMLConsumer, XMLPipe, XMLProducer
- public abstract class AbstractDOMTransformer
- extends DOMBuilder
- implements Transformer, DOMBuilder.Listener, org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.excalibur.pool.Recyclable
An Abstract DOM Transformer, for use when a transformer needs a DOM-based
view of the document.
Subclass this interface and implement transform(Document doc)
.
If you need a ComponentManager there is an instance variable
manager
for use.
- Version:
- CVS $Revision $Date
- Author:
- Ross Burton, Bruce G. Robertson
Field Summary |
protected org.xml.sax.ContentHandler |
contentHandler
The ContentHandler receiving SAX events. |
protected org.xml.sax.ext.LexicalHandler |
lexicalHandler
The LexicalHandler receiving SAX events. |
protected org.apache.avalon.framework.component.ComponentManager |
manager
A ComponentManager which is available for use. |
protected java.util.Map |
objectModel
The request object model |
protected org.apache.avalon.framework.parameters.Parameters |
parameters
Parameters in the sitemap |
protected SourceResolver |
resolver
The SAX entity resolver |
protected java.lang.String |
source
The URI requested |
Fields inherited from interface org.apache.cocoon.transformation.Transformer |
ROLE |
Method Summary |
void |
compose(org.apache.avalon.framework.component.ComponentManager manager)
Set the component manager. |
void |
dispose()
dispose |
void |
notify(org.w3c.dom.Document doc)
This method is called when the Document is finished. |
void |
recycle()
Recycle the component. |
void |
setConsumer(XMLConsumer consumer)
Set the XMLConsumer that will receive XML data.
|
void |
setContentHandler(org.xml.sax.ContentHandler handler)
Set the ContentHandler that will receive XML data.
|
void |
setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
Set the LexicalHandler that will receive XML data.
|
void |
setup(SourceResolver resolver,
java.util.Map objectModel,
java.lang.String src,
org.apache.avalon.framework.parameters.Parameters par)
Set the SourceResolver , objectModel Map ,
the source and sitemap Parameters used to process the request.
|
protected abstract org.w3c.dom.Document |
transform(org.w3c.dom.Document doc)
Transform the specified DOM, returning a new DOM to stream down the pipeline. |
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe |
characters, comment, endCDATA, endDTD, endElement, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity, startPrefixMapping |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable |
getLogger, setLogger, 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.xml.sax.ContentHandler |
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping |
Methods inherited from interface org.xml.sax.ext.LexicalHandler |
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity |
resolver
protected SourceResolver resolver
- The SAX entity resolver
objectModel
protected java.util.Map objectModel
- The request object model
source
protected java.lang.String source
- The URI requested
parameters
protected org.apache.avalon.framework.parameters.Parameters parameters
- Parameters in the sitemap
manager
protected org.apache.avalon.framework.component.ComponentManager manager
- A
ComponentManager
which is available for use.
contentHandler
protected org.xml.sax.ContentHandler contentHandler
- The
ContentHandler
receiving SAX events.
lexicalHandler
protected org.xml.sax.ext.LexicalHandler lexicalHandler
- The
LexicalHandler
receiving SAX events.
AbstractDOMTransformer
public AbstractDOMTransformer()
compose
public void compose(org.apache.avalon.framework.component.ComponentManager manager)
- Set the component manager.
- Specified by:
compose
in interface org.apache.avalon.framework.component.Composable
recycle
public void recycle()
- Recycle the component.
- Specified by:
recycle
in interface org.apache.avalon.excalibur.pool.Recyclable
- Overrides:
recycle
in class DOMBuilder
setup
public void setup(SourceResolver resolver,
java.util.Map objectModel,
java.lang.String src,
org.apache.avalon.framework.parameters.Parameters par)
throws ProcessingException,
org.xml.sax.SAXException,
java.io.IOException
- Set the
SourceResolver
, objectModel Map
,
the source and sitemap Parameters
used to process the request.
If you wish to process the parameters, override this method, call
super()
and then add your code.
- Specified by:
setup
in interface SitemapModelComponent
notify
public void notify(org.w3c.dom.Document doc)
throws org.xml.sax.SAXException
- This method is called when the Document is finished.
- Specified by:
notify
in interface DOMBuilder.Listener
- Parameters:
doc
- The DOM Document object representing this SAX stream- See Also:
DOMBuilder.Listener
transform
protected abstract org.w3c.dom.Document transform(org.w3c.dom.Document doc)
- Transform the specified DOM, returning a new DOM to stream down the pipeline.
- Parameters:
doc
- The DOM Document representing the SAX stream
setConsumer
public void setConsumer(XMLConsumer consumer)
- Set the
XMLConsumer
that will receive XML data.
This method will simply call setContentHandler(consumer)
and setLexicalHandler(consumer)
.
- Specified by:
setConsumer
in interface XMLProducer
- Overrides:
setConsumer
in class AbstractXMLProducer
setContentHandler
public void setContentHandler(org.xml.sax.ContentHandler handler)
- Set the
ContentHandler
that will receive XML data.
Subclasses may retrieve this ContentHandler
instance
accessing the protected super.contentHandler
field.
- Overrides:
setContentHandler
in class AbstractXMLProducer
setLexicalHandler
public void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
- Set the
LexicalHandler
that will receive XML data.
Subclasses may retrieve this LexicalHandler
instance
accessing the protected super.lexicalHandler
field.
- Overrides:
setLexicalHandler
in class AbstractXMLProducer
- Throws:
java.lang.IllegalStateException
- If the LexicalHandler
or
the XMLConsumer
were
already set.
dispose
public void dispose()
- dispose
- Specified by:
dispose
in interface org.apache.avalon.framework.activity.Disposable
Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.