dk.statsbiblioteket.doms.summa
Class SummaStorage

java.lang.Object
  extended by Control
      extended by dk.statsbiblioteket.doms.summa.SummaStorage

public class SummaStorage
extends Control

Implementation of the Summa IO Storage API on top of Fedoras OAIProvider plugin. This implementation provides read-only access to the Fedora DOMS Repository. Methods from the Control interface that modify the Storage will in this implementation throw an UnsupprtedOperationException.

Version:
summaStorage-0.2 - build date 01/29/2007 11:57

Field Summary
private  long currentIterKey
           
private  OAIDateFormat dateFormatter
           
private static boolean doDebug
           
private  java.lang.String fedoraBaseURL
           
private  java.lang.String fedoraRecordDisseminator
           
private  java.util.Map<java.lang.Long,java.util.Iterator<Record>> iterators
           
private static Log log
           
private  Client oaiClient
           
 
Constructor Summary
SummaStorage()
           
 
Method Summary
 Record createNewRecord(java.lang.String name, byte[] data, java.lang.String base)
          NOT IMPLEMENTED.
 Record createNewRecord(java.lang.String name, java.lang.String base)
          NOT IMPLEMENTED.
private  RecordIterator createRecordIterator(ListRecordsResponse response)
           
 boolean deleteRecord(java.lang.String name)
          NOT IMPLEMENTED.
 void exportRMIInterface()
          Exports this objects Access interface over RMI.
 Record getRecord(java.lang.String name)
          Get the record with the given name.
 RecordIterator getRecords(java.lang.String base)
          Get an iterator over all records in the DOMS or all records belonging to a given OAI set.
 RecordIterator getRecordsFrom(java.lang.String name, java.lang.String base)
          NOT IMPLEMENTED.
 RecordIterator getRecordsModifiedAfter(long time, java.lang.String base)
          Get an iterator over all records from a given OIA set modified after the given time.
 RecordIterator[] getSplits(int splits, java.lang.String base)
          NOT IMPLEMENTED.
 RecordAndNext next(java.lang.Long iteratorKey)
          Return the next record in the record iteration identified by the given iterator key.
 void perform()
          NOT IMPLEMENTED.
 boolean recordActive(java.lang.String name)
          NOT IMPLEMENTED.
 boolean recordExists(java.lang.String name)
          NOT IMPLEMENTED.
 void removeDeletedBefore(long time, java.lang.String base)
          NOT IMPLEMENTED.
 void updateRecord(Record record)
          NOT IMPLEMENTED.
 void updateRecord(java.lang.String name, byte[] data)
          NOT IMPLEMENTED.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final Log log

doDebug

private static boolean doDebug

oaiClient

private Client oaiClient

currentIterKey

private long currentIterKey

iterators

private java.util.Map<java.lang.Long,java.util.Iterator<Record>> iterators

dateFormatter

private OAIDateFormat dateFormatter

fedoraBaseURL

private java.lang.String fedoraBaseURL

fedoraRecordDisseminator

private java.lang.String fedoraRecordDisseminator
Constructor Detail

SummaStorage

public SummaStorage()
             throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException
Method Detail

getRecords

public RecordIterator getRecords(java.lang.String base)
                          throws java.rmi.RemoteException
Get an iterator over all records in the DOMS or all records belonging to a given OAI set. The returned Iterator will handle resumption tokens transparently.

Parameters:
base - The OAI set from which to harvest records. If this is an empty string all records will be iterated.
Returns:
a RecordIterator oover the requested set of records
Throws:
java.rmi.RemoteException
See Also:
Selective Harvesting

getRecordsModifiedAfter

public RecordIterator getRecordsModifiedAfter(long time,
                                              java.lang.String base)
                                       throws java.rmi.RemoteException
Get an iterator over all records from a given OIA set modified after the given time. The iterator is sorted by name.

Parameters:
time - a timestamp in milliseconds
base - the name of the OAI set to retrieve records from The empty string implies all records.
Returns:
a RecordIterator of records modified after given time (sorted by name)
Throws:
java.rmi.RemoteException

getRecordsFrom

public RecordIterator getRecordsFrom(java.lang.String name,
                                     java.lang.String base)
                              throws java.rmi.RemoteException
NOT IMPLEMENTED. Get an iterator over all records from the given base "from" the given name. I.e. get all records with name "larger than" the given name. Would we prefer "larger than or equal to"? The iterator is sorted by name. This method will always return an UnsupportedOperationException due to limitations in the underlying OAI-PMH protocol

Parameters:
name - record name (bib#/id)
base - the name of the original record base
Returns:
a RecordIterator of records "from" the given name (sorted by name)
Throws:
java.rmi.RemoteException

getSplits

public RecordIterator[] getSplits(int splits,
                                  java.lang.String base)
                           throws java.rmi.RemoteException
NOT IMPLEMENTED. Get 'splits' iterators over disjoint record sets off which the union is all records from 'base'.

Parameters:
splits - the number of iterators
base - the name of the original record base
Returns:
an array of RecordIterators of which the union is all records
Throws:
java.rmi.RemoteException

getRecord

public Record getRecord(java.lang.String name)
                 throws java.rmi.RemoteException
Get the record with the given name. This method circumvents the oaiprovider and access the Fedora REST api directly.

Parameters:
name - record name (bib#/id)
Returns:
the requested Record; null on record not found
Throws:
java.rmi.RemoteException

createNewRecord

public Record createNewRecord(java.lang.String name,
                              java.lang.String base)
                       throws java.rmi.RemoteException
NOT IMPLEMENTED. Create a new record with the given name and base, the timestamp "now" and no data.

Parameters:
name - record name (bib#/id)
base - the name of the original record base
Returns:
the created Record
Throws:
java.rmi.RemoteException

createNewRecord

public Record createNewRecord(java.lang.String name,
                              byte[] data,
                              java.lang.String base)
                       throws java.rmi.RemoteException
NOT IMPLEMENTED. Create a new record with the given name and base, the timestamp "now" and the given data.

Parameters:
name - record name (bib#/id)
data - record data
base - the name of the original record base
Returns:
the created Record
Throws:
java.rmi.RemoteException

deleteRecord

public boolean deleteRecord(java.lang.String name)
                     throws java.rmi.RemoteException
NOT IMPLEMENTED. Delete the record of the given name (id). The record is marked deleted, but kept in storage...

Parameters:
name - record name (bib#/id)
Returns:
true on success; false otherwise
Throws:
java.rmi.RemoteException

removeDeletedBefore

public void removeDeletedBefore(long time,
                                java.lang.String base)
                         throws java.rmi.RemoteException
NOT IMPLEMENTED. Remove from storage records with the given base and state set to deleted before given time. I.e. remove records from given base with state deleted and time stamp before given time.

Parameters:
time - upper bound time stamp
base - name of the original record base
Throws:
java.rmi.RemoteException

updateRecord

public void updateRecord(Record record)
                  throws java.rmi.RemoteException
NOT IMPLEMENTED. Find the stored record by the name in the given record and update data and timestamp. The data is updated to the data given in the record and the time stamp to "now".

Parameters:
record - the record to be updated in storage
Throws:
java.rmi.RemoteException

updateRecord

public void updateRecord(java.lang.String name,
                         byte[] data)
                  throws java.rmi.RemoteException
NOT IMPLEMENTED. Find the record by name/bib#/id and update data, and timestamp. The data is updated to the given data and the time stamp to "now".

Parameters:
name - record name (bib#/id)
data - record data
Throws:
java.rmi.RemoteException

recordExists

public boolean recordExists(java.lang.String name)
                     throws java.rmi.RemoteException
NOT IMPLEMENTED. Check if a record of the given name exists.

Parameters:
name - record name (bib#/id)
Returns:
true if a record of the given name exists; false otherwise
Throws:
java.rmi.RemoteException

recordActive

public boolean recordActive(java.lang.String name)
                     throws java.rmi.RemoteException
NOT IMPLEMENTED. Check if a record of the given name exists AND is active. I.e. the record exists and is NOT marked deleted.

Parameters:
name - record name (bib#/id)
Returns:
true if a record of the given name exists and is active; false otherwise
Throws:
java.rmi.RemoteException

next

public RecordAndNext next(java.lang.Long iteratorKey)
                   throws java.rmi.RemoteException
Return the next record in the record iteration identified by the given iterator key. Should only be used by RecordSaxPrser to be used with ListRecordRespons objectIterator Objects.

Parameters:
iteratorKey - iterator key
Returns:
a RecordAndNext object holding the next Record in the RecordIterator identified by the iteratorKey as well as the next next value; the Record in the RecordAndNext object can be null if the iteration has no more elements or the iterator is not found (does not throw a NoSuchElementException)
Throws:
java.rmi.RemoteException

perform

public void perform()
NOT IMPLEMENTED. Method required by the dk.statsbiblioteket.util.schedule.Schedulable interface


exportRMIInterface

public void exportRMIInterface()
                        throws java.rmi.RemoteException
Exports this objects Access interface over RMI.

Throws:
java.rmi.RemoteException - if export fails.

createRecordIterator

private RecordIterator createRecordIterator(ListRecordsResponse response)