***  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

public class DAVResource
implements DAVResourceInterface

A DAVResource represents a WebDAV (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), userid, password, proxy host, proxy port, proxy userid, 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 c = new ConnectionInfo("http://http-server/path-to-resource", "user", "pwd");
     // proxy information, if required
     c.setProxyHost("myproxy.com");
     c.setProxyPort(3100);

     DAVResource r1 = new DAVResource(c, logger);
     r1.setProperty(...);
     if (r1.getStatusCode() != 200) out.println(r1.getStatusMessage());
 } catch (DAVException e) { e.printStackTrace(); }
 
In order to create a collection use the longer form of the constructor. For example,
 DAVResource r2 = new DAVResource(c, true, logger);
 
this will ensure that r2 is a collection resource (it may contain other resources). Alternatively do this in two steps
 DAVResource r2 = new DAVResource(c, logger);
 r2.makeCollection();
 

Since:
1.0

Field Summary
static int DONT_CARE
           
static int MUST_EXIST
           
static int MUST_NOT_EXIST
           
 
Constructor Summary
DAVResource(ConnectionInfo cInfo)
          Create a DAVResource using the connection information.
DAVResource(ConnectionInfo cInfo, boolean createCollection)
          Create a DAVResource using the connection information.
DAVResource(ConnectionInfo cInfo, boolean createCollection, java.lang.Object logger)
          Deprecated. As of release 9.3, replaced by DAVResource(ConnectionInfo, boolean)
DAVResource(ConnectionInfo cInfo, java.lang.Object logger)
          Deprecated. As of release 9.3, replaced by DAVResource(ConnectionInfo)
DAVResource(java.lang.String url)
          Create a DAVResource using a string URL.
DAVResource(java.lang.String url, boolean createCollection)
          Create a DAVResource using a string URL and boolean flag to indicate whether a collection should be created or not.
DAVResource(java.lang.String url, boolean createCollection, java.lang.String userName, java.lang.String password)
          Deprecated. As of release 9.3, replaced by DAVResource(ConnectionInfo, boolean)
DAVResource(java.lang.String url, boolean createCollection, java.lang.String userName, java.lang.String password, java.lang.Object logger)
          Deprecated. As of release 9.3, replaced by DAVResource(ConnectionInfo, boolean)
DAVResource(java.lang.String url, java.lang.Object logger)
          Deprecated. As of release 9.3, replaced by DAVResource(String)
DAVResource(java.lang.String url, java.lang.String userName, java.lang.String password)
          Create a DAVResource using a string URL, userName and password.
DAVResource(java.lang.String url, java.lang.String userName, java.lang.String password, java.lang.Object logger)
          Deprecated. As of release 9.3, replaced by DAVResource(String, String, String)
DAVResource(java.net.URL url)
          Create a DAVResource using a Java URL.
 
Method Summary
 void close()
          Close the connection used by this DAVResource
 DAVResource copy(java.lang.String targetPath)
          Copy resource to the target path on the same host as the source.
 void delete()
          Deletes the current resource.
protected  org.apache.webdav.lib.WebdavState discoverLock(java.lang.String owner, java.lang.String path, org.apache.webdav.lib.WebdavState state)
          Discover the given owner and locktoken and set the locktoken
 void doCheckin()
          Check in this resource.
 void doCheckout()
          Checks out this resource.
 void doControl()
          Puts the resource until version control.
 void doLabel(int labelAction, java.lang.String label)
          Modify the version label on the resource (if this is supported by the server).
 java.util.Properties doOptions()
           
 void doUncheckout()
          Uncheckout this resource, cancelling a previous checkout.
 boolean exists()
          Returns whether the resource exists or not
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()
          Get the Access Control List for this resource.
 java.lang.String getACL()
          Get the Access Control List for this resource.
 org.apache.webdav.lib.Lock getActiveLockFor(java.lang.String owner)
          Get an active lock, if it exists, for the owner
 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 getChildrenList(java.lang.String path)
          Get a list of children.
 java.util.Map getChildrenProperties(PropertyName[] properties)
          Get all the properties of a collection's members (depth=1) in as single server request.
 byte[] getContents()
          Returns the contents of the resource as a byte array.
 void getContents(java.io.File fileData)
          Returns the contents of the resource into the supplied file.
 java.lang.String getContentsAsString()
          Return the contents of the resource as a String.
 java.io.InputStream getContentsInputStream()
          Returns the contents of the resource as an InputStream
 java.lang.String getContentType()
          Return the content type of the content for this resource
 java.util.Set getCurrentUserPrivilegeSet()
          Get a the current list of privileges this user has for this resource.
 java.lang.String[] getDavCapabilities()
          Returns a list of DAV capabilties.
 int getDepth()
          Get the value for depth.
 int getExistsRequirement()
           
 org.apache.log4j.Logger getLogger()
          Returns the logger currently being used by DAVResource.
 java.util.Map getMultiStatus()
          Return the multistatus information for the last operation.
 boolean getOverwrite()
          Get value for overWrite
 java.lang.String getPath()
          Get 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 resource.
 org.apache.webdav.lib.Property[] getProperties()
          Returns all the properties on the DAV resource
 org.apache.webdav.lib.Property[] getProperties(org.w3c.dom.Element[] propNames)
          Returns all the properties specified in the parameter on the DAV resource
 org.apache.webdav.lib.Property[] getProperties(PropertyName[] propNames)
          Returns all the properties specified in the parameter on the DAV resource
 org.apache.webdav.lib.Property[] getProperties(java.lang.String propNames)
          Returns properties for a given set of property names.
 org.apache.webdav.lib.Property[] getProperty(org.w3c.dom.Element propName)
          Returns the property specified in the parameter on the DAV resource
 org.apache.webdav.lib.Property[] getProperty(PropertyName propName)
          Returns a property for a given property name.
 org.apache.webdav.lib.Property[] getProperty(java.lang.String propName)
          Returns a property for a given property name.
 PropertyMap getPropertyMap()
          Returns a property map of the resources properties.
 org.apache.webdav.lib.Property[] getPropertyNames()
          Returns a list of property names for the resource
 int getStatusCode()
          Returns the status code for the last operation
 java.lang.String getStatusMessage()
          Returns the status message for the last operation.
 com.sas.services.webdav.TreeNode getSupportedPrivilegeSet()
          Get a list of privileges that apply to this resource.
 java.lang.String getTempDir()
          Gets the current value of the directory used for temporary files.
 java.net.URL getURL()
          Returns the URL that this DAV Resource represents
 com.sas.services.webdav.Version getVersion(java.lang.String versionName)
          Gets a particular version of this resource
protected  boolean isAuthReqd()
          Returns whether a password is required to connect to this server
 boolean isCollection()
          Returns whether this resource is a collection or not
 boolean isLocked()
          Returns whether this resource is locked or not
 java.lang.String lock()
          Locks the resource
 boolean makeCollection()
          Make a collection.
 DAVResource move(java.lang.String targetPath)
          Move this resource to another location (path) on the same server as the source.
 void removeProperties(org.w3c.dom.Element[] props)
          Remove/delete properties from a resource
 void removeProperties(PropertyName[] props)
          Remove/delete properties from a resource
 void removeProperty(org.w3c.dom.Element prop)
          Remove/delete properties from a resource
 void removeProperty(PropertyName prop)
          Remove/delete a property from a resource
 void removeProperty(java.lang.String prop)
          Remove/delete properties from a resource
 org.apache.webdav.lib.Property[] report(java.lang.String body)
          Run a report on the current resource.
 org.apache.webdav.lib.Property[] search(org.w3c.dom.Element searchQuery)
          The SEARCH method invokes one of the implemented search grammars on the server to evaluate the query.
 org.apache.webdav.lib.Property[] search(java.lang.String searchString)
          The SEARCH method invokes one of the implemented search grammars on the server to evaluate the query.
 java.lang.String setAcl(com.sas.services.webdav.Acl acl)
          Set/Update the Access Control List for this resource.
 java.lang.String setACL(java.lang.String acl)
          Set/Update the Access Control List for this resource.
 void setContents(byte[] contents)
          Provide content for the resource.
 void setContents(java.io.InputStream is)
          Set the content from an InputStream.
 void setContents(java.lang.String content)
          Set the contents of the resource, passing in a URL
 void setContents(java.net.URL url)
          Set the content for the resource from an URL
 void setContentType(java.lang.String contentType)
          Set the contents type for the content of the resource
 void setDebug(int debug)
          Set the value for debug.
 void setDepth(int depth)
          Set the value for depth.
 void setEscapedPath(java.lang.String escapedPath)
          Set the path for this resource using an escaped string.
 void setExistsRequirement(int requirement)
           
 void setLogger(java.lang.Object logger)
          This method no longer has any effect.
 void setOverwrite(boolean overwrite)
          Set the value for overWrite
 void setPassword(java.lang.String password)
          Set the value for password.
 void setPath(java.lang.String path)
          Set the path for this resource.
 void setPathNoAction(java.lang.String path)
          Deprecated.  
 void setProperties(org.w3c.dom.DocumentFragment doc)
          Set properties on the resource
 void setProperties(org.w3c.dom.Element[] elems)
          Set properties on the resource
 void setProperties(PropertyName[] props, java.lang.String[] propValues)
          Set properties on the resource
 void setProperty(org.w3c.dom.Element elem)
          Set a property on the resource
 void setProperty(PropertyName prop, java.lang.String propValue)
          Set a property on the resource
 void setSessionContext(java.lang.Object sessionContext)
          Deprecated.  
 void setTempDir(java.lang.String tempDir)
          Sets the temp directory used for storing 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)
          Returns whether the statusCode parameter represents success or not.
static java.lang.String unencodePath(java.lang.String path)
          Unencode the path.
 void unlock()
          Unlock a resource
 void unlock(java.lang.String lockToken)
          Unlock a resource
 

Field Detail

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
Create a DAVResource using a string URL.

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

DAVResource

public DAVResource(java.lang.String url,
                   java.lang.Object logger)
            throws DAVException
Deprecated. As of release 9.3, replaced by DAVResource(String)

Create a DAVResource using a string URL. DAVResource will use the Logger for logging.

Parameters:
url - URL for the resource
logger - This is ignored since we no longer use Logging Service.
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
Create a DAVResource using a string URL, userName and password.

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.lang.String url,
                   java.lang.String userName,
                   java.lang.String password,
                   java.lang.Object logger)
            throws DAVException
Deprecated. As of release 9.3, replaced by DAVResource(String, String, String)

Create a DAVResource using a string URL, userName and password. The specified logger will be used to log DAV activity.

Parameters:
url - URL for the resource
userName - authentication user name
password - password for authentication
logger - This is ignored since we no longer use Logging Service.
Throws:
DAVException - if a DAV Server error occurs.

DAVResource

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

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
Create a DAVResource using a string URL and boolean flag to indicate whether a collection should be created or not.

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

DAVResource

public DAVResource(java.lang.String url,
                   boolean createCollection,
                   java.lang.String userName,
                   java.lang.String password)
            throws DAVException
Deprecated. As of release 9.3, replaced by DAVResource(ConnectionInfo, boolean)

Create a DAVResource using a string URL. This constructor can also create a collection if createCollection is true

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

DAVResource

public DAVResource(java.lang.String url,
                   boolean createCollection,
                   java.lang.String userName,
                   java.lang.String password,
                   java.lang.Object logger)
            throws DAVException
Deprecated. As of release 9.3, replaced by DAVResource(ConnectionInfo, boolean)

Create a DAVResource using a string URL. This constructor can also create a collection if createCollection is true. The logger is ignored since we no longer use Logging Service.

Parameters:
url - URL for the resource
createCollection - create a DAV collection if true
userName - authentication user name
password - password for authentication
logger - This is ignored.
Throws:
DAVException - if a DAV Server error occurs.

DAVResource

public DAVResource(ConnectionInfo cInfo,
                   java.lang.Object logger)
            throws DAVException
Deprecated. As of release 9.3, replaced by DAVResource(ConnectionInfo)

Create a DAVResource using the connection information. The logger is ignored.

Parameters:
cInfo - The connection information for the resource
logger - Ignored since we no longer use Logging Service.
Throws:
DAVException - if a DAV Server error occurs.

DAVResource

public DAVResource(ConnectionInfo cInfo,
                   boolean createCollection,
                   java.lang.Object logger)
            throws DAVException
Deprecated. As of release 9.3, replaced by DAVResource(ConnectionInfo, boolean)

Create a DAVResource using the connection information. The logger is ignored.

Parameters:
cInfo - The connection information for the resource
createCollection - create a DAV collection if true
logger - ignored since we no longer use Logging Service.
Throws:
DAVException - if a DAV Server error occurs.

DAVResource

public DAVResource(ConnectionInfo cInfo)
            throws DAVException
Create a DAVResource using the connection information. The logger is ignored. For internal use only

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
Create a DAVResource using the connection information. The logger is ignored. For internal use only

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

makeCollection

public boolean makeCollection()
                       throws DAVException
Make 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 the DAVResource.

Specified by:
makeCollection in interface DAVResourceInterface
Returns:
boolean True if make collection succeeded, false otherwise
Throws:
DAVException - in the case of server failures

copy

public DAVResource copy(java.lang.String targetPath)
                 throws DAVException,
                        java.rmi.RemoteException
Copy resource to the target path on the same host as the source.

Specified by:
copy in interface DAVResourceInterface
Parameters:
targetPath - The path 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 server failures
java.rmi.RemoteException - in the case of network failures

delete

public void delete()
            throws DAVException,
                   java.rmi.RemoteException
Deletes the current resource.

Specified by:
delete in interface DAVResourceInterface
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

getActiveLockFor

public org.apache.webdav.lib.Lock getActiveLockFor(java.lang.String owner)
                                            throws DAVException
Description copied from interface: DAVResourceInterface
Get an active lock, if it exists, for the owner

Specified by:
getActiveLockFor in interface DAVResourceInterface
Parameters:
owner - The owner for which the lock is being sought
Returns:
Lock The lock for this owner if it exists
Throws:
DAVException - in the event of a WebDAV failure.

getContents

public byte[] getContents()
                   throws DAVException,
                          java.rmi.RemoteException
Returns the contents of the resource as a byte array. This method assumes there is a limit on the length of the content and therefore uses memory to buffer the content. If the content is large or memory buffering is not desirable, then use the other getContentxxx methods for streaming content.

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

getContentsAsString

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

Specified by:
getContentsAsString in interface DAVResourceInterface
Returns:
String The contents of the 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
Returns the contents of the resource into the supplied file.

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

getContentsInputStream

public java.io.InputStream getContentsInputStream()
                                           throws DAVException,
                                                  java.rmi.RemoteException
Returns the contents of the resource as an InputStream

Specified by:
getContentsInputStream in interface DAVResourceInterface
Returns:
java.io.InputStream
Throws:
DAVException - in the case of a WebDAV error
java.rmi.RemoteException - in the case of a network failure

getContentType

public java.lang.String getContentType()
                                throws DAVException,
                                       java.rmi.RemoteException
Return the content type of the content for this resource

Specified by:
getContentType in interface DAVResourceInterface
Returns:
String The content type for this resource
Throws:
DAVException - in the event of a WebDAV failure.
java.rmi.RemoteException - in the event of network failure.

getProperties

public org.apache.webdav.lib.Property[] getProperties()
                                               throws DAVException,
                                                      java.rmi.RemoteException
Returns all the properties on the DAV resource

Specified by:
getProperties in interface DAVResourceInterface
Returns:
Array of DAV properties
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

getProperty

public org.apache.webdav.lib.Property[] getProperty(org.w3c.dom.Element propName)
                                             throws DAVException,
                                                    java.rmi.RemoteException
Returns the property specified in the parameter on the DAV resource

Specified by:
getProperty in interface DAVResourceInterface
Parameters:
propName - property name elements - specifying which property value should be returned
Returns:
Array of DAV properties
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

getProperties

public org.apache.webdav.lib.Property[] getProperties(org.w3c.dom.Element[] propNames)
                                               throws DAVException,
                                                      java.rmi.RemoteException
Returns all the properties specified in the parameter on the DAV resource

Specified by:
getProperties in interface DAVResourceInterface
Parameters:
propNames - Array of property name elements - specifying which property values should be returned
Returns:
Array of DAV properties
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

getProperty

public org.apache.webdav.lib.Property[] getProperty(PropertyName propName)
                                             throws DAVException,
                                                    java.rmi.RemoteException
Returns a property for a given property name. It is possible to return multiple property objects as the resouce might represent a collection.

Specified by:
getProperty in interface DAVResourceInterface
Parameters:
propName - name of property for which value should be returned
Returns:
Array of DAV properties
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

getProperties

public org.apache.webdav.lib.Property[] getProperties(PropertyName[] propNames)
                                               throws DAVException,
                                                      java.rmi.RemoteException
Returns all the properties specified in the parameter on the DAV resource

Specified by:
getProperties in interface DAVResourceInterface
Parameters:
propNames - Array of property names, specifying which property values should be returned
Returns:
Array of DAV properties
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

getProperty

public org.apache.webdav.lib.Property[] getProperty(java.lang.String propName)
                                             throws DAVException,
                                                    java.rmi.RemoteException
Returns a property for a given property name. It is possible to return multiple property objects as the resouce might represent a collection.

Specified by:
getProperty in interface DAVResourceInterface
Parameters:
propName - name of property for which value should be returned
Returns:
Array of DAV properties
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

getProperties

public org.apache.webdav.lib.Property[] getProperties(java.lang.String propNames)
                                               throws DAVException,
                                                      java.rmi.RemoteException
Returns properties for a given set of property names. Multiple properties from multiple resources might be returned as the resouce might represent a collection.

Specified by:
getProperties in interface DAVResourceInterface
Parameters:
propNames - names of properties for which values should be returned
Returns:
Array of DAV properties
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

getPropertyNames

public org.apache.webdav.lib.Property[] getPropertyNames()
                                                  throws DAVException,
                                                         java.rmi.RemoteException
Returns a list of property names for the resource

Specified by:
getPropertyNames in interface DAVResourceInterface
Returns:
Array of DAV properties
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

getStatusCode

public int getStatusCode()
                  throws DAVException,
                         java.rmi.RemoteException
Returns the status code for the last operation

Specified by:
getStatusCode in interface DAVResourceInterface
Returns:
status code for DAV Resource
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

getStatusMessage

public java.lang.String getStatusMessage()
Returns the status message for the last operation. Text for statusCode.

Specified by:
getStatusMessage in interface DAVResourceInterface
Returns:
status message for DAV Resource

getURL

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

Specified by:
getURL in interface DAVResourceInterface
Returns:
url for resource
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

isCollection

public boolean isCollection()
                     throws DAVException,
                            java.rmi.RemoteException
Returns whether this resource is a collection or not

Specified by:
isCollection in interface DAVResourceInterface
Returns:
isCollection ?
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

isLocked

public boolean isLocked()
                 throws DAVException,
                        java.rmi.RemoteException
Returns whether this resource is locked or not

Specified by:
isLocked in interface DAVResourceInterface
Returns:
isLocked ?
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

lock

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

Specified by:
lock in interface DAVResourceInterface
Returns:
String The lock token for the successfully applied lock
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

move

public DAVResource move(java.lang.String targetPath)
                 throws DAVException,
                        java.rmi.RemoteException
Move this resource to another location (path) on the same server as the source.

Specified by:
move in interface DAVResourceInterface
Parameters:
targetPath - The target path where the resource will be moved
Returns:
If successful, then a new DAVResource representing the new destination is created and returned
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

removeProperties

public void removeProperties(PropertyName[] props)
                      throws DAVException,
                             java.rmi.RemoteException
Remove/delete properties from a resource

Specified by:
removeProperties in interface DAVResourceInterface
Parameters:
props - names of the properties to remove
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

removeProperties

public void removeProperties(org.w3c.dom.Element[] props)
                      throws DAVException,
                             java.rmi.RemoteException
Remove/delete properties from a resource

Specified by:
removeProperties in interface DAVResourceInterface
Parameters:
props - names of the properties to remove
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

removeProperty

public void removeProperty(org.w3c.dom.Element prop)
                    throws DAVException,
                           java.rmi.RemoteException
Remove/delete properties from a resource

Specified by:
removeProperty in interface DAVResourceInterface
Parameters:
prop - property to remove
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

removeProperty

public void removeProperty(java.lang.String prop)
                    throws DAVException,
                           java.rmi.RemoteException
Remove/delete properties from a resource

Specified by:
removeProperty in interface DAVResourceInterface
Parameters:
prop - property to remove
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

removeProperty

public void removeProperty(PropertyName prop)
                    throws DAVException,
                           java.rmi.RemoteException
Remove/delete a property from a resource

Specified by:
removeProperty in interface DAVResourceInterface
Parameters:
prop - name of the property to remove
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

search

public org.apache.webdav.lib.Property[] search(java.lang.String searchString)
                                        throws DAVException,
                                               java.rmi.RemoteException
The SEARCH method invokes one of the implemented search grammars on the server to evaluate the query.

Specified by:
search in interface DAVResourceInterface
Parameters:
searchString - A string in the correct format for the grammar selected. This will be passed to the server in the body of the of the SEARCH method.
Returns:
Property[] An array of properties that satisfy the query
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

search

public org.apache.webdav.lib.Property[] search(org.w3c.dom.Element searchQuery)
                                        throws DAVException,
                                               java.rmi.RemoteException
The SEARCH method invokes one of the implemented search grammars on the server to evaluate the query.

Specified by:
search in interface DAVResourceInterface
Parameters:
searchQuery - An XML representation of the query
Returns:
Property[] An array of properties that satisfy the query
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
Provide content for the resource. This will result in a PUT to the resource.

Specified by:
setContents in interface DAVResourceInterface
Parameters:
contents - byte array for the resource contents
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

setContents

public void setContents(java.net.URL url)
                 throws DAVException,
                        java.rmi.RemoteException
Set the content for the resource from an URL

Specified by:
setContents in interface DAVResourceInterface
Parameters:
url - The URL for the contents to be PUT to this resource
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

setContents

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

Specified by:
setContents in interface DAVResourceInterface
Parameters:
content - The string containing the content for this 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
Set the content from an InputStream. As this information might be required more than once (eg. authorization required or a network error), the contents of the stream will be buffered in a temporary file, which will then be sent. For remote deployment the InputStream should be wrapped in an InputStreamAdapter

Specified by:
setContents in interface DAVResourceInterface
Parameters:
is - The input stream that contains the content.
Throws:
DAVException - in the case of a WebDAV error
java.rmi.RemoteException - in the case of a network failure

setContentType

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

Specified by:
setContentType in interface DAVResourceInterface
Parameters:
contentType - The content type for this 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.Element[] elems)
                   throws DAVException,
                          java.rmi.RemoteException
Set properties on the resource

Specified by:
setProperties in interface DAVResourceInterface
Parameters:
elems - an array of DOM2 elements that identify the properties to set on the resource
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

setProperties

public void setProperties(PropertyName[] props,
                          java.lang.String[] propValues)
                   throws DAVException,
                          java.rmi.RemoteException
Set properties on the resource

Specified by:
setProperties in interface DAVResourceInterface
Parameters:
props - property names
propValues - property values (which will be escaped unless it is a CDATA section)
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

setProperties

public void setProperties(org.w3c.dom.DocumentFragment doc)
                   throws DAVException,
                          java.rmi.RemoteException
Set properties on the resource

Specified by:
setProperties in interface DAVResourceInterface
Parameters:
doc - document fragment containing elements that represent the properties to be set on the resource
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

setProperty

public void setProperty(PropertyName prop,
                        java.lang.String propValue)
                 throws DAVException,
                        java.rmi.RemoteException
Set a property on the resource

Specified by:
setProperty in interface DAVResourceInterface
Parameters:
prop - name of the property
propValue - value of the property (which will be escaped unless it is a CDATA section)
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

setProperty

public void setProperty(org.w3c.dom.Element elem)
                 throws DAVException,
                        java.rmi.RemoteException
Set a property on the resource

Specified by:
setProperty in interface DAVResourceInterface
Parameters:
elem - an XML element that represents the property name and value
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

unlock

public void unlock()
            throws DAVException,
                   java.rmi.RemoteException
Unlock a resource

Specified by:
unlock in interface DAVResourceInterface
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

unlock

public void unlock(java.lang.String lockToken)
            throws DAVException,
                   java.rmi.RemoteException
Unlock a resource

Specified by:
unlock in interface DAVResourceInterface
Parameters:
lockToken - The lock token for the resource
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

getOverwrite

public boolean getOverwrite()
Get value for overWrite

Specified by:
getOverwrite in interface DAVResourceInterface
Returns:
overWrite

setOverwrite

public void setOverwrite(boolean overwrite)
Set the value for overWrite

Specified by:
setOverwrite in interface DAVResourceInterface
Parameters:
overwrite - Overwrite flag

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: DepthSupport is in org.apache.webdav.lib.methods

Specified by:
setDepth in interface DAVResourceInterface
Parameters:
depth - org.apache.webdav.lib.methods.DepthSupport
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

getDepth

public int getDepth()
Get the value for depth. This is the depth on which DAV operations will be based. They can be one of three values: DepthSupport is in org.apache.webdav.lib.methods

Specified by:
getDepth in interface DAVResourceInterface
Returns:
org.apache.webdav.lib.methods.DepthSupport

doOptions

public java.util.Properties doOptions()
                               throws DAVException,
                                      java.rmi.RemoteException
Throws:
DAVException
java.rmi.RemoteException

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 capabilties. 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 (eg. access-control). The DAV header is a comma delimited list of capabilites, 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 connnection, 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:
boolean - 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)
Returns whether the statusCode parameter represents success or not. The HTTP status codes in the range 200-299 are successful. All others indicate some sort of unsuccessful attempt.

Parameters:
statusCode - A status code to be checked for success or failure
Returns:
boolean - true if statusCode is successful, false otherwise

setLogger

public void setLogger(java.lang.Object logger)
This method no longer has any effect. We no longer use the Logging Service.

Parameters:
logger - The logger.

getLogger

public org.apache.log4j.Logger getLogger()
Returns the logger currently being used by DAVResource.

Returns:
Logger The logger that is currently being used

getMultiStatus

public java.util.Map getMultiStatus()
Return the multistatus 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
Close the connection used by this DAVResource

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

setTempDir

public void setTempDir(java.lang.String tempDir)
                throws java.rmi.RemoteException
Sets the temp directory used for storing files. The default is set to the value of the Java system variable java.io.tmpdir, but if required can be changed for a particular instance using this method.

Specified by:
setTempDir in interface DAVResourceInterface
Parameters:
tempDir - The directory to be used for temporary files
Throws:
java.rmi.RemoteException - in the case of network failures

getTempDir

public java.lang.String getTempDir()
                            throws java.rmi.RemoteException
Gets the current value of the directory used for temporary files. The initial value of this field is taken from the Java system variable java.io.tmpdir, but may have been changed.

Specified by:
getTempDir in interface DAVResourceInterface
Returns:
String The directory used for temporary files
Throws:
java.rmi.RemoteException - in the case of network failures

exists

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

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

report

public org.apache.webdav.lib.Property[] report(java.lang.String body)
                                        throws DAVException,
                                               java.rmi.RemoteException
Run a report on the current resource. The report body is the body of the request sent to the server, using the REPORT method.

Specified by:
report in interface DAVResourceInterface
Parameters:
body - An XML document string that represents the report request
Returns:
Property[]. A list of the results from the report.
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

getACL

public java.lang.String getACL()
                        throws DAVException,
                               java.rmi.RemoteException
Get the Access Control List for this resource.

Specified by:
getACL in interface DAVResourceInterface
Returns:
String An XML serialized document describing the ACL for this resource
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

getAcl

public com.sas.services.webdav.Acl getAcl()
                                   throws DAVException,
                                          java.rmi.RemoteException
Get the Access Control List for this resource.

Specified by:
getAcl in interface DAVResourceInterface
Returns:
String An access control list for this resource
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

setACL

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

Specified by:
setACL in interface DAVResourceInterface
Parameters:
acl - An XML serialized document describing the ACL for this resource
Returns:
Document The result document from the ACL method
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

setAcl

public java.lang.String setAcl(com.sas.services.webdav.Acl acl)
                        throws DAVException,
                               java.rmi.RemoteException
Set/Update the Access Control List for this resource.

Specified by:
setAcl in interface DAVResourceInterface
Parameters:
acl - An Acl object describing the ACL for this resource
Returns:
String The result document from the ACL method
Throws:
DAVException - in the case of server failures
java.rmi.RemoteException - in the case of network failures

setSessionContext

public void setSessionContext(java.lang.Object sessionContext)
                       throws java.rmi.RemoteException
Deprecated. 

This method is deprecated and no longer serves any purpose.

Specified by:
setSessionContext in interface DAVResourceInterface
Parameters:
sessionContext - The session context to set
Throws:
java.rmi.RemoteException - in the event of a network failure

setPath

public void setPath(java.lang.String path)
Set the path for this 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

setEscapedPath

public void setEscapedPath(java.lang.String escapedPath)
Set the path for this resource using an escaped string. 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. If the path is not escaped, use setPath instead.

Specified by:
setEscapedPath in interface DAVResourceInterface
Parameters:
escapedPath - The new encoded path for the WebDAV resource

setPathNoAction

public void setPathNoAction(java.lang.String path)
Deprecated. 

Description copied from interface: DAVResourceInterface
Set the path for this 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:
setPathNoAction in interface DAVResourceInterface
Parameters:
path - The path

getPath

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

Specified by:
getPath in interface DAVResourceInterface
Returns:
String The current path for this WebDAV resource

doControl

public void doControl()
               throws DAVException,
                      java.rmi.RemoteException
Puts the resource until 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 resource.

Specified by:
getPreviousVersionNames in interface DAVResourceInterface
Returns:
List(String) The version names for this 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 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
Modify the version label on the resource (if this is supported by the server).

Specified by:
doLabel in interface DAVResourceInterface
Parameters:
labelAction - Specify whether the label should be set (specify 1), added (specify 2), removed (specify 3)
label - The value of the label
Throws:
DAVException - in the case of a WebDAV error
java.rmi.RemoteException - in the case of network failures

doCheckin

public void doCheckin()
               throws DAVException,
                      java.rmi.RemoteException
Check in this 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 resource, cancelling 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,
                                                  java.rmi.RemoteException
Gets a particular version of this resource

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

setExistsRequirement

public void setExistsRequirement(int requirement)
Specified by:
setExistsRequirement in interface DAVResourceInterface

getExistsRequirement

public int getExistsRequirement()
Specified by:
getExistsRequirement in interface DAVResourceInterface

discoverLock

protected org.apache.webdav.lib.WebdavState discoverLock(java.lang.String owner,
                                                         java.lang.String path,
                                                         org.apache.webdav.lib.WebdavState state)
Discover the given owner and locktoken and set the locktoken

Parameters:
owner - the activelock owner
path - the path
state - the state to save the locktoken
Returns:
state probably having lock information renewly

getSupportedPrivilegeSet

public com.sas.services.webdav.TreeNode getSupportedPrivilegeSet()
Description copied from interface: DAVResourceInterface
Get a list of privileges that apply to this resource.

Specified by:
getSupportedPrivilegeSet in interface DAVResourceInterface
Returns:
Map (of Privileges) The supported privilege set for this resource

getCurrentUserPrivilegeSet

public java.util.Set getCurrentUserPrivilegeSet()
Description copied from interface: DAVResourceInterface
Get a the current list of privileges this user has for this resource.

Specified by:
getCurrentUserPrivilegeSet in interface DAVResourceInterface
Returns:
Set (of Privileges) The privileges the user has for this resource

getChildrenList

public java.util.List getChildrenList(java.lang.String path)
Get a 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 the resource
Returns:
List (of String) The paths for the children

getChildrenProperties

public java.util.Map 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 urls to (Map of property name to value)) 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.