org.apache.cocoon.serialization
Class ElementProcessorSerializer

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.serialization.ElementProcessorSerializer
All Implemented Interfaces:
Component, LogEnabled, Serviceable, Serializer, SitemapOutputComponent, XMLConsumer, ContentHandler, LexicalHandler
Direct Known Subclasses:
POIFSSerializer

public abstract class ElementProcessorSerializer
extends AbstractLogEnabled
implements Serializer, Serviceable

An implementation of nearly all of the methods included in the org.apache.poi.serialization.Serializer interface This is an abstract class. Concrete extensions need to implement the following methods:

Version:
$Id: ElementProcessorSerializer.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Marc Johnson (marc_johnson27591@hotmail.com), Nicola Ken Barozzi (nicolaken@apache.org)

Field Summary
protected  ServiceManager manager
           
 
Fields inherited from interface org.apache.cocoon.serialization.Serializer
ROLE
 
Constructor Summary
ElementProcessorSerializer()
          Constructor
 
Method Summary
 void characters(char[] ch, int start, int length)
          Receive notification of character data.
 void comment(char[] ch, int start, int length)
          Report an XML comment anywhere in the document.
protected abstract  void doPreInitialization(ElementProcessor processor)
          perform whatever pre-initialization seems good on the ElementProcessor
 void endCDATA()
          Report the end of a CDATA section.
 void endDTD()
          Report the end of DTD declarations.
 void endElement(String namespaceURI, String localName, String qName)
          Receive notification of the end of an element.
 void endEntity(String name)
          Report the end of an entity.
 void endPrefixMapping(String prefix)
          End the scope of a prefix-URI mapping.
protected abstract  ElementProcessorFactory getElementProcessorFactory()
          get the appropriate ElementProcessorFactory
protected  OutputStream getOutputStream()
           
 void ignorableWhitespace(char[] ch, int start, int length)
          Receive notification of ignorable whitespace in element content.
 void processingInstruction(String target, String data)
          Receive notification of a processing instruction.
protected  SAXException SAXExceptionFactory(String message)
          Create a SAXException
protected  SAXException SAXExceptionFactory(String message, Exception e)
          Create a new SAXException
 void service(ServiceManager manager)
           
 void setDocumentLocator(Locator locator)
          Receive an object for locating the origin of SAX document events.
 void setOutputStream(OutputStream out)
          Set the OutputStream where the requested resource should be serialized.
 boolean shouldSetContentLength()
          Test if the component wants to set the content length.
 void skippedEntity(String name)
          Receive notification of a skipped entity.
 void startCDATA()
          Report the start of a CDATA section.
 void startDocument()
          Receive notification of the beginning of a document.
 void startDTD(String name, String publicId, String systemId)
          Report the start of DTD declarations, if any.
 void startElement(String namespaceURI, String localName, String qName, Attributes atts)
          Receive notification of the beginning of an element.
 void startEntity(String name)
          Report the beginning of some internal and external XML entities.
 void startPrefixMapping(String prefix, String uri)
          Begin the scope of a prefix-URI Namespace mapping.
 
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.xml.sax.ContentHandler
endDocument
 
Methods inherited from interface org.apache.cocoon.sitemap.SitemapOutputComponent
getMimeType
 

Field Detail

manager

protected ServiceManager manager
Constructor Detail

ElementProcessorSerializer

public ElementProcessorSerializer()
Constructor

Method Detail

service

public void service(ServiceManager manager)
Specified by:
service in interface Serviceable

getElementProcessorFactory

protected abstract ElementProcessorFactory getElementProcessorFactory()
get the appropriate ElementProcessorFactory

Returns:
an ElementProcessorFactory suitable for the file type

doPreInitialization

protected abstract void doPreInitialization(ElementProcessor processor)
                                     throws SAXException
perform whatever pre-initialization seems good on the ElementProcessor

Parameters:
processor - the processor to be initialized
Throws:
SAXException - on errors

getOutputStream

protected OutputStream getOutputStream()
Returns:
the output stream

SAXExceptionFactory

protected SAXException SAXExceptionFactory(String message,
                                           Exception e)
Create a new SAXException

Parameters:
message - the exception message
e - the underlying exception (may be null)
Returns:
new SAXException

SAXExceptionFactory

protected SAXException SAXExceptionFactory(String message)
Create a SAXException

Parameters:
message - the exception message
Returns:
new SAXException

setOutputStream

public void setOutputStream(OutputStream out)
Set the OutputStream where the requested resource should be serialized.

Specified by:
setOutputStream in interface SitemapOutputComponent
Parameters:
out - the OutputStream to which the serialized data will be written

shouldSetContentLength

public boolean shouldSetContentLength()
Test if the component wants to set the content length.

Specified by:
shouldSetContentLength in interface SitemapOutputComponent
Returns:
false

comment

public void comment(char[] ch,
                    int start,
                    int length)
Report an XML comment anywhere in the document. We don't really care.

Specified by:
comment in interface LexicalHandler

endCDATA

public void endCDATA()
Report the end of a CDATA section. We don't really care.

Specified by:
endCDATA in interface LexicalHandler

endDTD

public void endDTD()
Report the end of DTD declarations. We don't really care.

Specified by:
endDTD in interface LexicalHandler

endEntity

public void endEntity(String name)
Report the end of an entity. We don't really care.

Specified by:
endEntity in interface LexicalHandler

startCDATA

public void startCDATA()
Report the start of a CDATA section. We don't really care.

Specified by:
startCDATA in interface LexicalHandler

startDTD

public void startDTD(String name,
                     String publicId,
                     String systemId)
Report the start of DTD declarations, if any. We don't really care.

Specified by:
startDTD in interface LexicalHandler

startEntity

public void startEntity(String name)
Report the beginning of some internal and external XML entities. We don't really care.

Specified by:
startEntity in interface LexicalHandler

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Receive notification of character data.

Specified by:
characters in interface ContentHandler
Parameters:
ch - the character array
start - the start index in ch
length - the length of the valid part of ch
Throws:
SAXException - if anything goes wrong in processing the character data

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Receive notification of the end of an element.

Specified by:
endElement in interface ContentHandler
Throws:
SAXException - on any errors processing the event.

endPrefixMapping

public void endPrefixMapping(String prefix)
End the scope of a prefix-URI mapping. We don't really care.

Specified by:
endPrefixMapping in interface ContentHandler

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Receive notification of ignorable whitespace in element content.

Specified by:
ignorableWhitespace in interface ContentHandler
Parameters:
ch - the character array
start - the start index in ch
length - the length of the valid part of ch
Throws:
SAXException - if anything goes wrong in processing the character data

processingInstruction

public void processingInstruction(String target,
                                  String data)
Receive notification of a processing instruction. We don't really care.

Specified by:
processingInstruction in interface ContentHandler

setDocumentLocator

public void setDocumentLocator(Locator locator)
Receive an object for locating the origin of SAX document events.

Specified by:
setDocumentLocator in interface ContentHandler
Parameters:
locator - the Locator object

skippedEntity

public void skippedEntity(String name)
Receive notification of a skipped entity. We don't really care.

Specified by:
skippedEntity in interface ContentHandler

startDocument

public void startDocument()
Receive notification of the beginning of a document.

Specified by:
startDocument in interface ContentHandler

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Receive notification of the beginning of an element.

Specified by:
startElement in interface ContentHandler
Parameters:
namespaceURI - the namespace this element is in
localName - the local name of the element
qName - the qualified name of the element
atts - the Attributes, if any, of the element
Throws:
SAXException - if we cannot create an ElementProcessor to handle the element

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
Begin the scope of a prefix-URI Namespace mapping. We don't really care.

Specified by:
startPrefixMapping in interface ContentHandler


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