|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfedora.client.FedoraClient
public class FedoraClient
General-purpose utility class for Fedora clients. Provides methods to get SOAP stubs for Fedora APIs. Also serves as one-stop-shopping for issuing HTTP requests using Apache's HttpClient. Provides option for client to handle HTTP redirects (notably 302 status that occurs with SSL auto-redirects at server.)
| Nested Class Summary | |
|---|---|
class |
FedoraClient.SOAPEndpoint
Class for storing a Fedora SOAP endpoint, which consists of an endpoint name and a URL. |
| Nested classes/interfaces inherited from interface fedora.common.Constants |
|---|
Constants.FedoraHome |
| Field Summary | |
|---|---|
static java.lang.String |
FEDORA_URI_PREFIX
|
boolean |
FOLLOW_REDIRECTS
Whether to automatically follow HTTP redirects. |
static boolean |
FORCE_LOG4J_CONFIGURATION
Deprecated. |
int |
MAX_CONNECTIONS_PER_HOST
Maxiumum http connections per host (for REST calls only). |
int |
MAX_TOTAL_CONNECTIONS
Maxiumum total http connections (for REST calls only). |
int |
SOCKET_TIMEOUT_SECONDS
Seconds to wait while waiting for data over the socket (SO_TIMEOUT). |
int |
TIMEOUT_SECONDS
Seconds to wait before a connection is established. |
| Fields inherited from interface fedora.common.Constants |
|---|
ACTION, BDEF, BMECH, DATASTREAM, DC, DISSEMINATOR, ENVIRONMENT, FEDORA, FEDORA_HOME, FEDORA_SYSTEM_DEF_PID, FEDORA_SYSTEM_DEF_URI, HTTP_REQUEST, MODEL, OBJECT, RDF, RECOVERY, RELS_EXT, RESOURCE, SUBJECT, TUCANA, VIEW, XSD |
| Constructor Summary | |
|---|---|
FedoraClient(java.lang.String baseURL,
java.lang.String user,
java.lang.String pass)
|
|
| Method Summary | |
|---|---|
HttpInputStream |
get(java.lang.String locator,
boolean failIfNotOK)
Get an HTTP resource with the response as an InputStream, given a resource locator that either begins with 'info:fedora/' , 'http://', or '/'. |
HttpInputStream |
get(java.lang.String locator,
boolean failIfNotOK,
boolean followRedirects)
Get an HTTP resource with the response as an InputStream, given a resource locator that either begins with 'info:fedora/' , 'http://', or '/'. |
HttpInputStream |
get(java.net.URL url,
boolean failIfNotOK)
Get an HTTP resource with the response as an InputStream, given a URL. |
HttpInputStream |
get(java.net.URL url,
boolean failIfNotOK,
boolean followRedirects)
Get an HTTP resource with the response as an InputStream, given a URL. |
FedoraAPIA |
getAPIA()
Get a new SOAP stub for API-A. |
java.net.URL |
getAPIAEndpointURL()
|
FedoraAPIM |
getAPIM()
Get a new SOAP stub for API-M. |
java.net.URL |
getAPIMEndpointURL()
|
static java.util.List |
getCompatibleServerVersions()
|
org.apache.commons.httpclient.HttpClient |
getHttpClient()
|
java.util.Date |
getLastModifiedDate(java.lang.String locator)
|
java.lang.String |
getResponseAsString(java.lang.String locator,
boolean failIfNotOK,
boolean followRedirects)
Get an HTTP resource with the response as a String instead of an InputStream, given a resource locator that either begins with 'info:fedora/' , 'http://', or '/'. |
java.util.Date |
getServerDate()
Return the current date as reported by the Fedora server. |
java.lang.String |
getServerVersion()
Get the version reported by the remote Fedora server. |
org.trippi.TupleIterator |
getTuples(java.util.Map params)
Get tuples from the remote resource index. |
java.lang.String |
getUploadURL()
Get the URL to which API-M upload requests will be sent. |
static java.lang.String |
getVersion()
|
void |
reloadPolicies()
|
java.lang.String |
uploadFile(java.io.File file)
Upload the given file to Fedora's upload interface via HTTP POST. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String FEDORA_URI_PREFIX
@Deprecated public static boolean FORCE_LOG4J_CONFIGURATION
public int TIMEOUT_SECONDS
public int SOCKET_TIMEOUT_SECONDS
public int MAX_CONNECTIONS_PER_HOST
public int MAX_TOTAL_CONNECTIONS
public boolean FOLLOW_REDIRECTS
| Constructor Detail |
|---|
public FedoraClient(java.lang.String baseURL,
java.lang.String user,
java.lang.String pass)
throws java.net.MalformedURLException
java.net.MalformedURLException| Method Detail |
|---|
public org.apache.commons.httpclient.HttpClient getHttpClient()
public java.lang.String uploadFile(java.io.File file)
throws java.io.IOException
java.io.IOException
public java.lang.String getUploadURL()
throws java.io.IOException
java.io.IOException
public HttpInputStream get(java.lang.String locator,
boolean failIfNotOK)
throws java.io.IOException
locator - A URL, relative Fedora URL, or Fedora URI that we want to
do an HTTP GET uponfailIfNotOK - boolean value indicating if an exception should be thrown
if we do NOT receive an HTTP 200 response (OK)
java.io.IOException
public HttpInputStream get(java.net.URL url,
boolean failIfNotOK)
throws java.io.IOException
url - A URL that we want to do an HTTP GET uponfailIfNotOK - boolean value indicating if an exception should be thrown
if we do NOT receive an HTTP 200 response (OK)
java.io.IOException
public HttpInputStream get(java.lang.String locator,
boolean failIfNotOK,
boolean followRedirects)
throws java.io.IOException
locator - A URL, relative Fedora URL, or Fedora URI that we want to
do an HTTP GET uponfailIfNotOK - boolean value indicating if an exception should be thrown
if we do NOT receive an HTTP 200 response (OK)followRedirects - boolean value indicating whether HTTP redirects
should be handled in this method, or be passed along
so that they can be handled later.
java.io.IOException
public HttpInputStream get(java.net.URL url,
boolean failIfNotOK,
boolean followRedirects)
throws java.io.IOException
url - A URL that we want to do an HTTP GET uponfailIfNotOK - boolean value indicating if an exception should be thrown
if we do NOT receive an HTTP 200 response (OK)followRedirects - boolean value indicating whether HTTP redirects
should be handled in this method, or be passed along
so that they can be handled later.
java.io.IOException
public java.lang.String getResponseAsString(java.lang.String locator,
boolean failIfNotOK,
boolean followRedirects)
throws java.io.IOException
locator - A URL, relative Fedora URL, or Fedora URI that we want to
do an HTTP GET uponfailIfNotOK - boolean value indicating if an exception should be thrown
if we do NOT receive an HTTP 200 response (OK)followRedirects - boolean value indicating whether HTTP redirects
should be handled in this method, or be passed along
so that they can be handled later.
java.io.IOException
public FedoraAPIA getAPIA()
throws java.lang.Exception
FedoraClient specifies "http",
regular HTTP communication will be attempted first. If the server
redirects this client to use HTTPS instead, the redirect will be
followed and SSL will be used automatically.
java.lang.Exception
public java.net.URL getAPIAEndpointURL()
throws java.io.IOException
java.io.IOException
public FedoraAPIM getAPIM()
throws java.lang.Exception
FedoraClient specifies "http",
regular HTTP communication will be attempted first. If the server
redirects this client to use HTTPS instead, the redirect will be
followed and SSL will be used automatically.
java.lang.Exception
public java.net.URL getAPIMEndpointURL()
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String getVersion()
public static java.util.List getCompatibleServerVersions()
public java.lang.String getServerVersion()
throws java.io.IOException
java.io.IOException
public java.util.Date getServerDate()
throws java.io.IOException
java.io.IOException - if the HTTP Date header is not provided by the server
for any reason, or it is in the wrong format.
public java.util.Date getLastModifiedDate(java.lang.String locator)
throws java.io.IOException
java.io.IOException
public void reloadPolicies()
throws java.io.IOException
java.io.IOException
public org.trippi.TupleIterator getTuples(java.util.Map params)
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||