Class ResourcesExplorerGenerator
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.ametys.plugins.explorer.resources.generators.ResourcesExplorerGenerator
- All Implemented Interfaces:
Poolable
,Recyclable
,Disposable
,Component
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
- Direct Known Subclasses:
ExplorerEntitiesGenerator
,ExplorerEntityGenerator
,ResourceGenerator
,ResourcesExplorerGenerator
,ResourcesGenerator
,SearchGenerator
Generates a subtree of
The subnodes are SAXed to a depth of 0 by default.
ExplorerNode
.The subnodes are SAXed to a depth of 0 by default.
- Depth of -1 means generate all
- 0 means only the given node and its children (resources and folders)
- 1 means the given node, its children and their children, and so on.
-
Field Summary
Modifier and TypeFieldDescriptionprotected AmetysObjectResolver
The resolver for ametys objectprotected UserManager
The user managerstatic final String
Constant for resourcestatic final String
Constant for resource collectionFields 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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
_matchFilter
(Resource resource, String[] allowedExtensions) Determines if the resource matches the allowed extensionsvoid
generate()
protected void
getAdditionalAttributes
(AttributesImpl attrs, Resource resource) Get the additional attributesprotected AttributesImpl
Returns the attributes corresponding to an Explorer node.protected AttributesImpl
getResourceAttributes
(Resource resource) Returns the attributes corresponding to a Resource.protected String
getResourcesIconCls
(Resource resource) CSS suffix class name getter for the icon resource.protected void
saxCollection
(ExplorerNode node) SAX aExplorerNode
protected void
saxCollection
(ExplorerNode node, boolean saxNode) SAX aExplorerNode
protected void
saxCollection
(ExplorerNode node, boolean saxNode, String nodeTag) SAX aExplorerNode
protected void
saxCollection
(ExplorerNode node, int depth, boolean saxNode, String nodeTag) SAX aExplorerNode
protected void
saxCollection
(ExplorerNode node, int depth, String[] allowedExtensions) SAX aExplorerNode
protected void
saxExplorerNode
(ExplorerNode node, int depth) SAX aExplorerNode
protected void
saxExplorerNode
(ExplorerNode node, int depth, String[] allowedExtensions) SAX aExplorerNode
protected void
saxResource
(Resource resource) SAX aResource
void
service
(ServiceManager sManager) Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
dispose
Methods inherited from class org.apache.cocoon.generation.AbstractGenerator
recycle, setup
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 Details
-
RESOURCE_COLLECTION
Constant for resource collection- See Also:
-
RESOURCE
Constant for resource- See Also:
-
_resolver
The resolver for ametys object -
_userManager
The user manager
-
-
Constructor Details
-
ResourcesExplorerGenerator
public ResourcesExplorerGenerator()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableGenerator
- Throws:
ServiceException
-
generate
-
saxCollection
SAX aExplorerNode
- Parameters:
node
- The node to sax- Throws:
SAXException
- If an error occurred while saxing
-
saxCollection
SAX aExplorerNode
- Parameters:
node
- The node to saxsaxNode
- True to wrap the collection with an XML node representing the current node.- Throws:
SAXException
- If an error occurred while saxing
-
saxCollection
protected void saxCollection(ExplorerNode node, boolean saxNode, String nodeTag) throws SAXException SAX aExplorerNode
- Parameters:
node
- The node to saxsaxNode
- True to wrap the collection with an XML node representing the current node.nodeTag
- The tag to use- Throws:
SAXException
- If an error occurred while saxing
-
saxCollection
protected void saxCollection(ExplorerNode node, int depth, boolean saxNode, String nodeTag) throws SAXException SAX aExplorerNode
- Parameters:
node
- The node to saxdepth
- The recursive depth to saxsaxNode
- True to wrap the collection with an XML node representing the current node.nodeTag
- The tag to use- Throws:
SAXException
- If an error occurred while saxing
-
saxCollection
protected void saxCollection(ExplorerNode node, int depth, String[] allowedExtensions) throws SAXException SAX aExplorerNode
- Parameters:
node
- The node to saxdepth
- The recursive depth to saxallowedExtensions
- The allowed file extensions (lower-case). Can be null or empty to not filter on file extensions- Throws:
SAXException
- If an error occurred while saxing
-
_matchFilter
Determines if the resource matches the allowed extensions- Parameters:
resource
- The resourceallowedExtensions
- allowed file extensions- Returns:
- true if the allowed extensions are empty or null, or if the resource's name matches the allowed extensions
-
saxExplorerNode
SAX aExplorerNode
- Parameters:
node
- The explorer node to SAX.depth
- The recursive depth to sax- Throws:
SAXException
- If an error occurred while SAXing
-
saxExplorerNode
protected void saxExplorerNode(ExplorerNode node, int depth, String[] allowedExtensions) throws SAXException SAX aExplorerNode
- Parameters:
node
- The explorer node to SAX.depth
- The recursive depth to saxallowedExtensions
- allowed file extensions- Throws:
SAXException
- If an error occurred while SAXing
-
getExplorerNodeAttributes
Returns the attributes corresponding to an Explorer node.- Parameters:
node
- The explorer node to SAX.- Returns:
- the attributes
-
saxResource
SAX aResource
- Parameters:
resource
- The resource to SAX- Throws:
SAXException
- If an error occurred while SAXing
-
getResourceAttributes
Returns the attributes corresponding to a Resource.- Parameters:
resource
- The resource to SAX- Returns:
- the attributes
-
getResourcesIconCls
CSS suffix class name getter for the icon resource.- Parameters:
resource
- The resource- Returns:
- The suffix of the css class for the icon of this resource.
-
getAdditionalAttributes
Get the additional attributes- Parameters:
attrs
- The attributesresource
- The resource
-