org.fcrepo.server.storage
Class DirectoryBasedRepositoryReader

java.lang.Object
  extended by org.fcrepo.server.storage.DirectoryBasedRepositoryReader
All Implemented Interfaces:
RepositoryReader

public class DirectoryBasedRepositoryReader
extends Object
implements RepositoryReader

A RepositoryReader that uses a directory of serialized objects as its working repository.

All files in the directory must be digital object serializations, and none may have the same PID. This is verified upon construction.

Note: This implementation does not recognize when files are added to the directory. What is in the directory at construction-time is what is assumed to be the extent of the repository for the life of the object.

Author:
Chris Wilper

Constructor Summary
DirectoryBasedRepositoryReader(File directory, DOTranslator translator, String exportFormat, String storageFormat, String encoding)
          Initializes the RepositoryReader by looking at all files in the provided directory and ensuring that they're all serialized digital objects and that there are no PID conflicts.
 
Method Summary
 DOReader getReader(boolean UseCachedObject, Context context, String pid)
          Gets a digital object reader.
 ServiceDefinitionReader getServiceDefinitionReader(boolean UseCachedObject, Context context, String pid)
           
 ServiceDeploymentReader getServiceDeploymentReader(boolean UseCachedObject, Context context, String pid)
           
 String[] listObjectPIDs(Context context)
          Gets a list of PIDs (accessible in the given context) of all objects in the repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectoryBasedRepositoryReader

public DirectoryBasedRepositoryReader(File directory,
                                      DOTranslator translator,
                                      String exportFormat,
                                      String storageFormat,
                                      String encoding)
                               throws StorageDeviceException,
                                      ObjectIntegrityException,
                                      StreamIOException,
                                      UnsupportedTranslationException,
                                      ServerException
Initializes the RepositoryReader by looking at all files in the provided directory and ensuring that they're all serialized digital objects and that there are no PID conflicts.

Parameters:
directory - the directory where this repository is based.
translator - the serialization/deserialization engine for objects.
exportFormat - the format to use for export requests.
storageFormat - the format of the objects on disk.
encoding - The character encoding used across all formats.
Throws:
StorageDeviceException
ObjectIntegrityException
StreamIOException
UnsupportedTranslationException
ServerException
Method Detail

getReader

public DOReader getReader(boolean UseCachedObject,
                          Context context,
                          String pid)
                   throws ObjectIntegrityException,
                          ObjectNotFoundException,
                          StreamIOException,
                          UnsupportedTranslationException,
                          ServerException
Description copied from interface: RepositoryReader
Gets a digital object reader.

Specified by:
getReader in interface RepositoryReader
context - The context of this request.
pid - The PID of the object.
Returns:
A reader.
Throws:
ServerException - If anything went wrong.
ObjectIntegrityException
ObjectNotFoundException
StreamIOException
UnsupportedTranslationException

getServiceDeploymentReader

public ServiceDeploymentReader getServiceDeploymentReader(boolean UseCachedObject,
                                                          Context context,
                                                          String pid)
                                                   throws ObjectIntegrityException,
                                                          ObjectNotFoundException,
                                                          StreamIOException,
                                                          UnsupportedTranslationException,
                                                          ServerException
Specified by:
getServiceDeploymentReader in interface RepositoryReader
Throws:
ObjectIntegrityException
ObjectNotFoundException
StreamIOException
UnsupportedTranslationException
ServerException

getServiceDefinitionReader

public ServiceDefinitionReader getServiceDefinitionReader(boolean UseCachedObject,
                                                          Context context,
                                                          String pid)
                                                   throws ObjectIntegrityException,
                                                          ObjectNotFoundException,
                                                          StreamIOException,
                                                          UnsupportedTranslationException,
                                                          ServerException
Specified by:
getServiceDefinitionReader in interface RepositoryReader
Throws:
ObjectIntegrityException
ObjectNotFoundException
StreamIOException
UnsupportedTranslationException
ServerException

listObjectPIDs

public String[] listObjectPIDs(Context context)
Description copied from interface: RepositoryReader
Gets a list of PIDs (accessible in the given context) of all objects in the repository.

Specified by:
listObjectPIDs in interface RepositoryReader


Copyright © 2012 DuraSpace. All Rights Reserved.