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
public class ResourcesExplorerGenerator extends ServiceableGenerator
Generates a subtree ofExplorerNode
.
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
Fields Modifier and Type Field Description protected ExplorerApplicationExtensionPoint
_explorerApplicationEP
The explorer application EPprotected AmetysObjectResolver
_resolver
The resolver for ametys objectprotected UserManager
_userManager
The user managerstatic String
RESOURCE
Constant for resourcestatic String
RESOURCE_COLLECTION
Constant for resource collection-
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
-
-
Constructor Summary
Constructors Constructor Description ResourcesExplorerGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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
getExplorerNodeAttributes(ExplorerNode node)
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 Detail
-
RESOURCE_COLLECTION
public static final String RESOURCE_COLLECTION
Constant for resource collection- See Also:
- Constant Field Values
-
RESOURCE
public static final String RESOURCE
Constant for resource- See Also:
- Constant Field Values
-
_resolver
protected AmetysObjectResolver _resolver
The resolver for ametys object
-
_userManager
protected UserManager _userManager
The user manager
-
_explorerApplicationEP
protected ExplorerApplicationExtensionPoint _explorerApplicationEP
The explorer application EP
-
-
Constructor Detail
-
ResourcesExplorerGenerator
public ResourcesExplorerGenerator()
-
-
Method Detail
-
service
public void service(ServiceManager sManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableGenerator
- Throws:
ServiceException
-
generate
public void generate() throws IOException, SAXException, ProcessingException
-
saxCollection
protected void saxCollection(ExplorerNode node) throws SAXException
SAX aExplorerNode
- Parameters:
node
- The node to sax- Throws:
SAXException
- If an error occurred while saxing
-
saxCollection
protected void saxCollection(ExplorerNode node, boolean saxNode) throws SAXException
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
protected boolean _matchFilter(Resource resource, String[] allowedExtensions)
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
protected void saxExplorerNode(ExplorerNode node, int depth) throws SAXException
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
protected AttributesImpl getExplorerNodeAttributes(ExplorerNode node)
Returns the attributes corresponding to an Explorer node.- Parameters:
node
- The explorer node to SAX.- Returns:
- the attributes
-
saxResource
protected void saxResource(Resource resource) throws SAXException
SAX aResource
- Parameters:
resource
- The resource to SAX- Throws:
SAXException
- If an error occurred while SAXing
-
getResourceAttributes
protected AttributesImpl getResourceAttributes(Resource resource)
Returns the attributes corresponding to a Resource.- Parameters:
resource
- The resource to SAX- Returns:
- the attributes
-
getResourcesIconCls
protected String getResourcesIconCls(Resource resource)
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
protected void getAdditionalAttributes(AttributesImpl attrs, Resource resource)
Get the additional attributes- Parameters:
attrs
- The attributesresource
- The resource
-
-