Package edu.ucsb.nceas.metacat.startup
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcontextDestroyed(javax.servlet.ServletContextEvent sce) voidcontextInitialized(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 voidStart to convert the storage if the db is configured and the storage conversion status is PENDING or FAILEDstatic StorageGet the storage instanceprotected voidInitialize the remainder of Metacat.static voidSchedule a site map taskstatic voidInitialize the storage system.static booleanGet the status of full-initialization.protected static voidSchedule the sitemap generator to run periodically and update all of the sitemap files for search indexing enginesprotected static voidStart to re-generate indexes for those haven't been indexed in another thread.
-
Field Details
-
APPLICATION_NAME
- See Also:
-
-
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:
contextInitializedin interfacejavax.servlet.ServletContextListener- Parameters:
ServletContextEvent- the ServletContextEvent object will be used in Metacat
-
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent sce) - Specified by:
contextDestroyedin interfacejavax.servlet.ServletContextListener
-
initAfterMetacatConfig
protected void initAfterMetacatConfig() throws ServiceException, javax.servlet.ServletException, edu.ucsb.nceas.utilities.PropertyNotFoundException, SQLException, edu.ucsb.nceas.utilities.UtilExceptionInitialize the remainder of Metacat. This is the part that can only be initialized after metacat properties have been configured.- Throws:
ServiceExceptionjavax.servlet.ServletExceptionedu.ucsb.nceas.utilities.PropertyNotFoundExceptionSQLExceptionedu.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
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, ServiceExceptionInitialize the storage system.- Throws:
edu.ucsb.nceas.utilities.PropertyNotFoundExceptionServiceException
-
convertStorage
protected void convertStorage() throws MetacatUtilException, AdminException, edu.ucsb.nceas.utilities.GeneralPropertyExceptionStart to convert the storage if the db is configured and the storage conversion status is PENDING or FAILED- Throws:
MetacatUtilExceptionAdminExceptionedu.ucsb.nceas.utilities.GeneralPropertyException
-