|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.esupportail.portal.channels.CWebdav.provider.access.ServerAccess
org.esupportail.portal.channels.CWebdav.provider.access.WebdavAccessImpl
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 org.apache.commons.logging.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 |
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 |
private java.util.Vector |
getProperties(java.lang.String path,
java.lang.String propertyName)
Get a resource's property specified by the path |
private java.util.Vector |
getProperties(java.lang.String path,
java.util.Vector properties)
Get a resource's property specified by the path |
java.lang.String |
getProperty(java.lang.String path,
java.lang.String propertyName)
Get a resource's property specified by the path |
java.lang.String |
getServerCurrentHierPath()
Return the hierarchy path oh the server. for example, if the server's url is http://URL:PORT/slide, the currentHierPath is "/slide" |
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 path,
java.lang.String propertyName,
java.lang.String propertyValue)
Set the property of resource |
boolean |
upload(org.jasig.portal.MultipartDataSource inputFile,
java.lang.String path)
Upload a file to the path given in argument |
Methods inherited from class org.esupportail.portal.channels.CWebdav.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 |
protected static final org.apache.commons.logging.Log log
private java.lang.String url
private java.lang.String login
private java.lang.String password
private org.apache.commons.httpclient.HttpURL httpURL
private org.apache.webdav.lib.WebdavResource resource
private java.lang.String connexionPath
private org.esupportail.portal.utils.webdav.acl.ACLManager aclManager
private java.lang.String aclNamespace
private java.lang.String aclUserPrefix
private java.lang.String aclGroupPrefix
private static final java.text.SimpleDateFormat[] formats
Constructor Detail |
public WebdavAccessImpl()
Method Detail |
public void init(Space space) throws java.net.MalformedURLException, PropertiesException
init
in class ServerAccess
space
- the space corresponding to the server access
java.net.MalformedURLException
PropertiesException
private void init(java.lang.String url, java.lang.String login, java.lang.String password) throws java.net.MalformedURLException
url
- webdav urllogin
- connexion loginpassword
- connexioàn password
java.net.MalformedURLException
public java.lang.String getServerCurrentHierPath() throws java.net.MalformedURLException
getServerCurrentHierPath
in class ServerAccess
java.net.MalformedURLException
public void connect() throws ServerException, BadConnexionParameters
connect
in class ServerAccess
ServerException
BadConnexionParameters
public void disconnect() throws ServerException
disconnect
in class ServerAccess
ServerException
public java.io.InputStream getMethodData(java.lang.String fullPath) throws java.io.IOException
getMethodData
in class ServerAccess
fullPath
- the full resource path
java.io.IOException
public ChannelResource[] ls(java.lang.String path, java.lang.String targetDirectory) throws NotExistsResourceException, ApplicationException, NotAuthorizedException
ls
in class ServerAccess
path
- directory path on the dav servertargetDirectory
- the directory name to list
NotExistsResourceException
ApplicationException
NotAuthorizedException
public boolean upload(org.jasig.portal.MultipartDataSource inputFile, java.lang.String path) throws ApplicationException, ServerException, NotExistsResourceException, StillExistsException, BadFormatException, UploadException, EmptyFileOnUploadException, OverQuotaException, NotAuthorizedDeleteException, NotAuthorizedUploadException, NotAuthorizedException
upload
in class ServerAccess
inputFile
- the input filepath
- the path
ApplicationException
ServerException
NotExistsResourceException
StillExistsException
BadFormatException
UploadException
EmptyFileOnUploadException
OverQuotaException
NotAuthorizedDeleteException
NotAuthorizedUploadException
NotAuthorizedException
private boolean fileIsEmptyOnServer(java.lang.String fileName, java.lang.String path) throws ApplicationException
fileName
- the name of the file to checkpath
- the path where is the file on the server
ApplicationException
public boolean delete(java.lang.String file, java.lang.String path) throws ApplicationException, DeleteException, NotAuthorizedDeleteException, NotExistsResourceException, NotAuthorizedException
delete
in class ServerAccess
file
- file/directory to deletepath
- path where is file/directory
ApplicationException
DeleteException
NotAuthorizedDeleteException
NotExistsResourceException
NotAuthorizedException
public boolean rename(java.lang.String oldName, java.lang.String newName, java.lang.String path) throws StillExistsException, BadFormatException, ApplicationException, RenameException, NotAuthorizedRenameException, NotExistsResourceException, NotAuthorizedException
rename
in class ServerAccess
oldName
- file/directory to renamenewName
- new name of the file/directorypath
- path where is file/directory
StillExistsException
BadFormatException
ApplicationException
RenameException
NotAuthorizedRenameException
NotExistsResourceException
NotAuthorizedException
public boolean createDir(java.lang.String name, java.lang.String path) throws ApplicationException, CreateDirectoryException, StillExistsException, BadFormatException, NotAuthorizedNewDirException, NotExistsResourceException, NotAuthorizedException
createDir
in class ServerAccess
name
- file/directory to deletepath
- path where is file/directory
ApplicationException
CreateDirectoryException
StillExistsException
BadFormatException
NotAuthorizedNewDirException
NotExistsResourceException
NotAuthorizedException
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
canPaste
in class ServerAccess
fromSpace
- the space from whitch we want to pastetoSpaceKey
- the space key where we want to pasteclipboardPath
- the path where is the clipboadclipboard
- the containt of the clipboardcurentDirPath
- the path of the curent dir
ApplicationException
PasteInChildDirectoryException
PasteWithSameNameException
PasteDeletedResourceException
NotAuthorizedException
protected boolean localCopy(java.lang.String resource, java.lang.String fromPath, java.lang.String toPath) throws CopyException, ApplicationException, OverQuotaException, NotExistsResourceException, PasteNotAuthorizedResourceException, NotAuthorizedException, NotAuthorizedUploadException
localCopy
in class ServerAccess
resource
- resource to copyfromPath
- path where is the resourcetoPath
- path to copy the resource
CopyException
ApplicationException
OverQuotaException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedException
NotAuthorizedUploadException
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
distantCopy
in class ServerAccess
resource
- resource to copyfromAccess
- the space access from witch we want to copyfromPath
- path where is the resourcetoPath
- path to copy the resource
CopyException
ApplicationException
OverQuotaException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedException
NotAuthorizedUploadException
ServerException
private boolean distantCopy(ChannelResource resource, ServerAccess fromAccess, java.lang.String toPath) throws CopyException, ApplicationException, OverQuotaException, PasteNotAuthorizedResourceException, NotExistsResourceException, PasteNotAuthorizedResourceException, NotAuthorizedException, NotAuthorizedUploadException, ServerException
resource
- resource to copyfromAccess
- the space access from witch we want to copytoPath
- path to copy the resource
CopyException
ApplicationException
OverQuotaException
PasteNotAuthorizedResourceException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedException
NotAuthorizedUploadException
ServerException
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
fileName
- file to copyfromAccess
- the space access from witch we want to copyabsoluteFromPath
- path where is the resourcetoPath
- path to copy the resource
CopyException
ApplicationException
OverQuotaException
PasteNotAuthorizedResourceException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedException
NotAuthorizedUploadException
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
directoryName
- file to directoryfromAccess
- the space access from witch we want to copyabsoluteFromPath
- path where is the resourcetoPath
- path to copy the resource
CopyException
ApplicationException
OverQuotaException
PasteNotAuthorizedResourceException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedException
NotAuthorizedUploadException
ServerException
protected boolean localMove(java.lang.String resource, java.lang.String fromPath, java.lang.String toPath) throws MoveException, ApplicationException, OverQuotaException, PasteNotAuthorizedResourceException, NotExistsResourceException, PasteNotAuthorizedResourceException, NotAuthorizedException, NotAuthorizedUploadException
localMove
in class ServerAccess
resource
- resource to movefromPath
- path where is the resourcetoPath
- path to copy the resource
MoveException
ApplicationException
OverQuotaException
PasteNotAuthorizedResourceException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedException
NotAuthorizedUploadException
public ChannelResource download(java.lang.String name, java.lang.String path) throws DownloadException
download
in class ServerAccess
name
- the file namepath
- the path where to find the file
DownloadException
public boolean exists(java.lang.String resourceName, java.lang.String path) throws ApplicationException, NotAuthorizedException
exists
in class ServerAccess
resourceName
- name of the file/directory to verifypath
- path to find the file/directory
ApplicationException
NotAuthorizedException
public boolean exists(java.lang.String fullPath) throws ApplicationException, NotAuthorizedException
exists
in class ServerAccess
fullPath
- path to find the file/directory
ApplicationException
NotAuthorizedException
public boolean canRead(java.lang.String resourceName, java.lang.String path) throws ApplicationException
canRead
in class ServerAccess
resourceName
- name of the file/directory to verifypath
- path to find the file/directory
ApplicationException
public boolean canRead(java.lang.String path) throws ApplicationException
canRead
in class ServerAccess
path
- path to find the file/directory
ApplicationException
public boolean isDirectory(java.lang.String name, java.lang.String path) throws ApplicationException, NotAuthorizedException, NotExistsResourceException
isDirectory
in class ServerAccess
name
- the name of the resourcepath
- the path
ApplicationException
NotAuthorizedException
NotExistsResourceException
public boolean isEmpty(java.lang.String dir, java.lang.String path) throws ApplicationException, NotExistsResourceException, NotAuthorizedException
isEmpty
in class ServerAccess
dir
- the name of the directorypath
- the path
ApplicationException
NotExistsResourceException
NotAuthorizedException
private java.util.Vector getProperties(java.lang.String path, java.lang.String propertyName) throws ServerException
path
- the resource pathpropertyName
- the property name
ServerException
private java.util.Vector getProperties(java.lang.String path, java.util.Vector properties) throws ServerException
path
- the resource pathproperties
- a vector containing the properties name
ServerException
public java.lang.String getProperty(java.lang.String path, java.lang.String propertyName) throws ServerException
getProperty
in class ServerAccess
path
- the resource pathpropertyName
- the property name
ServerException
public boolean setProperty(java.lang.String path, java.lang.String propertyName, java.lang.String propertyValue) throws ServerException
setProperty
in class ServerAccess
path
- the resource pathpropertyName
- the name of the property to setpropertyValue
- the value of the property to set
ServerException
public org.esupportail.portal.utils.webdav.acl.EsupPermissions getPermissions(java.lang.String path, java.lang.String permissionType) throws AclReadException, AclAccessException, NotSupportedAclException
getPermissions
in class ServerAccess
path
- the resource pathpermissionType
- the type of permission (read, write, ....)
AclReadException
AclAccessException
NotSupportedAclException
public org.esupportail.portal.utils.webdav.acl.EsupPermissions getPermissions(java.lang.String path) throws AclReadException, AclAccessException, NotSupportedAclException
getPermissions
in class ServerAccess
path
- the resource path
AclReadException
AclAccessException
NotSupportedAclException
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
grant
in class ServerAccess
path
- the resource pathprincipal
- the concerned user rolepermissionType
- the permission type: [read|read-acl|read-current-user-privilege-set|write|write-acl|write-properties|write-content]
AclReadException
AclAccessException
AclWriteException
NotSupportedAclException
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
deny
in class ServerAccess
path
- the resource pathprincipal
- the concerned user rolepermissionType
- the permission type: [read|read-acl|read-current-user-privilege-set|write|write-acl|write-properties|write-content]
AclReadException
AclAccessException
AclWriteException
NotSupportedAclException
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
in class ServerAccess
path
- the resource pathprincipal
- the concerned user rolepermissionType
- the permission type: [read|read-acl|read-current-user-privilege-set|write|write-acl|write-properties|write-content]
AclReadException
AclAccessException
AclWriteException
NotSupportedAclException
public java.util.Vector hasInheritedPermission(java.lang.String path, java.lang.String principal, java.lang.String permissionType, boolean negative) throws AclReadException, AclAccessException, NotSupportedAclException
hasInheritedPermission
in class ServerAccess
path
- the resource pathprincipal
- the concerned user rolepermissionType
- 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
AclReadException
AclAccessException
NotSupportedAclException
public boolean hasNotInheritedPermission(java.lang.String path, java.lang.String principal, java.lang.String permissionType, boolean negative) throws AclReadException, AclAccessException, NotSupportedAclException
hasNotInheritedPermission
in class ServerAccess
path
- the resource pathprincipal
- the concerned user rolepermissionType
- 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
AclReadException
AclAccessException
NotSupportedAclException
private static java.lang.String decodeMarks(java.lang.String input)
input
-
private static java.lang.String getName(java.lang.String url)
URI.getName()
private static java.util.Date parseDate(java.lang.String dateValue)
java.util.Date
string for HTTP-date.
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
webdavResource
- the webdavresource usedpath
- the resource path to list
org.apache.commons.httpclient.HttpException
java.io.IOException
public ChannelResource[] ls(java.lang.String fullPath) throws NotExistsResourceException, ApplicationException, NotAuthorizedException
ls
in class ServerAccess
fullPath
- directory path on the dav server
NotExistsResourceException
ApplicationException
NotAuthorizedException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |