|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.pipeline.component.AbstractPipelineComponent org.apache.cocoon.sax.AbstractSAXPipelineComponent org.apache.cocoon.sax.AbstractSAXProducer org.apache.cocoon.sax.AbstractSAXGenerator org.apache.cocoon.optional.pipeline.components.sax.directory.DirectoryGenerator
public class DirectoryGenerator
Field Summary | |
---|---|
protected org.xml.sax.helpers.AttributesImpl |
attributes
Convenience object, so we don't need to create an AttributesImpl for every element. |
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 Pattern |
excludeRE
The regular expression for the exclude pattern. |
protected static String |
FILE_NODE_NAME
|
protected static String |
FILENAME_ATTR_NAME
|
protected Pattern |
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 Pattern |
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. |
Constructor Summary | |
---|---|
DirectoryGenerator()
|
|
DirectoryGenerator(File file)
|
Method Summary | |
---|---|
protected void |
addAncestorPath(File path,
Stack<File> ancestors)
Adds recursively the path from the directory matched by the root pattern down to the requested directory. |
protected void |
addPath(File path,
int scanDepth)
Adds a single node to the generated document. |
CacheKey |
constructCacheKey()
|
protected void |
endNode(String nodeName)
Ends the named node. |
void |
execute()
Gets the source validity, using a deferred validity object. |
protected Stack<File> |
getAncestors(File path)
Creates a stack containing the ancestors of File up to specified directory. |
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 |
setConfiguration(Map<String,? extends Object> configuration)
Pass component specific configuration parameters to the pipeline component in a generic way. |
void |
setDirectorySource(File directorySource)
|
protected void |
setNodeAttributes(File path)
Sets the attributes for a given path. |
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.sax.AbstractSAXProducer |
---|
getSAXConsumer, setConsumer, setSAXConsumer, toString |
Methods inherited from class org.apache.cocoon.pipeline.component.AbstractPipelineComponent |
---|
finish, setup |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.cocoon.pipeline.component.PipelineComponent |
---|
finish, setup |
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 org.xml.sax.helpers.AttributesImpl attributes
protected int depth
protected SimpleDateFormat dateFormatter
protected long refreshDelay
protected String sort
protected boolean reverse
false
is
default.
protected Pattern rootRE
protected Pattern includeRE
protected Pattern excludeRE
protected boolean isRequestedDirectory
src
attribute on the generator's configuration.
Constructor Detail |
---|
public DirectoryGenerator()
public DirectoryGenerator(File file)
Method Detail |
---|
public void setDirectorySource(File directorySource)
public void setConfiguration(Map<String,? extends Object> configuration)
PipelineComponent
setConfiguration
in interface PipelineComponent
setConfiguration
in class AbstractPipelineComponent
configuration
- The Map
of configuration parameters.public void execute() throws ProcessingException
execute
in interface Starter
SAXException
- if an error occurs while outputting the document
ProcessingException
- if the requested URI isn't a directory on the local filesystempublic SourceValidity getValidity() { if (this.validity == null) { this.validity = new
DirValidity(this.refreshDelay); } return this.validity; }/
/** Generate XML data.
protected Stack<File> getAncestors(File path)
path
- the File whose ancestors shall be retrieved
protected void addAncestorPath(File path, Stack<File> ancestors) throws SAXException
path
- the requested directory.ancestors
- the stack of the ancestors.
SAXException
protected void addPath(File path, int scanDepth) throws SAXException
path
- the file/directory to processscanDepth
- 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 CacheKey constructCacheKey()
constructCacheKey
in interface CachingPipelineComponent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |