proai.driver
Interface OAIDriver

All Superinterfaces:
Writable
All Known Implementing Classes:
OAIDriverImpl

public interface OAIDriver
extends Writable

An interface to a repository. Note that an OAIDriver *must* implement a public no-arg constructor, and will be initialized via a call to init(Properties).

Author:
cwilper@cs.cornell.edu

Method Summary
 void close()
          Release any resources held by the driver.
 java.util.Date getLatestDate()
          Get the latest date that something changed in the remote repository.
 void init(java.util.Properties props)
          Initialize from properties.
 RemoteIterator<? extends MetadataFormat> listMetadataFormats()
          Get an iterator over a list of MetadataFormat objects representing all OAI metadata formats currently supported by the repository.
 RemoteIterator<? extends Record> listRecords(java.util.Date from, java.util.Date until, java.lang.String mdPrefix)
          Get an iterator of Record objects representing all records in the format indicated by mdPrefix, which have changed in the given date range.
 RemoteIterator<? extends SetInfo> listSetInfo()
          Get an iterator over a list of SetInfo objects representing all OAI sets currently supported by the repository.
 void write(java.io.PrintWriter out)
          Write information about the repository to the given PrintWriter.
 void writeRecordXML(java.lang.String itemID, java.lang.String mdPrefix, java.lang.String sourceInfo, java.io.PrintWriter writer)
          Write the XML of the record whose source info is given.
 

Method Detail

init

void init(java.util.Properties props)
          throws RepositoryException
Initialize from properties.

Parameters:
props - the implementation-specific initialization properties.
Throws:
RepositoryException - if required properties are missing/bad, or initialization failed for any reason.

write

void write(java.io.PrintWriter out)
           throws RepositoryException
Write information about the repository to the given PrintWriter.

This will be a well-formed XML chunk beginning with an Identify element, as described in section 4.2 of the OAI-PMH 2.0 specification.

Specified by:
write in interface Writable
Throws:
RepositoryException - if there is a problem reading from the repository.

getLatestDate

java.util.Date getLatestDate()
                             throws RepositoryException
Get the latest date that something changed in the remote repository.

If this is greater than the previously-aquired latestDate, the formats, setInfos, and identity will be retrieved again, and it will be used as the "until" date for the next record query.

Throws:
RepositoryException

listMetadataFormats

RemoteIterator<? extends MetadataFormat> listMetadataFormats()
                                                             throws RepositoryException
Get an iterator over a list of MetadataFormat objects representing all OAI metadata formats currently supported by the repository.

Throws:
RepositoryException
See Also:
MetadataFormat

listSetInfo

RemoteIterator<? extends SetInfo> listSetInfo()
                                              throws RepositoryException
Get an iterator over a list of SetInfo objects representing all OAI sets currently supported by the repository.

The content will be a well-formed XML chunk beginning with a set element, as described in section 4.6 of the OAI-PMH 2.0 specification.

Throws:
RepositoryException
See Also:
SetInfo

listRecords

RemoteIterator<? extends Record> listRecords(java.util.Date from,
                                             java.util.Date until,
                                             java.lang.String mdPrefix)
                                             throws RepositoryException
Get an iterator of Record objects representing all records in the format indicated by mdPrefix, which have changed in the given date range.

Regarding dates: If from is not null, the date is greater than (non-inclusive) Until must be specified, and it is less than or equal to (inclusive).

Throws:
RepositoryException
See Also:
Record

writeRecordXML

void writeRecordXML(java.lang.String itemID,
                    java.lang.String mdPrefix,
                    java.lang.String sourceInfo,
                    java.io.PrintWriter writer)
                    throws RepositoryException
Write the XML of the record whose source info is given. SourceInfo MUST NOT contain newlines. Otherwise, the format is up to the implementation. The Record implementation produces these strings, and the OAIDriver implementation should know how to use them to produce the XML. The record must be a well-formed XML chunk beginning with a record element, as described in section 4.1 of the OAI-PMH 2.0 specification.

Throws:
RepositoryException

close

void close()
           throws RepositoryException
Release any resources held by the driver.

Throws:
RepositoryException