fedora.server.storage
Class FastBmechReader

java.lang.Object
  extended by fedora.server.storage.FastDOReader
      extended by fedora.server.storage.FastBmechReader
All Implemented Interfaces:
BMechReader, DOReader

public class FastBmechReader
extends FastDOReader
implements BMechReader

Title: FastBmechReader.java

Description: BMECH Object Reader that accesses objects located in the "Fast" storage area. It mirros the functionality of SimpleBMechReader for the "Definitive" storage aread. To enhance performance of disseminations, there are two distinct storage areas for digital objects:

  1. "Fast" storage area - The storage area containing a subset of digital objects that is optimized for performance. Both the composition of the subset of objects and storage area are implementation specific. For Phase 1, this object subset consists of a partial replication of the most current version of each object and is used as the primary source for resolving dissemination requests. The replication is partial since only information required to disseminate the object is replicated in the Fast storage area. For Phase 1, the Fast storage area is implemented as a relational database that is accessed via JDBC. Note that an appropriate definitve reader should always be used to obtain the most complete information about a specific object. A fast reader is used primarily for dissemination requests..
  2. Definitive storage area - The storage area containing complete information on all digital objects in the repository. This storage area is used as the authoritative source for reading complete information about a digital object. This storage area is used as a secondary source for resolving dissemination requests when the specified object does not exist in the Fast storage area.

This reader is designed to read bmech objects from the "Fast" storage area that is implemented as a relational database. If the object cannot be found in the relational database, this reader will attempt to read the object from the Definitive storage area using the appropriate definitive reader. When the object exists in both storage areas, preference is given to the Fast storage area since this reader is designed to read primarily from the Fast Storage area. A SimpleBMechReader should always be used to read the authoritative version of a bmech object.

Note that versioning is not implemented in Phase 1. Methods in FastBmechReader that contain arguments related to versioning date such as versDateTime or asOfDate will be ignored in Phase 1.

Version:
$Id: FastBmechReader.java 5218 2006-11-20 05:10:11Z cwilper $
Author:
rlw@virginia.edu

Field Summary
 
Fields inherited from class fedora.server.storage.FastDOReader
connectionPool, definitiveDOReader, doLabel, fedoraServerHost, fedoraServerPort, isFoundInDefinitiveStore, isFoundInFastStore, m_context, m_manager, PID, s_server
 
Constructor Summary
FastBmechReader(Context context, java.lang.String objectPID)
          Constructs an instance of FastBmechReader.
 
Method Summary
 BMechDSBindSpec getServiceDSInputSpec(java.util.Date versDateTime)
           
 MethodDefOperationBind[] getServiceMethodBindings(java.util.Date versDateTime)
           
 MethodParmDef[] getServiceMethodParms(java.lang.String methodName, java.util.Date versDateTime)
          Gets default mechanism method parameters associated with the specified method name.
 MethodDef[] getServiceMethods(java.util.Date versDateTime)
          Gets all method defintiions associated with the specified Behavior Mechanism.
 java.io.InputStream getServiceMethodsXML(java.util.Date versDateTime)
          Gets XML containing method definitions.
 java.lang.String locateBmechPID(java.lang.String bMechPID)
          Locates the specified bmech object using its persistent identifier.
 
Methods inherited from class fedora.server.storage.FastDOReader
ExportObject, getAuditRecords, GetBehaviorDefs, getContentModelId, getCreateDate, GetDatastream, getDatastream, GetDatastreams, getDatastreamVersions, getDisseminationBindingInfo, GetDisseminator, GetDisseminators, getDisseminatorVersions, GetDSBindingMaps, getFedoraObjectType, getLastModDate, getObjectHistory, GetObjectLabel, getObjectMethodParms, GetObjectPID, GetObjectState, GetObjectXML, getOwnerId, ListDatastreamIDs, ListDisseminatorIDs, listMethods, listMethods, locatePID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fedora.server.storage.DOReader
ExportObject, getAuditRecords, GetBehaviorDefs, getContentModelId, getCreateDate, GetDatastream, getDatastream, GetDatastreams, getDatastreamVersions, getDisseminationBindingInfo, GetDisseminator, GetDisseminators, getDisseminatorVersions, GetDSBindingMaps, getFedoraObjectType, getLastModDate, getObjectHistory, GetObjectLabel, getObjectMethodParms, GetObjectPID, GetObjectState, GetObjectXML, getOwnerId, ListDatastreamIDs, ListDisseminatorIDs, listMethods, listMethods
 

Constructor Detail

FastBmechReader

public FastBmechReader(Context context,
                       java.lang.String objectPID)
                throws ServerException

Constructs an instance of FastBmechReader.

Constructs a new FastBmechReader for the specified bmech object. If the object is found, this constructor initializes the class variables for bMechPID and bMechLabel.

Parameters:
context - The context of this request.
objectPID - The persistent identifier of the bmech object.
Throws:
ServerException - If any type of error occurred fulfilling the request.
Method Detail

getServiceMethodParms

public MethodParmDef[] getServiceMethodParms(java.lang.String methodName,
                                             java.util.Date versDateTime)
                                      throws GeneralException

Gets default mechanism method parameters associated with the specified method name. Default method parameters are defined by the Behavior Mechanism object as mechanism default parameters and cannot be altered by the user.

Specified by:
getServiceMethodParms in interface BMechReader
Parameters:
methodName - The name of the method.
versDateTime - The versioning datetime stamp.
Returns:
An array of method parameter definitions.
Throws:
GeneralException - If there was any misc exception that we want to catch and re-throw as a Fedora exception. Extends ServerException.

getServiceMethods

public MethodDef[] getServiceMethods(java.util.Date versDateTime)
                              throws ServerException

Gets all method defintiions associated with the specified Behavior Mechanism. Note the PID of the associated Behavior Mechanism object is determined via reflection based on the specified PID of the digital object and the PID of its Behavior Definition object. This method retrieves the list of available methods based on the assocaited Behavior Mechanism object and NOT the Behavior Definition object. This is done to insure that only methods that have been implemented in the mechanism are returned. This distinction is only important when versioning is enabled in a later release. When versioning is enabled, it is possible that a versioned Behavior Definition may have methods that have not yet been implemented by all of its associated Behavior Mechanisms. In such a case, only those methods implemented in the mechanism will be returned.

Specified by:
getServiceMethods in interface BMechReader
Parameters:
versDateTime - The versioning datetime stamp.
Returns:
An array of method definitions.
Throws:
ServerException - If there was any misc exception that we want to catch and re-throw as a Fedora exception. Extends ServerException.

getServiceMethodBindings

public MethodDefOperationBind[] getServiceMethodBindings(java.util.Date versDateTime)
                                                  throws ServerException
Specified by:
getServiceMethodBindings in interface BMechReader
Throws:
ServerException

getServiceMethodsXML

public java.io.InputStream getServiceMethodsXML(java.util.Date versDateTime)
                                         throws ServerException

Gets XML containing method definitions. Since the XML representation of digital objects is not stored in the Fast storage area, this method uses a BMechReader to query the Definitive storage area.

Specified by:
getServiceMethodsXML in interface BMechReader
Parameters:
versDateTime - The versioning datetime stamp.
Returns:
A stream of bytes containing XML-encoded representation of method definitions from XML in the Behavior Mechanism object.
Throws:
ServerException - If any type of error occurred fulfilling the request.

getServiceDSInputSpec

public BMechDSBindSpec getServiceDSInputSpec(java.util.Date versDateTime)
                                      throws ServerException
Specified by:
getServiceDSInputSpec in interface BMechReader
Throws:
ServerException

locateBmechPID

public java.lang.String locateBmechPID(java.lang.String bMechPID)
                                throws GeneralException,
                                       ServerException

Locates the specified bmech object using its persistent identifier. This method will first attempt to locate the object in the Fast storage area. If the the object cannot be located there, it will then try to find it in the Definitive storage area. If the object is found, the object's label is returned. Otherwise, it throws GeneralException.

Parameters:
bMechPID - persistent identifier of the digital object.
Returns:
String containing label of the specified digital object.
Throws:
GeneralException - If there was any misc exception that we want to catch and re-throw as a Fedora exception. Extends ServerException.
ServerException - If any type of error occurred fulfilling the request.