Class ResourceTreeSitemapGenerator
- All Implemented Interfaces:
SitemapGenerator
SitemapGenerator that traverses a resource tree.
Implementations may change the traversal behaviour by overriding
shouldFollow(Resource) or
shouldInclude(Resource) but it is recommended to always consider the default
implementation. The default implementation includes only Resources that have a "jcr:content" child and
follows through only on content that is not below the "jcr:content" or any other sitemap root.
This implementation keeps track of the traversal's state in the
SitemapGenerator.Context. It is capable to continue from a previous
persisted state, when the generation got aborted.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.sling.sitemap.spi.generator.SitemapGenerator
SitemapGenerator.Context -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.sling.sitemap.spi.generator.SitemapGenerator
getNames, getOnDemandNames
-
Constructor Details
-
ResourceTreeSitemapGenerator
public ResourceTreeSitemapGenerator()
-
-
Method Details
-
generate
public final void generate(@NotNull @NotNull Resource sitemapRoot, @NotNull @NotNull String name, @NotNull @NotNull Sitemap sitemap, @NotNull SitemapGenerator.Context context) throws SitemapException Description copied from interface:SitemapGeneratorGenerates aSitemapwith the given name at the givenResource.This process may be stateful and the given
SitemapGenerator.Contextcan be used to keep track of the state. For example a traversal that keeps track on the lastResourceadded to theSitemap.- Specified by:
generatein interfaceSitemapGenerator- Parameters:
sitemapRoot- the root at which the sitemap should be createdname- the name, one of the names returned bySitemapGenerator.getNames(Resource)for the given sitemapRootsitemap- theSitemapobject to add locations tocontext- the context under which the sitemap is generated- Throws:
SitemapException- may be thrown in unrecoverable exceptional cases
-