org.apache.jackrabbit.webdav
Interface DavResource

All Known Subinterfaces:
DeltaVResource, ObservationResource, OrderingResource, TransactionResource, VersionableResource, VersionControlledResource, VersionHistoryResource, VersionResource

public interface DavResource

DavResource provides standard WebDAV functionality as specified by RFC 2518.


Field Summary
static String COMPLIANCE_CLASS
          Constant for WebDAV 1 and 2 compliance class as is represented by this resource.
static String METHODS
          String constant representing the WebDAV 1 and 2 method set.
 
Method Summary
 void addLockManager(LockManager lockmgr)
          Add an external LockManager to this resource.
 void addMember(DavResource resource, InputContext inputContext)
          Add the given resource as an internal member to this resource.
 MultiStatusResponse alterProperties(DavPropertySet setProperties, DavPropertyNameSet removePropertyNames)
          Set/add the specified properties and remove the properties with the given names from this resource respectively.
 void copy(DavResource destination, boolean shallow)
          Copy this DavResource to the given destination resource
 boolean exists()
          Returns true if this webdav resource represents an existing repository item.
 DavResource getCollection()
          Retrieve the resource this resource is internal member of.
 String getComplianceClass()
          Returns a comma separted list of all compliance classes the given resource is fulfilling.
 String getDisplayName()
          Returns the display name of this resource.
 DavResourceFactory getFactory()
          Return the DavResourceFactory that created this resource.
 String getHref()
          Returns the absolute href of this resource as returned in the multistatus response body.
 DavResourceLocator getLocator()
          Returns the locator object for this webdav resource, which encapsulates the information for building the complete 'href'.
 ActiveLock getLock(Type type, Scope scope)
          Return the lock present on this webdav resource or null if the resource is either not locked or not lockable at all.
 ActiveLock[] getLocks()
          Returns an array of all locks applied to the given resource.
 DavResourceIterator getMembers()
          Returns an iterator over all internal members.
 long getModificationTime()
          Return the time of the last modification or -1 if the modification time could not be retrieved.
 DavPropertySet getProperties()
          Returns all webdav properties present on this resource.
 DavProperty getProperty(DavPropertyName name)
          Return the webdav property with the specified name.
 DavPropertyName[] getPropertyNames()
          Returns an array of all property names available on this resource.
 String getResourcePath()
          Returns the path of the hierarchy element defined by this DavResource.
 DavSession getSession()
          Retrieve the DavSession associated with this resource.
 String getSupportedMethods()
          Returns a comma separated list of all METHODS supported by the given resource.
 boolean hasLock(Type type, Scope scope)
          Returns true if a lock applies to this resource.
 boolean isCollection()
          Returns true if this webdav resource has the resourcetype 'collection'.
 boolean isLockable(Type type, Scope scope)
          Returns true, if the this resource allows locking.
 ActiveLock lock(LockInfo reqLockInfo)
          Lock this webdav resource with the information retrieve from the request and return the resulting lockdiscovery object.
 void move(DavResource destination)
          Move this DavResource to the given destination resource
 ActiveLock refreshLock(LockInfo reqLockInfo, String lockToken)
          Refresh an existing lock by resetting the timeout.
 void removeMember(DavResource member)
          Removes the specified member from this resource.
 void removeProperty(DavPropertyName propertyName)
          Remove the specified property from this resource.
 void setProperty(DavProperty property)
          Add/Set the specified property on this resource.
 void spool(OutputContext outputContext)
          Spools the resource properties and ev.
 void unlock(String lockToken)
          Remove the lock indentified by the included lock token from this resource.
 

Field Detail

COMPLIANCE_CLASS

public static final String COMPLIANCE_CLASS
Constant for WebDAV 1 and 2 compliance class as is represented by this resource.

See Also:
Constant Field Values

METHODS

public static final String METHODS
String constant representing the WebDAV 1 and 2 method set.

See Also:
Constant Field Values
Method Detail

getComplianceClass

public String getComplianceClass()
Returns a comma separted list of all compliance classes the given resource is fulfilling.

Returns:
compliance classes

getSupportedMethods

public String getSupportedMethods()
Returns a comma separated list of all METHODS supported by the given resource.

Returns:
METHODS supported by this resource.

exists

public boolean exists()
Returns true if this webdav resource represents an existing repository item.

Returns:
true, if the resource represents an existing repository item.

isCollection

public boolean isCollection()
Returns true if this webdav resource has the resourcetype 'collection'.

Returns:
true if the resource represents a collection resource.

getDisplayName

public String getDisplayName()
Returns the display name of this resource.

Returns:
display name.

getLocator

public DavResourceLocator getLocator()
Returns the locator object for this webdav resource, which encapsulates the information for building the complete 'href'.

Returns:
the locator for this resource.
See Also:
getResourcePath(), getHref()

getResourcePath

public String getResourcePath()
Returns the path of the hierarchy element defined by this DavResource. This method is a shortcut for DavResource.getLocator().getResourcePath().

Returns:
path of the element defined by this DavResource.

getHref

public String getHref()
Returns the absolute href of this resource as returned in the multistatus response body.

Returns:
href

getModificationTime

public long getModificationTime()
Return the time of the last modification or -1 if the modification time could not be retrieved.

Returns:
time of last modification or -1.

spool

public void spool(OutputContext outputContext)
           throws IOException
Spools the resource properties and ev. content to the specified context (e.g. to respond to a 'GET' or 'HEAD' request). The context could e.g. wrap the servlet response.

Parameters:
outputContext -
Throws:
IOException

getPropertyNames

public DavPropertyName[] getPropertyNames()
Returns an array of all property names available on this resource.

Returns:
an array of property names.

getProperty

public DavProperty getProperty(DavPropertyName name)
Return the webdav property with the specified name.

Parameters:
name - name of the webdav property
Returns:
the DavProperty with the given name or null if the property does not exist.

getProperties

public DavPropertySet getProperties()
Returns all webdav properties present on this resource.

Returns:
a DavPropertySet containing all webdav property of this resource.

setProperty

public void setProperty(DavProperty property)
                 throws DavException
Add/Set the specified property on this resource.

Parameters:
property -
Throws:
DavException - if an error occurs

removeProperty

public void removeProperty(DavPropertyName propertyName)
                    throws DavException
Remove the specified property from this resource.

Parameters:
propertyName -
Throws:
DavException - if an error occurs

alterProperties

public MultiStatusResponse alterProperties(DavPropertySet setProperties,
                                           DavPropertyNameSet removePropertyNames)
                                    throws DavException
Set/add the specified properties and remove the properties with the given names from this resource respectively.

Parameters:
setProperties - Set of properties to be added or modified
removePropertyNames - Set of property names to be removed
Returns:
multistatus response listing the status resulting from setting and/or removing the specified properties, in order to allow a detailled multistatus response.
Throws:
DavException - if an error occured. This may be the case if the general state of the resource prevents any properties to be set or removed (e.g. due to a lock).

getCollection

public DavResource getCollection()
Retrieve the resource this resource is internal member of.

Returns:
resource this resource is an internal member of. In case this resource is the root null is returned.

addMember

public void addMember(DavResource resource,
                      InputContext inputContext)
               throws DavException
Add the given resource as an internal member to this resource.

Parameters:
resource - DavResource to be added as internal member.
inputContext - Context providing the properties and content for the internal member to be created or replaced.
Throws:
DavException

getMembers

public DavResourceIterator getMembers()
Returns an iterator over all internal members.

Returns:
a {@link DavResourceIterator) over all internal members.

removeMember

public void removeMember(DavResource member)
                  throws DavException
Removes the specified member from this resource.

Throws:
DavException

move

public void move(DavResource destination)
          throws DavException
Move this DavResource to the given destination resource

Parameters:
destination -
Throws:
DavException

copy

public void copy(DavResource destination,
                 boolean shallow)
          throws DavException
Copy this DavResource to the given destination resource

Parameters:
destination -
shallow -
Throws:
DavException

isLockable

public boolean isLockable(Type type,
                          Scope scope)
Returns true, if the this resource allows locking. NOTE, that this method does not define, whether a lock/unlock can be successfully executed.

Parameters:
type -
scope -
Returns:
true, if this resource supports any locking.

hasLock

public boolean hasLock(Type type,
                       Scope scope)
Returns true if a lock applies to this resource. This may be either a lock on this resource itself or a deep lock inherited from a collection above this resource.
Note, that true is returned whenever a lock applies to that resource even if the lock is expired or not effective due to the fact that the request provides the proper lock token.

Parameters:
type -
Returns:
true if a lock applies to this resource.

getLock

public ActiveLock getLock(Type type,
                          Scope scope)
Return the lock present on this webdav resource or null if the resource is either not locked or not lockable at all. Note, that a resource may have a lock that is inherited by a deep lock inforced on one of its 'parent' resources.

Parameters:
type -
Returns:
lock information of this resource or null if this resource has no lock applying it. If an error occurs while retrieving the lock information null is returned as well.

getLocks

public ActiveLock[] getLocks()
Returns an array of all locks applied to the given resource.

Returns:
array of locks. The array is empty if there are no locks applied to this resource.

lock

public ActiveLock lock(LockInfo reqLockInfo)
                throws DavException
Lock this webdav resource with the information retrieve from the request and return the resulting lockdiscovery object.

Parameters:
reqLockInfo - lock info as retrieved from the request.
Returns:
lockdiscovery object to be returned in the response. If the lock could not be obtained a DavException is thrown.
Throws:
DavException - if the lock could not be obtained.

refreshLock

public ActiveLock refreshLock(LockInfo reqLockInfo,
                              String lockToken)
                       throws DavException
Refresh an existing lock by resetting the timeout.

Parameters:
reqLockInfo - lock info as retrieved from the request.
lockToken - identifying the lock to be refreshed.
Returns:
lockdiscovery object to be returned in the response body. If the lock could not be refreshed a DavException is thrown.
Throws:
DavException - if the lock could not be refreshed.

unlock

public void unlock(String lockToken)
            throws DavException
Remove the lock indentified by the included lock token from this resource. This method will return false if the unlocking did not succeed.

Parameters:
lockToken - indentifying the lock to be removed.
Throws:
DavException - if the lock could not be removed.

addLockManager

public void addLockManager(LockManager lockmgr)
Add an external LockManager to this resource. This method may throw UnsupportedOperationException if the resource does handle locking itself.

Parameters:
lockmgr -
See Also:
LockManager

getFactory

public DavResourceFactory getFactory()
Return the DavResourceFactory that created this resource.

Returns:
the factory that created this resource.

getSession

public DavSession getSession()
Retrieve the DavSession associated with this resource.

Returns:
session object associated with this resource.


Copyright © 2005-2006 . All Rights Reserved.