fedora.server.storage
Class DirectoryBasedRepositoryReader

java.lang.Object
  extended byfedora.server.StdoutLogging
      extended byfedora.server.storage.DirectoryBasedRepositoryReader
All Implemented Interfaces:
Logging, RepositoryReader

public class DirectoryBasedRepositoryReader
extends StdoutLogging
implements RepositoryReader

Title: DirectoryBasedRepositoryReader.java

Description: 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.

-----------------------------------------------------------------------------

License and Copyright: The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/.

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The entire file consists of original code. Copyright © 2002-2005 by The Rector and Visitors of the University of Virginia and Cornell University. All rights reserved.

-----------------------------------------------------------------------------

Version:
$Id: DirectoryBasedRepositoryReader.java,v 1.16 2005/01/11 20:06:07 cwilper Exp $
Author:
cwilper@cs.cornell.edu

Field Summary
 
Fields inherited from class fedora.server.StdoutLogging
CONFIG, FINE, FINER, FINEST, INFO, SEVERE, WARNING
 
Constructor Summary
DirectoryBasedRepositoryReader(java.io.File directory, fedora.server.storage.translation.DOTranslator translator, java.lang.String exportFormat, java.lang.String storageFormat, java.lang.String encoding, Logging logTarget)
          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
 BDefReader getBDefReader(Context context, java.lang.String pid)
           
 BMechReader getBMechReader(Context context, java.lang.String pid)
           
 DOReader getReader(Context context, java.lang.String pid)
          Gets a digital object reader.
 java.lang.String[] listObjectPIDs(Context context)
          Gets a list of PIDs (accessible in the given context) of all objects in the repository.
 
Methods inherited from class fedora.server.StdoutLogging
logConfig, logFine, logFiner, logFinest, loggingConfig, loggingFine, loggingFiner, loggingFinest, loggingInfo, loggingSevere, loggingWarning, logInfo, logSevere, logWarning, setLogLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectoryBasedRepositoryReader

public DirectoryBasedRepositoryReader(java.io.File directory,
                                      fedora.server.storage.translation.DOTranslator translator,
                                      java.lang.String exportFormat,
                                      java.lang.String storageFormat,
                                      java.lang.String encoding,
                                      Logging logTarget)
                               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 exportObject requests.
storageFormat - the format of the objects on disk.
encoding - The character encoding used across all formats.
Method Detail

getReader

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

Specified by:
getReader in interface RepositoryReader
Parameters:
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

getBMechReader

public BMechReader getBMechReader(Context context,
                                  java.lang.String pid)
                           throws ObjectIntegrityException,
                                  ObjectNotFoundException,
                                  StreamIOException,
                                  UnsupportedTranslationException,
                                  ServerException
Specified by:
getBMechReader in interface RepositoryReader
Throws:
ObjectIntegrityException
ObjectNotFoundException
StreamIOException
UnsupportedTranslationException
ServerException

getBDefReader

public BDefReader getBDefReader(Context context,
                                java.lang.String pid)
                         throws ObjectIntegrityException,
                                ObjectNotFoundException,
                                StreamIOException,
                                UnsupportedTranslationException,
                                ServerException
Specified by:
getBDefReader in interface RepositoryReader
Throws:
ObjectIntegrityException
ObjectNotFoundException
StreamIOException
UnsupportedTranslationException
ServerException

listObjectPIDs

public java.lang.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