Class MCRGoogleSitemapCommon

java.lang.Object
org.mycore.frontend.indexbrowser.MCRGoogleSitemapCommon

public final class MCRGoogleSitemapCommon extends Object
This class implements all common methods to create the sitemap data.
used properties:
  • MCR.baseurl - the application base URL
  • MCR.WebApplication.basedir - the directory where the web application is stored
  • MCR.GoogleSitemap.Directory - the directory where the sitemap should be stored relative to MCR.WebApplication.basedir (it could be empty)
  • MCR.GoogleSitemap.Types - a list of MCRObject types, they should be included
  • MCR.GoogleSitemap.Freq - the frequency of harvesting, 'monthly' is default
  • MCR.GoogleSitemap.Style - a style extension for the URL in form of ?XSL.Style={style}, default is empty
  • MCR.GoogleSitemap.ObjectPath - the path to get the MCRObject in the sitemap URL, 'receive/' is default
  • MCR.GoogleSitemap.NumberOfURLs - the number of URLs in one sitemap file, 10000 is default
see http://www.sitemaps.org/de/protocol.html
Version:
$Revision$ $Date$
Author:
Frank Lützenkirchen, Jens Kupferschmidt, Thomas Scheffler (yagee)
  • Constructor Details

  • Method Details

    • checkSitemapFile

      protected int checkSitemapFile() throws IOException
      The method computes the number of sitemap files. If we have less than numberOfURLs URLs and only one MyCoRe type the sitemap_google.xml contained all URLs. Otherwise it split the sitemap in an sitemap_google.xml index file and a lot of sitemap_google_xxxx.xml URL files.
      Returns:
      the number of files, one for a single sitemap_google.xml file, more than one for the index and all parts.
      Throws:
      IOException
    • getFileName

      protected String getFileName(int number, boolean withpath)
      The method return the path to the sitemap_google.xml file.
      Parameters:
      number - number of this file - '1' = sitemap_google.xml - '> 1' sitemap_google_xxx.xml
      withpath - true for the full path, false for the file name
      Returns:
      a path to sitemap_google.xml
    • buildSingleSitemap

      protected Document buildSingleSitemap() throws Exception
      The method build the sitemap_google.xml JDOM document over all items.
      Returns:
      The sitemap_google.xml as JDOM document
      Throws:
      Exception
    • buildPartSitemap

      protected Document buildPartSitemap(int number) throws Exception
      The method call the database and build the sitemap_google.xml JDOM document.
      Parameters:
      number - number of this file - '1' = sitemap_google.xml - '> 1' sitemap_google_xxx.xml
      Returns:
      The sitemap.xml as JDOM document
      Throws:
      Exception
    • buildSitemapIndex

      protected Document buildSitemapIndex(int number)
      The method build the index sitemap_google.xml JDOM document.
      Parameters:
      number - number of indexed files (must greater than 1
      Returns:
      The index sitemap_google.xml as JDOM document
    • removeSitemapFiles

      protected void removeSitemapFiles()
      This method remove all sitemap files from the webapps directory.