org.dspace.app.dav.client
Class LNIClientUtils

java.lang.Object
  extended by org.dspace.app.dav.client.LNIClientUtils

public class LNIClientUtils
extends Object

Convenience and Utility functions for DSpace Lightweight Network Interface clients. This class should be included in the JAR prepared for Java-based clients of the LNI, along with the generated SOAP code.

Version:
$Revision: 5845 $
Author:
Larry Stone

Field Summary
static int INFINITY
          Depth of infinity in SOAP propfind().
 
Constructor Summary
LNIClientUtils()
           
 
Method Summary
static URL makeDAVURL(String endpoint, String davURI)
          Make a URL to access LNI WebDAV resource, given a LNI SOAP "endpoint" URL and a relative WebDAV URI.
static URL makeDAVURL(String endpoint, String davURI, String packager)
          Make a URL to access LNI WebDAV resource, given a LNI SOAP "endpoint" URL and a relative WebDAV URI.
static String makeLNIURI(String endpoint, String davurl)
          Translates a WebDAV URL, such as would be returned by the PUT method, into a resource URI relative to the DAV root which can be passed to the SOAP methods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INFINITY

public static final int INFINITY
Depth of infinity in SOAP propfind().

See Also:
Constant Field Values
Constructor Detail

LNIClientUtils

public LNIClientUtils()
Method Detail

makeDAVURL

public static URL makeDAVURL(String endpoint,
                             String davURI,
                             String packager)
                      throws MalformedURLException
Make a URL to access LNI WebDAV resource, given a LNI SOAP "endpoint" URL and a relative WebDAV URI. Since the LNI SOAP interface does not include any means to submit or disseminate DSpace Items, it relies on the WebDAV LNI's GET and PUT methods. To make a WebDAV request, the client must first construct a WebDAV URL; this function makes that step much more convenient.

This is the inverse of makeLNIURI.

Since the actual Web servlet supporting the LNI SOAP interface can also respond to WebDAV GET and PUT methods, there is a straightforward way to construct the URL:

1. Remove the last pathname element from the SOAP "endpoint" URL, including the '/' (slash) separator character.

2. Append the "relative URI" returned e.g. by the SOAP lookup() function to this URL.

3. Add the packager specification and other query arguments, e.g. by appending "?packager=METS"

Parameters:
endpoint - full URL of LNI Soap endpoint, as used with SOAP.
davURI - relative URI of DAV resource, as returned by lookup(). assumed to start with "/". May be null.
packager - name of packager to use to retrieve/submit Item, or null.
Returns:
new URL.
Throws:
MalformedURLException - if endpoint is unacceptable URL, or the resulting construct is not an acceptable URL.

makeDAVURL

public static URL makeDAVURL(String endpoint,
                             String davURI)
                      throws MalformedURLException
Make a URL to access LNI WebDAV resource, given a LNI SOAP "endpoint" URL and a relative WebDAV URI. This version takes only two arguments, leaving out the packager option.

This is the inverse of makeLNIURI.

Parameters:
endpoint - full URL of LNI Soap endpoint, as used with SOAP.
davURI - relative URI of DAV resource, as returned by lookup(). assumed to start with "/". May be null.
Returns:
new URL
Throws:
MalformedURLException - if endpoint is unacceptable URL, or the resulting construct is not an acceptable URL.

makeLNIURI

public static String makeLNIURI(String endpoint,
                                String davurl)
                         throws MalformedURLException
Translates a WebDAV URL, such as would be returned by the PUT method, into a resource URI relative to the DAV root which can be passed to the SOAP methods.

This is the inverse of makeDAVURL.

Parameters:
endpoint - full URL of LNI Soap endpoint, as used with SOAP.
davurl - the davurl
Returns:
the string
Throws:
MalformedURLException - the malformed URL exception


Copyright © 2011 DuraSpace. All Rights Reserved.