org.apache.cocoon.transformation
Class SourcePropsWritingTransformer

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.xml.AbstractXMLPipe
              extended by org.apache.cocoon.transformation.AbstractTransformer
                  extended by org.apache.cocoon.transformation.AbstractSAXTransformer
                      extended by org.apache.cocoon.transformation.SourcePropsWritingTransformer
All Implemented Interfaces:
Poolable, Recyclable, Disposable, Component, Configurable, LogEnabled, Serviceable, SitemapModelComponent, Transformer, XMLPipe, XMLProducer, XMLConsumer, ContentHandler, LexicalHandler

public class SourcePropsWritingTransformer
extends AbstractSAXTransformer

This transformer allows you to set and remove properties on an InspectableSource.

Input XML document example:

 <page>
   ...
   <source:patch xmlns:source="http://apache.org/cocoon/propwrite/1.0">
     <source:source>webdav://localhost/webdav/step1/repo/contentA.xml</source:source>
     <source:set>
       <myns:author xmlns:myns="meta">me</myns:author>
     </source:set>
     <source:remove>
       <myns:title xmlns:myns="meta"/>
     </source:remove>
   </source:patch>
   ...
 </page>
 

Version:
$Id: SourcePropsWritingTransformer.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Guido Casper

Field Summary
static String PATCH_ELEMENT
          incoming elements
static String REMOVE_ELEMENT
           
static String SET_ELEMENT
           
static String SOURCE_ELEMENT
           
static String SPWT_URI
           
 
Fields inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
context, defaultNamespaceURI, EMPTY_ATTRIBUTES, emptyAttributes, ignoreEmptyCharacters, ignoreEventsCount, ignoreHooksCount, ignoreWhitespaces, manager, namespaceURI, objectModel, parameters, recorderStack, request, resolver, 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
SourcePropsWritingTransformer()
          Constructor Set the namespace
 
Method Summary
 void endTransformingElement(String uri, String name, String raw)
          Receive notification of the end of an element.
 void recycle()
          Recycle the producer by removing references, and resetting handlers to null (empty) implementations.
 void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
          Set the SourceResolver, objectModel Map, the source and sitemap Parameters used to process the request.
 void startTransformingElement(String uri, String name, String raw, Attributes attr)
          Receive notification of the beginning of an element.
 
Methods inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
addRecorder, characters, comment, configure, dispose, endCDATA, endDocument, endDTD, endElement, endEntity, endParametersRecording, endParametersRecording, endPrefixMapping, endRecording, endSAXRecording, endSerializedXMLRecording, endTextRecording, findPrefixMapping, getMutableAttributes, ignorableWhitespace, processingInstruction, removeRecorder, sendEndElementEvent, sendEndElementEventNS, sendEndPrefixMapping, sendEvents, sendParametersEvents, sendStartElementEvent, sendStartElementEvent, sendStartElementEventNS, sendStartElementEventNS, sendStartPrefixMapping, sendTextEvent, service, setDocumentLocator, setupTransforming, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity, startParametersRecording, startPrefixMapping, startRecording, startSAXRecording, startSerializedXMLRecording, startTextRecording
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
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.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

SPWT_URI

public static final String SPWT_URI
See Also:
Constant Field Values

PATCH_ELEMENT

public static final String PATCH_ELEMENT
incoming elements

See Also:
Constant Field Values

SOURCE_ELEMENT

public static final String SOURCE_ELEMENT
See Also:
Constant Field Values

SET_ELEMENT

public static final String SET_ELEMENT
See Also:
Constant Field Values

REMOVE_ELEMENT

public static final String REMOVE_ELEMENT
See Also:
Constant Field Values
Constructor Detail

SourcePropsWritingTransformer

public SourcePropsWritingTransformer()
Constructor Set the namespace

Method Detail

recycle

public void recycle()
Description copied from class: AbstractXMLProducer
Recycle the producer by removing references, and resetting handlers to null (empty) implementations.

Specified by:
recycle in interface Recyclable
Overrides:
recycle in class AbstractSAXTransformer

setup

public void setup(SourceResolver resolver,
                  Map objectModel,
                  String src,
                  Parameters par)
           throws ProcessingException,
                  SAXException,
                  IOException
Set the SourceResolver, objectModel Map, the source and sitemap Parameters used to process the request.

Specified by:
setup in interface SitemapModelComponent
Overrides:
setup in class AbstractSAXTransformer
Parameters:
resolver - Source Resolver
objectModel - Object model
src - URI of the source attribute
par - Parameters for the transformer
Throws:
ProcessingException
SAXException
IOException

startTransformingElement

public void startTransformingElement(String uri,
                                     String name,
                                     String raw,
                                     Attributes attr)
                              throws SAXException,
                                     IOException,
                                     ProcessingException
Receive notification of the beginning of an element.

Overrides:
startTransformingElement in class AbstractSAXTransformer
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
name - 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.
attr - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
SAXException
IOException
ProcessingException

endTransformingElement

public void endTransformingElement(String uri,
                                   String name,
                                   String raw)
                            throws SAXException,
                                   IOException,
                                   ProcessingException
Receive notification of the end of an element.

Overrides:
endTransformingElement in class AbstractSAXTransformer
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
name - 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.
Throws:
SAXException
IOException
ProcessingException


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