edu.ucsb.nceas.metacat

## Class Sitemap

- java.lang.Object
- - java.util.TimerTask
  - - edu.ucsb.nceas.metacat.Sitemap

- All Implemented Interfaces:
    java.lang.Runnable

      public class Sitemap
      extends java.util.TimerTask

  A Sitemap represents a document that lists all of the content of the Metacat server for use by harvesting spiders that wish to index the contents of the Metacat site. It is used to generate an XML representation of all of the URLs of the site in order to facilitate indexing of the metacat site by search engines. Which objects are included? - Only documents with public read permission are included - Only documents with object_formats in the xml_catalog table are included - All non-obsoleted metadata objects are included in the sitemap(s) Other notes: - The sitemaps this class generates are intended to be served another application such as MetacatUI - A sitemap index is generated regardless of the number of URLs present - URLs for the location of the sitemaps and the entries themselves are controlled by the 'sitemap.location.base' and 'sitemap.entry.base' properties which can be full URLs or absolute paths. - sitemap.location.base controls first part of the URLs in the sitemap index - sitemap.entry.base controls the first part of the URLs in the sitemap files themselves
  Author:
    Matt Jones, Bryce Mecum

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Sitemap(java.io.File directory, java.lang.String locationBase, java.lang.String entryBase)` Construct a new instance of the Sitemap.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `generateSitemaps()` Generate all of the sitemap files needed to list the URLs from this instance of Metacat, using the open sitemap format described here: http://www.sitemaps.org/protocol.html URLs are written to a single file, unless the maximum number of URLs allowed in the sitemap file is exceeded, in which subsequent numbered files are created.
    `void` | `run()` Execute the timed task when called, in this case by generating the sitemap files needed for this Metacat instance.

    - ### Methods inherited from class java.util.TimerTask

      `cancel, scheduledExecutionTime`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Sitemap

          public Sitemap(java.io.File directory,
                         java.lang.String locationBase,
                         java.lang.String entryBase)

      Construct a new instance of the Sitemap.
      Parameters:
        `directory` - the location to store sitemap files
        `locationBase` - the base URL for constructing sitemap location URLs
        `entryBase` - the base URL for constructing sitemap entry URLs

  - ### Method Detail

    - #### run

          public void run()

      Execute the timed task when called, in this case by generating the sitemap files needed for this Metacat instance.
      Specified by:
        `run` in interface `java.lang.Runnable`
      Specified by:
        `run` in class `java.util.TimerTask`

    - #### generateSitemaps

          public void generateSitemaps()

      Generate all of the sitemap files needed to list the URLs from this instance of Metacat, using the open sitemap format described here: http://www.sitemaps.org/protocol.html URLs are written to a single file, unless the maximum number of URLs allowed in the sitemap file is exceeded, in which subsequent numbered files are created. An index of the sitemaps is also created. The sitemap index can be registered with search index providers such as Google, but beware that it needs to be accessible in a location above the mount point for the service URLs. By default the files are placed in {context}/sitemaps, but you will need to expose them at a location matching what's set in the sitemap.location.base and sitemap.entry.base properties in order to be trusted by Google. See the Sitemaps.org documentation for details.

Copyright © 2020 Regents of the University of California. All Rights Reserved.