DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.config
Class CollectionRegistry

java.lang.Object
  extended by org.dlese.dpc.schemedit.config.CollectionRegistry

public class CollectionRegistry
extends Object

Holds CollectionConfig instances in a map structure, keyed by collection id (e.g., "dcc"); The registry is initialized during system startup by reading from a configDir where the collection config files are located.

Version:
$Id: CollectionRegistry.java,v 1.31 2010/07/14 00:18:49 jweather Exp $
Author:
ostwald

$Id: CollectionRegistry.java,v 1.31 2010/07/14 00:18:49 jweather Exp $


Constructor Summary
CollectionRegistry()
          no-argument Constructor for the CollectionRegistry object
CollectionRegistry(File configDir, String idFilesPath, String defaultCollConfigPath)
          Register collections from configuration directory
 
Method Summary
 void deleteCollection(CollectionConfig config)
          Unregister a collection and delete it's configuration file.
 void deleteCollection(String collection)
          Unregister a collection and deletes it's configuration file.
 void destroy()
          Description of the Method
 CollectionConfig findCollectionByHandle(String handle)
          find collectionConfig having provided handle as its MetadataProviderHandle.
 CollectionConfig getCollectionConfig(String collection)
          Gets the collectionConfig attribute of the CollectionRegistry object
 CollectionConfig getCollectionConfig(String collection, boolean createIfNotFound)
          Gets a CollectionConfig instance corresponding to the provided collection.
 long getCollectionConfigMod()
          Gets the collectionConfigMod attribute of the CollectionRegistry object
 List getFinalStatusFlags()
          Gets a list of the finalStatusFlags defined by each collection.
 String getFinalStatusLabel(String collection)
          Gets the finalStatusLabel attribute of the CollectionRegistry object
 String getIdFilesPath()
           
 IDGenerator getIDGenerator(String collectionKey)
          Obtain IDGenerator instance for specified collection (which must be registered).
 String getIdPrefix(String collectionKey)
           
 Set getIds()
          Returns the keys for the registered collections.
 CollectionConfig getMasterCollectionConfig()
           
 Map getMasterStatusLabelMap()
          Gets the masterStatusLabelMap attribute of the CollectionRegistry object
 List getMasterStatusList()
          Returns a list of all status flags defined by all registered collections.
 String getNextID(String collectionKey)
          Convenience method to obtain a new record ID from specified collection (which must exist)
 void initializeIDGenerator(CollectionConfig collectionConfig, SimpleLuceneIndex index)
           
 void initializeIDGenerators(SimpleLuceneIndex index)
          Initialize the IDGenerator for each collection in the index so that the next ID to be assigned will increment the last assigned ID for that collection.
 boolean isDuplicateIdPrefix(String idPrefix)
           
 boolean isDuplicateIdPrefix(String collectionKey, String idPrefix)
           
 boolean isNDRCollection(String collection)
           
 boolean isRegistered(String collectionKey)
           
 void register(CollectionConfig config)
          Register a collection by placing it's CollectionConfig instance in the map.
 void setCollectionConfigMod()
          Sets the collectionConfigMod attribute of the CollectionRegistry object
 int size()
          The number of registered collections
 String toString()
          Print the items of the mdvMap for debugging purposes.
 void unregister(CollectionConfig config)
          Remove the CollectionConfig from the registry.
 void unregister(String id)
          NOT YET DOCUMENTED
 void updateMasterStatusList()
          NOT YET DOCUMENTED
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CollectionRegistry

public CollectionRegistry()
no-argument Constructor for the CollectionRegistry object


CollectionRegistry

public CollectionRegistry(File configDir,
                          String idFilesPath,
                          String defaultCollConfigPath)
Register collections from configuration directory

Parameters:
configDir - NOT YET DOCUMENTED
Method Detail

isNDRCollection

public boolean isNDRCollection(String collection)

isRegistered

public boolean isRegistered(String collectionKey)

getMasterCollectionConfig

public CollectionConfig getMasterCollectionConfig()

getIdFilesPath

public String getIdFilesPath()

findCollectionByHandle

public CollectionConfig findCollectionByHandle(String handle)
find collectionConfig having provided handle as its MetadataProviderHandle.

Parameters:
handle - NOT YET DOCUMENTED
Returns:
null if provided handle is empty or if matching config not found.

getCollectionConfig

public CollectionConfig getCollectionConfig(String collection)
Gets the collectionConfig attribute of the CollectionRegistry object

Parameters:
collection - collectionKey (e.g., "dcc")
Returns:
The collectionConfig value

getCollectionConfig

public CollectionConfig getCollectionConfig(String collection,
                                            boolean createIfNotFound)
Gets a CollectionConfig instance corresponding to the provided collection.

Parameters:
collection - Description of the Parameter
createIfNotFound - NOT YET DOCUMENTED
Returns:
The collectionConfig value

isDuplicateIdPrefix

public boolean isDuplicateIdPrefix(String idPrefix)

isDuplicateIdPrefix

public boolean isDuplicateIdPrefix(String collectionKey,
                                   String idPrefix)

getNextID

public String getNextID(String collectionKey)
Convenience method to obtain a new record ID from specified collection (which must exist)


getIdPrefix

public String getIdPrefix(String collectionKey)

getIDGenerator

public IDGenerator getIDGenerator(String collectionKey)
Obtain IDGenerator instance for specified collection (which must be registered).


initializeIDGenerators

public void initializeIDGenerators(SimpleLuceneIndex index)
Initialize the IDGenerator for each collection in the index so that the next ID to be assigned will increment the last assigned ID for that collection.


initializeIDGenerator

public void initializeIDGenerator(CollectionConfig collectionConfig,
                                  SimpleLuceneIndex index)
                           throws Exception
Throws:
Exception

getCollectionConfigMod

public long getCollectionConfigMod()
Gets the collectionConfigMod attribute of the CollectionRegistry object

Returns:
The collectionConfigMod value

setCollectionConfigMod

public void setCollectionConfigMod()
Sets the collectionConfigMod attribute of the CollectionRegistry object


getFinalStatusLabel

public String getFinalStatusLabel(String collection)
Gets the finalStatusLabel attribute of the CollectionRegistry object

Parameters:
collection - NOT YET DOCUMENTED
Returns:
The finalStatusLabel value

getFinalStatusFlags

public List getFinalStatusFlags()
Gets a list of the finalStatusFlags defined by each collection.

Returns:
The finalStatusFlags value

getMasterStatusList

public List getMasterStatusList()
Returns a list of all status flags defined by all registered collections.

Returns:
The masterStatusList value

updateMasterStatusList

public void updateMasterStatusList()
NOT YET DOCUMENTED


getMasterStatusLabelMap

public Map getMasterStatusLabelMap()
Gets the masterStatusLabelMap attribute of the CollectionRegistry object

Returns:
The masterStatusLabelMap value

register

public void register(CollectionConfig config)
              throws Exception
Register a collection by placing it's CollectionConfig instance in the map.

Parameters:
config - Description of the Parameter
Throws:
Exception

unregister

public void unregister(String id)
NOT YET DOCUMENTED

Parameters:
id - NOT YET DOCUMENTED

unregister

public void unregister(CollectionConfig config)
Remove the CollectionConfig from the registry.

Parameters:
config - Description of the Parameter

deleteCollection

public void deleteCollection(String collection)
Unregister a collection and deletes it's configuration file.

Parameters:
collection - Description of the Parameter

deleteCollection

public void deleteCollection(CollectionConfig config)
Unregister a collection and delete it's configuration file.

Parameters:
config - Description of the Parameter

toString

public String toString()
Print the items of the mdvMap for debugging purposes.

Overrides:
toString in class Object
Returns:
Description of the Return Value

getIds

public Set getIds()
Returns the keys for the registered collections.

Returns:
The ids value

size

public int size()
The number of registered collections

Returns:
NOT YET DOCUMENTED

destroy

public void destroy()
Description of the Method


DLESE Tools
v1.6.0