Package org.apache.sling.sitemap

## Interface SitemapService

    @ProviderType
    public interface SitemapService

A service that gives consumers access to minimal information about sitemaps.

### Field Summary

Fields
`static String` `DEFAULT_SITEMAP_NAME` The default name used for (unnamed) sitemaps.
`static String` `EVENT_PROPERTY_SITEMAP_NAME` The event property storing the generated sitemap's name.
`static String` `EVENT_PROPERTY_SITEMAP_ROOT` The event property storing the generated sitemap's root path.
`static String` `EVENT_PROPERTY_SITEMAP_STORAGE_PATH` The event property storing the generated sitemap's storage path.
`static String` `EVENT_PROPERTY_SITEMAP_STORAGE_SIZE` The event property storing the generated sitemap's binary size.
`static String` `EVENT_PROPERTY_SITEMAP_URLS` The event property storing the generated sitemap's count of urls.
`static String` `EVENT_TOPIC_SITEMAP_PURGED` The background cleanup will send events with that topic right after an obsolete sitemap file was purged.
`static String` `EVENT_TOPIC_SITEMAP_UPDATED` The background generation will send events with that topic right after a generated sitemap was persisted.
`static String` `PROPERTY_SITEMAP_ROOT` The name of a boolean property marking a resource as sitemap root `Resource`.
`static String` `SITEMAP_INDEX_NAME` The name used for sitemap indexes.

### Method Summary

All Methods Instance Methods Abstract Methods
`int` `getMaxEntries()` Returns the configured maximum number of urls a sitemap must not exceed.
`int` `getMaxSize()` Returns the configured maximum size (bytes) a sitemap must not exceed.
`@NotNull Collection<SitemapInfo>` `getSitemapInfo​(@NotNull org.apache.sling.api.resource.Resource sitemapRoot)` Returns the urls to the given `Resource`'s sitemaps, if any.
`void` `scheduleGeneration()` Calls all registered sitemap schedulers to schedule (re)generation for all sitemap roots and names.
`void` `scheduleGeneration​(String name)` Calls all registered sitemap schedulers registered for the given name to schedule (re)generation.
`void` `scheduleGeneration​(org.apache.sling.api.resource.Resource sitemapRoot)` Calls all registered sitemap schedulers with a search path containing the given resource to schedule (re)generation for all names.
`void` `scheduleGeneration​(org.apache.sling.api.resource.Resource sitemapRoot, String name)` Calls all registered sitemap schedulers with a search path containing the given resource and being registered for the given name to schedule (re)generation.

### Field Detail

#### PROPERTY_SITEMAP_ROOT

    static final String PROPERTY_SITEMAP_ROOT

The name of a boolean property marking a resource as sitemap root `Resource`. It may either be set to a `Resource` or to a `Resource`'s jcr:content child.

See Also:
  Constant Field Values

#### DEFAULT_SITEMAP_NAME

    static final String DEFAULT_SITEMAP_NAME

The default name used for (unnamed) sitemaps.

See Also:
  Constant Field Values

#### SITEMAP_INDEX_NAME

    static final String SITEMAP_INDEX_NAME

The name used for sitemap indexes.

See Also:
  Constant Field Values

#### EVENT_TOPIC_SITEMAP_UPDATED

    static final String EVENT_TOPIC_SITEMAP_UPDATED

The background generation will send events with that topic right after a generated sitemap was persisted.

See Also:
  Constant Field Values

#### EVENT_TOPIC_SITEMAP_PURGED

    static final String EVENT_TOPIC_SITEMAP_PURGED

The background cleanup will send events with that topic right after an obsolete sitemap file was purged.

See Also:
  Constant Field Values

#### EVENT_PROPERTY_SITEMAP_ROOT

    static final String EVENT_PROPERTY_SITEMAP_ROOT

The event property storing the generated sitemap's root path.

See Also:
  Constant Field Values

#### EVENT_PROPERTY_SITEMAP_NAME

    static final String EVENT_PROPERTY_SITEMAP_NAME

The event property storing the generated sitemap's name.

See Also:
  Constant Field Values

#### EVENT_PROPERTY_SITEMAP_URLS

    static final String EVENT_PROPERTY_SITEMAP_URLS

The event property storing the generated sitemap's count of urls.

See Also:
  Constant Field Values

#### EVENT_PROPERTY_SITEMAP_STORAGE_PATH

    static final String EVENT_PROPERTY_SITEMAP_STORAGE_PATH

The event property storing the generated sitemap's storage path.

See Also:
  Constant Field Values

#### EVENT_PROPERTY_SITEMAP_STORAGE_SIZE

    static final String EVENT_PROPERTY_SITEMAP_STORAGE_SIZE

The event property storing the generated sitemap's binary size.

See Also:
  Constant Field Values

### Method Detail

#### getMaxSize

    int getMaxSize()

Returns the configured maximum size (bytes) a sitemap must not exceed.

Returns:

#### getMaxEntries

    int getMaxEntries()

Returns the configured maximum number of urls a sitemap must not exceed.

Returns:

#### scheduleGeneration

    void scheduleGeneration()

Calls all registered sitemap schedulers to schedule (re)generation for all sitemap roots and names.

#### scheduleGeneration

    void scheduleGeneration​(String name)

Calls all registered sitemap schedulers registered for the given name to schedule (re)generation.

Parameters:
  `name` -

#### scheduleGeneration

    void scheduleGeneration​(org.apache.sling.api.resource.Resource sitemapRoot)

Calls all registered sitemap schedulers with a search path containing the given resource to schedule (re)generation for all names.

Parameters:
  `sitemapRoot` -

#### scheduleGeneration

    void scheduleGeneration​(org.apache.sling.api.resource.Resource sitemapRoot,
                            String name)

Calls all registered sitemap schedulers with a search path containing the given resource and being registered for the given name to schedule (re)generation.

Parameters:
  `sitemapRoot` -
  `name` -

#### getSitemapInfo

    @NotNull
    @NotNull Collection<SitemapInfo> getSitemapInfo​(@NotNull
                                                    @NotNull org.apache.sling.api.resource.Resource sitemapRoot)

Returns the urls to the given `Resource`'s sitemaps, if any.

The returned urls may contain a sitemap index when there are multiple sitemaps generated for the given sitemap root `Resource`. Or it may contain urls to another sitemap root, if the sitemap is nested below a top level sitemap root.

Numbers for size and entries can only be provided for sitemaps served from storage. For sitemap index or any sitemap not served from storage `-1` will be returned.

The default implementation uses `SitemapLinkExternalizer.externalize(Resource)` to create absolute urls.

Parameters:
  `sitemapRoot` - a `Resource` having `PROPERTY_SITEMAP_ROOT` set to true
Returns:
  a `Collection` of `SitemapInfo` objects