|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.esupportail.portal.channels.CWebdav.provider.DavAccess
org.esupportail.portal.channels.CWebdav.provider.DavAccessImpl
Id: DavAccessImpl.java,v 1.0 14 avr. 2004
Copyright (c) 2004 Esup Portail (www.esup-portail.org)
Classes: DavAccessImpl
Original Author: Yohan Colmant
Implements the DavAccess methods
Field Summary | |
private org.apache.commons.httpclient.HttpURL |
httpURL
The Http url used to access the webdav |
private java.lang.String |
login
The user login |
private java.lang.String |
password
The password for the dav acccess |
private org.apache.webdav.lib.WebdavResource |
resource
The WebDAV ressource |
private java.lang.String |
uri
The dav access uri |
Constructor Summary | |
DavAccessImpl()
Default constructor |
Method Summary | |
boolean |
canPaste(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 |
copy(java.lang.String resource,
java.lang.String fromPath,
java.lang.String toPath)
Copy method |
boolean |
createDir(java.lang.String name,
java.lang.String path)
Create the directory given in argument |
boolean |
delete(java.lang.String file,
java.lang.String path)
Delete the resource given in argument |
void |
disconnect()
Disconnection of the server |
ChannelWebdavResource |
dowload(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 |
java.lang.String |
getLogin()
Give the user login |
java.lang.String |
getPassword()
Give the user password |
java.lang.String |
getRedirectionPath(java.lang.String path)
This method is used to know the redirected path when we have an url in this form: http://SERVER:PORT/~context |
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" |
java.lang.String |
getUri()
Give the uri webdav access |
void |
init(java.lang.String uri,
java.lang.String login,
java.lang.String password)
This method initialize 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. |
ChannelWebdavResource[] |
ls(java.lang.String fullPath)
List all ressources for a given path |
ChannelWebdavResource[] |
ls(java.lang.String path,
java.lang.String targetDirectory)
List all ressources for a given path |
boolean |
move(java.lang.String resource,
java.lang.String fromPath,
java.lang.String toPath)
Move method |
boolean |
rename(java.lang.String oldName,
java.lang.String newName,
java.lang.String path)
Rename the 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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.lang.String uri
private java.lang.String login
private java.lang.String password
private org.apache.commons.httpclient.HttpURL httpURL
private org.apache.webdav.lib.WebdavResource resource
Constructor Detail |
public DavAccessImpl()
Method Detail |
public java.lang.String getLogin()
getLogin
in class DavAccess
public java.lang.String getPassword()
getPassword
in class DavAccess
public java.lang.String getUri()
getUri
in class DavAccess
public void init(java.lang.String uri, java.lang.String login, java.lang.String password) throws java.net.MalformedURLException
init
in class DavAccess
uri
- webdav urilogin
- connexion loginpassword
- connexioàn password
java.net.MalformedURLException
public java.lang.String getServerCurrentHierPath() throws java.net.MalformedURLException
getServerCurrentHierPath
in class DavAccess
java.net.MalformedURLException
public void connect() throws ServerException
connect
in class DavAccess
ServerException
public void disconnect() throws ServerException
disconnect
in class DavAccess
ServerException
public ChannelWebdavResource[] ls(java.lang.String fullPath) throws NotExistsResourceException, ApplicationException, NotAuthorizedException
ls
in class DavAccess
fullPath
- directory path on the dav server
NotExistsResourceException
ApplicationException
NotAuthorizedException
public ChannelWebdavResource[] ls(java.lang.String path, java.lang.String targetDirectory) throws NotExistsResourceException, ApplicationException, NotAuthorizedException
ls
in class DavAccess
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 DavAccess
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 DavAccess
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 DavAccess
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 DavAccess
name
- file/directory to deletepath
- path where is file/directory
ApplicationException
CreateDirectoryException
StillExistsException
BadFormatException
NotAuthorizedNewDirException
NotExistsResourceException
NotAuthorizedException
public boolean canPaste(java.lang.String clipboardPath, java.util.Vector clipboard, java.lang.String curentDirPath) throws ApplicationException, PasteInChildDirectoryException, PasteWithSameNameException, PasteDeletedResourceException, NotAuthorizedException
canPaste
in class DavAccess
clipboardPath
- the path where is the clipboadclipboard
- the containt of the clipboardcurentDirPath
- the path of the curent dir
ApplicationException
PasteInChildDirectoryException
PasteWithSameNameException
PasteDeletedResourceException
NotAuthorizedException
public boolean copy(java.lang.String resource, java.lang.String fromPath, java.lang.String toPath) throws CopyException, ApplicationException, OverQuotaException, PasteNotAuthorizedResourceException, NotExistsResourceException, PasteNotAuthorizedResourceException, NotAuthorizedException, NotAuthorizedUploadException
copy
in class DavAccess
resource
- resource to copyfromPath
- path where is the resourcetoPath
- path to copy the resource
CopyException
ApplicationException
OverQuotaException
NotAuthorizedException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedUploadException
public boolean move(java.lang.String resource, java.lang.String fromPath, java.lang.String toPath) throws ApplicationException, MoveException, PasteNotAuthorizedResourceException, NotExistsResourceException, PasteNotAuthorizedResourceException, NotAuthorizedException, NotAuthorizedUploadException
move
in class DavAccess
resource
- resource to movefromPath
- path where is the resourcetoPath
- path to move the resource
ApplicationException
MoveException
NotAuthorizedException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedUploadException
public ChannelWebdavResource dowload(java.lang.String name, java.lang.String path) throws DownloadException
dowload
in class DavAccess
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 DavAccess
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 DavAccess
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 DavAccess
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 DavAccess
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 DavAccess
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 DavAccess
dir
- the name of the directorypath
- the path
ApplicationException
NotExistsResourceException
NotAuthorizedException
public java.lang.String getRedirectionPath(java.lang.String path)
getRedirectionPath
in class DavAccess
path
- the context path, for example /slide/~bidon
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |