|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avalon.framework.logger.AbstractLogEnabled org.apache.cocoon.xml.AbstractXMLProducer org.apache.cocoon.generation.AbstractGenerator org.apache.cocoon.generation.ServiceableGenerator org.apache.cocoon.generation.DirectoryGenerator
public class DirectoryGenerator
Nested Class Summary | |
---|---|
static class |
DirectoryGenerator.DirValidity
Specific validity class, that holds all files that have been generated |
Field Summary | |
---|---|
protected AttributesImpl |
attributes
Convenience object, so we don't need to create an AttributesImpl for every element. |
protected List |
cacheKeyParList
The cache key needs to be generated for the configuration of this generator, so storing the parameters for generateKey(). |
protected static String |
DATE_ATTR_NAME
|
protected SimpleDateFormat |
dateFormatter
The dateFormatter determines into which date format the lastModified time should be converted. |
protected int |
depth
The depth parameter determines how deep the DirectoryGenerator should delve. |
protected static String |
DIR_NODE_NAME
|
protected Source |
directorySource
The source object for the directory. |
protected org.apache.regexp.RE |
excludeRE
The regular expression for the exclude pattern. |
protected static String |
FILE_NODE_NAME
|
protected static String |
FILENAME_ATTR_NAME
|
protected org.apache.regexp.RE |
includeRE
The regular expression for the include pattern. |
protected boolean |
isRequestedDirectory
This is only set to true for the requested directory specified by the src attribute on the generator's configuration. |
protected static String |
LASTMOD_ATTR_NAME
|
protected static String |
PREFIX
The namespace prefix for this namespace. |
protected long |
refreshDelay
The delay between checks on updates to the filesystem. |
protected boolean |
reverse
The reverse parameter reverses the sort order. |
protected org.apache.regexp.RE |
rootRE
The regular expression for the root pattern. |
protected static String |
SIZE_ATTR_NAME
|
protected String |
sort
The sort parameter determines by which attribute the content of one directory should be sorted. |
protected static String |
URI
The URI of the namespace of this generator. |
protected DirectoryGenerator.DirValidity |
validity
The validity that is being built |
Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator |
---|
manager |
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator |
---|
objectModel, parameters, resolver, source |
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer |
---|
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer |
Fields inherited from interface org.apache.cocoon.generation.Generator |
---|
ROLE |
Constructor Summary | |
---|---|
DirectoryGenerator()
|
Method Summary | |
---|---|
protected void |
addAncestorPath(File path,
Stack ancestors)
Adds recursively the path from the directory matched by the root pattern down to the requested directory. |
protected void |
addPath(File path,
int depth)
Adds a single node to the generated document. |
protected void |
endNode(String nodeName)
Ends the named node. |
void |
generate()
Generate XML data. |
protected Stack |
getAncestors(File path)
Creates a stack containing the ancestors of File up to specified directory. |
Serializable |
getKey()
Generate the unique key. |
SourceValidity |
getValidity()
Gets the source validity, using a deferred validity object. |
protected boolean |
isExcluded(File path)
Determines if a given File shall be excluded from viewing. |
protected boolean |
isIncluded(File path)
Determines if a given File shall be visible. |
protected boolean |
isRoot(File path)
Determines if a given File is the defined root. |
void |
recycle()
Recycle resources |
protected void |
setNodeAttributes(File path)
Sets the attributes for a given path. |
void |
setup(SourceResolver resolver,
Map objectModel,
String src,
Parameters par)
Set the request parameters. |
protected void |
startNode(String nodeName,
File path)
Begins a named node and calls setNodeAttributes to set its attributes. |
Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator |
---|
dispose, service |
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 |
---|
protected static final String URI
protected static final String PREFIX
protected static final String DIR_NODE_NAME
protected static final String FILE_NODE_NAME
protected static final String FILENAME_ATTR_NAME
protected static final String LASTMOD_ATTR_NAME
protected static final String DATE_ATTR_NAME
protected static final String SIZE_ATTR_NAME
protected DirectoryGenerator.DirValidity validity
protected AttributesImpl attributes
protected List cacheKeyParList
protected int depth
protected SimpleDateFormat dateFormatter
protected long refreshDelay
protected String sort
protected boolean reverse
false
is default.
protected org.apache.regexp.RE rootRE
protected org.apache.regexp.RE includeRE
protected org.apache.regexp.RE excludeRE
protected boolean isRequestedDirectory
src
attribute on the generator's configuration.
protected Source directorySource
Constructor Detail |
---|
public DirectoryGenerator()
Method Detail |
---|
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws ProcessingException, SAXException, IOException
setup
in interface SitemapModelComponent
setup
in class AbstractGenerator
resolver
- the SourceResolver objectobjectModel
- a Map
containing model objectsrc
- the directory to be XMLized specified as src attribute on <map:generate/>par
- configuration parameters
ProcessingException
SAXException
IOException
public Serializable getKey()
CacheableProcessingComponent
getKey
in interface CacheableProcessingComponent
null
if the component
is currently not cacheable.public SourceValidity getValidity()
getValidity
in interface CacheableProcessingComponent
null
if the
component is currently not cacheable.DirectoryGenerator.DirValidity
public void generate() throws SAXException, ProcessingException
generate
in interface Generator
SAXException
- if an error occurs while outputting the document
ProcessingException
- if the requsted URI isn't a directory on the local filesystemprotected Stack getAncestors(File path)
path
- the File whose ancestors shall be retrieved
protected void addAncestorPath(File path, Stack ancestors) throws SAXException
path
- the requested directory.ancestors
- the stack of the ancestors.
SAXException
protected void addPath(File path, int depth) throws SAXException
path
- the file/directory to processdepth
- how deep to scan the directory
SAXException
- if an error occurs while constructing nodesprotected void startNode(String nodeName, File path) throws SAXException
nodeName
- the name of the new nodepath
- the file/directory to use when setting attributes
SAXException
- if an error occurs while creating the nodeprotected void setNodeAttributes(File path) throws SAXException
path
- the file/directory to use when setting attributes
SAXException
- if an error occurs while setting the attributesprotected void endNode(String nodeName) throws SAXException
nodeName
- the name of the new node
SAXException
- if an error occurs while closing the nodeprotected boolean isRoot(File path)
path
- the File to check
protected boolean isIncluded(File path)
path
- the File to check
null
,
false otherwise.protected boolean isExcluded(File path)
path
- the File to check
null
,
true otherwise.public void recycle()
recycle
in interface Recyclable
recycle
in class AbstractGenerator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |