org.fcrepo.server.storage.lowlevel.akubra
Class AkubraLowlevelStorageModule

java.lang.Object
  extended by org.fcrepo.server.Parameterized
      extended by org.fcrepo.server.Pluggable
          extended by org.fcrepo.server.Module
              extended by org.fcrepo.server.storage.lowlevel.akubra.AkubraLowlevelStorageModule
All Implemented Interfaces:
Constants, IListable, ILowlevelStorage, ISizable

public class AkubraLowlevelStorageModule
extends Module
implements ILowlevelStorage, IListable, ISizable

Wraps a Spring-configured AkubraLowlevelStore instance as a Module.

To use this module, edit $FEDORA_HOME/config/akubra-llstore.xml as appropriate and replace the existing LowlevelStorage module in fedora.fcfg with the following:

 <module role="org.fcrepo.server.storage.lowlevel.ILowlevelStorage"
   class="org.fcrepo.server.storage.lowlevel.akubra.AkubraLowlevelStorageModule"/>
 

Author:
Chris Wilper

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.fcrepo.common.Constants
Constants.FedoraHome
 
Field Summary
 
Fields inherited from interface org.fcrepo.common.Constants
ACCESS, ACTION, API, ATOM_APIM1_0, ATOM_ZIP1_1, ATOM1_1, AUDIT, AUDIT1_0, BATCH_MODIFY, BATCH_MODIFY1_1, BE_SECURITY, BE_SECURITY1_0, BINDING_SPEC, DATASTREAM, DC, DISSEMINATOR, DS_COMPOSITE_MODEL, DS_COMPOSITE_MODEL1_0, DS_INPUT_SPEC1_0, DS_INPUT_SPEC1_1, ENVIRONMENT, FCFG, FEDORA, FEDORA_APP_CONTEXT_NAME, FEDORA_DEFAULT_APP_CONTEXT, FEDORA_HOME, FEDORA_REPOSITORY_PID, FOXML, FOXML1_0, FOXML1_0_LEGACY, FOXML1_1, HTTP_REQUEST, MANAGEMENT, METHOD_MAP, METS, METS_EXT, METS_EXT1_0, METS_EXT1_0_LEGACY, METS_EXT1_1, MODEL, MULGARA, OAI_DC, OAI_DC2_0, OAI_FRIENDS, OAI_FRIENDS2_0, OAI_IDENTIFIER, OAI_IDENTIFIER2_0, OAI_PMH, OAI_PMH2_0, OAI_PROV, OAI_PROV2_0, OBJ_DATASTREAMS1_0, OBJ_HISTORY1_0, OBJ_ITEMS1_0, OBJ_METHODS1_0, OBJ_PROFILE1_0, OBJ_VALIDATION1_0, OBJECT, OLD_XLINK, PID_LIST1_0, RDF, RDF_XSD, RECOVERY, RELS_EXT, RELS_EXT1_0, RELS_INT1_0, REPO_DESC1_0, RESOURCE, SDEF, SDEF_METHOD_MAP1_0, SDEP, SDEP_METHOD_MAP1_0, SDEP_METHOD_MAP1_1, SERVICE_PROFILE, SOAP, SOAP_ENC, SUBJECT, TYPES, VIEW, WSDL, WSDL_HTTP, WSDL_MIME, XACML_POLICY, XACML_POLICY1_0, XACML1, XACML1_ACTION, XACML1_POLICY, XACML1_RESOURCE, XACML1_SUBJECT, XACML2_POLICY_SCHEMA, XLINK, XML_XSD, XMLNS, XSI
 
Constructor Summary
AkubraLowlevelStorageModule(Map<String,String> moduleParameters, Server server, String role)
           
 
Method Summary
 long addDatastream(String pid, InputStream content, Map<String,String> hints)
          Sets the content of a new datastream version.
 void addObject(String pid, InputStream content, Map<String,String> hints)
          Adds a new object.
 void auditDatastream()
          Performs a consistency check against the datastream index if such an index exists.
 void auditObject()
          Performs a consistency check against the object index if such an index exists.
 long getDatastreamSize(String dsKey)
          Return the size of a datastream in bytes
 Iterator<String> listDatastreams()
          Lists all stored datastreams in no particular order.
 Iterator<String> listObjects()
          Lists all stored objects in no particular order.
 void postInitModule()
          Second stage of Module initialization.
 void rebuildDatastream()
          Reconstructs the datastream index if such an index exists.
 void rebuildObject()
          Reconstructs the object index if such an index exists.
 void removeDatastream(String pid)
          Removes the content of an existing datastream version.
 void removeObject(String pid)
          Removes an object.
 long replaceDatastream(String pid, InputStream content, Map<String,String> hints)
          Sets the content of an existing datastream version.
 void replaceObject(String pid, InputStream content, Map<String,String> hints)
          Replaces an existing object.
 InputStream retrieveDatastream(String pid)
          Gets the content of an existing datastream version.
 InputStream retrieveObject(String pid)
          Gets an existing object.
 void setImpl(ILowlevelStorage store)
           
 void setLLStoreImpl(ILowlevelStorage impl)
           
 
Methods inherited from class org.fcrepo.server.Module
getRole, getServer, initModule, shutdownModule
 
Methods inherited from class org.fcrepo.server.Pluggable
getHelp, getOptionalParameters, getParameterHelp, getRequiredModuleRoles, getRequiredParameters
 
Methods inherited from class org.fcrepo.server.Parameterized
getParameter, getParameter, getParameter, getParameterList, getParameters, getParameters, parameterNames, setParameter, setParameters, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AkubraLowlevelStorageModule

public AkubraLowlevelStorageModule(Map<String,String> moduleParameters,
                                   Server server,
                                   String role)
                            throws ModuleInitializationException
Throws:
ModuleInitializationException
Method Detail

setImpl

public void setImpl(ILowlevelStorage store)

setLLStoreImpl

public void setLLStoreImpl(ILowlevelStorage impl)

postInitModule

public void postInitModule()
                    throws ModuleInitializationException
Description copied from class: Module
Second stage of Module initialization. This is guaranteed to run after all Modules' initModule() methods have run.

Overrides:
postInitModule in class Module
Throws:
ModuleInitializationException - If initialization values are invalid or initialization fails for some other reason.

addObject

public void addObject(String pid,
                      InputStream content,
                      Map<String,String> hints)
               throws LowlevelStorageException
Description copied from interface: ILowlevelStorage
Adds a new object.

Specified by:
addObject in interface ILowlevelStorage
Parameters:
pid - the pid of the object.
content - the serialized object.
hints - a map of hints for object storage
Throws:
LowlevelStorageException - if the object already exists or cannot be added for any other reason.

replaceObject

public void replaceObject(String pid,
                          InputStream content,
                          Map<String,String> hints)
                   throws LowlevelStorageException
Description copied from interface: ILowlevelStorage
Replaces an existing object.

Specified by:
replaceObject in interface ILowlevelStorage
Parameters:
pid - the pid of the object.
content - the serialized object.
Throws:
LowlevelStorageException - if the object does not already exist or cannot be replaced for any other reason.

retrieveObject

public InputStream retrieveObject(String pid)
                           throws LowlevelStorageException
Description copied from interface: ILowlevelStorage
Gets an existing object.

Specified by:
retrieveObject in interface ILowlevelStorage
Parameters:
pid - the pid of the object.
Returns:
the serialized form of the object, as stored.
Throws:
LowlevelStorageException - if the object does not exist or cannot be read for any other reason.

removeObject

public void removeObject(String pid)
                  throws LowlevelStorageException
Description copied from interface: ILowlevelStorage
Removes an object.

Specified by:
removeObject in interface ILowlevelStorage
Parameters:
pid - the pid of the object.
Throws:
LowlevelStorageException - if the object does not exist or cannot be removed for any other reason.

rebuildObject

public void rebuildObject()
                   throws LowlevelStorageException
Description copied from interface: ILowlevelStorage
Reconstructs the object index if such an index exists. The object index associates an object with a stored location. If the implementation does not use an index, this is a no-op.

Warning

Rebuilding the object index is not expected to be an atomic operation and should only be run while the system is offline or reads and writes are otherwise prevented.

Specified by:
rebuildObject in interface ILowlevelStorage
Throws:
LowlevelStorageException - if an error occurs that prevents the index from being rebuilt.

auditObject

public void auditObject()
                 throws LowlevelStorageException
Description copied from interface: ILowlevelStorage
Performs a consistency check against the object index if such an index exists. The object index associates an object with a stored location. If the implementation does not use an index, this is a no-op. If any inconsistencies are found, they will be reported to the system logger.

Specified by:
auditObject in interface ILowlevelStorage
Throws:
LowlevelStorageException - if an error occurs that prevents the consistency check from taking place.

addDatastream

public long addDatastream(String pid,
                          InputStream content,
                          Map<String,String> hints)
                   throws LowlevelStorageException
Description copied from interface: ILowlevelStorage
Sets the content of a new datastream version.

Specified by:
addDatastream in interface ILowlevelStorage
Parameters:
pid - the $pid "+" $dsId "+" $dsVersionId string that uniquely identifies the datastream version.
content - the content.
Throws:
LowlevelStorageException - if the datastream version already exists or cannot be added for any other reason.

replaceDatastream

public long replaceDatastream(String pid,
                              InputStream content,
                              Map<String,String> hints)
                       throws LowlevelStorageException
Description copied from interface: ILowlevelStorage
Sets the content of an existing datastream version.

Specified by:
replaceDatastream in interface ILowlevelStorage
Parameters:
pid - the $pid "+" $dsId "+" $dsVersionId string that uniquely identifies the datastream version.
content - the content.
Throws:
LowlevelStorageException - if the datastream version does not already exist or cannot be replaced for any other reason.

retrieveDatastream

public InputStream retrieveDatastream(String pid)
                               throws LowlevelStorageException
Description copied from interface: ILowlevelStorage
Gets the content of an existing datastream version.

Specified by:
retrieveDatastream in interface ILowlevelStorage
Parameters:
pid - the $pid "+" $dsId "+" $dsVersionId string that uniquely identifies the datastream version.
Returns:
the content.
Throws:
LowlevelStorageException - if the datastream version does not exist or cannot be read for any other reason.

removeDatastream

public void removeDatastream(String pid)
                      throws LowlevelStorageException
Description copied from interface: ILowlevelStorage
Removes the content of an existing datastream version.

Specified by:
removeDatastream in interface ILowlevelStorage
Parameters:
pid - the $pid "+" $dsId "+" $dsVersionId string that uniquely identifies the datastream version.
Throws:
LowlevelStorageException - if the datastream version does not exist or cannot be removed for any other reason.

rebuildDatastream

public void rebuildDatastream()
                       throws LowlevelStorageException
Description copied from interface: ILowlevelStorage
Reconstructs the datastream index if such an index exists. The datastream index associates a datastream version with a stored location. If the implementation does not use an index, this is a no-op.

Warning

Rebuilding the datastream index is not expected to be an atomic operation and should only be run while the system is offline or reads and writes are otherwise prevented.

Specified by:
rebuildDatastream in interface ILowlevelStorage
Throws:
LowlevelStorageException - if an error occurs that prevents the

auditDatastream

public void auditDatastream()
                     throws LowlevelStorageException
Description copied from interface: ILowlevelStorage
Performs a consistency check against the datastream index if such an index exists. The datastream index associates a datastream version with a stored location. If the implementation does not use an index, this is a no-op. If any inconsistencies are found, they will be reported to the system logger.

Specified by:
auditDatastream in interface ILowlevelStorage
Throws:
LowlevelStorageException - if an error occurs that prevents the consistency check from taking place.

listObjects

public Iterator<String> listObjects()
Description copied from interface: IListable
Lists all stored objects in no particular order.

Specified by:
listObjects in interface IListable
Returns:
an iterator of all stored object pids.

listDatastreams

public Iterator<String> listDatastreams()
Description copied from interface: IListable
Lists all stored datastreams in no particular order.

Specified by:
listDatastreams in interface IListable
Returns:
an iterator of all stored datastream keys, each in the following format: $pid "+" $dsId "+" $dsVersionId

getDatastreamSize

public long getDatastreamSize(String dsKey)
                       throws LowlevelStorageException
Description copied from interface: ISizable
Return the size of a datastream in bytes

Specified by:
getDatastreamSize in interface ISizable
Returns:
Throws:
LowlevelStorageException


Copyright © 2012 DuraSpace. All Rights Reserved.