Interface SitemapGenerator

    • Method Detail

      • getNames

        @NotNull
        default @NotNull java.util.Set<java.lang.String> getNames​(@NotNull
                                                                  @NotNull Resource sitemapRoot)
        Returns a 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.

        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 by 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.

        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 a 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.

        Parameters:
        sitemapRoot - the root at which the sitemap should be created
        name - the name, one of the names returned by getNames(Resource) for the given sitemapRoot
        sitemap - the Sitemap object to add locations to
        context - the context under which the sitemap is generated
        Throws:
        SitemapException - may be thrown in unrecoverable exceptional cases