org.fedoracommons.funapi.fedora
Class FedoraResolver

java.lang.Object
  extended by org.fedoracommons.funapi.fedora.FedoraResolver
All Implemented Interfaces:
ObjectResolver

public class FedoraResolver
extends java.lang.Object
implements ObjectResolver

Implementation of ObjectResolver for a Fedora repository. This implementation will attempt to load a properties file with the name FedoraResolver.properties. Required properties:

baseURL
The base URL of the Fedora repository, e.g. http://localhost:8080/fedora/
formatsDatastream
The id of a content model object's inline XML datastream which describes the unAPI formats available for a Fedora object, e.g. UNAPI-FORMATS
The formatsDatastream must return an XML document that contains a JSON array describing the available formats. For example:
<json>
[["info:fedora/*/DC","oai_dc","text/xml","http://www.openarchives.org/OAI/2.0/oai_dc.xsd"],
 ["info:fedora/*/demo:dc2mods.sdef/transform","mods","application/xml","http://www.loc.gov/standards/mods/"]]
</json>
The above is a JSON array of arrays surrounded by <json> tags. Each four-element inner array represents a single unAPI format. The first element is the dissemination type URI which will requested object in the requested format. The remaining three elements are the unAPI format, type and docs.

Since:
0.1
Version:
$Id: FedoraResolver.java 33 2008-10-25 19:31:36Z pangloss $
Author:
Edwin Shin

Constructor Summary
FedoraResolver()
           
 
Method Summary
 UnapiFormats getFormats()
          Provide the object formats which should be supported for all objects available through the unAPI service.
 UnapiFormats getFormats(java.lang.String id)
          Provide a list of object formats available from the unAPI service for the object identified by id.
 UnapiObject getObject(java.lang.String id, java.lang.String format)
          Return an UnapiObject representing the object specified by id in the format specified by format.
protected  void setFedoraClient(fedora.client.FedoraClient fedoraClient)
           
protected  void setHttpClient(org.apache.commons.httpclient.HttpClient httpClient)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FedoraResolver

public FedoraResolver()
               throws UnapiException
Throws:
UnapiException
Method Detail

getFormats

public UnapiFormats getFormats()
                        throws UnapiException
Description copied from interface: ObjectResolver
Provide the object formats which should be supported for all objects available through the unAPI service.

Specified by:
getFormats in interface ObjectResolver
Returns:
UnapiFormats representing the object formats supported for all objects.
Throws:
UnapiException

getFormats

public UnapiFormats getFormats(java.lang.String id)
                        throws UnapiException
Description copied from interface: ObjectResolver
Provide a list of object formats available from the unAPI service for the object identified by id. It is similar to the getFormats response, but the returned UnapiFormats object must have the requested id set.

Specified by:
getFormats in interface ObjectResolver
Returns:
UnapiFormats representing the object formats supported for the requested object.
Throws:
UnapiException

getObject

public UnapiObject getObject(java.lang.String id,
                             java.lang.String format)
                      throws UnapiException
Description copied from interface: ObjectResolver

Return an UnapiObject representing the object specified by id in the format specified by format.

Implementations should throw an IdentifierException for requests for an identifier that is not available on the server. Implementations should throw a FormatException for requests for an identifier that is available on the server in a format that is not available for that identifier.

Specified by:
getObject in interface ObjectResolver
Returns:
UnapiObject
Throws:
UnapiException

setHttpClient

protected void setHttpClient(org.apache.commons.httpclient.HttpClient httpClient)

setFedoraClient

protected void setFedoraClient(fedora.client.FedoraClient fedoraClient)


Copyright © 2008 Fedora Commons, Inc.. All Rights Reserved.