***  This class provides Binary Compatibility only, not Source Compatibility  ***

com.sas.services.webdav
Class DAVResource

com.sas.services.webdav.DAVResource
All Implemented Interfaces:
DAVResourceInterface, java.rmi.Remote

@SASScope(value="ALL")
@BinaryCompatibilityOnly
public class DAVResource
implements DAVResourceInterface

A DAVResource represents a WebDAV (Web-based Distributed Authoring and Versioning) resource as specified in IETF RFC 2518. To create a DAVResource, use a ConnectionInfo object passed to the constructor. ConnectionInfo includes the URL of the resource (containing the host, port and path), user ID, password, proxy host, proxy port, proxy user ID, proxy password. The DAVResource object can then be manipulated using the various methods defined in the Resource interface. After any operation on a resource, check the status on the object using getStatusCode() and getStatusMessage(). For example,

 try
 {
     ConnectionInfo connectionInfo = new ConnectionInfo("http://http-server/path-to-resource",
                                                        "user",
                                                        "pwd");
     // proxy information, if required
     connectionInfo.setProxyHost("myproxy.com");
     connectionInfo.setProxyPort(3100);

     DAVResource davResource1 = new DAVResource(connectionInfo);
     int httpStatusCode = davResource1.getStatusCode();
     if (HttpStatus.SC_NOT_FOUND == httpStatusCode)
     {
         // DAV resource was not found
     }

     davResource1.setProperty(...);
     if (HttpStatus.SC_OK != davResource1.getStatusCode())
     {
         out.println(davResource1.getStatusMessage());
     }
 }
 catch (DAVException e)
 {
     // handle the exception
 }
 
In order to create a collection use the longer form of the constructor. For example,
 DAVResource davResource2 = new DAVResource(connectionInfo, true);
 int httpStatusCode = davResource2.getStatusCode();
 if (HttpStatus.SC_NOT_FOUND == httpStatusCode)
 {
     // DAV resource was not found
 }
 
This will ensure that davResource2 is a collection resource (it may contain other resources). Alternatively, do this in two steps
 DAVResource davResource2 = new DAVResource(connectionInfo);
 int httpStatusCode = davResource2.getStatusCode();
 if (HttpStatus.SC_NOT_FOUND == httpStatusCode)
 {
     // DAV resource was not found
 }
 davResource2.makeCollection();
 

Since:
1.0

Field Summary
protected  ConnectionInfo _connectionInfo
          Connection information.
static int DONT_CARE
           
static int HTTP_DEFAULT_PORT
          The default port for HTTP is 80.
static int MUST_EXIST
           
static int MUST_NOT_EXIST
           
 
Constructor Summary
DAVResource(ConnectionInfo cInfo)
          Creates a DAVResource using the connection information.
DAVResource(ConnectionInfo cInfo, boolean createCollection)
          Creates a DAVResource using the connection information.
DAVResource(java.lang.String url)
          Creates a DAVResource using a string URL.
DAVResource(java.lang.String url, boolean createCollection)
          Creates a DAVResource using a string URL and boolean flag to indicate whether a collection should be created.
DAVResource(java.lang.String url, java.lang.String userName, java.lang.String password)
          Creates a DAVResource using a string URL, userName and password.
DAVResource(java.net.URL url)
          Creates a DAVResource using a Java URL.
 
Method Summary
 void close()
          Closes the socket used for this connection.
 org.apache.http.entity.ContentType contentType()
          Gets the Apache HTTP entity content type of the content for this DAV resource.
 DAVResource copy(java.lang.String targetPath)
          Copies resource to the target destination.
 void delete()
          Deletes this DAV resource.
 void doCheckin()
          Check in this DAV resource.
 void doCheckout()
          Checks out this DAV resource.
 void doControl()
          Puts the resource under version control.
 void doLabel(int labelAction, java.lang.String label)
          Modifies the version label on the resource (if this is supported by the server).
 void doLabel(int labelAction, java.lang.String label, int depth)
          Modifies the label on the version resource (if this is supported by the server).
 java.util.Properties doOptions()
          Gets the options as Properties representing the header name/value pairs.
 DavPropertyResult doReport(org.apache.jackrabbit.webdav.version.report.ReportInfo reportInfo)
          Gets a report on the current DAV resource.
 DavPropertyResult doSearch(org.apache.jackrabbit.webdav.search.SearchInfo searchInfo)
          The SEARCH method invokes one of the implemented search grammars on the server to evaluate the query.
 void doUncheckout()
          Uncheckout this DAV resource, canceling a previous checkout.
 boolean exists()
          Returns whether the resource exists.
static java.lang.String extractPath(java.lang.String url)
          Extract the path (query and fragment identifier from a URL).
 com.sas.services.webdav.Acl getAcl()
          Gets the access control list for this DAV resource.
 java.lang.String getACL()
          Gets the access control list (ACL) for this DAV resource.
 java.lang.String[] getAllowedMethods()
          Returns a list of methods allowed on this resource.
 com.sas.services.webdav.Version getCheckedIn()
          Retrieves the currently checked in resource.
 com.sas.services.webdav.Version getCheckedOut()
          Retrieves the currently checked out resource.
 java.util.List<java.lang.String> getChildrenList(java.lang.String path)
          Gets the list of children.
 java.util.Map<java.lang.String,PropertyMap> getChildrenProperties(PropertyName[] properties)
          Get all the properties of a collection's members (depth=1) in as single server request.
 byte[] getContents()
          Gets the contents of this DAV resource as a byte array.
 void getContents(java.io.File fileData)
          Gets the content of this DAV resource into a file specified as the parameter.
 java.lang.String getContentsAsString()
          Gets the contents of this DAV resource as a String.
 java.io.InputStream getContentsInputStream()
          Gets the content of this DAV resource as a stream.
 java.lang.String getContentType()
          Gets the content type of the content for this DAV resource.
 java.lang.String[] getDavCapabilities()
          Returns a list of DAV capabilities.
 DavPropertyResult getDavProperties()
          Gets all of the DAV resource's properties using the resource's depth.
 DavPropertyResult getDavProperties(org.apache.jackrabbit.webdav.property.DavPropertyNameSet davPropertyNameSet, int depth)
          Gets the properties for the specified DAV property names and search depth.
 DavPropertyResult getDavProperties(int depth)
          Gets all of the DAV resource's properties for the specified depth.
 DavPropertyResult getDavProperties(PropertyName[] propertyNames)
          Gets all the properties for the specified property names on the DAV resource.
 DavPropertyResult getDavProperties(PropertyName[] propertyNames, int depth)
          Gets all the properties for the specified property names on the DAV resource.
 DavPropertyResult getDavPropertyNames()
          Gets DAV properties for all of a DAV resource's property names.
 DavPropertyResult getDavPropertyNames(int depth)
          Gets DAV properties for all of a DAV resource's property names for the specified depth.
 int getDepth()
          Gets the value for depth.
 int getExistsRequirement()
          Gets the existence requirement.
 java.lang.String getLock(java.lang.String userName)
          Gets this DAV resource's lock token for the specified user.
 java.util.Map getMultiStatus()
          Returns the multiple status information for the last operation.
 boolean getOverwrite()
          Gets the overwrite flag which specifies whether this DAV resource can be overwritten.
 java.lang.String getPath()
          Gets the path for the WebDAV resource that is currently represented by this DAVResource.
 java.util.List getPreviousVersionNames()
          Gets a list of previous version names for this DAV resource.
 PropertyMap getPropertyMap()
          Returns a property map of the resources properties.
 int getStatusCode()
          Gets the HTTP status code for the last operation/method.
 java.lang.String getStatusMessage()
          Gets the message associated with the status code for the last operation/method.
 java.lang.String getTempDir()
          Returns the current setting for the directory for temporary files.
 java.net.URL getURL()
          Gets the URL that this DAV resource represents.
 com.sas.services.webdav.Version getVersion(java.lang.String versionName)
          Gets a particular version of this DAV resource.
protected  boolean isAuthReqd()
          Returns whether a password is required to connect to this server
 boolean isCollection()
          Is this DAV resource a collection?
 boolean isLocked()
          Is this DAV resource locked?
 java.lang.String lock()
          Locks this DAV resource.
 boolean makeCollection()
          Makes a collection.
 DAVResource move(java.lang.String targetPath)
          Moves this DAV resource to the location given in the parameter.
 void removeProperties(org.w3c.dom.Element[] propNames)
          Removes the properties specified in the parameter.
 void removeProperties(PropertyName[] propertyNames)
          Removes the properties specified in the parameter.
 void removeProperty(org.w3c.dom.Element propName)
          Removes the property specified in the parameter.
 void removeProperty(PropertyName propName)
          Removes the property specified in the parameter.
 void removeProperty(java.lang.String propName)
          Removes the property specified in the parameter.
 java.lang.String setAcl(com.sas.services.webdav.Acl acl)
          Sets the access control list for this DAV resource.
 java.lang.String setACL(java.lang.String acl)
          Set/Update the Access Control List for this DAV resource.
 void setContents(byte[] contents)
          Sets the contents of the resource, passing in a byte array.
 void setContents(java.io.InputStream is)
          Sets the contents of the resource from an input stream.
 void setContents(java.lang.String content)
          Sets the contents of the resource, passing in a URL.
 void setContents(java.net.URL url)
          Sets the contents of the resource, passing in a URL.
 void setContentType(java.lang.String contentType)
          Sets the contents type for the content of the resource.
 void setCredentialsProvider(org.apache.http.client.CredentialsProvider credentialsProvider)
          Sets a credentials provider.
 void setDebug(int debug)
          Set the value for debug.
 void setDepth(int depth)
          Set the value for depth.
 void setExistsRequirement(int requirement)
          Sets the existence requirement.
 void setOverwrite(boolean overwrite)
          Sets the overwrite flag which specifies whether this DAV resource can be overwritten.
 void setPassword(java.lang.String password)
          Set the value for password.
 void setPath(java.lang.String path)
          Sets the path for this DAV resource.
 void setProperties(org.w3c.dom.DocumentFragment props)
          Sets the values of properties, as given in the parameter.
 void setProperties(org.w3c.dom.Element[] elems)
          Sets the values of properties, as given in the parameter.
 void setProperties(PropertyName[] propNames, java.lang.String[] propValues)
          Sets the values of properties, as given in the parameter.
 void setProperty(org.w3c.dom.Element prop)
          Sets the value of a property, as given in the parameter.
 void setProperty(PropertyName propName, java.lang.String propValue)
          Sets the value of a property, as given in the parameter.
 void setTempDir(java.lang.String tempDir)
          Provides a way to set a directory for temporary files.
 void setUserName(java.lang.String userName)
          Set the value for userName.
 boolean SUCCEEDED()
          Returns whether the last method was successful or not.
protected static boolean SUCCEEDED(int statusCode)
          
static java.lang.String unencodePath(java.lang.String path)
          Unencode the path.
 void unlock()
          Unlocks the resource, if previously locked by the same principal.
 void unlock(java.lang.String lockToken)
          Unlocks the resource, with the correct locktoken.
 

Field Detail

HTTP_DEFAULT_PORT

public static final int HTTP_DEFAULT_PORT
The default port for HTTP is 80.

See Also:
Constant Field Values

_connectionInfo

protected ConnectionInfo _connectionInfo
Connection information.


DONT_CARE

public static final int DONT_CARE
See Also:
Constant Field Values

MUST_EXIST

public static final int MUST_EXIST
See Also:
Constant Field Values

MUST_NOT_EXIST

public static final int MUST_NOT_EXIST
See Also:
Constant Field Values
Constructor Detail

DAVResource

public DAVResource(java.lang.String url)
            throws DAVException
Creates a DAVResource using a string URL.

Note that one should check the HTTP status code (e.g. HttpStatus.SC_NOT_FOUND) after invoking this constructor since a DAVException is not thrown for all exceptions.

Parameters:
url - URL for the resource.
Throws:
DAVException - if a DAV Server error occurs.

DAVResource

public DAVResource(java.lang.String url,
                   java.lang.String userName,
                   java.lang.String password)
            throws DAVException
Creates a DAVResource using a string URL, userName and password.

Note that one should check the HTTP status code (e.g. HttpStatus.SC_NOT_FOUND) after invoking this constructor since a DAVException is not thrown for all exceptions.

Parameters:
url - URL for the resource
userName - authentication user name
password - password for authentication
Throws:
DAVException - if a DAV Server error occurs.

DAVResource

public DAVResource(java.net.URL url)
            throws DAVException
Creates a DAVResource using a Java URL.

Note that one should check the HTTP status code (e.g. HttpStatus.SC_NOT_FOUND) after invoking this constructor since a DAVException is not thrown for all exceptions.

Parameters:
url - URL for the resource
Throws:
DAVException - if a DAV Server error occurs.

DAVResource

public DAVResource(java.lang.String url,
                   boolean createCollection)
            throws DAVException
Creates a DAVResource using a string URL and boolean flag to indicate whether a collection should be created.

Note that one should check the HTTP status code (e.g. HttpStatus.SC_NOT_FOUND) after invoking this constructor since a DAVException is not thrown for all exceptions.

Parameters:
url - URL for the resource
createCollection - The URL indicates a collection resource
Throws:
DAVException - if a DAV Server error occurs.

DAVResource

public DAVResource(ConnectionInfo cInfo)
            throws DAVException
Creates a DAVResource using the connection information. For internal use only.

Note that one should check the HTTP status code (e.g. HttpStatus.SC_NOT_FOUND) after invoking this constructor since a DAVException is not thrown for all exceptions.

Parameters:
cInfo - The connection information for the resource
Throws:
DAVException - if a DAV Server error occurs.

DAVResource

public DAVResource(ConnectionInfo cInfo,
                   boolean createCollection)
            throws DAVException
Creates a DAVResource using the connection information. For internal use only.

Note that one should check the HTTP status code (e.g. HttpStatus.SC_NOT_FOUND) after invoking this constructor since a DAVException is not thrown for all exceptions.

Parameters:
cInfo - The connection information for the resource
createCollection - create a DAV collection if true
Throws:
DAVException - if a DAV Server error occurs.
Method Detail

setCredentialsProvider

public void setCredentialsProvider(org.apache.http.client.CredentialsProvider credentialsProvider)
Description copied from interface: DAVResourceInterface
Sets a credentials provider. When authentication has failed, the credentials provider is called to provide a set of credentials for authentication. This allows an external agent to provide credentials when original credentials no longer work e.g. one-time passwords.

Specified by:
setCredentialsProvider in interface DAVResourceInterface

makeCollection

public boolean makeCollection()
                       throws DAVException
Makes a collection. This method only works on a null resource (one that doesn't exist yet). One would normally call this method immediately after creating this DAVResource.

Specified by:
makeCollection in interface DAVResourceInterface
Returns:
boolean True is make collection successful, false otherwise.
Throws:
DAVException - in the case of a WebDAV error.

copy

public DAVResource copy(java.lang.String targetPath)
                 throws DAVException,
                        java.rmi.RemoteException
Copies resource to the target destination.

Specified by:
copy in interface DAVResourceInterface
Parameters:
targetPath - location to which current resource is to be copied.
Returns:
If successful, then a new DAVResource representing the new destination is created and returned.
Throws:
DAVException - in the case of a WebDAV error.
java.rmi.RemoteException - in the case of network failures.

delete

public void delete()
            throws DAVException,
                   java.rmi.RemoteException
Deletes this DAV resource.

Specified by:
delete in interface DAVResourceInterface
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

getLock

public java.lang.String getLock(java.lang.String userName)
                         throws DAVException
Gets this DAV resource's lock token for the specified user.

Parameters:
userName - Name of the user whose lock token is desired for this DAV resource.
Returns:
Lock token or null if the specified user does not own the lock for this DAV resource.
Throws:
DAVException - if an error is encountered.

getContents

public byte[] getContents()
                   throws DAVException,
                          java.rmi.RemoteException
Gets the contents of this DAV resource as a byte array.

Specified by:
getContents in interface DAVResourceInterface
Returns:
byte[] The contents of the resource as a byte array
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

getContentsAsString

public java.lang.String getContentsAsString()
                                     throws DAVException,
                                            java.rmi.RemoteException
Gets the contents of this DAV resource as a String.

Specified by:
getContentsAsString in interface DAVResourceInterface
Returns:
String representation of the contents of this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

getContents

public void getContents(java.io.File fileData)
                 throws DAVException,
                        java.rmi.RemoteException
Gets the content of this DAV resource into a file specified as the parameter.

Specified by:
getContents in interface DAVResourceInterface
Parameters:
fileData - The file into which the contents of the resource should be written.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

getContentsInputStream

public java.io.InputStream getContentsInputStream()
                                           throws DAVException,
                                                  java.rmi.RemoteException
Gets the content of this DAV resource as a stream.

Specified by:
getContentsInputStream in interface DAVResourceInterface
Returns:
InputStream The stream representing the content of the resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

getContentType

public java.lang.String getContentType()
Gets the content type of the content for this DAV resource.

Specified by:
getContentType in interface DAVResourceInterface
Returns:
String The content type for this DAV resource
See Also:
DAVResourceInterface.contentType(), DAVResourceInterface.setContentType(String)

contentType

public org.apache.http.entity.ContentType contentType()
Gets the Apache HTTP entity content type of the content for this DAV resource.

Specified by:
contentType in interface DAVResourceInterface
Returns:
Apache HTTP entity content type of the content for this DAV resource or null if no MIME type has been specified.
See Also:
DAVResourceInterface.getContentType(), DAVResourceInterface.setContentType(String)

getDavProperties

public DavPropertyResult getDavProperties()
                                   throws DAVException,
                                          java.rmi.RemoteException
Gets all of the DAV resource's properties using the resource's depth.

Specified by:
getDavProperties in interface DAVResourceInterface
Returns:
DavPropertyResult which has the DAV properties which were returned by the property find method.
Throws:
DAVException - in the case of server failures.
java.rmi.RemoteException - in the case of network failures.
See Also:
DAVResourceInterface.setDepth(int), DAVResourceInterface.getDavProperties(int)

getDavProperties

public DavPropertyResult getDavProperties(int depth)
                                   throws DAVException,
                                          java.rmi.RemoteException
Gets all of the DAV resource's properties for the specified depth.

Specified by:
getDavProperties in interface DAVResourceInterface
Parameters:
depth - The depth on which DAV operations will be based. Specify one of DavConstants.DEPTH_0 or DavConstants.DEPTH_1 or DavConstants.DEPTH_INFINITY.
Returns:
DavPropertyResult which has the DAV properties which were returned by the property find method.
Throws:
DAVException - in the case of server failures.
java.rmi.RemoteException - in the case of network failures.
See Also:
DAVResourceInterface.getDavProperties()

getDavProperties

public DavPropertyResult getDavProperties(PropertyName[] propertyNames)
                                   throws DAVException,
                                          java.rmi.RemoteException
Gets all the properties for the specified property names on the DAV resource.

Specified by:
getDavProperties in interface DAVResourceInterface
Parameters:
propertyNames - Array of property names, specifying which properties should be returned.
Returns:
DavPropertyResult which has the DAV properties which were returned by the property find method.
Throws:
DAVException - in the case of server failures.
java.rmi.RemoteException - in the case of network failures.

getDavProperties

public DavPropertyResult getDavProperties(PropertyName[] propertyNames,
                                          int depth)
                                   throws DAVException,
                                          java.rmi.RemoteException
Gets all the properties for the specified property names on the DAV resource.

Specified by:
getDavProperties in interface DAVResourceInterface
Parameters:
propertyNames - Array of property names, specifying which properties should be returned.
depth - The depth on which DAV operations will be based. Specify one of DavConstants.DEPTH_0 or DavConstants.DEPTH_1 or DavConstants.DEPTH_INFINITY.
Returns:
DavPropertyResult which has the DAV properties which were returned by the property find method.
Throws:
DAVException - in the case of server failures.
java.rmi.RemoteException - in the case of network failures.

getDavProperties

public DavPropertyResult getDavProperties(org.apache.jackrabbit.webdav.property.DavPropertyNameSet davPropertyNameSet,
                                          int depth)
                                   throws DAVException,
                                          java.rmi.RemoteException
Gets the properties for the specified DAV property names and search depth.

Specified by:
getDavProperties in interface DAVResourceInterface
Parameters:
davPropertyNameSet - Set of the names of the DAV properties which should be returned.
depth - The depth on which DAV operations will be based. Specify one of DavConstants.DEPTH_0 or DavConstants.DEPTH_1 or DavConstants.DEPTH_INFINITY.
Returns:
DavPropertyResult which has the DAV properties which were returned by the property find method.
Throws:
DAVException - in the case of server failures.
java.rmi.RemoteException - in the case of network failures.

getDavPropertyNames

public DavPropertyResult getDavPropertyNames()
                                      throws DAVException,
                                             java.rmi.RemoteException
Gets DAV properties for all of a DAV resource's property names.

Specified by:
getDavPropertyNames in interface DAVResourceInterface
Returns:
DavPropertyResult which has the DAV properties which were returned by the property find method.
Throws:
DAVException - in the case of server failures.
java.rmi.RemoteException - in the case of network failures.
See Also:
DAVResourceInterface.getDavPropertyNames(int), DAVResourceInterface.setDepth(int)

getDavPropertyNames

public DavPropertyResult getDavPropertyNames(int depth)
                                      throws DAVException,
                                             java.rmi.RemoteException
Gets DAV properties for all of a DAV resource's property names for the specified depth.

Specified by:
getDavPropertyNames in interface DAVResourceInterface
Returns:
DavPropertyResult which has the DAV properties which were returned by the property find method.
Throws:
DAVException - in the case of server failures.
java.rmi.RemoteException - in the case of network failures.
See Also:
DAVResourceInterface.getDavPropertyNames()

getStatusCode

public int getStatusCode()
                  throws DAVException,
                         java.rmi.RemoteException
Gets the HTTP status code for the last operation/method.

Specified by:
getStatusCode in interface DAVResourceInterface
Returns:
The HTTP status code for the last request on this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

getStatusMessage

public java.lang.String getStatusMessage()
Gets the message associated with the status code for the last operation/method.

Specified by:
getStatusMessage in interface DAVResourceInterface
Returns:
The status message for the last request on this DAV resource.

getURL

public java.net.URL getURL()
                    throws DAVException,
                           java.rmi.RemoteException
Gets the URL that this DAV resource represents.

Specified by:
getURL in interface DAVResourceInterface
Returns:
The URL for this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

isCollection

public boolean isCollection()
                     throws DAVException,
                            java.rmi.RemoteException
Is this DAV resource a collection?

Specified by:
isCollection in interface DAVResourceInterface
Returns:
true if it is a collection, false otherwise.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

isLocked

public boolean isLocked()
                 throws DAVException,
                        java.rmi.RemoteException
Is this DAV resource locked?

Specified by:
isLocked in interface DAVResourceInterface
Returns:
true if it is locked, false otherwise.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

lock

public java.lang.String lock()
                      throws DAVException,
                             java.rmi.RemoteException
Locks this DAV resource.

Specified by:
lock in interface DAVResourceInterface
Returns:
The lock token if the resource is successfully locked.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

move

public DAVResource move(java.lang.String targetPath)
                 throws DAVException,
                        java.rmi.RemoteException
Moves this DAV resource to the location given in the parameter.

Specified by:
move in interface DAVResourceInterface
Parameters:
targetPath - The destination URL for this copy.
Returns:
A DAVResource that represents the new resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

removeProperties

public void removeProperties(PropertyName[] propertyNames)
                      throws DAVException,
                             java.rmi.RemoteException
Removes the properties specified in the parameter.

Specified by:
removeProperties in interface DAVResourceInterface
Parameters:
propertyNames - An array of property names that should be removed.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

removeProperties

public void removeProperties(org.w3c.dom.Element[] propNames)
                      throws DAVException,
                             java.rmi.RemoteException
Removes the properties specified in the parameter.

Specified by:
removeProperties in interface DAVResourceInterface
Parameters:
propNames - An array of property names that should be removed.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

removeProperty

public void removeProperty(org.w3c.dom.Element propName)
                    throws DAVException,
                           java.rmi.RemoteException
Removes the property specified in the parameter.

Specified by:
removeProperty in interface DAVResourceInterface
Parameters:
propName - The name of a property that should be removed from this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

removeProperty

public void removeProperty(java.lang.String propName)
                    throws DAVException,
                           java.rmi.RemoteException
Removes the property specified in the parameter.

Specified by:
removeProperty in interface DAVResourceInterface
Parameters:
propName - The name of a property that should be removed from this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

removeProperty

public void removeProperty(PropertyName propName)
                    throws DAVException,
                           java.rmi.RemoteException
Removes the property specified in the parameter.

Specified by:
removeProperty in interface DAVResourceInterface
Parameters:
propName - The name of a property that should be removed from this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

doSearch

public DavPropertyResult doSearch(org.apache.jackrabbit.webdav.search.SearchInfo searchInfo)
                           throws DAVException,
                                  java.rmi.RemoteException
The SEARCH method invokes one of the implemented search grammars on the server to evaluate the query.

Specified by:
doSearch in interface DAVResourceInterface
Parameters:
searchInfo - The search criteria.
Returns:
DavPropertyResult which has the DAV properties which were returned by the property find method.
Throws:
DAVException - in the case of server failures.
java.rmi.RemoteException - in the case of network failures.

setContents

public void setContents(byte[] contents)
                 throws DAVException,
                        java.rmi.RemoteException
Sets the contents of the resource, passing in a byte array.

Specified by:
setContents in interface DAVResourceInterface
Parameters:
contents - The byte array containing the content for this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

setContents

public void setContents(java.net.URL url)
                 throws DAVException,
                        java.rmi.RemoteException
Sets the contents of the resource, passing in a URL.

Specified by:
setContents in interface DAVResourceInterface
Parameters:
url - A URL that represents the content for this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

setContents

public void setContents(java.lang.String content)
                 throws DAVException,
                        java.rmi.RemoteException
Sets the contents of the resource, passing in a URL.

Specified by:
setContents in interface DAVResourceInterface
Parameters:
content - The string containing the content for this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

setContents

public void setContents(java.io.InputStream is)
                 throws DAVException,
                        java.rmi.RemoteException
Sets the contents of the resource from an input stream. For remote deployment the InputStream should be wrapped in an InputStreamAdapter.

Specified by:
setContents in interface DAVResourceInterface
Parameters:
is - An input stream representing the content for this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

setContentType

public void setContentType(java.lang.String contentType)
                    throws DAVException,
                           java.rmi.RemoteException
Sets the contents type for the content of the resource.

Specified by:
setContentType in interface DAVResourceInterface
Parameters:
contentType - The content type for this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.
See Also:
DAVResourceInterface.contentType(), DAVResourceInterface.getContentType()

setProperties

public void setProperties(org.w3c.dom.Element[] elems)
                   throws DAVException,
                          java.rmi.RemoteException
Sets the values of properties, as given in the parameter.

Specified by:
setProperties in interface DAVResourceInterface
Parameters:
elems - An array of properties to be set on this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

setProperties

public void setProperties(PropertyName[] propNames,
                          java.lang.String[] propValues)
                   throws DAVException,
                          java.rmi.RemoteException
Sets the values of properties, as given in the parameter.

Specified by:
setProperties in interface DAVResourceInterface
Parameters:
propNames - An array of property names to be set on this DAV resource.
propValues - An array of property values to be set on this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

setProperties

public void setProperties(org.w3c.dom.DocumentFragment props)
                   throws DAVException,
                          java.rmi.RemoteException
Sets the values of properties, as given in the parameter.

Specified by:
setProperties in interface DAVResourceInterface
Parameters:
props - An XML document fragment that defines the properties to be set on this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

setProperty

public void setProperty(PropertyName propName,
                        java.lang.String propValue)
                 throws DAVException,
                        java.rmi.RemoteException
Sets the value of a property, as given in the parameter.

Specified by:
setProperty in interface DAVResourceInterface
Parameters:
propName - An property name to be set on this DAV resource.
propValue - A property value to be set on this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

setProperty

public void setProperty(org.w3c.dom.Element prop)
                 throws DAVException,
                        java.rmi.RemoteException
Sets the value of a property, as given in the parameter.

Specified by:
setProperty in interface DAVResourceInterface
Parameters:
prop - An XML element that represents a property to be set on this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

unlock

public void unlock()
            throws DAVException,
                   java.rmi.RemoteException
Unlocks the resource, if previously locked by the same principal.

Specified by:
unlock in interface DAVResourceInterface
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

unlock

public void unlock(java.lang.String lockToken)
            throws DAVException,
                   java.rmi.RemoteException
Unlocks the resource, with the correct locktoken.

Specified by:
unlock in interface DAVResourceInterface
Parameters:
lockToken - The lock token for this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

getOverwrite

public boolean getOverwrite()
Gets the overwrite flag which specifies whether this DAV resource can be overwritten.

Specified by:
getOverwrite in interface DAVResourceInterface
Returns:
true if the overwrite flag is set, false otherwise

setOverwrite

public void setOverwrite(boolean overwrite)
Sets the overwrite flag which specifies whether this DAV resource can be overwritten.

Specified by:
setOverwrite in interface DAVResourceInterface
Parameters:
overwrite - The value of the overwrite flag to set on the resource.

setUserName

public void setUserName(java.lang.String userName)
Set the value for userName. Used in authentication requests to the server

Parameters:
userName - user name

setPassword

public void setPassword(java.lang.String password)
Set the value for password. Used in authentication requests to the server

Parameters:
password - password

setDebug

public void setDebug(int debug)
Set the value for debug.

Parameters:
debug - The debug setting

setDepth

public void setDepth(int depth)
              throws DAVException,
                     java.rmi.RemoteException
Set the value for depth. This is the depth on which DAV operations will be based. They can be one of three values:

Specified by:
setDepth in interface DAVResourceInterface
Parameters:
depth - The depth on which DAV operations will be based. Specify one of DavConstants.DEPTH_0 or DavConstants.DEPTH_1 or DavConstants.DEPTH_INFINITY.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

getDepth

public int getDepth()
Gets the value for depth. This is the depth on which DAV operations will be based. They can be one of three values:

Specified by:
getDepth in interface DAVResourceInterface
Returns:
The depth on which DAV operations will be based.

doOptions

public java.util.Properties doOptions()
                               throws DAVException,
                                      java.rmi.RemoteException
Gets the options as Properties representing the header name/value pairs. The DAV status, allowedMethods and davCapabilities are also updated.

Returns:
Properties keyed by a header name to its value.
Throws:
DAVException - if unable to get the DAV options.
java.rmi.RemoteException - if a communications-related exception occurs.

getAllowedMethods

public java.lang.String[] getAllowedMethods()
Returns a list of methods allowed on this resource.

Returns:
String[] - list of methods allowed on this resource

getDavCapabilities

public java.lang.String[] getDavCapabilities()
Returns a list of DAV capabilities. The DAV header provides information on what DAV functions are supported by the server. Basic DAV support requires the DAV header and a value of "1", but support for locking features would have a value "1,2" for the DAV header. Further capabilities will be added in the future (e.g. access-control). The DAV header is a comma delimited list of capabilities, returned as items in a string array.

Returns:
String[] - DAV capabilities supported by the server

isAuthReqd

protected boolean isAuthReqd()
Returns whether a password is required to connect to this server

Returns:
boolean - true if authentication credentials are required for a connection, false otherwise

SUCCEEDED

public boolean SUCCEEDED()
                  throws java.rmi.RemoteException
Returns whether the last method was successful or not. The HTTP status codes in the range 200-299 are successful. All others indicate some sort of unsuccessful attempt.

Specified by:
SUCCEEDED in interface DAVResourceInterface
Returns:
true if last method was successful, false otherwise.
Throws:
java.rmi.RemoteException - in the case of network failures.

SUCCEEDED

protected static boolean SUCCEEDED(int statusCode)


getMultiStatus

public java.util.Map getMultiStatus()
Returns the multiple status information for the last operation.

Returns:
Map (href to propstat) Multistatus response from the last DAV method.

close

public void close()
           throws java.rmi.RemoteException
Closes the socket used for this connection. This can be useful for servers that have a limit on the number of connections (e.g. IIS), and provides a way to control network resources.

Specified by:
close in interface DAVResourceInterface
Throws:
java.rmi.RemoteException - in the event of network failure.

setTempDir

public void setTempDir(java.lang.String tempDir)
                throws java.rmi.RemoteException
Provides a way to set a directory for temporary files. The java.io.tmp system property can be used to set this value at JVM invocation. If the system property is not set "/temp/" is the default, but can be overridden with this method.

Specified by:
setTempDir in interface DAVResourceInterface
Parameters:
tempDir - Temporary directory for temporary files.
Throws:
java.rmi.RemoteException - in the event of network failure.

getTempDir

public java.lang.String getTempDir()
                            throws java.rmi.RemoteException
Returns the current setting for the directory for temporary files.

Specified by:
getTempDir in interface DAVResourceInterface
Returns:
The temporary directory for temporary files.
Throws:
java.rmi.RemoteException - in the event of network failure.

exists

public boolean exists()
               throws java.rmi.RemoteException
Returns whether the resource exists.

Specified by:
exists in interface DAVResourceInterface
Returns:
true if resource exists, false otherwise.
Throws:
java.rmi.RemoteException - in the event of network failure.

doReport

public DavPropertyResult doReport(org.apache.jackrabbit.webdav.version.report.ReportInfo reportInfo)
                           throws DAVException
Gets a report on the current DAV resource. The ReportInfo parameter specifies the following information.

Specified by:
doReport in interface DAVResourceInterface
Parameters:
reportInfo - Information which specifies the desired report.
Returns:
DavPropertyResult which has the DAV properties which were returned by the property report method.
Throws:
DAVException - in the case of server failures.

getACL

public java.lang.String getACL()
                        throws DAVException,
                               java.rmi.RemoteException
Gets the access control list (ACL) for this DAV resource.

Specified by:
getACL in interface DAVResourceInterface
Returns:
String An XML serialized document describing the ACL for this DAV resource.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.
See Also:
DAVResourceInterface.getAcl(), DAVResourceInterface.setACL(String)

getAcl

public com.sas.services.webdav.Acl getAcl()
                                   throws DAVException,
                                          java.rmi.RemoteException
Gets the access control list for this DAV resource.

Specified by:
getAcl in interface DAVResourceInterface
Returns:
The access control list for this DAV resource.
Throws:
DAVException - in the case of a WebDAV error.
java.rmi.RemoteException - in the case of network failures.
See Also:
DAVResourceInterface.getACL(), DAVResourceInterface.setAcl(Acl)

setACL

public java.lang.String setACL(java.lang.String acl)
                        throws DAVException,
                               java.rmi.RemoteException
Set/Update the Access Control List for this DAV resource.

Specified by:
setACL in interface DAVResourceInterface
Parameters:
acl - An XML serialized document describing the ACL for this DAV resource.
Returns:
Document The result document from the ACL method or null if there was no response document.
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.
See Also:
DAVResourceInterface.getACL()

setAcl

public java.lang.String setAcl(com.sas.services.webdav.Acl acl)
                        throws DAVException,
                               java.rmi.RemoteException
Sets the access control list for this DAV resource.

Specified by:
setAcl in interface DAVResourceInterface
Parameters:
acl - The access control list to set for this DAV resource.
Returns:
The string representation of the access control list or null if there was no response document.
Throws:
DAVException - in the case of a WebDAV error.
java.rmi.RemoteException - in the case of network failures.
See Also:
DAVResourceInterface.getAcl()

setPath

public void setPath(java.lang.String path)
Sets the path for this DAV resource. If the resource was originally created as http://server/origpath, then calling this method will change the resource path to http://server/path. This allows the same DAVResource object to be used for any WebDAV resource.

Specified by:
setPath in interface DAVResourceInterface
Parameters:
path - The new path for the WebDAV resource.

getPath

public java.lang.String getPath()
Gets the path for the WebDAV resource that is currently represented by this DAVResource.

Specified by:
getPath in interface DAVResourceInterface
Returns:
The current path for this DAV resource.

doControl

public void doControl()
               throws DAVException,
                      java.rmi.RemoteException
Puts the resource under version control.

Specified by:
doControl in interface DAVResourceInterface
Throws:
DAVException - in the case of a WebDAV error.
java.rmi.RemoteException - in the case of network failures.

getPreviousVersionNames

public java.util.List getPreviousVersionNames()
                                       throws DAVException,
                                              java.rmi.RemoteException
Gets a list of previous version names for this DAV resource.

Specified by:
getPreviousVersionNames in interface DAVResourceInterface
Returns:
List(String) The version names for this DAV resource.
Throws:
DAVException - in the case of a WebDAV error.
java.rmi.RemoteException - in the case of network failures.

doCheckout

public void doCheckout()
                throws DAVException,
                       java.rmi.RemoteException
Checks out this DAV resource.

Specified by:
doCheckout in interface DAVResourceInterface
Throws:
DAVException - in the case of a WebDAV error.
java.rmi.RemoteException - in the case of network failures.

doLabel

public void doLabel(int labelAction,
                    java.lang.String label)
             throws DAVException,
                    java.rmi.RemoteException
Modifies the version label on the resource (if this is supported by the server).

Specified by:
doLabel in interface DAVResourceInterface
Parameters:
labelAction - Specifies the action which is to be executed.
  • LabelInfo#TYPE_SET
  • LabelInfo#TYPE_REMOVE
  • LabelInfo#TYPE_ADD
label - The value of the label.
Throws:
DAVException - in the case of a WebDAV error.
java.rmi.RemoteException - in the case of network failures.
See Also:
DAVResourceInterface.doLabel(int, String, int)

doLabel

public void doLabel(int labelAction,
                    java.lang.String label,
                    int depth)
             throws DAVException,
                    java.rmi.RemoteException
Modifies the label on the version resource (if this is supported by the server).

Specified by:
doLabel in interface DAVResourceInterface
Parameters:
labelAction - Specifies the action which is to be executed.
  • LabelInfo#TYPE_SET
  • LabelInfo#TYPE_REMOVE
  • LabelInfo#TYPE_ADD
label - The value of the label.
depth - The depth.
Throws:
DAVException - in the case of a WebDAV error.
java.rmi.RemoteException - in the case of network failures.
See Also:
DAVResourceInterface.doLabel(int, String)

doCheckin

public void doCheckin()
               throws DAVException,
                      java.rmi.RemoteException
Check in this DAV resource.

Specified by:
doCheckin in interface DAVResourceInterface
Throws:
DAVException - in the case of a WebDAV error.
java.rmi.RemoteException - in the case of network failures.

doUncheckout

public void doUncheckout()
                  throws DAVException,
                         java.rmi.RemoteException
Uncheckout this DAV resource, canceling a previous checkout.

Specified by:
doUncheckout in interface DAVResourceInterface
Throws:
DAVException - in the case of a WebDAV error.
java.rmi.RemoteException - in the case of network failures.

getCheckedIn

public com.sas.services.webdav.Version getCheckedIn()
                                             throws DAVException,
                                                    java.rmi.RemoteException
Retrieves the currently checked in resource.

Specified by:
getCheckedIn in interface DAVResourceInterface
Returns:
Version An object describing the version that is checked in.
Throws:
DAVException - in the case of a WebDAV error.
java.rmi.RemoteException - in the case of network failures.

getCheckedOut

public com.sas.services.webdav.Version getCheckedOut()
                                              throws DAVException,
                                                     java.rmi.RemoteException
Retrieves the currently checked out resource.

Specified by:
getCheckedOut in interface DAVResourceInterface
Returns:
Version An object describing the version that is checked out.
Throws:
DAVException - in the case of a WebDAV error.
java.rmi.RemoteException - in the case of network failures.

getVersion

public com.sas.services.webdav.Version getVersion(java.lang.String versionName)
                                           throws DAVException
Gets a particular version of this DAV resource.

Specified by:
getVersion in interface DAVResourceInterface
Parameters:
versionName - Which version to retrieve for this DAV resource.
Returns:
Version An object describing the version of this DAV resource.
Throws:
DAVException - in the case of a WebDAV error.

setExistsRequirement

public void setExistsRequirement(int requirement)
Sets the existence requirement.

Specified by:
setExistsRequirement in interface DAVResourceInterface
Parameters:
requirement - 0 if we don't care or 1 if it must exist or 2 if it must not exist.

getExistsRequirement

public int getExistsRequirement()
Gets the existence requirement.

Specified by:
getExistsRequirement in interface DAVResourceInterface
Returns:
0 if we don't care or 1 if it must exist or 2 if it must not exist.

getChildrenList

public java.util.List<java.lang.String> getChildrenList(java.lang.String path)
Gets the list of children. If this is not a collection, or is an empty collection the returned list will be empty. Otherwise, it will contain the path for each child in the collection.

Specified by:
getChildrenList in interface DAVResourceInterface
Parameters:
path - The path of this DAV resource.
Returns:
List (of String) The paths for the children.

getChildrenProperties

public java.util.Map<java.lang.String,PropertyMap> getChildrenProperties(PropertyName[] properties)
                                                                  throws DAVException,
                                                                         java.rmi.RemoteException
Get all the properties of a collection's members (depth=1) in as single server request. This does not bind to each one of the items in the collection and is a quick way to find out what items are in the collection without fetching each one.

Returns:
Map (maps String representation of a URL to (Map of String property name to its String value)) which is the property map for all the items in this collection.
Throws:
DAVException - in the case of a WebDAV error.
java.rmi.RemoteException - in the case of a network error.

extractPath

public static java.lang.String extractPath(java.lang.String url)
Extract the path (query and fragment identifier from a URL). This method does not use the URL/URI classes and simply scans for the right location of the beginning of the path.

Parameters:
url - The URL from which the path should be extracted
Returns:
String Everything after the beginning of the path in the supplied URL.

unencodePath

public static java.lang.String unencodePath(java.lang.String path)
Unencode the path.

Parameters:
path - The URL from which the path should be extracted.
Returns:
String Everything after the beginning of the path in the supplied URL.

getPropertyMap

public PropertyMap getPropertyMap()
                           throws java.rmi.RemoteException,
                                  DAVException
Returns a property map of the resources properties.

Returns:
PropertyMap A map containing the properties for this resource
Throws:
DAVException - in the event of WebDAV errors
java.rmi.RemoteException - in the case of network errors

***  This class provides Binary Compatibility only, not Source Compatibility  ***




Copyright © 2009 SAS Institute Inc. All Rights Reserved.