org.apache.cocoon.serialization
Class ElementProcessorSerializer

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.serialization.ElementProcessorSerializer
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.component.Composable, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler, org.apache.avalon.framework.logger.Loggable, Serializer, SitemapOutputComponent, XMLConsumer
Direct Known Subclasses:
POIFSSerializer

public abstract class ElementProcessorSerializer
extends org.apache.avalon.framework.logger.AbstractLoggable
implements Serializer, org.apache.avalon.framework.component.Composable

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:

Author:
Marc Johnson (marc_johnson27591@hotmail.com), Nicola Ken Barozzi (nicolaken@apache.org)

Field Summary
protected  org.apache.avalon.framework.component.ComponentManager manager
          Component 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[] ignored_ch, int ignored_start, int ignored_length)
          Report an XML comment anywhere in the document.
 void compose(org.apache.avalon.framework.component.ComponentManager manager)
           
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(java.lang.String ignored_namespaceURI, java.lang.String ignored_localName, java.lang.String ignored_qName)
          Receive notification of the end of an element.
 void endEntity(java.lang.String ignored_name)
          Report the end of an entity.
 void endPrefixMapping(java.lang.String ignored_prefix)
          End the scope of a prefix-URI mapping.
protected abstract  ElementProcessorFactory getElementProcessorFactory()
          get the appropriate ElementProcessorFactory
protected  java.io.OutputStream getOutputStream()
           
 void ignorableWhitespace(char[] ch, int start, int length)
          Receive notification of ignorable whitespace in element content.
 void processingInstruction(java.lang.String ignored_target, java.lang.String ignored_data)
          Receive notification of a processing instruction.
protected  org.xml.sax.SAXException SAXExceptionFactory(java.lang.String message)
          Create a SAXException
protected  org.xml.sax.SAXException SAXExceptionFactory(java.lang.String message, java.lang.Exception e)
          Create a new SAXException
 void setDocumentLocator(org.xml.sax.Locator locator)
          Receive an object for locating the origin of SAX document events.
 void setOutputStream(java.io.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(java.lang.String ignored_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(java.lang.String ignored_name, java.lang.String ignored_publicId, java.lang.String ignored_systemId)
          Report the start of DTD declarations, if any.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          Receive notification of the beginning of an element.
 void startEntity(java.lang.String ignored_name)
          Report the beginning of some internal and external XML entities.
 void startPrefixMapping(java.lang.String ignored_prefix, java.lang.String ignored_uri)
          Begin the scope of a prefix-URI Namespace mapping.
 
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
endDocument
 
Methods inherited from interface org.apache.cocoon.sitemap.SitemapOutputComponent
getMimeType
 

Field Detail

manager

protected org.apache.avalon.framework.component.ComponentManager manager
Component Manager
Constructor Detail

ElementProcessorSerializer

public ElementProcessorSerializer()
Constructor
Method Detail

compose

public void compose(org.apache.avalon.framework.component.ComponentManager manager)
Specified by:
compose in interface org.apache.avalon.framework.component.Composable

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 org.xml.sax.SAXException
perform whatever pre-initialization seems good on the ElementProcessor
Parameters:
processor - the processor to be initialized
Throws:
org.xml.sax.SAXException - on errors

getOutputStream

protected java.io.OutputStream getOutputStream()
Returns:
the output stream

SAXExceptionFactory

protected org.xml.sax.SAXException SAXExceptionFactory(java.lang.String message,
                                                       java.lang.Exception e)
Create a new SAXException
Parameters:
message - the exception message
e - the underlying exception (may be null)
Returns:
new SAXException

SAXExceptionFactory

protected org.xml.sax.SAXException SAXExceptionFactory(java.lang.String message)
Create a SAXException
Parameters:
message - the exception message
Returns:
new SAXException

setOutputStream

public void setOutputStream(java.io.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[] ignored_ch,
                    int ignored_start,
                    int ignored_length)
Report an XML comment anywhere in the document. We don't really care.
Specified by:
comment in interface org.xml.sax.ext.LexicalHandler
Parameters:
ignored_ch -  
ignored_start -  
ignored_length -  

endCDATA

public void endCDATA()
Report the end of a CDATA section. We don't really care.
Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler

endDTD

public void endDTD()
Report the end of DTD declarations. We don't really care.
Specified by:
endDTD in interface org.xml.sax.ext.LexicalHandler

endEntity

public void endEntity(java.lang.String ignored_name)
Report the end of an entity. We don't really care.
Specified by:
endEntity in interface org.xml.sax.ext.LexicalHandler
Parameters:
ignored_name -  

startCDATA

public void startCDATA()
Report the start of a CDATA section. We don't really care.
Specified by:
startCDATA in interface org.xml.sax.ext.LexicalHandler

startDTD

public void startDTD(java.lang.String ignored_name,
                     java.lang.String ignored_publicId,
                     java.lang.String ignored_systemId)
Report the start of DTD declarations, if any. We don't really care.
Specified by:
startDTD in interface org.xml.sax.ext.LexicalHandler
Parameters:
ignored_name -  
ignored_publicId -  
ignored_systemId -  

startEntity

public void startEntity(java.lang.String ignored_name)
Report the beginning of some internal and external XML entities. We don't really care.
Specified by:
startEntity in interface org.xml.sax.ext.LexicalHandler
Parameters:
ignored_name -  

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Receive notification of character data.
Specified by:
characters in interface org.xml.sax.ContentHandler
Parameters:
ch - the character array
start - the start index in ch
length - the length of the valid part of ch
Throws:
org.xml.sax.SAXException - if anything goes wrong in processing the character data

endElement

public void endElement(java.lang.String ignored_namespaceURI,
                       java.lang.String ignored_localName,
                       java.lang.String ignored_qName)
                throws org.xml.sax.SAXException
Receive notification of the end of an element.
Specified by:
endElement in interface org.xml.sax.ContentHandler
Parameters:
ignored_namespaceURI -  
ignored_localName -  
ignored_qName -  
Throws:
org.xml.sax.SAXException - on any errors processing the event.

endPrefixMapping

public void endPrefixMapping(java.lang.String ignored_prefix)
End the scope of a prefix-URI mapping. We don't really care.
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Parameters:
ignored_prefix -  

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Receive notification of ignorable whitespace in element content.
Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler
Parameters:
ch - the character array
start - the start index in ch
length - the length of the valid part of ch
Throws:
org.xml.sax.SAXException - if anything goes wrong in processing the character data

processingInstruction

public void processingInstruction(java.lang.String ignored_target,
                                  java.lang.String ignored_data)
Receive notification of a processing instruction. We don't really care.
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler
Parameters:
ignored_target -  
ignored_data -  

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Receive an object for locating the origin of SAX document events.
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Parameters:
locator - the Locator object

skippedEntity

public void skippedEntity(java.lang.String ignored_name)
Receive notification of a skipped entity. We don't really care.
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler
Parameters:
ignored_name -  

startDocument

public void startDocument()
Receive notification of the beginning of a document.
Specified by:
startDocument in interface org.xml.sax.ContentHandler

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Receive notification of the beginning of an element.
Specified by:
startElement in interface org.xml.sax.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:
org.xml.sax.SAXException - if we cannot create an ElementProcessor to handle the element

startPrefixMapping

public void startPrefixMapping(java.lang.String ignored_prefix,
                               java.lang.String ignored_uri)
Begin the scope of a prefix-URI Namespace mapping. We don't really care.
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Parameters:
ignored_prefix -  
ignored_uri -  


Copyright � 1999-2002 Apache Software Foundation. All Rights Reserved.