| org.apache.cocoon.generation.AbstractGenerator org.apache.cocoon.generation.ServiceableGenerator org.apache.cocoon.generation.TraversableGenerator
All known Subclasses: org.apache.cocoon.generation.TraversableSourceDescriptionGenerator, org.apache.cocoon.generation.XPathTraversableGenerator,
TraversableGenerator | public class TraversableGenerator extends ServiceableGenerator implements CacheableProcessingComponent(Code) | | Generates an XML source hierarchy listing from a Traversable Source.
The root node of the generated document will normally be a
collection node and a collection node can contain zero or more
resource or collection nodes. A resource node has no children.
Each node will contain the following attributes:
- name
- the name of the source
- lastModified
- the time the source was last modified, measured as the number of
milliseconds since the epoch (as in java.io.File.lastModified)
- size
- the source size, in bytes (as in java.io.File.length)
- date (optional)
- the time the source was last modified in human-readable form
Configuration options:
- depth (optional)
- Sets how deep TraversableGenerator should delve into the
source hierarchy. If set to 1 (the default), only the starting
collection's immediate contents will be returned.
- sort (optional)
- Sort order in which the nodes are returned. Possible values are
name, size, time, collection. collection is the same as name,
except that the collection entries are listed first. System order is
default.
- reverse (optional)
- Reverse the order of the sort
- dateFormat (optional)
- Sets the format for the date attribute of each node, as
described in java.text.SimpleDateFormat. If unset, the default
format for the current locale will be used.
- timeZone (optional)
- Sets the time zone offset ID for the date attribute, as
described in java.util.TimeZone. If unset, the default
system time zone will be used.
- refreshDelay (optional)
- Sets the delay (in seconds) between checks on the source hierarchy
for changed content. Defaults to 1 second.
author: Pierpaolo Fumagalli author: (Apache Software Foundation) author: Conny Krappatsch author: (SMB GmbH) for Virbus AG author: Daniele Madama author: Gianugo Rabellino version: CVS $Id: TraversableGenerator.java 433543 2006-08-22 06:22:54Z crossley $ |
Method Summary | |
protected void | addAncestorPath(TraversableSource source, Stack ancestors) Adds recursively the path from the source matched by the root pattern
down to the requested source. | protected void | addContent(TraversableSource source) Allow subclasses a chance to generate additional elements within collection and resource
elements. | protected void | addPath(TraversableSource source, int depth) Adds a single node to the generated document. | protected void | endNode(String nodeName) Ends the named node. | public void | generate() Generate XML data. | protected Stack | getAncestors(TraversableSource source) Creates a stack containing the ancestors of a traversable source up to
specific parent matching the root pattern. | public Serializable | getKey() | public SourceValidity | getValidity() Gets the source validity, using a deferred validity object. | protected boolean | isExcluded(TraversableSource source) Determines if a given source shall be excluded from viewing. | protected boolean | isIncluded(TraversableSource source) Determines if a given source shall be visible. | protected boolean | isRoot(TraversableSource source) Determines if a given source is the defined root. | public void | recycle() | protected void | setNodeAttributes(TraversableSource source) Sets the attributes for a given source. | public void | setup(SourceResolver resolver, Map objectModel, String src, Parameters par) Set the request parameters. | protected void | startNode(String nodeName, TraversableSource source) Begins a named node and calls setNodeAttributes to set its attributes. |
COL_NODE_NAME | final protected static String COL_NODE_NAME(Code) | | |
DATE_ATTR_NAME | final protected static String DATE_ATTR_NAME(Code) | | |
LASTMOD_ATTR_NAME | final protected static String LASTMOD_ATTR_NAME(Code) | | |
PREFIX | final protected static String PREFIX(Code) | | The namespace prefix for this namespace.
|
RESOURCE_NODE_NAME | final protected static String RESOURCE_NODE_NAME(Code) | | |
RES_NAME_ATTR_NAME | final protected static String RES_NAME_ATTR_NAME(Code) | | |
SIZE_ATTR_NAME | final protected static String SIZE_ATTR_NAME(Code) | | |
URI | final protected static String URI(Code) | | The URI of the namespace of this generator.
|
URI_ATTR_NAME | final protected static String URI_ATTR_NAME(Code) | | |
attributes | protected AttributesImpl attributes(Code) | | Convenience object, so we don't need to create an AttributesImpl for every element.
|
cacheKeyParList | protected List cacheKeyParList(Code) | | The cache key needs to be generated for the configuration of this
generator, so storing the parameters for generateKey().
Using the member variables after setup() would not work I guess. I don't
know a way from the regular expressions back to the pattern or at least
a useful string.
|
dateFormatter | protected SimpleDateFormat dateFormatter(Code) | | The dateFormatter determines into which date format the lastModified
time should be converted.
FIXME: SimpleDateFormat is not supported by all locales!
|
depth | protected int depth(Code) | | The depth parameter determines how deep the TraversableGenerator should delve.
|
excludeRE | protected RE excludeRE(Code) | | The regular expression for the exclude pattern.
|
includeRE | protected RE includeRE(Code) | | The regular expression for the include pattern.
|
isRequestedSource | protected boolean isRequestedSource(Code) | | This is only set to true for the requested source specified by the
src attribute on the generator's configuration.
|
refreshDelay | protected long refreshDelay(Code) | | The delay between checks on updates to the source hierarchy.
|
reverse | protected boolean reverse(Code) | | The reverse parameter reverses the sort order. false is default.
|
rootRE | protected RE rootRE(Code) | | The regular expression for the root pattern.
|
sort | protected String sort(Code) | | The sort parameter determines by which attribute the content of one
collection should be sorted. Possible values are "name", "size", "time"
and "collection", where "collection" is the same as "name", except that
collection entries are listed first.
|
addAncestorPath | protected void addAncestorPath(TraversableSource source, Stack ancestors) throws SAXException, ProcessingException(Code) | | Adds recursively the path from the source matched by the root pattern
down to the requested source.
Parameters: source - the requested source. Parameters: ancestors - the stack of the ancestors. throws: SAXException - throws: ProcessingException - |
addContent | protected void addContent(TraversableSource source) throws SAXException, ProcessingException(Code) | | Allow subclasses a chance to generate additional elements within collection and resource
elements.
Parameters: source - the source to generate additional data for. |
addPath | protected void addPath(TraversableSource source, int depth) throws SAXException, ProcessingException(Code) | | Adds a single node to the generated document. If the path is a
collection and depth is greater than zero, then recursive calls
are made to add nodes for the collection's children.
Parameters: source - the resource/collection to process Parameters: depth - how deep to scan the collection hierarchy throws: SAXException - if an error occurs while constructing nodes throws: ProcessingException - if a problem occurs with the source |
endNode | protected void endNode(String nodeName) throws SAXException(Code) | | Ends the named node.
Parameters: nodeName - the name of the new node throws: SAXException - if an error occurs while closing the node |
getAncestors | protected Stack getAncestors(TraversableSource source) throws IOException(Code) | | Creates a stack containing the ancestors of a traversable source up to
specific parent matching the root pattern.
Parameters: source - the traversable source whose ancestors shall be retrieved a Stack containing the ancestors. |
getValidity | public SourceValidity getValidity()(Code) | | Gets the source validity, using a deferred validity object. The validity
is initially empty since the resources that define it are not known
before generation has occured. So the returned object is kept by the
generator and filled with each of the resources that is traversed.
See Also: org.apache.cocoon.components.source.impl.MultiSourceValidity |
isExcluded | protected boolean isExcluded(TraversableSource source)(Code) | | Determines if a given source shall be excluded from viewing.
Parameters: source - the source to check false if the given source shall not be excluded or the exclude Pattern is not set,true otherwise. |
isIncluded | protected boolean isIncluded(TraversableSource source)(Code) | | Determines if a given source shall be visible.
Parameters: source - the source to check true if the source shall be visible or the include Pattern is not set,false otherwise. |
isRoot | protected boolean isRoot(TraversableSource source)(Code) | | Determines if a given source is the defined root.
Parameters: source - the source to check true if the source is the root or the root pattern is not set,false otherwise. |
recycle | public void recycle()(Code) | | Recycle resources
|
setNodeAttributes | protected void setNodeAttributes(TraversableSource source) throws SAXException, ProcessingException(Code) | | Sets the attributes for a given source. For example attributes for the
name, the size and the last modification date of the source are added.
Parameters: source - the source attributes are added for |
setup | public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws ProcessingException, SAXException, IOException(Code) | | Set the request parameters. Must be called before the generate method.
Parameters: resolver - the SourceResolver object Parameters: objectModel - a Map containing model object Parameters: src - the Traversable Source to be XMLized specified assrc attribute on <map:generate/> Parameters: par - configuration parameters |
startNode | protected void startNode(String nodeName, TraversableSource source) throws SAXException, ProcessingException(Code) | | Begins a named node and calls setNodeAttributes to set its attributes.
Parameters: nodeName - the name of the new node Parameters: source - the source a node with its attributes is added for throws: SAXException - if an error occurs while creating the node |
Fields inherited from org.apache.cocoon.generation.ServiceableGenerator | protected ServiceManager manager(Code)(Java Doc)
|
Methods inherited from org.apache.cocoon.generation.ServiceableGenerator | public void dispose()(Code)(Java Doc) public void service(ServiceManager manager) throws ServiceException(Code)(Java Doc)
|
|
|