DLESE Tools
v1.6.0

org.dlese.dpc.repository.indexing
Class CollectionIndexer

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

public class CollectionIndexer
extends Object

Manage collections of records in a DDS repository.

Author:
John Weatherley

Constructor Summary
CollectionIndexer(RepositoryManager repositoryManager, IndexingManager indexingManager)
          Constructor for the CollectionIndexer object
 
Method Summary
 void deleteCollection(String collectionKey)
          Delete a collection and all its records from a DDS repository.
 void deletePreviousSessionRecords(CollectionIndexingSession currentSession)
          Delete all records that DO NOT have the given session ID.
 void deleteRecord(String id)
          Deletes a record in the repository.
 List getConfiguredCollections()
          Get a list of the collections currently configured.
static String getDateStamp()
          Return a string for the current time and date, sutiable for display in log files and output to standout:
protected  CollectionIndexingSession getExistingCollectionIndexingSession(String sessionId)
          Gets the existingCollectionIndexingSession attribute of the CollectionIndexer object
 CollectionIndexingSession getNewCollectionIndexingSession(String collectionKey)
          Gets the newCollectionIndexingSession attribute of the CollectionIndexer object
 boolean isCollectionConfigured(String collectionKey)
          Gets the collectionConfigured attribute of the CollectionIndexer object
 void printStatusMessage(String msg)
          Post a status message to the indexing process to let admins know the current indexing status.
 void putCollection(String collectionKey, String format, String name, String description, String additionalMetadata)
          Put a collection in the repository.
 void putRecord(String recordXml, String collectionKey, String id, CollectionIndexingSession session)
          Put a record in a collection, adding or replacing the given record in the repository.
static void setDebug(boolean db)
          Sets the debug attribute of the CollectionIndexer object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionIndexer

public CollectionIndexer(RepositoryManager repositoryManager,
                         IndexingManager indexingManager)
Constructor for the CollectionIndexer object

Parameters:
repositoryManager - The RepositoryManager
indexingManager - The IndexingManager
Method Detail

putCollection

public void putCollection(String collectionKey,
                          String format,
                          String name,
                          String description,
                          String additionalMetadata)
                   throws Exception
Put a collection in the repository. If the collection key does not exist, the collection will be created otherwise it will be updated with this new information.

Parameters:
collectionKey - The collection key, for example 'dcc'
format - The XML format for the records that will reside in the collection
name - A display name for the collection
description - A long description for the collection
additionalMetadata - A text or XML string to be inserted into the additionalMetadata element of the collection record, or null for none
Throws:
Exception - If error

deleteCollection

public void deleteCollection(String collectionKey)
                      throws Exception
Delete a collection and all its records from a DDS repository.

Parameters:
collectionKey - The key indicatint the collection to delete
Throws:
Exception - If error

getConfiguredCollections

public List getConfiguredCollections()
Get a list of the collections currently configured.

Returns:
A List of collection key Strings, for example 'dcc'

isCollectionConfigured

public boolean isCollectionConfigured(String collectionKey)
Gets the collectionConfigured attribute of the CollectionIndexer object

Parameters:
collectionKey - The key for the collection
Returns:
The collectionConfigured value

putRecord

public void putRecord(String recordXml,
                      String collectionKey,
                      String id,
                      CollectionIndexingSession session)
               throws Exception
Put a record in a collection, adding or replacing the given record in the repository.

Parameters:
recordXml - The XML for this record
collectionKey - The collection this record should be put
id - The ID of the record - ignored if the ID can be derived from the record XML
session - An indexing session ID - used for deleting records later after a new indexing session occurs
Throws:
Exception - If error

deleteRecord

public void deleteRecord(String id)
                  throws Exception
Deletes a record in the repository.

Parameters:
id - Id of the record.
Throws:
Exception - If error

getNewCollectionIndexingSession

public CollectionIndexingSession getNewCollectionIndexingSession(String collectionKey)
Gets the newCollectionIndexingSession attribute of the CollectionIndexer object

Parameters:
collectionKey - The collection
Returns:
A new indexing session ID

printStatusMessage

public void printStatusMessage(String msg)
Post a status message to the indexing process to let admins know the current indexing status.

Parameters:
msg - The message to post

getExistingCollectionIndexingSession

protected CollectionIndexingSession getExistingCollectionIndexingSession(String sessionId)
Gets the existingCollectionIndexingSession attribute of the CollectionIndexer object

Parameters:
sessionId - The session ID
Returns:
The existingCollectionIndexingSession value

deletePreviousSessionRecords

public void deletePreviousSessionRecords(CollectionIndexingSession currentSession)
Delete all records that DO NOT have the given session ID.

Parameters:
currentSession - The session ID

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

setDebug

public static final void setDebug(boolean db)
Sets the debug attribute of the CollectionIndexer object

Parameters:
db - The new debug value

DLESE Tools
v1.6.0