org.apache.cocoon.transformation
Class FilterTransformer
java.lang.Object
org.apache.cocoon.util.AbstractLogEnabled
org.apache.cocoon.xml.AbstractXMLProducer
org.apache.cocoon.xml.AbstractXMLPipe
org.apache.cocoon.transformation.AbstractTransformer
org.apache.cocoon.transformation.FilterTransformer
- All Implemented Interfaces:
- org.apache.cocoon.caching.CacheableProcessingComponent, 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 FilterTransformer
- extends org.apache.cocoon.transformation.AbstractTransformer
- implements org.apache.cocoon.caching.CacheableProcessingComponent
The filter transformer can be used to let only an amount of elements through in
a given block.
Usage in the sitemap:
<map:transform type="filter">
<map:parameter name="element-name" value="row"/>
<map:parameter name="count" value="5"/>
<map:parameter name="blocknr" value="3"/>
</map:transform>
Only the 3rd block will be shown, containing only 5 row elements.
Known limitation: behaviour of transformer when trigger elements are nested
is not predictable.
- Version:
- $Id: FilterTransformer.html 1304280 2012-03-23 11:18:01Z ilgrosso $
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 |
Method Summary |
void |
characters(char[] c,
int start,
int len)
|
void |
comment(char[] ch,
int start,
int len)
|
void |
endCDATA()
|
void |
endElement(String uri,
String name,
String raw)
|
void |
endEntity(String name)
|
Serializable |
getKey()
Generate the unique key. |
SourceValidity |
getValidity()
Generate the validity object. |
void |
processingInstruction(String target,
String data)
|
void |
setup(org.apache.cocoon.environment.SourceResolver resolver,
Map objectModel,
String source,
Parameters parameters)
BEGIN SitemapComponent methods |
void |
startCDATA()
|
void |
startElement(String uri,
String name,
String raw,
Attributes attributes)
BEGIN SAX ContentHandler handlers |
void |
startEntity(String name)
|
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe |
endDocument, endDTD, endPrefixMapping, ignorableWhitespace, setDocumentLocator, skippedEntity, startDocument, startDTD, startPrefixMapping |
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer |
recycle, 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 |
counter
protected int counter
count
protected int count
blocknr
protected int blocknr
currentBlocknr
protected int currentBlocknr
elementName
protected String elementName
parentName
protected String parentName
skip
protected boolean skip
foundIt
protected boolean foundIt
FilterTransformer
public FilterTransformer()
setup
public void setup(org.apache.cocoon.environment.SourceResolver resolver,
Map objectModel,
String source,
Parameters parameters)
throws org.apache.cocoon.ProcessingException,
SAXException,
IOException
- BEGIN SitemapComponent methods
- Specified by:
setup
in interface org.apache.cocoon.sitemap.SitemapModelComponent
- Throws:
org.apache.cocoon.ProcessingException
SAXException
IOException
getKey
public Serializable getKey()
- Generate the unique key.
This key must be unique inside the space of this component.
This method must be invoked before the generateValidity() method.
- Specified by:
getKey
in interface org.apache.cocoon.caching.CacheableProcessingComponent
- Returns:
- The generated key or
0
if the component
is currently not cacheable.
getValidity
public SourceValidity getValidity()
- Generate the validity object.
Before this method can be invoked the generateKey() method
must be invoked.
- Specified by:
getValidity
in interface org.apache.cocoon.caching.CacheableProcessingComponent
- Returns:
- The generated validity object or
null
if the
component is currently not cacheable.
startElement
public void startElement(String uri,
String name,
String raw,
Attributes attributes)
throws SAXException
- BEGIN SAX ContentHandler handlers
- Specified by:
startElement
in interface ContentHandler
- Throws:
SAXException
endElement
public void endElement(String uri,
String name,
String raw)
throws SAXException
- Specified by:
endElement
in interface ContentHandler
- Throws:
SAXException
characters
public void characters(char[] c,
int start,
int len)
throws SAXException
- Specified by:
characters
in interface ContentHandler
- Throws:
SAXException
processingInstruction
public void processingInstruction(String target,
String data)
throws SAXException
- Specified by:
processingInstruction
in interface ContentHandler
- Throws:
SAXException
startEntity
public void startEntity(String name)
throws SAXException
- Specified by:
startEntity
in interface LexicalHandler
- Throws:
SAXException
endEntity
public void endEntity(String name)
throws SAXException
- Specified by:
endEntity
in interface LexicalHandler
- Throws:
SAXException
startCDATA
public void startCDATA()
throws SAXException
- Specified by:
startCDATA
in interface LexicalHandler
- Throws:
SAXException
endCDATA
public void endCDATA()
throws SAXException
- Specified by:
endCDATA
in interface LexicalHandler
- Throws:
SAXException
comment
public void comment(char[] ch,
int start,
int len)
throws SAXException
- Specified by:
comment
in interface LexicalHandler
- Throws:
SAXException
Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.