org.apache.cocoon.transformation
Class TeeTransformer

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.AbstractSAXTransformer
                      extended byorg.apache.cocoon.transformation.TeeTransformer
All Implemented Interfaces:
Configurable, ContentHandler, Disposable, LexicalHandler, Poolable, Recyclable, Serviceable, org.apache.cocoon.sitemap.SitemapModelComponent, org.apache.cocoon.transformation.Transformer, org.apache.cocoon.xml.XMLConsumer, XMLConsumer, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer

public class TeeTransformer
extends org.apache.cocoon.transformation.AbstractSAXTransformer

This transformer works just like the unix "tee" command and is useful for debugging received XML streams. It is also able to launch an optional system command to view or edit the generated file, so that every time the pipeline is executed, your editor pops up.

The Teetransformer serializes SAX events as-is to the ModifiableSource specified by its src parameter. It does not in any way change the events.

Usage:
 <map:transform type="tee" src="url">
   <command>emacs %s>
 </map:transform>
 

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

Field Summary
 
Fields inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
context, defaultNamespaceURI, EMPTY_ATTRIBUTES, ignoreEmptyCharacters, ignoreEventsCount, ignoreHooksCount, ignoreWhitespaces, manager, namespaceURI, objectModel, parameters, recorderStack, removeOurNamespacePrefixes, request, response, source, stack
 
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
TeeTransformer()
           
 
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 configure(Configuration configuration)
           
 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()
           
 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)
           
 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.transformation.AbstractSAXTransformer
addRecorder, dispose, endParametersRecording, endParametersRecording, endRecording, endSAXRecording, endSerializedXMLRecording, endTextRecording, endTransformingElement, findPrefixMapping, getMutableAttributes, removeRecorder, sendEndElementEvent, sendEndElementEventNS, sendEndPrefixMapping, sendEvents, sendParametersEvents, sendStartElementEvent, sendStartElementEvent, sendStartElementEventNS, sendStartElementEventNS, sendStartPrefixMapping, sendTextEvent, service, setupTransforming, startParametersRecording, startRecording, startSAXRecording, startSerializedXMLRecording, startTextRecording, startTransformingElement
 
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

TeeTransformer

public TeeTransformer()
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
Throws:
org.apache.cocoon.ProcessingException
SAXException
IOException

configure

public void configure(Configuration configuration)
               throws ConfigurationException
Throws:
ConfigurationException

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. Optionally execute a command to view the output file

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

recycle

public void recycle()


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