org.mycore.datamodel.ifs
Class MCRContentStoreFactory

java.lang.Object
  extended by org.mycore.datamodel.ifs.MCRContentStoreFactory

public class MCRContentStoreFactory
extends Object

This class manages instances of MCRContentStore and MCRAudioVideoExtender and provides methods to get these for a given Store ID or MCRFile instance. The class is responsible for looking up, loading, instantiating and remembering the implementations of MCRContentStore and MCRAudioVideoExtender that are used in the system.

Version:
$Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
Author:
Frank Lützenkirchen, Thomas Scheffler (yagee)

Field Summary
protected static Hashtable EXTENDER_CLASSES
          Hashtable StoreID to Class that implements MCRAudioVideoExtender
protected static Hashtable INDEX_STORES
          Hashtable StoreID to MCRContentStore implementing org.mycore.services.query.MCRTextSearchInterface
protected static MCRContentStoreSelector STORE_SELECTOR
          The MCRContentStoreSelector implementation that will be used
protected static Hashtable STORES
          Hashtable StoreID to MCRContentStore instance
 
Constructor Summary
MCRContentStoreFactory()
           
 
Method Summary
(package private) static MCRAudioVideoExtender buildExtender(MCRFileReader file)
          If the MCRContentStore of the MCRFile given provides an MCRAudioVideoExtender implementation, this method creates and initializes the MCRAudioVideoExtender instance for the MCRFile.
protected static Class getExtenderClass(String storeID)
          Returns the Class instance that implements the MCRAudioVideoExtender for the MCRContentStore with the given ID.
static MCRContentStore getStore(String storeID)
          Returns the MCRContentStore instance that is configured for this StoreID.
(package private) static boolean providesAudioVideoExtender(String storeID)
          Returns true if the MCRContentStore with the given StoreID provides an MCRAudioVideoExtender implementation, false otherwise.
static MCRContentStore selectStore(MCRFile file)
          Returns the MCRContentStore instance that should be used to store the content of the given file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STORES

protected static Hashtable STORES
Hashtable StoreID to MCRContentStore instance


EXTENDER_CLASSES

protected static Hashtable EXTENDER_CLASSES
Hashtable StoreID to Class that implements MCRAudioVideoExtender


INDEX_STORES

protected static Hashtable INDEX_STORES
Hashtable StoreID to MCRContentStore implementing org.mycore.services.query.MCRTextSearchInterface


STORE_SELECTOR

protected static MCRContentStoreSelector STORE_SELECTOR
The MCRContentStoreSelector implementation that will be used

Constructor Detail

MCRContentStoreFactory

public MCRContentStoreFactory()
Method Detail

getStore

public static MCRContentStore getStore(String storeID)
Returns the MCRContentStore instance that is configured for this StoreID. The instance that is returned is configured by the property MCR.IFS.ContentStore..Class in mycore.properties.

Parameters:
storeID - the non-null ID of the MCRContentStore implementation
Returns:
the MCRContentStore instance that uses this storeID
Throws:
MCRConfigurationException - if no MCRContentStore implementation is configured for this storeID

selectStore

public static MCRContentStore selectStore(MCRFile file)
Returns the MCRContentStore instance that should be used to store the content of the given file. The configured MCRContentStoreSelector is used to make this decision.

See Also:
MCRContentStoreSelector, MCRContentStore

getExtenderClass

protected static Class getExtenderClass(String storeID)
Returns the Class instance that implements the MCRAudioVideoExtender for the MCRContentStore with the given ID. That class is configured by the property MCR.IFS.AVExtender..Class in mycore.properties.

Parameters:
storeID - the non-null StoreID of the MCRContentStore
Returns:
the Class that implements MCRAudioVideoExtender for the StoreID given, or null
Throws:
MCRConfigurationException - if the MCRAudioVideoExtender implementation class could not be loaded

providesAudioVideoExtender

static boolean providesAudioVideoExtender(String storeID)
Returns true if the MCRContentStore with the given StoreID provides an MCRAudioVideoExtender implementation, false otherwise. The MCRAudioVideoExtender for a certain MCRContentStore is configured by the property MCR.IFS.AVExtender..Class in mycore.properties.

Parameters:
storeID - the non-null StoreID of the MCRContentStore
Returns:
the MCRAudioVideoExtender for the StoreID given, or null
Throws:
MCRConfigurationException - if the MCRAudioVideoExtender implementation class could not be loaded

buildExtender

static MCRAudioVideoExtender buildExtender(MCRFileReader file)
If the MCRContentStore of the MCRFile given provides an MCRAudioVideoExtender implementation, this method creates and initializes the MCRAudioVideoExtender instance for the MCRFile. The instance that is returned is configured by the property MCR.IFS.AVExtender..Class in mycore.properties.

Parameters:
file - the non-null MCRFile that should get an MCRAudioVideoExtender
Returns:
the MCRAudioVideoExtender for the MCRFile given, or null
Throws:
MCRConfigurationException - if the MCRAudioVideoExtender implementation class could not be loaded