org.apache.cocoon.xml
Class AbstractXMLProducer

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
All Implemented Interfaces:
Poolable, Recyclable, org.apache.cocoon.xml.XMLProducer
Direct Known Subclasses:
AbstractGenerator, AbstractXMLPipe, DOMStreamer.DefaultDOMStreamer, DOMStreamer.NamespaceNormalizingDOMStreamer

public abstract class AbstractXMLProducer
extends org.apache.cocoon.util.AbstractLogEnabled
implements org.apache.cocoon.xml.XMLProducer, Recyclable

This abstract class provides default implementation of the methods specified by the XMLProducer interface.

Version:
$Id: AbstractXMLProducer.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
protected  ContentHandler contentHandler
          The ContentHandler receiving SAX events.
protected static ContentHandler EMPTY_CONTENT_HANDLER
          Empty, do-nothing content handler
protected  LexicalHandler lexicalHandler
          The LexicalHandler receiving SAX events.
protected  org.apache.cocoon.xml.XMLConsumer xmlConsumer
          The XMLConsumer receiving SAX events.
 
Constructor Summary
AbstractXMLProducer()
           
 
Method Summary
 void recycle()
          Recycle the producer by removing references, and resetting handlers to null (empty) implementations.
 void setConsumer(org.apache.cocoon.xml.XMLConsumer consumer)
          Set the XMLConsumer that will receive XML data.
 void setContentHandler(ContentHandler handler)
          Set the ContentHandler that will receive XML data.
 void setLexicalHandler(LexicalHandler handler)
          Set the LexicalHandler that will receive XML data.
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_CONTENT_HANDLER

protected static final ContentHandler EMPTY_CONTENT_HANDLER
Empty, do-nothing content handler


xmlConsumer

protected org.apache.cocoon.xml.XMLConsumer xmlConsumer
The XMLConsumer receiving SAX events.


contentHandler

protected ContentHandler contentHandler
The ContentHandler receiving SAX events.


lexicalHandler

protected LexicalHandler lexicalHandler
The LexicalHandler receiving SAX events.

Constructor Detail

AbstractXMLProducer

public AbstractXMLProducer()
Method Detail

setConsumer

public void setConsumer(org.apache.cocoon.xml.XMLConsumer consumer)
Set the XMLConsumer that will receive XML data.

This method will call setContentHandler(consumer) and setLexicalHandler(consumer) since XMLConsumer interface implements both ContentHandler and LexicalHandler.

Specified by:
setConsumer in interface org.apache.cocoon.xml.XMLProducer
Parameters:
consumer - xml consumer, should never be null.

setContentHandler

public void setContentHandler(ContentHandler handler)
Set the ContentHandler that will receive XML data.

Subclasses may retrieve this ContentHandler instance accessing the protected super.contentHandler field.

Parameters:
handler - content handler, should never be null.

setLexicalHandler

public void setLexicalHandler(LexicalHandler handler)
Set the LexicalHandler that will receive XML data.

Subclasses may retrieve this LexicalHandler instance accessing the protected super.lexicalHandler field.

Parameters:
handler - lexical handler, should never be null.

recycle

public void recycle()
Recycle the producer by removing references, and resetting handlers to null (empty) implementations.

Specified by:
recycle in interface Recyclable


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.