|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fcrepo.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 org.fcrepo.common.Constants |
|---|
Constants.FedoraHome |
| Field Summary | |
|---|---|
static String |
FEDORA_URI_PREFIX
|
boolean |
FOLLOW_REDIRECTS
Whether to automatically follow HTTP redirects. |
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. |
| Constructor Summary | |
|---|---|
FedoraClient(String baseURL,
String user,
String pass)
|
|
| Method Summary | |
|---|---|
HttpInputStream |
get(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(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(URL url,
boolean failIfNotOK)
Get an HTTP resource with the response as an InputStream, given a URL. |
HttpInputStream |
get(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. |
URL |
getAPIAEndpointURL()
|
FedoraAPIAMTOM |
getAPIAMTOM()
|
URL |
getAPIAMTOMEndpointURL()
|
FedoraAPIM |
getAPIM()
Get a new SOAP stub for API-M. |
URL |
getAPIMEndpointURL()
|
FedoraAPIMMTOM |
getAPIMMTOM()
|
URL |
getAPIMMTOMEndpointURL()
|
static List<String> |
getCompatibleServerVersions()
|
org.apache.commons.httpclient.HttpClient |
getHttpClient()
|
Date |
getLastModifiedDate(String locator)
|
String |
getResponseAsString(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 '/'. |
Date |
getServerDate()
Return the current date as reported by the Fedora server. |
String |
getServerVersion()
Get the version reported by the remote Fedora server. |
org.trippi.TupleIterator |
getTuples(Map<String,String> params)
Get tuples from the remote resource index. |
String |
getUploadURL()
Get the URL to which API-M upload requests will be sent. |
static String |
getVersion()
|
void |
reloadPolicies()
|
String |
uploadFile(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 String FEDORA_URI_PREFIX
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(String baseURL,
String user,
String pass)
throws MalformedURLException
MalformedURLException| Method Detail |
|---|
public org.apache.commons.httpclient.HttpClient getHttpClient()
public String uploadFile(File file)
throws IOException
IOException
public String getUploadURL()
throws IOException
IOException
public HttpInputStream get(String locator,
boolean failIfNotOK)
throws 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)
IOException
public HttpInputStream get(URL url,
boolean failIfNotOK)
throws 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)
IOException
public HttpInputStream get(String locator,
boolean failIfNotOK,
boolean followRedirects)
throws 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.
IOException
public HttpInputStream get(URL url,
boolean failIfNotOK,
boolean followRedirects)
throws 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.
IOException
public String getResponseAsString(String locator,
boolean failIfNotOK,
boolean followRedirects)
throws 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.
IOException
public FedoraAPIA getAPIA()
throws javax.xml.rpc.ServiceException,
IOException
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.
javax.xml.rpc.ServiceException
IOException
public URL getAPIAEndpointURL()
throws IOException
IOException
public FedoraAPIAMTOM getAPIAMTOM()
throws javax.xml.rpc.ServiceException,
IOException
javax.xml.rpc.ServiceException
IOException
public URL getAPIAMTOMEndpointURL()
throws IOException
IOException
public FedoraAPIM getAPIM()
throws javax.xml.rpc.ServiceException,
IOException
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.
javax.xml.rpc.ServiceException
IOException
public URL getAPIMEndpointURL()
throws IOException
IOException
public FedoraAPIMMTOM getAPIMMTOM()
throws javax.xml.rpc.ServiceException,
IOException
javax.xml.rpc.ServiceException
IOException
public URL getAPIMMTOMEndpointURL()
throws IOException
IOExceptionpublic static String getVersion()
public static List<String> getCompatibleServerVersions()
public String getServerVersion()
throws IOException
IOException
public Date getServerDate()
throws IOException
IOException - if the HTTP Date header is not provided by the server for any
reason, or it is in the wrong format.
public Date getLastModifiedDate(String locator)
throws IOException
IOException
public void reloadPolicies()
throws IOException
IOException
public org.trippi.TupleIterator getTuples(Map<String,String> params)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||