net.cnri.do_api
Class Repository

java.lang.Object
  extended by net.cnri.do_api.DigitalObject
      extended by net.cnri.do_api.Repository

public class Repository
extends DigitalObject

This object provides high level access to a digital object repository.


Nested Class Summary
static interface Repository.CloseableIterator<T>
           
 
Field Summary
static java.lang.String SERIALIZED_ENCODING
           
 
Constructor Summary
Repository(DOAuthentication auth, DOServiceInfo service)
          Constructor for a repository that interfaces an object that provides an interface to the with the given authentication information
Repository(DOAuthentication auth, java.lang.String repoID)
          Constructor for a repository that interfaces an object that provides an interface to the with the given authentication information
Repository(java.lang.String repoID, DOClientConnection conn)
          Construct a Repository instance which can be used to talk over existing connections to DO servers.
 
Method Summary
 java.lang.String copyObjectFrom(Repository source, java.lang.String objectID)
          Create a new object on this repository with the given identifier and return the ID of the new object.
 DigitalObject createDigitalObject(java.lang.String objectID)
          Create a new digital object in this repository and return an interface to that object.
 void deleteDigitalObject(java.lang.String objectID)
          Deletes a specified digital object from the repository
 DOClientConnection getConnection()
          Internal method to return the underlying connection that is used to communicate with this Repository.
 DigitalObject getDigitalObject(java.lang.String objectID)
          If the specified digital object exists in the repository, this method will return an instance of the DigitalObject class corresponding to that object.
 java.util.Iterator listObjects()
          Return an iterator of object IDs that are contained in this repository.
 StreamPair performOperation(java.lang.String objectID, java.lang.String operationID, HeaderSet parameters)
          Invoke a low-level operation on the given object, returning the input and output streams for the operation in a StreamPair.
 Repository.CloseableIterator<HeaderSet> search(java.lang.String query)
           
 void setUseEncryption(boolean encrypt)
          Sets whether or not the connection to this repository will be encrypted.
 java.lang.String toString()
          Returns a nicely formatted label for this object
 boolean verifyDigitalObject(java.lang.String objectID)
          Verifies that the specified digital object exists in the current repository
 
Methods inherited from class net.cnri.do_api.DigitalObject
checkAuthorization, deleteAttribute, deleteAttributes, deleteDataElement, deleteObject, getAttribute, getAttributes, getDataElement, getDateCreated, getDateLastModified, getID, getObjectID, getRepository, getSize, listAttributes, listDataElements, performOperation, refresh, setAttribute, setAttributes, verifyDataElement
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SERIALIZED_ENCODING

public static final java.lang.String SERIALIZED_ENCODING
See Also:
Constant Field Values
Constructor Detail

Repository

public Repository(DOAuthentication auth,
                  java.lang.String repoID)
           throws DOException
Constructor for a repository that interfaces an object that provides an interface to the with the given authentication information

Throws:
DOException

Repository

public Repository(DOAuthentication auth,
                  DOServiceInfo service)
           throws DOException
Constructor for a repository that interfaces an object that provides an interface to the with the given authentication information

Throws:
DOException

Repository

public Repository(java.lang.String repoID,
                  DOClientConnection conn)
Construct a Repository instance which can be used to talk over existing connections to DO servers.

Method Detail

toString

public java.lang.String toString()
Description copied from class: DigitalObject
Returns a nicely formatted label for this object

Overrides:
toString in class DigitalObject

setUseEncryption

public void setUseEncryption(boolean encrypt)
Sets whether or not the connection to this repository will be encrypted. This has no effect on the current connection if the authentication handshake has already taken occurred.


getConnection

public DOClientConnection getConnection()
                                 throws DOException
Internal method to return the underlying connection that is used to communicate with this Repository.

Throws:
DOException

verifyDigitalObject

public boolean verifyDigitalObject(java.lang.String objectID)
                            throws DOException,
                                   java.io.IOException
Verifies that the specified digital object exists in the current repository

Throws:
DOException
java.io.IOException

performOperation

public StreamPair performOperation(java.lang.String objectID,
                                   java.lang.String operationID,
                                   HeaderSet parameters)
                            throws DOException,
                                   java.io.IOException
Invoke a low-level operation on the given object, returning the input and output streams for the operation in a StreamPair. The caller must be careful to close both streams of the StreamPair when they are no longer used. For some operations the caller should close the output stream before any input will be received.

Throws:
DOException
java.io.IOException

createDigitalObject

public DigitalObject createDigitalObject(java.lang.String objectID)
                                  throws DOException
Create a new digital object in this repository and return an interface to that object. The objectID parameter indicates the identifier for the object. If the given objectID is null then the repository should choose a unique identifier and create the object. If an objectID is provided then the client should have permission to register that identifier in the handle system - otherwise the object will be created but will not be referenceable from outside of the repository.

Throws:
DOException

deleteDigitalObject

public void deleteDigitalObject(java.lang.String objectID)
                         throws DOException,
                                java.io.IOException
Deletes a specified digital object from the repository

Throws:
DOException
java.io.IOException

getDigitalObject

public DigitalObject getDigitalObject(java.lang.String objectID)
                               throws DOException,
                                      java.io.IOException
If the specified digital object exists in the repository, this method will return an instance of the DigitalObject class corresponding to that object.

Throws:
DOException
java.io.IOException

listObjects

public java.util.Iterator listObjects()
                               throws DOException,
                                      java.io.IOException
Return an iterator of object IDs that are contained in this repository.

Throws:
DOException
java.io.IOException

copyObjectFrom

public java.lang.String copyObjectFrom(Repository source,
                                       java.lang.String objectID)
                                throws DOException
Create a new object on this repository with the given identifier and return the ID of the new object. The object is copied from the given source repository into this repository.

Throws:
DOException

search

public Repository.CloseableIterator<HeaderSet> search(java.lang.String query)
                                               throws DOException,
                                                      java.io.IOException
Throws:
DOException
java.io.IOException