The Fedora Digital Object Manager

This is the Fedora Digital Object Manager It it a library that allows for Fedora objects to be accessed as Planets objects. The primary class is FedoraObjectManager, which implements the Planets DigitalObjectManager interface. Find the sourceforge page here

Install

The object planets:PlanetsContentModelContentModel must exist in the repository. This is the content model for planets content models, sort of a class for classes. Then, one or more planets content models must exist in the repository. One such object has been included, planets:ContentModel_FileObject. The planets:PlanetsContentModelContentModel must reference one planets content model. At the moment, it references planets:ContentModel_FileObject. Planets content models must have a datastream called "PLANETS". It should have the information about how a fedora object should be mapped to a planets object. The schema for this has been included, and is called PlanetsDatastreamSchema.xsd. A sample planets datastream have also been included. The content of the exported objects are a API-A-Lite reference to the content datastream in the data objects. So, if the repository require authentication to access these datastreams, it will be impossible to read the contents of the planets objects afterwards. When this setup have been done, the system should be ready to use.

Usage

The Fedora Object Manager can be created with this constructor
    /**
     * Constructor. Initialises the FedoraObjectManager
     * @param username the username to connect as
     * @param password the password
     * @param server the server location, often something like http://localhost:8080/fedora
     * @throws FedoraConnectionException If a connection could not be made
     */
    public FedoraObjectManager(String username, String password, String server) throws FedoraConnectionException;
The object manager implements these functions
/**
 * Interface for storage and retrieval of Digital Objects in an IF Data Registry.
 * 
 * @author Carl Wilson
 * 
 */
public interface DigitalObjectManager {

    /**
     * Persist a DigitalObject to the Data Registry as a new object
     *
     * @param digitalObject The object to store
     * @return the pdURI where the object was stored.
     * @throws DigitalObjectNotStoredException  if the storing somehow failed
     */
    public URI storeAsNew(DigitalObject digitalObject) throws DigitalObjectNotStoredException;
    
    /**
     * Persist a DigitalObject to the Data Registry as a new object, associated the suggested URI if possible.
     * 
     * If a particular implementation does not permit the caller to dictate the store layout, the URI may be overridden.
     * Consequently, the returned URI should be retained as the object reference, not the passed one.
     *
     * @param pdURI The suggested URI to associate with the stored object.
     * @param digitalObject The object to store.
     * @return the pdURI A URI associated with the newly-stored object and which could be used to recover it via the .read(URI) method.
     * @throws DigitalObjectNotStoredException  if the storing somehow failed
     */
    public URI storeAsNew( URI pdURI, DigitalObject digitalObject ) throws DigitalObjectNotStoredException;

    /**
     * Updates an existing object in the repository to contain the given digital object. The repository might create a
     * new object for the new version. This method returns the uri of the updated object.
     * @param pdURI the object to update
     * @param digitalObject the information to update with
     * @return the id of the updated object
     * @throws DigitalObjectNotStoredException if the storing somehow failed
     */
    public URI updateExisting(URI pdURI, DigitalObject digitalObject) throws DigitalObjectNotStoredException, DigitalObjectNotFoundException;

	/**
	 * Test if Digital Objects can be persisted.
	 * 
	 * @param pdURI The URI that we wish to write to, or NULL to test if the whole repository is read-only.
	 * @return false if the 'store' method should work for this URI. If 
	 * the whole DOM is a read-only system, then return false when pdURI == NULL.
	 * If some parts are writable, return true when pdURI == NULL.
	 */
    public boolean isWritable( URI pdURI );
	
    /**
     * Returns the URIs of Digital Objects matching the given parent pdURI.
     * 
     * If the pdURI points to a 'file' (A Digital Object)
     * then this should return null.
     * 
     * If the pdURI points to a 'directory', then this should return a valid List object, with zero or more entries.
     * 
     * If the Query has been set, only return matching Digital Objects.
     * 
     * @param pdURI
     *            URI that identifies an Digital Object or folder
     * @return an array of all child URIs.  Empty folders return an empty list, and files return null.
     */
    public List list(URI pdURI);

}