org.apache.cocoon.transformation
Class LogTransformer

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.xml.AbstractXMLPipe
              extended byorg.apache.cocoon.transformation.AbstractTransformer
                  extended byorg.apache.cocoon.transformation.LogTransformer
All Implemented Interfaces:
ContentHandler, LexicalHandler, Poolable, Recyclable, org.apache.cocoon.sitemap.SitemapModelComponent, org.apache.cocoon.transformation.Transformer, XMLConsumer, org.apache.cocoon.xml.XMLConsumer, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer

public class LogTransformer
extends org.apache.cocoon.transformation.AbstractTransformer

The LogTransformer is a class that can be plugged into a pipeline to print the SAX events which passes thru this transformer in a readable form to a file.
The file will be specified in a parameter tag in the sitemap pipeline to the transformer as follows:

 <map:transform type="log">
   <map:parameter name="logfile" value="logfile.log"/>
   <map:parameter name="append" value="no"/>
 </map:transform>
 

Because the log file will be hardcoded into the sitemap this LOGTransformer will not be thread save!!
This transformations main purpose is debugging.

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

Field Summary
 
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
LogTransformer()
           
 
Method Summary
 void characters(char[] ch, int start, int len)
          Receive notification of character data.
 void comment(char[] ch, int start, int len)
          Report an XML comment anywhere in the document.
 void destroy()
          Attempt to close the log file when the class is GC'd
 void endCDATA()
          Report the end of a CDATA section.
 void endDocument()
          Receive notification of the end of a document.
 void endDTD()
          Report the end of DTD declarations.
 void endElement(String uri, String loc, String raw)
          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.
 void ignorableWhitespace(char[] ch, int start, int len)
          Receive notification of ignorable whitespace in element content.
 void processingInstruction(String target, String data)
          Receive notification of a processing instruction.
 void recycle()
          Recycle
 void setDocumentLocator(Locator locator)
          Receive an object for locating the origin of SAX document events.
 void setup(org.apache.cocoon.environment.SourceResolver resolver, Map objectModel, String src, Parameters parameters)
          Setup
 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 uri, String loc, String raw, Attributes a)
          Receive notification of the beginning of an element.
 void startEntity(String name)
          Report the beginning of an entity.
 void startPrefixMapping(String prefix, String uri)
          Begin the scope of a prefix-URI Namespace mapping.
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
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
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Constructor Detail

LogTransformer

public LogTransformer()
Method Detail

setup

public void setup(org.apache.cocoon.environment.SourceResolver resolver,
                  Map objectModel,
                  String src,
                  Parameters parameters)
           throws org.apache.cocoon.ProcessingException,
                  SAXException,
                  IOException
Setup

Throws:
org.apache.cocoon.ProcessingException
SAXException
IOException

recycle

public void recycle()
Recycle


setDocumentLocator

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


startDocument

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

Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Receive notification of the end of a document.

Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Begin the scope of a prefix-URI Namespace mapping.

Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
End the scope of a prefix-URI mapping.

Throws:
SAXException

startElement

public void startElement(String uri,
                         String loc,
                         String raw,
                         Attributes a)
                  throws SAXException
Receive notification of the beginning of an element.

Throws:
SAXException

endElement

public void endElement(String uri,
                       String loc,
                       String raw)
                throws SAXException
Receive notification of the end of an element.

Throws:
SAXException

characters

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

Throws:
SAXException

ignorableWhitespace

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

Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Receive notification of a processing instruction.

Throws:
SAXException

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
Receive notification of a skipped entity.

Throws:
SAXException

startDTD

public void startDTD(String name,
                     String publicId,
                     String systemId)
              throws SAXException
Report the start of DTD declarations, if any.

Throws:
SAXException

endDTD

public void endDTD()
            throws SAXException
Report the end of DTD declarations.

Throws:
SAXException

startEntity

public void startEntity(String name)
                 throws SAXException
Report the beginning of an entity.

Throws:
SAXException

endEntity

public void endEntity(String name)
               throws SAXException
Report the end of an entity.

Throws:
SAXException

startCDATA

public void startCDATA()
                throws SAXException
Report the start of a CDATA section.

Throws:
SAXException

endCDATA

public void endCDATA()
              throws SAXException
Report the end of a CDATA section.

Throws:
SAXException

comment

public void comment(char[] ch,
                    int start,
                    int len)
             throws SAXException
Report an XML comment anywhere in the document.

Throws:
SAXException

destroy

public void destroy()
Attempt to close the log file when the class is GC'd



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