org.apache.cocoon.transformation
Class SimpleFormInstanceExtractionTransformer

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.AbstractExtractionTransformer
                      extended byorg.apache.cocoon.transformation.SimpleFormInstanceExtractionTransformer
All Implemented Interfaces:
Configurable, ContentHandler, LexicalHandler, Poolable, Recyclable, Serviceable, 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 SimpleFormInstanceExtractionTransformer
extends org.apache.cocoon.transformation.AbstractExtractionTransformer
implements Configurable, Serviceable

This transformer sieves an incoming stream of xml and extracts a document fragment from it depending on a given tag and stores the fragment using an OutputModule with a name based an attribute of another enclosing tag. Default configuration fires on <form-instance/> and uses @name of enclosing <form/> tag. Default OutputModule is request-attr. This is usefull in conjunction with the SimpleFormTransformer when setting the InputModule for it to a chain of request-param and request-attr so that the extracted form instance data is used only when no similar request parameter exists.

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

Nested Class Summary
protected  class SimpleFormInstanceExtractionTransformer.ElementData
           
 
Field Summary
protected static String OUTPUT_MODULE_SELECTOR
           
 
Fields inherited from class org.apache.cocoon.transformation.AbstractExtractionTransformer
currentBuilder, extractLevel
 
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
SimpleFormInstanceExtractionTransformer()
           
 
Method Summary
 void configure(Configuration config)
           
 boolean endExtracting(String uri, String loc, String raw)
          Receive notification of the beginning of an element.
 void endExtractingDocument(String uri, String loc, String raw)
          End root element and replace it with the instance name.
 void handleExtractedDocument(Document doc)
          Receive notification of the end of the extracted Document.
 void recycle()
           
 void service(ServiceManager manager)
           
 void setup(org.apache.cocoon.environment.SourceResolver resolver, Map objectModel, String src, Parameters parameters)
          Setup the transformer.
 boolean startExtracting(String uri, String loc, String raw, Attributes a)
          Receive notification of the beginning of an element.
 void startExtractingDocument(String uri, String loc, String raw, Attributes a)
          Start root element and replace it with the instance name.
 
Methods inherited from class org.apache.cocoon.transformation.AbstractExtractionTransformer
characters, comment, endCDATA, endDTD, endElement, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, skippedEntity, startCDATA, startDTD, startElement, startEntity, startPrefixMapping
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
endDocument, setDocumentLocator, startDocument
 
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.xml.sax.ContentHandler
endDocument, setDocumentLocator, startDocument
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

OUTPUT_MODULE_SELECTOR

protected static final String OUTPUT_MODULE_SELECTOR
Constructor Detail

SimpleFormInstanceExtractionTransformer

public SimpleFormInstanceExtractionTransformer()
Method Detail

configure

public void configure(Configuration config)
               throws ConfigurationException
Specified by:
configure in interface Configurable
Throws:
ConfigurationException

service

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

setup

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

Specified by:
setup in interface org.apache.cocoon.sitemap.SitemapModelComponent
Throws:
org.apache.cocoon.ProcessingException
SAXException
IOException

recycle

public void recycle()
Specified by:
recycle in interface Recyclable

startExtracting

public boolean startExtracting(String uri,
                               String loc,
                               String raw,
                               Attributes a)
Receive notification of the beginning of an element.

Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
loc - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
a - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Returns:
a boolean value to signal to start extracting

endExtracting

public boolean endExtracting(String uri,
                             String loc,
                             String raw)
Receive notification of the beginning of an element.

Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
loc - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if
Returns:
a boolean value to signal to stop extracting

startExtractingDocument

public void startExtractingDocument(String uri,
                                    String loc,
                                    String raw,
                                    Attributes a)
                             throws SAXException
Start root element and replace it with the instance name.

Throws:
SAXException
See Also:
AbstractExtractionTransformer.startExtractingDocument(String, String, String, Attributes)

endExtractingDocument

public void endExtractingDocument(String uri,
                                  String loc,
                                  String raw)
                           throws SAXException
End root element and replace it with the instance name.

Throws:
SAXException
See Also:
AbstractExtractionTransformer.endExtractingDocument(String, String, String)

handleExtractedDocument

public void handleExtractedDocument(Document doc)
Receive notification of the end of the extracted Document.

Parameters:
doc - a Document value


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