org.apache.wvcm.store.webdav
Class ResourceWebdavAccessor

java.lang.Object
  extended by org.apache.wvcm.store.webdav.WebdavAccessor
      extended by org.apache.wvcm.store.webdav.ResourceWebdavAccessor
All Implemented Interfaces:
Accessor, ResourceAccessor
Direct Known Subclasses:
ActivityWebdavAccessor, ControllableResourceWebdavAccessor, FolderWebdavAccessor, PrincipalWebdavAccessor, PrivilegeWebdavAccessor, VersionHistoryWebdavAccessor, VersionWebdavAccessor

public class ResourceWebdavAccessor
extends WebdavAccessor
implements ResourceAccessor

WebDAV-based implementation of ResourceAccessor.

Version:
$Revision: 1.1.1.1.2.15 $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.wvcm.store.webdav.WebdavAccessor
WebdavAccessor.HttpClientWrapper
 
Field Summary
 
Fields inherited from class org.apache.wvcm.store.webdav.WebdavAccessor
providerImpl
 
Constructor Summary
ResourceWebdavAccessor(Resource resource)
          Constructor.
 
Method Summary
protected  void addLockTokens(org.apache.commons.httpclient.HttpMethod method)
           
protected  void addLockTokens(IClientMethod method)
           
protected  WebdavAccessor.HttpClientWrapper client()
          Get the HttpClient of this accessor.
protected  boolean containsNestedProperties(PropertyNameList pnl)
           
 boolean doCheckExists()
          Checks whether the associated resource exists at the storage where this accessor is in charge of.
 void doCopy(java.lang.String destination, boolean overwrite)
          Create a copy of the resource identified by the associated proxy at the location identified by the destination.
 void doDelete()
          Deletes the resource at the location of the associated resource.
protected  void doLabel(java.lang.String label, int operator)
           
 LockToken doLock(LockToken.Timeout timeout, boolean deep, boolean exclusive, java.lang.String owner)
          NOT YET STANDARD Locks this resource.
 void doMove(java.lang.String destination, boolean overwrite)
          Moves the resource identified by associated proxy to the location identified by the destination.
 java.util.List doReadAccessControlList(boolean includeInherited)
          Return the list of AccessControlElement instances (ACL) defined on the associated resource.
 ResourceImpl doReadAllAttributes(PropertyNameList wantedPropertyList)
           
 Resource doReadContent(PropertyNameList wantedPropertyList, java.io.OutputStream content)
          Return a new resource proxy at the location of the associated resource containing the wanted properties.
 Resource doReadProperties(PropertyNameList wantedPropertyList)
          Return a new resource proxy at the location of the associated resource containing the wanted properties.
 java.util.List doSearch(PropertyNameList wantedPropertyList, SearchToken searchToken)
          Return a list of Resource objects containing the wanted properties according to the conditions of the specified search token from the scope defined by the associated resource.
 void doUnlock(LockToken lockToken)
          NOT YET STANDARD Releases the specified lock of this resource.
 void doWriteAccessControlList(java.util.List acl)
          Modifies the access control list (ACL) of the associated resource.
 void doWriteContent(java.io.InputStream content, java.lang.String contentIdentifier)
          Persists content changes to a resource.
 void doWriteProperties()
          Deletes the resource at the location of the associated resource.
protected  java.lang.Exception[] getNestedExceptions(java.util.List rsL)
           
 Resource resource()
          Get the resource proxy this accessor works for.
protected  void setHttpMethod(org.apache.commons.httpclient.HttpMethod method)
          Set the HTTP method in the resource.
protected  void setHttpMethod(IClientMethod method)
          Set the HTTP method in the resource.
 
Methods inherited from class org.apache.wvcm.store.webdav.WebdavAccessor
defaultContextPath, getHttpClient, getHttpClientWrapper, initialize, serverWorkspaceFolderList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.wvcm.store.Accessor
serverWorkspaceFolderList
 

Constructor Detail

ResourceWebdavAccessor

public ResourceWebdavAccessor(Resource resource)
Constructor.

Method Detail

resource

public Resource resource()
Get the resource proxy this accessor works for.

Specified by:
resource in interface ResourceAccessor
Returns:
a ResourceImpl

client

protected WebdavAccessor.HttpClientWrapper client()
                                           throws WvcmException
Get the HttpClient of this accessor.

Overrides:
client in class WebdavAccessor
Returns:
a HttpClient
Throws:
WvcmException

doReadContent

public Resource doReadContent(PropertyNameList wantedPropertyList,
                              java.io.OutputStream content)
                       throws WvcmException
Return a new resource proxy at the location of the associated resource containing the wanted properties. The exact resource type of the resulting resource proxy is determined by this method. The resource content is written to content and content is closed.

Specified by:
doReadContent in interface ResourceAccessor
Parameters:
wantedPropertyList - the wanted properties
content - an OutputStream
Returns:
a new resource proxy containing the wanted properties
Throws:
WvcmException

doReadProperties

public Resource doReadProperties(PropertyNameList wantedPropertyList)
                          throws WvcmException
Return a new resource proxy at the location of the associated resource containing the wanted properties. The exact resource type of the resulting resource proxy is determined by this method.

Specified by:
doReadProperties in interface ResourceAccessor
Parameters:
wantedPropertyList - the wanted properties
Returns:
a new resource proxy containing the wanted properties
Throws:
WvcmException

containsNestedProperties

protected boolean containsNestedProperties(PropertyNameList pnl)

doWriteContent

public void doWriteContent(java.io.InputStream content,
                           java.lang.String contentIdentifier)
                    throws WvcmException
Persists content changes to a resource. If contentIdentifier matches the current state identifier of the persistent resource, the content of the resource is replaced with the bytes read from content, and content is then closed. If reading from the stream throws a java.io.IOException, then no further data will be read from the stream, and after attempting to close the stream, a WvcmException wrapping the IOException will be thrown, possibly leading to incomplete data being stored on the resource.

Specified by:
doWriteContent in interface ResourceAccessor
Parameters:
content - the content input stream
contentIdentifier - the content identifier to match the current identifier
Throws:
WvcmException - if the resource identified by this Resource does not exist.
WvcmException

doWriteProperties

public void doWriteProperties()
                       throws WvcmException
Deletes the resource at the location of the associated resource. If a folder is deleted, its members are deleted as well.

Specified by:
doWriteProperties in interface ResourceAccessor
Throws:
WvcmException

doDelete

public void doDelete()
              throws WvcmException
Description copied from interface: ResourceAccessor
Deletes the resource at the location of the associated resource. If a folder is deleted, its members are deleted as well.

Specified by:
doDelete in interface ResourceAccessor
Throws:
WvcmException

getNestedExceptions

protected java.lang.Exception[] getNestedExceptions(java.util.List rsL)

doMove

public void doMove(java.lang.String destination,
                   boolean overwrite)
            throws WvcmException
Moves the resource identified by associated proxy to the location identified by the destination.

Specified by:
doMove in interface ResourceAccessor
Parameters:
destination - The new location of the resource.
overwrite - If false the existence of a resource at the destination will cause doMove to fail; otherwise, doMove will replace the destination resource.
Throws:
WvcmException

doCopy

public void doCopy(java.lang.String destination,
                   boolean overwrite)
            throws WvcmException
Create a copy of the resource identified by the associated proxy at the location identified by the destination.

Specified by:
doCopy in interface ResourceAccessor
Parameters:
destination - The location of the new resource created by doCopy.
overwrite - If false the existence of a resource at the destination will cause the copy to fail; otherwise, doCopy will replace the destination resource.
Throws:
WvcmException

doCheckExists

public boolean doCheckExists()
                      throws WvcmException
Checks whether the associated resource exists at the storage where this accessor is in charge of.

Specified by:
doCheckExists in interface ResourceAccessor
Returns:
true, if the resource exists
Throws:
WvcmException

doSearch

public java.util.List doSearch(PropertyNameList wantedPropertyList,
                               SearchToken searchToken)
                        throws WvcmException
Return a list of Resource objects containing the wanted properties according to the conditions of the specified search token from the scope defined by the associated resource. A requested property named XXX can be retrieved from the resource with the getXxx method.

Specified by:
doSearch in interface ResourceAccessor
Parameters:
wantedPropertyList - the wanted properties
searchToken - a SearchToken
Returns:
the result list
Throws:
WvcmException

doReadAllAttributes

public ResourceImpl doReadAllAttributes(PropertyNameList wantedPropertyList)
                                 throws WvcmException
Throws:
WvcmException

doLabel

protected void doLabel(java.lang.String label,
                       int operator)
                throws WvcmException
Throws:
WvcmException

doReadAccessControlList

public java.util.List doReadAccessControlList(boolean includeInherited)
                                       throws WvcmException
Return the list of AccessControlElement instances (ACL) defined on the associated resource. The ACL specifies the list of access control elements (ACEs), which define what principals are to get what privileges for this resource. Each ACE specifies the set of privileges to be either granted or denied to a single principal. If the ACL is empty, no principal is granted any privilege.

Specified by:
doReadAccessControlList in interface ResourceAccessor
Parameters:
includeInherited - if false, only ACEs defined for the resource are returned; otherwise, the ACL includes all inherited ACEs
Returns:
a List
Throws:
WvcmException

doWriteAccessControlList

public void doWriteAccessControlList(java.util.List acl)
                              throws WvcmException
Modifies the access control list (ACL) of the associated resource. Specifically, this method only permits modification to ACEs that are not inherited, and are not protected.

Specified by:
doWriteAccessControlList in interface ResourceAccessor
Parameters:
acl - a list of AccessControlElement instances
Throws:
WvcmException

addLockTokens

protected void addLockTokens(org.apache.commons.httpclient.HttpMethod method)
                      throws WvcmException
Throws:
WvcmException

addLockTokens

protected void addLockTokens(IClientMethod method)
                      throws WvcmException
Throws:
WvcmException

doLock

public LockToken doLock(LockToken.Timeout timeout,
                        boolean deep,
                        boolean exclusive,
                        java.lang.String owner)
                 throws WvcmException
NOT YET STANDARD Locks this resource.

Specified by:
doLock in interface ResourceAccessor
Parameters:
timeout - a Timeout
deep - a boolean
exclusive - a boolean
owner - a String
Returns:
a LockToken
Throws:
WvcmException

doUnlock

public void doUnlock(LockToken lockToken)
              throws WvcmException
NOT YET STANDARD Releases the specified lock of this resource.

Specified by:
doUnlock in interface ResourceAccessor
Parameters:
lockToken - a LockToken
Throws:
WvcmException

setHttpMethod

protected void setHttpMethod(org.apache.commons.httpclient.HttpMethod method)
Set the HTTP method in the resource. This is so that users may discover details about the HTTP method in case of failure.

Parameters:
method - HTTP method used

setHttpMethod

protected void setHttpMethod(IClientMethod method)
Set the HTTP method in the resource. This is so that users may discover details about the HTTP method in case of failure.

Parameters:
method - HTTP method used (from client-3 or client-4)


Copyright (c) 2003 - Apache Software Foundation