Class MetacatInitializer

java.lang.Object
edu.ucsb.nceas.metacat.startup.MetacatInitializer
All Implemented Interfaces:
EventListener, javax.servlet.ServletContextListener

@WebListener public class MetacatInitializer extends Object implements javax.servlet.ServletContextListener
A class to initialize Metacat
Author:
tao
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    contextDestroyed(javax.servlet.ServletContextEvent sce)
     
    void
    contextInitialized(javax.servlet.ServletContextEvent sce)
    An implementation of ServletContextListener that is called automatically by the servlet container on startup, and used to verify that we have the essential components in place and Metacat is initialized.
    protected void
    Start to convert the storage if the db is configured and the storage conversion status is PENDING or FAILED
    static Storage
    Get the storage instance
    protected void
    Initialize the remainder of Metacat.
    static void
    Schedule a site map task
    static void
    Initialize the storage system.
    static boolean
    Get the status of full-initialization.
    protected static void
    Schedule the sitemap generator to run periodically and update all of the sitemap files for search indexing engines
    protected static void
    Start to re-generate indexes for those haven't been indexed in another thread.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • MetacatInitializer

      public MetacatInitializer()
  • Method Details

    • contextInitialized

      public void contextInitialized(javax.servlet.ServletContextEvent sce)
      An implementation of ServletContextListener that is called automatically by the servlet container on startup, and used to verify that we have the essential components in place and Metacat is initialized. So it can run successfully.
      Specified by:
      contextInitialized in interface javax.servlet.ServletContextListener
      Parameters:
      ServletContextEvent - the ServletContextEvent object will be used in Metacat
    • contextDestroyed

      public void contextDestroyed(javax.servlet.ServletContextEvent sce)
      Specified by:
      contextDestroyed in interface javax.servlet.ServletContextListener
    • initAfterMetacatConfig

      protected void initAfterMetacatConfig() throws ServiceException, javax.servlet.ServletException, edu.ucsb.nceas.utilities.PropertyNotFoundException, SQLException, edu.ucsb.nceas.utilities.UtilException
      Initialize the remainder of Metacat. This is the part that can only be initialized after metacat properties have been configured.
      Throws:
      ServiceException
      javax.servlet.ServletException
      edu.ucsb.nceas.utilities.PropertyNotFoundException
      SQLException
      edu.ucsb.nceas.utilities.UtilException
    • initializeSitemapTask

      public static void initializeSitemapTask()
      Schedule a site map task
    • scheduleSitemapGeneration

      protected static void scheduleSitemapGeneration()
      Schedule the sitemap generator to run periodically and update all of the sitemap files for search indexing engines
    • startIndexReGenerator

      protected static void startIndexReGenerator()
      Start to re-generate indexes for those haven't been indexed in another thread. It will create a timer to run this task periodically. If the property of "index.regenerate.interval" is less than 0, the thread would NOT run.
    • isFullyInitialized

      public static boolean isFullyInitialized()
      Get the status of full-initialization.
      Returns:
      true if the Metacat instance is fully initialized; false otherwise.
    • getStorage

      public static Storage getStorage() throws org.dataone.service.exceptions.ServiceFailure
      Get the storage instance
      Returns:
      the instance of storage
      Throws:
      org.dataone.service.exceptions.ServiceFailure
    • initStorage

      public static void initStorage() throws edu.ucsb.nceas.utilities.PropertyNotFoundException, ServiceException
      Initialize the storage system.
      Throws:
      edu.ucsb.nceas.utilities.PropertyNotFoundException
      ServiceException
    • convertStorage

      protected void convertStorage() throws MetacatUtilException, AdminException, edu.ucsb.nceas.utilities.GeneralPropertyException
      Start to convert the storage if the db is configured and the storage conversion status is PENDING or FAILED
      Throws:
      MetacatUtilException
      AdminException
      edu.ucsb.nceas.utilities.GeneralPropertyException