DLESE Tools
v1.6.0

org.dlese.dpc.repository.indexing
Class IndexingManager

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

public class IndexingManager
extends Object

Manages indexing processes from external sources to RepositoryManager that implement the IndexingEventHandler Interface.

Author:
John Weatherley

Constructor Summary
IndexingManager(RepositoryManager repositoryManager)
          Constructor for the IndexingManager object -- refactor to be a factory...
 
Method Summary
 void addIndexingEventHandler(String itemIndexerClassName)
          Adds an event handler that performs the indexing actions, sets the config directory and fires the configure and init event.
protected  void addIndexingMessage(String msg)
          Adds a feature to the IndexingMessage attribute of the IndexingManager object
 void destroy()
          Issue the abort indexing event to watchers and shut down the IndexingManager
 void fireAbortIndexingEvent(String itemIndexerClassName)
          Fire this event to indicate to watchers that they should abort indexing at the earliest point possible.
 void fireConfigureAndInitializeEvent(String itemIndexerClassName)
          Fire this event to indicate to watchers that they update their configuration settings.
 void fireIndexAllCollectionsEvent(String itemIndexerClassName)
          Fire this event to indicate to watchers that they should perform indexing for ALL collections that they know about using CollectionIndexer.putRecord(java.lang.String, java.lang.String, java.lang.String, org.dlese.dpc.repository.indexing.CollectionIndexingSession), CollectionIndexer.deleteRecord(java.lang.String), CollectionIndexer.deletePreviousSessionRecords(org.dlese.dpc.repository.indexing.CollectionIndexingSession).
 void fireIndexCollectionEvent(String collectionKey, String itemIndexerClassName)
          Fire this event to indicate to watchers that they should perform indexing for the given collection if they are managing it using CollectionIndexer.putRecord(java.lang.String, java.lang.String, java.lang.String, org.dlese.dpc.repository.indexing.CollectionIndexingSession), CollectionIndexer.deleteRecord(java.lang.String), CollectionIndexer.deletePreviousSessionRecords(org.dlese.dpc.repository.indexing.CollectionIndexingSession).
 void fireIndexerReadyEvent(String itemIndexerClassName)
          Fire this event to indicate to watchers that the indexer is ready to accept indexing calls.
 void fireUpdateCollectionsEvent(String itemIndexerClassName)
          Fire this event to indicate to watchers that they should update their collections using CollectionIndexer.putCollection() and CollectionIndexer.deleteCollection().
static String getDateStamp()
          Return a string for the current time and date, sutiable for display in log files and output to standout:
 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.
 ArrayList getIndexingMessages()
          Gets the indexing status messages.
 Date getIndexingStartTime()
          Gets the indexingStartTime Date, representing the time of day the indexer will run, or null if no indexing cron is being used.
static String getSimpleDateStamp()
          Return a string for the current time and date, sutiable for display in log files and output to standout:
 void setDebug(boolean db)
          Sets the debug attribute of the IndexingManager object
 void startIndexingTimer(String indexingStartTime, String indexingDaysOfWeek)
          Starts or restarts the indexing timer thread to run every 24 hours, beginning at the specified time/date.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexingManager

public IndexingManager(RepositoryManager repositoryManager)
Constructor for the IndexingManager object -- refactor to be a factory...

Parameters:
repositoryManager - The RepositoryManager
Method Detail

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
Fire this event to indicate to watchers that they should perform indexing for the given collection if they are managing it using CollectionIndexer.putRecord(java.lang.String, java.lang.String, java.lang.String, org.dlese.dpc.repository.indexing.CollectionIndexingSession), CollectionIndexer.deleteRecord(java.lang.String), CollectionIndexer.deletePreviousSessionRecords(org.dlese.dpc.repository.indexing.CollectionIndexingSession).

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
Fire this event to indicate to watchers that they should perform indexing for ALL collections that they know about using CollectionIndexer.putRecord(java.lang.String, java.lang.String, java.lang.String, org.dlese.dpc.repository.indexing.CollectionIndexingSession), CollectionIndexer.deleteRecord(java.lang.String), CollectionIndexer.deletePreviousSessionRecords(org.dlese.dpc.repository.indexing.CollectionIndexingSession).

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

DLESE Tools
v1.6.0