Class IndexingManager

java.lang.Object
org.dlese.dpc.repository.indexing.IndexingManager

public class IndexingManager extends Object
Manages indexing processes from external sources to RepositoryManager that implement the
invalid reference
IndexingEventHandler
Interface.
Author:
John Weatherley
  • Constructor Details

    • IndexingManager

      public IndexingManager(RepositoryManager repositoryManager)
      Constructor for the IndexingManager object -- refactor to be a factory...
      Parameters:
      repositoryManager - The RepositoryManager
  • Method Details

    • addIndexingEventHandler

      public void addIndexingEventHandler(String itemIndexerClassName) throws Exception
      Adds an event handler that performs the indexing actions, sets the config directory and fires the configure and init event.
      Parameters:
      itemIndexerClassName - An event handler that implements the ItemIndexer Interface.
      Throws:
      Exception - If error
    • fireIndexerReadyEvent

      public void fireIndexerReadyEvent(String itemIndexerClassName) throws Exception
      Fire this event to indicate to watchers that the indexer is ready to accept indexing calls.
      Parameters:
      itemIndexerClassName - An ItemIndexer to fire the event on, or null to fire the event on all handlers
      Throws:
      Exception - If error
    • fireUpdateCollectionsEvent

      public void fireUpdateCollectionsEvent(String itemIndexerClassName) throws Exception
      Fire this event to indicate to watchers that they should update their collections using CollectionIndexer.putCollection() and CollectionIndexer.deleteCollection().
      Parameters:
      itemIndexerClassName - An ItemIndexer to fire the event on, or null to fire the event on all handlers
      Throws:
      Exception - If error
    • fireIndexCollectionEvent

      public void fireIndexCollectionEvent(String collectionKey, String itemIndexerClassName) throws Exception
      Parameters:
      collectionKey - The collection key that should be indexed
      itemIndexerClassName - An ItemIndexer to fire the event on, or null to fire the event on all handlers
      Throws:
      Exception - If error
    • fireIndexAllCollectionsEvent

      public void fireIndexAllCollectionsEvent(String itemIndexerClassName) throws Exception
      Parameters:
      itemIndexerClassName - An ItemIndexer to fire the event on, or null to fire the event on all handlers
      Throws:
      Exception - If error
    • fireAbortIndexingEvent

      public void fireAbortIndexingEvent(String itemIndexerClassName) throws Exception
      Fire this event to indicate to watchers that they should abort indexing at the earliest point possible.
      Parameters:
      itemIndexerClassName - An ItemIndexer to fire the event on, or null to fire the event on all handlers
      Throws:
      Exception - If error
    • fireConfigureAndInitializeEvent

      public void fireConfigureAndInitializeEvent(String itemIndexerClassName) throws Exception
      Fire this event to indicate to watchers that they update their configuration settings. This is called automatically once at startup.
      Parameters:
      itemIndexerClassName - An ItemIndexer to fire the event on, or null to fire the event on all handlers
      Throws:
      Exception - If error
    • destroy

      public void destroy() throws Exception
      Issue the abort indexing event to watchers and shut down the IndexingManager
      Throws:
      Exception - If error
    • getIndexingMessages

      public ArrayList getIndexingMessages()
      Gets the indexing status messages.
      Returns:
      The indexingMessages.
    • addIndexingMessage

      protected void addIndexingMessage(String msg)
      Adds a feature to the IndexingMessage attribute of the IndexingManager object
      Parameters:
      msg - The feature to be added to the IndexingMessage attribute
    • startIndexingTimer

      public void startIndexingTimer(String indexingStartTime, String indexingDaysOfWeek) throws Exception
      Starts or restarts the indexing timer thread to run every 24 hours, beginning at the specified time/date. Use this method to schedule the timer to run as a nightly cron, beginning at the time you wish the indexer to run.
      Parameters:
      indexingStartTime - The time of day at which start the indexing process in H:mm (24 hour time) format, for example 0:35 or 23:35, or null to disable auto indexing.
      indexingDaysOfWeek - The days of week to run the indexer as a comma separated list of integers, for example 1,3,5 where 1=Sunday, 2=Monday, 7=Saturday etc. or null for all days.
      Throws:
      Exception - If error reding the values
    • getIndexingStartTime

      public Date getIndexingStartTime()
      Gets the indexingStartTime Date, representing the time of day the indexer will run, or null if no indexing cron is being used.
      Returns:
      The indexingStartTime or null
    • getIndexingDaysOfWeek

      public int[] getIndexingDaysOfWeek()
      Gets the days of the week the indexer will run as an array of Calendar.DAY_OF_WEEK fields, or null to indicate all days of the week.
      Returns:
      The indexingDaysOfWeek or null for all days
    • getDateStamp

      public static String getDateStamp()
      Return a string for the current time and date, sutiable for display in log files and output to standout:
      Returns:
      The dateStamp value
    • getSimpleDateStamp

      public static String getSimpleDateStamp()
      Return a string for the current time and date, sutiable for display in log files and output to standout:
      Returns:
      The dateStamp value
    • setDebug

      public final void setDebug(boolean db)
      Sets the debug attribute of the IndexingManager object
      Parameters:
      db - The new debug value