Class CollectionIndexer
java.lang.Object
org.dlese.dpc.repository.indexing.CollectionIndexer
Manage collections of records in a DDS repository.
- Author:
- John Weatherley
-
Constructor Summary
ConstructorsConstructorDescriptionCollectionIndexer(RepositoryManager repositoryManager, IndexingManager indexingManager) Constructor for the CollectionIndexer object -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteCollection(String collectionKey) Delete a collection and all its records from a DDS repository.voiddeletePreviousSessionRecords(CollectionIndexingSession currentSession) Delete all records that DO NOT have the given session ID.voiddeleteRecord(String id) Deletes a record in the repository.Get a list of the collections currently configured.static StringReturn a string for the current time and date, sutiable for display in log files and output to standout:protected CollectionIndexingSessiongetExistingCollectionIndexingSession(String sessionId) Gets the existingCollectionIndexingSession attribute of the CollectionIndexer objectgetNewCollectionIndexingSession(String collectionKey) Gets the newCollectionIndexingSession attribute of the CollectionIndexer objectbooleanisCollectionConfigured(String collectionKey) Gets the collectionConfigured attribute of the CollectionIndexer objectvoidprintStatusMessage(String msg) Post a status message to the indexing process to let admins know the current indexing status.voidputCollection(String collectionKey, String format, String name, String description, String additionalMetadata) Put a collection in the repository.voidputRecord(String recordXml, String collectionKey, String id, CollectionIndexingSession session) Put a record in a collection, adding or replacing the given record in the repository.static final voidsetDebug(boolean db) Sets the debug attribute of the CollectionIndexer object
-
Constructor Details
-
CollectionIndexer
Constructor for the CollectionIndexer object- Parameters:
repositoryManager- The RepositoryManagerindexingManager- The IndexingManager
-
-
Method Details
-
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 collectionname- A display name for the collectiondescription- A long description for the collectionadditionalMetadata- 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
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
Get a list of the collections currently configured.- Returns:
- A List of collection key Strings, for example 'dcc'
-
isCollectionConfigured
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 recordcollectionKey- The collection this record should be putid- The ID of the record - ignored if the ID can be derived from the record XMLsession- An indexing session ID - used for deleting records later after a new indexing session occurs- Throws:
Exception- If error
-
deleteRecord
Deletes a record in the repository.- Parameters:
id- Id of the record.- Throws:
Exception- If error
-
getNewCollectionIndexingSession
Gets the newCollectionIndexingSession attribute of the CollectionIndexer object- Parameters:
collectionKey- The collection- Returns:
- A new indexing session ID
-
printStatusMessage
Post a status message to the indexing process to let admins know the current indexing status.- Parameters:
msg- The message to post
-
getExistingCollectionIndexingSession
Gets the existingCollectionIndexingSession attribute of the CollectionIndexer object- Parameters:
sessionId- The session ID- Returns:
- The existingCollectionIndexingSession value
-
deletePreviousSessionRecords
Delete all records that DO NOT have the given session ID.- Parameters:
currentSession- The session ID
-
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
-