org.esupportail.portal.channels.CStockage.provider.access
Class WebdavAccessImpl

java.lang.Object
  extended byorg.esupportail.portal.channels.CStockage.provider.access.ServerAccess
      extended byorg.esupportail.portal.channels.CStockage.provider.access.WebdavAccessImpl

public class WebdavAccessImpl
extends ServerAccess

Id: WebdavAccessImpl.java,v 1.0 14 avr. 2004
Copyright (c) 2004 Esup Portail (www.esup-portail.org)
Classes: WebdavAccessImpl
Original Author: Yohan Colmant
Implements the ServerAccess methods to access a DAV server


Field Summary
private  java.lang.String aclGroupPrefix
          The group prefix for the ACL
private  org.esupportail.portal.utils.webdav.acl.ACLManager aclManager
          An object used to manage the ACL acces
private  java.lang.String aclNamespace
          The namespace for the ACL
private  java.lang.String aclUserPrefix
          The user prefix for the ACL
private  java.lang.String connexionPath
          The path used at the first connexion
private static java.text.SimpleDateFormat[] formats
          Date formats using for Date parsing.
private  org.apache.commons.httpclient.HttpURL httpURL
          The Http url used to access the webdav
protected static Log log
          Logger object
private  java.lang.String login
          The user login
private  java.lang.String password
          The password for the dav access
private  org.apache.webdav.lib.WebdavResource resource
          The WebDAV ressource
private  java.lang.String url
          The dav access url
 
Constructor Summary
WebdavAccessImpl()
          Default constructor
 
Method Summary
 boolean canPaste(Space fromSpace, java.lang.String toSpaceKey, java.lang.String clipboardPath, java.util.Vector clipboard, java.lang.String curentDirPath)
          Check if we can paste here
 boolean canRead(java.lang.String path)
          Check if we are authorized to read this resource
 boolean canRead(java.lang.String resourceName, java.lang.String path)
          Check if we are authorized to read this resource
 void connect()
          Connect this object to the server
 boolean createDir(java.lang.String name, java.lang.String path)
          Create the directory given in argument
private static java.lang.String decodeMarks(java.lang.String input)
          Unescape octets for some characters that a server might (but should not) have escaped.
 boolean delete(java.lang.String file, java.lang.String path)
          Delete the resource given in argument
 org.esupportail.portal.utils.webdav.acl.EsupPermissions deny(java.lang.String path, java.lang.String principal, java.lang.String permissionType)
          Add a deny permission on a resource for a user role specified
 void disconnect()
          Disconnection of the server
private  boolean distantCopy(ChannelResource resource, ServerAccess fromAccess, java.lang.String toPath)
          The distant copy method
protected  boolean distantCopy(java.lang.String resource, ServerAccess fromAccess, java.lang.String fromPath, java.lang.String toPath)
          The distant copy method
private  boolean distantCopyDirectory(java.lang.String directoryName, ServerAccess fromAccess, java.lang.String absoluteFromPath, java.lang.String toPath)
          The distant copy method of a directory
private  boolean distantCopyFile(java.lang.String fileName, ServerAccess fromAccess, java.lang.String absoluteFromPath, java.lang.String toPath)
          The distant copy method of a file
 ChannelResource download(java.lang.String name, java.lang.String path)
          Return the resource associated to the file to download
private  boolean exist(java.lang.String fullPath)
          Check is the resource exists
 boolean exists(java.lang.String fullPath)
          Check is the resource exists
 boolean exists(java.lang.String resourceName, java.lang.String path)
          Check is the resource exists
private  boolean fileIsEmptyOnServer(java.lang.String fileName, java.lang.String path)
          Check if a file is empty on the server
private static java.util.Vector getChilds(org.apache.webdav.lib.WebdavResource webdavResource, java.lang.String path)
          Get a path child resources
 java.io.InputStream getMethodData(java.lang.String fullPath)
          Return the stream from a resource
private static java.lang.String getName(java.lang.String url)
          Get the name of this WebdavResource.
 org.esupportail.portal.utils.webdav.acl.EsupPermissions getPermissions(java.lang.String path)
          Get a resource permissions as an EsupPermissions object
 org.esupportail.portal.utils.webdav.acl.EsupPermissions getPermissions(java.lang.String path, java.lang.String permissionType)
          Get a resource permissions as an EsupPermissions object
 java.lang.String getProperty(java.lang.String namespace, java.lang.String path, java.lang.String propertyName)
          Get a resource's property specified by the path
 org.esupportail.portal.utils.webdav.acl.EsupPermissions grant(java.lang.String path, java.lang.String principal, java.lang.String permissionType)
          Add a grant permission on a resource for a user role specified
 java.util.Vector hasInheritedPermission(java.lang.String path, java.lang.String principal, java.lang.String permissionType, boolean negative)
          Check if the specified resource has the inherited permission given in parameter
 boolean hasNotInheritedPermission(java.lang.String path, java.lang.String principal, java.lang.String permissionType, boolean negative)
          Check if the specified resource has the not inherited permission given in parameter
 void init(Space space)
          This method initializes the parameters.
private  void init(java.lang.String url, java.lang.String login, java.lang.String password)
          This method initializes the parameters.
 boolean isDirectory(java.lang.String name, java.lang.String path)
          Check if the resource named name is a directory in the path given
 boolean isEmpty(java.lang.String dir, java.lang.String path)
          Check if the directory named dir is empty or not.
protected  boolean localCopy(java.lang.String resource, java.lang.String fromPath, java.lang.String toPath)
          Local copy method
protected  boolean localMove(java.lang.String resource, java.lang.String fromPath, java.lang.String toPath)
          Local move method
 ChannelResource[] ls(java.lang.String fullPath)
          List all ressources for a given path
 ChannelResource[] ls(java.lang.String path, java.lang.String targetDirectory)
          List all ressources for a given path
private static java.util.Date parseDate(java.lang.String dateValue)
          Parse the java.util.Date string for HTTP-date.
 boolean rename(java.lang.String oldName, java.lang.String newName, java.lang.String path)
          Rename the resource
 org.esupportail.portal.utils.webdav.acl.EsupPermissions revoke(java.lang.String path, java.lang.String principal, java.lang.String permissionType)
          Revoke permission on a resource for a user role specified
 boolean setProperty(java.lang.String namespace, java.lang.String path, java.lang.String propertyName, java.lang.String propertyValue)
          Set the property of resource
 boolean upload(java.lang.String fileName, java.io.InputStream fileStream, java.lang.String path)
          Upload a file to the path given in argument
 
Methods inherited from class org.esupportail.portal.channels.CStockage.provider.access.ServerAccess
copy, move
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final Log log
Logger object


url

private java.lang.String url
The dav access url


login

private java.lang.String login
The user login


password

private java.lang.String password
The password for the dav access


httpURL

private org.apache.commons.httpclient.HttpURL httpURL
The Http url used to access the webdav


resource

private org.apache.webdav.lib.WebdavResource resource
The WebDAV ressource


connexionPath

private java.lang.String connexionPath
The path used at the first connexion


aclManager

private org.esupportail.portal.utils.webdav.acl.ACLManager aclManager
An object used to manage the ACL acces


aclNamespace

private java.lang.String aclNamespace
The namespace for the ACL


aclUserPrefix

private java.lang.String aclUserPrefix
The user prefix for the ACL


aclGroupPrefix

private java.lang.String aclGroupPrefix
The group prefix for the ACL


formats

private static final java.text.SimpleDateFormat[] formats
Date formats using for Date parsing.

Constructor Detail

WebdavAccessImpl

public WebdavAccessImpl()
Default constructor

Method Detail

init

public void init(Space space)
          throws java.net.MalformedURLException,
                 PropertiesException
This method initializes the parameters. You have to call this method before calling connect method.

Specified by:
init in class ServerAccess
Parameters:
space - the space corresponding to the server access
Throws:
java.net.MalformedURLException
PropertiesException

init

private void init(java.lang.String url,
                  java.lang.String login,
                  java.lang.String password)
           throws java.net.MalformedURLException
This method initializes the parameters. You have to call this method before calling connect method.

Parameters:
url - webdav url
login - connexion login
password - connexioàn password
Throws:
java.net.MalformedURLException

connect

public void connect()
             throws ServerException,
                    BadConnexionParameters
Connect this object to the server

Specified by:
connect in class ServerAccess
Throws:
ServerException
BadConnexionParameters

disconnect

public void disconnect()
                throws ServerException
Disconnection of the server

Specified by:
disconnect in class ServerAccess
Throws:
ServerException

getMethodData

public java.io.InputStream getMethodData(java.lang.String fullPath)
                                  throws java.io.IOException
Return the stream from a resource

Specified by:
getMethodData in class ServerAccess
Parameters:
fullPath - the full resource path
Returns:
the InputStream
Throws:
java.io.IOException

ls

public ChannelResource[] ls(java.lang.String path,
                            java.lang.String targetDirectory)
                     throws NotExistsResourceException,
                            ApplicationException,
                            NotAuthorizedException
List all ressources for a given path

Specified by:
ls in class ServerAccess
Parameters:
path - directory path on the dav server
targetDirectory - the directory name to list
Returns:
ChannelWebdavResource array
Throws:
NotExistsResourceException
ApplicationException
NotAuthorizedException

upload

public boolean upload(java.lang.String fileName,
                      java.io.InputStream fileStream,
                      java.lang.String path)
               throws ApplicationException,
                      ServerException,
                      NotExistsResourceException,
                      StillExistsException,
                      BadFormatException,
                      UploadException,
                      EmptyFileOnUploadException,
                      OverQuotaException,
                      NotAuthorizedDeleteException,
                      NotAuthorizedUploadException,
                      NotAuthorizedException,
                      PropertiesException
Upload a file to the path given in argument

Specified by:
upload in class ServerAccess
Parameters:
fileName - the input file name
fileStream - the input file stream
path - the path
Returns:
boolean true if no problem, else false
Throws:
ApplicationException
ServerException
NotExistsResourceException
StillExistsException
BadFormatException
UploadException
EmptyFileOnUploadException
OverQuotaException
NotAuthorizedDeleteException
NotAuthorizedUploadException
NotAuthorizedException
PropertiesException

fileIsEmptyOnServer

private boolean fileIsEmptyOnServer(java.lang.String fileName,
                                    java.lang.String path)
                             throws ApplicationException
Check if a file is empty on the server

Parameters:
fileName - the name of the file to check
path - the path where is the file on the server
Returns:
true if the file is empty on the server, false else
Throws:
ApplicationException

delete

public boolean delete(java.lang.String file,
                      java.lang.String path)
               throws ApplicationException,
                      DeleteException,
                      NotAuthorizedDeleteException,
                      NotExistsResourceException,
                      NotAuthorizedException
Delete the resource given in argument

Specified by:
delete in class ServerAccess
Parameters:
file - file/directory to delete
path - path where is file/directory
Returns:
boolean true if well done else false
Throws:
ApplicationException
DeleteException
NotAuthorizedDeleteException
NotExistsResourceException
NotAuthorizedException

rename

public boolean rename(java.lang.String oldName,
                      java.lang.String newName,
                      java.lang.String path)
               throws StillExistsException,
                      BadFormatException,
                      ApplicationException,
                      RenameException,
                      NotAuthorizedRenameException,
                      NotExistsResourceException,
                      NotAuthorizedException,
                      PropertiesException
Rename the resource

Specified by:
rename in class ServerAccess
Parameters:
oldName - file/directory to rename
newName - new name of the file/directory
path - path where is file/directory
Returns:
boolean true if well done else false
Throws:
StillExistsException
BadFormatException
ApplicationException
RenameException
NotAuthorizedRenameException
NotExistsResourceException
NotAuthorizedException
PropertiesException

createDir

public boolean createDir(java.lang.String name,
                         java.lang.String path)
                  throws ApplicationException,
                         CreateDirectoryException,
                         StillExistsException,
                         BadFormatException,
                         NotAuthorizedNewDirException,
                         NotExistsResourceException,
                         NotAuthorizedException,
                         PropertiesException
Create the directory given in argument

Specified by:
createDir in class ServerAccess
Parameters:
name - file/directory to delete
path - path where is file/directory
Returns:
boolean true if well done else false
Throws:
ApplicationException
CreateDirectoryException
StillExistsException
BadFormatException
NotAuthorizedNewDirException
NotExistsResourceException
NotAuthorizedException
PropertiesException

canPaste

public boolean canPaste(Space fromSpace,
                        java.lang.String toSpaceKey,
                        java.lang.String clipboardPath,
                        java.util.Vector clipboard,
                        java.lang.String curentDirPath)
                 throws ApplicationException,
                        PasteInChildDirectoryException,
                        PasteWithSameNameException,
                        PasteDeletedResourceException,
                        NotAuthorizedException
Check if we can paste here

Specified by:
canPaste in class ServerAccess
Parameters:
fromSpace - the space from whitch we want to paste
toSpaceKey - the space key where we want to paste
clipboardPath - the path where is the clipboad
clipboard - the containt of the clipboard
curentDirPath - the path of the curent dir
Returns:
true if ok excpetion else
Throws:
ApplicationException
PasteInChildDirectoryException
PasteWithSameNameException
PasteDeletedResourceException
NotAuthorizedException

localCopy

protected boolean localCopy(java.lang.String resource,
                            java.lang.String fromPath,
                            java.lang.String toPath)
                     throws CopyException,
                            ApplicationException,
                            OverQuotaException,
                            NotExistsResourceException,
                            PasteNotAuthorizedResourceException,
                            NotAuthorizedException,
                            NotAuthorizedUploadException
Local copy method

Specified by:
localCopy in class ServerAccess
Parameters:
resource - resource to copy
fromPath - path where is the resource
toPath - path to copy the resource
Returns:
boolean true if well done else false
Throws:
CopyException
ApplicationException
OverQuotaException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedException
NotAuthorizedUploadException

distantCopy

protected boolean distantCopy(java.lang.String resource,
                              ServerAccess fromAccess,
                              java.lang.String fromPath,
                              java.lang.String toPath)
                       throws CopyException,
                              ApplicationException,
                              OverQuotaException,
                              NotExistsResourceException,
                              PasteNotAuthorizedResourceException,
                              NotAuthorizedException,
                              NotAuthorizedUploadException,
                              ServerException
The distant copy method

Specified by:
distantCopy in class ServerAccess
Parameters:
resource - resource to copy
fromAccess - the space access from witch we want to copy
fromPath - path where is the resource
toPath - path to copy the resource
Returns:
boolean true if well done else false
Throws:
CopyException
ApplicationException
OverQuotaException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedException
NotAuthorizedUploadException
ServerException

distantCopy

private boolean distantCopy(ChannelResource resource,
                            ServerAccess fromAccess,
                            java.lang.String toPath)
                     throws CopyException,
                            ApplicationException,
                            OverQuotaException,
                            PasteNotAuthorizedResourceException,
                            NotExistsResourceException,
                            PasteNotAuthorizedResourceException,
                            NotAuthorizedException,
                            NotAuthorizedUploadException,
                            ServerException
The distant copy method

Parameters:
resource - resource to copy
fromAccess - the space access from witch we want to copy
toPath - path to copy the resource
Returns:
boolean true if well done else false
Throws:
CopyException
ApplicationException
OverQuotaException
PasteNotAuthorizedResourceException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedException
NotAuthorizedUploadException
ServerException

distantCopyFile

private boolean distantCopyFile(java.lang.String fileName,
                                ServerAccess fromAccess,
                                java.lang.String absoluteFromPath,
                                java.lang.String toPath)
                         throws CopyException,
                                ApplicationException,
                                OverQuotaException,
                                PasteNotAuthorizedResourceException,
                                NotExistsResourceException,
                                PasteNotAuthorizedResourceException,
                                NotAuthorizedException,
                                NotAuthorizedUploadException
The distant copy method of a file

Parameters:
fileName - file to copy
fromAccess - the space access from witch we want to copy
absoluteFromPath - path where is the resource
toPath - path to copy the resource
Returns:
boolean true if well done else false
Throws:
CopyException
ApplicationException
OverQuotaException
PasteNotAuthorizedResourceException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedException
NotAuthorizedUploadException

distantCopyDirectory

private boolean distantCopyDirectory(java.lang.String directoryName,
                                     ServerAccess fromAccess,
                                     java.lang.String absoluteFromPath,
                                     java.lang.String toPath)
                              throws CopyException,
                                     ApplicationException,
                                     OverQuotaException,
                                     PasteNotAuthorizedResourceException,
                                     NotExistsResourceException,
                                     PasteNotAuthorizedResourceException,
                                     NotAuthorizedException,
                                     NotAuthorizedUploadException,
                                     ServerException
The distant copy method of a directory

Parameters:
directoryName - file to directory
fromAccess - the space access from witch we want to copy
absoluteFromPath - path where is the resource
toPath - path to copy the resource
Returns:
boolean true if well done else false
Throws:
CopyException
ApplicationException
OverQuotaException
PasteNotAuthorizedResourceException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedException
NotAuthorizedUploadException
ServerException

localMove

protected boolean localMove(java.lang.String resource,
                            java.lang.String fromPath,
                            java.lang.String toPath)
                     throws MoveException,
                            ApplicationException,
                            OverQuotaException,
                            PasteNotAuthorizedResourceException,
                            NotExistsResourceException,
                            PasteNotAuthorizedResourceException,
                            NotAuthorizedException,
                            NotAuthorizedUploadException
Local move method

Specified by:
localMove in class ServerAccess
Parameters:
resource - resource to move
fromPath - path where is the resource
toPath - path to copy the resource
Returns:
boolean true if well done else false
Throws:
MoveException
ApplicationException
OverQuotaException
PasteNotAuthorizedResourceException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedException
NotAuthorizedUploadException

download

public ChannelResource download(java.lang.String name,
                                java.lang.String path)
                         throws DownloadException
Return the resource associated to the file to download

Specified by:
download in class ServerAccess
Parameters:
name - the file name
path - the path where to find the file
Returns:
the ChannelWebdavResource
Throws:
DownloadException

exists

public boolean exists(java.lang.String resourceName,
                      java.lang.String path)
               throws ApplicationException,
                      NotAuthorizedException
Check is the resource exists

Specified by:
exists in class ServerAccess
Parameters:
resourceName - name of the file/directory to verify
path - path to find the file/directory
Returns:
true if file/directory exists else false
Throws:
ApplicationException
NotAuthorizedException

exists

public boolean exists(java.lang.String fullPath)
               throws ApplicationException,
                      NotAuthorizedException
Check is the resource exists

Specified by:
exists in class ServerAccess
Parameters:
fullPath - path to find the file/directory
Returns:
true if file/directory exists else false
Throws:
ApplicationException
NotAuthorizedException

exist

private boolean exist(java.lang.String fullPath)
               throws ApplicationException,
                      NotAuthorizedException
Check is the resource exists

Parameters:
fullPath - path to find the file/directory
Returns:
true if file/directory exists else false
Throws:
ApplicationException
NotAuthorizedException

canRead

public boolean canRead(java.lang.String resourceName,
                       java.lang.String path)
                throws ApplicationException
Check if we are authorized to read this resource

Specified by:
canRead in class ServerAccess
Parameters:
resourceName - name of the file/directory to verify
path - path to find the file/directory
Returns:
true if authorized else false
Throws:
ApplicationException

canRead

public boolean canRead(java.lang.String path)
                throws ApplicationException
Check if we are authorized to read this resource

Specified by:
canRead in class ServerAccess
Parameters:
path - path to find the file/directory
Returns:
true if authorized else false
Throws:
ApplicationException

isDirectory

public boolean isDirectory(java.lang.String name,
                           java.lang.String path)
                    throws ApplicationException,
                           NotAuthorizedException,
                           NotExistsResourceException
Check if the resource named name is a directory in the path given

Specified by:
isDirectory in class ServerAccess
Parameters:
name - the name of the resource
path - the path
Returns:
true if directory, false else
Throws:
ApplicationException
NotAuthorizedException
NotExistsResourceException

isEmpty

public boolean isEmpty(java.lang.String dir,
                       java.lang.String path)
                throws ApplicationException,
                       NotExistsResourceException,
                       NotAuthorizedException
Check if the directory named dir is empty or not. We suppose that dir has been checked as a directory before

Specified by:
isEmpty in class ServerAccess
Parameters:
dir - the name of the directory
path - the path
Returns:
true if empty, false else
Throws:
ApplicationException
NotExistsResourceException
NotAuthorizedException

getProperty

public java.lang.String getProperty(java.lang.String namespace,
                                    java.lang.String path,
                                    java.lang.String propertyName)
                             throws ServerException
Get a resource's property specified by the path

Specified by:
getProperty in class ServerAccess
Parameters:
namespace - the namespace used for this metadata
path - the resource path
propertyName - the property name
Returns:
the property as a String object
Throws:
ServerException

setProperty

public boolean setProperty(java.lang.String namespace,
                           java.lang.String path,
                           java.lang.String propertyName,
                           java.lang.String propertyValue)
                    throws ServerException
Set the property of resource

Specified by:
setProperty in class ServerAccess
Parameters:
namespace - the namespace used for this metadata
path - the resource path
propertyName - the name of the property to set
propertyValue - the value of the property to set
Returns:
true if well done
Throws:
ServerException

getPermissions

public org.esupportail.portal.utils.webdav.acl.EsupPermissions getPermissions(java.lang.String path,
                                                                              java.lang.String permissionType)
                                                                       throws AclReadException,
                                                                              AclAccessException,
                                                                              NotSupportedAclException
Get a resource permissions as an EsupPermissions object

Specified by:
getPermissions in class ServerAccess
Parameters:
path - the resource path
permissionType - the type of permission (read, write, ....)
Returns:
an EsupPermissions object representing the permissions
Throws:
AclReadException
AclAccessException
NotSupportedAclException

getPermissions

public org.esupportail.portal.utils.webdav.acl.EsupPermissions getPermissions(java.lang.String path)
                                                                       throws AclReadException,
                                                                              AclAccessException,
                                                                              NotSupportedAclException
Get a resource permissions as an EsupPermissions object

Specified by:
getPermissions in class ServerAccess
Parameters:
path - the resource path
Returns:
an EsupPermissions object representing the permissions
Throws:
AclReadException
AclAccessException
NotSupportedAclException

grant

public org.esupportail.portal.utils.webdav.acl.EsupPermissions grant(java.lang.String path,
                                                                     java.lang.String principal,
                                                                     java.lang.String permissionType)
                                                              throws AclReadException,
                                                                     AclAccessException,
                                                                     AclWriteException,
                                                                     NotSupportedAclException
Add a grant permission on a resource for a user role specified

Specified by:
grant in class ServerAccess
Parameters:
path - the resource path
principal - the concerned user role
permissionType - the permission type: [read|read-acl|read-current-user-privilege-set|write|write-acl|write-properties|write-content]
Returns:
the EsupPermissions object modified by the action
Throws:
AclReadException
AclAccessException
AclWriteException
NotSupportedAclException

deny

public org.esupportail.portal.utils.webdav.acl.EsupPermissions deny(java.lang.String path,
                                                                    java.lang.String principal,
                                                                    java.lang.String permissionType)
                                                             throws AclReadException,
                                                                    AclAccessException,
                                                                    AclWriteException,
                                                                    NotSupportedAclException
Add a deny permission on a resource for a user role specified

Specified by:
deny in class ServerAccess
Parameters:
path - the resource path
principal - the concerned user role
permissionType - the permission type: [read|read-acl|read-current-user-privilege-set|write|write-acl|write-properties|write-content]
Returns:
the EsupPermissions object modified by the action
Throws:
AclReadException
AclAccessException
AclWriteException
NotSupportedAclException

revoke

public org.esupportail.portal.utils.webdav.acl.EsupPermissions revoke(java.lang.String path,
                                                                      java.lang.String principal,
                                                                      java.lang.String permissionType)
                                                               throws AclReadException,
                                                                      AclAccessException,
                                                                      AclWriteException,
                                                                      NotSupportedAclException
Revoke permission on a resource for a user role specified

Specified by:
revoke in class ServerAccess
Parameters:
path - the resource path
principal - the concerned user role
permissionType - the permission type: [read|read-acl|read-current-user-privilege-set|write|write-acl|write-properties|write-content]
Returns:
the EsupPermissions object modified by the action
Throws:
AclReadException
AclAccessException
AclWriteException
NotSupportedAclException

hasInheritedPermission

public java.util.Vector hasInheritedPermission(java.lang.String path,
                                               java.lang.String principal,
                                               java.lang.String permissionType,
                                               boolean negative)
                                        throws AclReadException,
                                               AclAccessException,
                                               NotSupportedAclException
Check if the specified resource has the inherited permission given in parameter

Specified by:
hasInheritedPermission in class ServerAccess
Parameters:
path - the resource path
principal - the concerned user role
permissionType - the permission type: [read|read-acl|read-current-user-privilege-set|write|write-acl|write-properties|write-content]
negative - false for grant, true for deny
Returns:
null if not inherited permission, else return the inherited permissions
Throws:
AclReadException
AclAccessException
NotSupportedAclException

hasNotInheritedPermission

public boolean hasNotInheritedPermission(java.lang.String path,
                                         java.lang.String principal,
                                         java.lang.String permissionType,
                                         boolean negative)
                                  throws AclReadException,
                                         AclAccessException,
                                         NotSupportedAclException
Check if the specified resource has the not inherited permission given in parameter

Specified by:
hasNotInheritedPermission in class ServerAccess
Parameters:
path - the resource path
principal - the concerned user role
permissionType - the permission type: [read|read-acl|read-current-user-privilege-set|write|write-acl|write-properties|write-content]
negative - false for grant, true for deny
Throws:
AclReadException
AclAccessException
NotSupportedAclException

decodeMarks

private static java.lang.String decodeMarks(java.lang.String input)
Unescape octets for some characters that a server might (but should not) have escaped. These are: "-", "_", ".", "!", "~", "*", "'", "(", ")" Look at section 2.3 of RFC 2396.

Parameters:
input -
Returns:
decoded marks

getName

private static java.lang.String getName(java.lang.String url)
Get the name of this WebdavResource. If the decoding of the name fails, this method will not throw an exception but return the escaped name instead.

Returns:
the name of this WebdavResource.
See Also:
URI.getName()

parseDate

private static java.util.Date parseDate(java.lang.String dateValue)
Parse the java.util.Date string for HTTP-date.

Returns:
The parsed date.

getChilds

private static java.util.Vector getChilds(org.apache.webdav.lib.WebdavResource webdavResource,
                                          java.lang.String path)
                                   throws org.apache.commons.httpclient.HttpException,
                                          java.io.IOException
Get a path child resources

Parameters:
webdavResource - the webdavresource used
path - the resource path to list
Returns:
a vector of ChannelResource
Throws:
org.apache.commons.httpclient.HttpException
java.io.IOException

ls

public ChannelResource[] ls(java.lang.String fullPath)
                     throws NotExistsResourceException,
                            ApplicationException,
                            NotAuthorizedException
List all ressources for a given path

Specified by:
ls in class ServerAccess
Parameters:
fullPath - directory path on the dav server
Returns:
ChannelWebdavResource array
Throws:
NotExistsResourceException
ApplicationException
NotAuthorizedException