@ConsumerType
public interface SitemapGenerator
SitemapGenerator implementations are responsible to generate one or many sitemaps for a given sitemap root
Resource. When a SitemapGenerator generates multiple sitemaps for a given Resource it has to
return their names using getNames(Resource). Also, the SitemapGenerator may decide
that any of those names should be served on-demand by returning a subset of names for
getOnDemandNames(Resource).
generate(Resource, String, Sitemap, Context) may be called for each name and
each sitemap root Resource, the implementation returned an non-empty Set of names for.
It is possible to register multiple SitemapGenerators for a single name. In this case the one with the
highest ranking according to the OSGI specification is used.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
SitemapGenerator.Context
A context object that gives the
SitemapGenerator access to additional configurations and methods to
track state. |
| Modifier and Type | Method and 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 a
Set of sitemap names this SitemapGenerator can generate for a particular sitemap
root Resource. |
default @NotNull java.util.Set<java.lang.String> |
getOnDemandNames(@NotNull Resource sitemapRoot)
Implementations may return a subset of the names returned by
getNames(Resource)
that should be served on-demand. |
@NotNull
default @NotNull java.util.Set<java.lang.String> getNames(@NotNull
@NotNull Resource sitemapRoot)
Set of sitemap names this SitemapGenerator can generate for a particular sitemap
root Resource. If the implementation does not generate a sitemap for a particular root it must return an
empty Set, if it does but does not differentiate by name, it must return a Set containing only
the SitemapService.DEFAULT_SITEMAP_NAME.
The default implementation returns a Set of only SitemapService.DEFAULT_SITEMAP_NAME.
Set of names@NotNull
default @NotNull java.util.Set<java.lang.String> getOnDemandNames(@NotNull
@NotNull Resource sitemapRoot)
getNames(Resource)
that should be served on-demand.
The default implementation returns an empty Set, meaning none of the names should be served on-demand.
sitemapRoot - void generate(@NotNull
@NotNull Resource sitemapRoot,
@NotNull
@NotNull java.lang.String name,
@NotNull
@NotNull Sitemap sitemap,
@NotNull
SitemapGenerator.Context context)
throws SitemapException
Sitemap with the given name at the given Resource.
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 last Resource added to the Sitemap.
sitemapRoot - the root at which the sitemap should be createdname - the name, one of the names returned by getNames(Resource) for the given
sitemapRootsitemap - the Sitemap object to add locations tocontext - the context under which the sitemap is generatedSitemapException - may be thrown in unrecoverable exceptional casesCopyright © 2010 - 2023 Adobe. All Rights Reserved