Interface SitemapGenerator
-
- All Known Subinterfaces:
PageTreeSitemapGenerator
- All Known Implementing Classes:
ResourceTreeSitemapGenerator
@ConsumerType public interface SitemapGenerator
SitemapGenerator
implementations are responsible to generate one or many sitemaps for a given sitemap rootResource
. When aSitemapGenerator
generates multiple sitemaps for a givenResource
it has to return their names usinggetNames(Resource)
. Also, theSitemapGenerator
may decide that any of those names should be served on-demand by returning a subset of names forgetOnDemandNames(Resource)
.generate(Resource, String, Sitemap, Context)
may be called for each name and each sitemap rootResource
, the implementation returned an non-emptySet
of names for.It is possible to register multiple
SitemapGenerator
s for a single name. In this case the one with the highest ranking according to the OSGI specification is used.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
SitemapGenerator.Context
A context object that gives theSitemapGenerator
access to additional configurations and methods to track state.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
generate(@NotNull Resource sitemapRoot, @NotNull java.lang.String name, @NotNull Sitemap sitemap, SitemapGenerator.Context context)
default @NotNull java.util.Set<java.lang.String>
getNames(@NotNull Resource sitemapRoot)
Returns aSet
of sitemap names thisSitemapGenerator
can generate for a particular sitemap rootResource
.default @NotNull java.util.Set<java.lang.String>
getOnDemandNames(@NotNull Resource sitemapRoot)
Implementations may return a subset of the names returned bygetNames(Resource)
that should be served on-demand.
-
-
-
Method Detail
-
getNames
@NotNull default @NotNull java.util.Set<java.lang.String> getNames(@NotNull @NotNull Resource sitemapRoot)
Returns aSet
of sitemap names thisSitemapGenerator
can generate for a particular sitemap rootResource
. If the implementation does not generate a sitemap for a particular root it must return an emptySet
, if it does but does not differentiate by name, it must return aSet
containing only theSitemapService.DEFAULT_SITEMAP_NAME
.The default implementation returns a
Set
of onlySitemapService.DEFAULT_SITEMAP_NAME
.- Returns:
- a
Set
of names
-
getOnDemandNames
@NotNull default @NotNull java.util.Set<java.lang.String> getOnDemandNames(@NotNull @NotNull Resource sitemapRoot)
Implementations may return a subset of the names returned bygetNames(Resource)
that should be served on-demand.The default implementation returns an empty
Set
, meaning none of the names should be served on-demand.- Parameters:
sitemapRoot
-- Returns:
-
generate
void generate(@NotNull @NotNull Resource sitemapRoot, @NotNull @NotNull java.lang.String name, @NotNull @NotNull Sitemap sitemap, @NotNull SitemapGenerator.Context context) throws SitemapException
Generates aSitemap
with the given name at the givenResource
.This process may be stateful and the given
SitemapGenerator.Context
can be used to keep track of the state. For example a traversal that keeps track on the lastResource
added to theSitemap
.- Parameters:
sitemapRoot
- the root at which the sitemap should be createdname
- the name, one of the names returned bygetNames(Resource)
for the given sitemapRootsitemap
- theSitemap
object to add locations tocontext
- the context under which the sitemap is generated- Throws:
SitemapException
- may be thrown in unrecoverable exceptional cases
-
-