org.esupportail.portal.channels.CWebdav.provider
Class DavAccess

java.lang.Object
  extended byorg.esupportail.portal.channels.CWebdav.provider.DavAccess
Direct Known Subclasses:
DavAccessImpl

public abstract class DavAccess
extends java.lang.Object

Id: DavAccess.java,v 1.0 14 avr. 2004
Copyright (c) 2004 Esup Portail (www.esup-portail.org)
Classes: DavAccess
Original Author: Yohan Colmant
Interface for the dav access


Constructor Summary
DavAccess()
           
 
Method Summary
abstract  boolean canPaste(java.lang.String clipboardPath, java.util.Vector clipboard, java.lang.String curentDirPath)
          Check if we can paste here
abstract  boolean canRead(java.lang.String path)
          Check if we are authorized to read this resource
abstract  boolean canRead(java.lang.String resourceName, java.lang.String path)
          Check if we are authorized to read this resource
abstract  void connect()
          Connect this object to the server
abstract  boolean copy(java.lang.String resource, java.lang.String fromPath, java.lang.String toPath)
          Copy method
abstract  boolean createDir(java.lang.String name, java.lang.String path)
          Create the directory given in argument
abstract  boolean delete(java.lang.String file, java.lang.String path)
          Delete the resource given in argument
abstract  void disconnect()
          Disconnection of the server
abstract  ChannelWebdavResource dowload(java.lang.String name, java.lang.String path)
          Return the resource associated to the file to download
abstract  boolean exists(java.lang.String fullPath)
          Check is the resource exists
abstract  boolean exists(java.lang.String resourceName, java.lang.String path)
          Check is the resource exists
abstract  java.lang.String getLogin()
          Give the user login
abstract  java.lang.String getPassword()
          Give the user password
abstract  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
abstract  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"
abstract  java.lang.String getUri()
          Give the uri webdav access
abstract  void init(java.lang.String uri, java.lang.String login, java.lang.String password)
          This method initialize the parameters.
abstract  boolean isDirectory(java.lang.String name, java.lang.String path)
          Check if the resource named name is a directory in the path given
abstract  boolean isEmpty(java.lang.String dir, java.lang.String path)
          Check if the directory named dir is empty or not.
abstract  ChannelWebdavResource[] ls(java.lang.String fullPath)
          List all ressources for a given path
abstract  ChannelWebdavResource[] ls(java.lang.String path, java.lang.String targetDirectory)
          List all ressources for a given path
abstract  boolean move(java.lang.String resource, java.lang.String fromPath, java.lang.String toPath)
          Move method
abstract  boolean rename(java.lang.String oldName, java.lang.String newName, java.lang.String path)
          Rename the resource
abstract  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
 

Constructor Detail

DavAccess

public DavAccess()
Method Detail

getLogin

public abstract java.lang.String getLogin()
Give the user login

Returns:
the user login

getPassword

public abstract java.lang.String getPassword()
Give the user password

Returns:
the user password

getUri

public abstract java.lang.String getUri()
Give the uri webdav access

Returns:
the uri webdav access

init

public abstract void init(java.lang.String uri,
                          java.lang.String login,
                          java.lang.String password)
                   throws java.net.MalformedURLException
This method initialize the parameters. You have to call this method after calling connect method

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

getServerCurrentHierPath

public abstract java.lang.String getServerCurrentHierPath()
                                                   throws java.net.MalformedURLException
Return the hierarchy path oh the server. for example, if the server's url is http://URL:PORT/slide, the currentHierPath is "/slide"

Returns:
a String
Throws:
java.net.MalformedURLException

connect

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

Throws:
ServerException

disconnect

public abstract void disconnect()
                         throws ServerException
Disconnection of the server

Throws:
ServerException

ls

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

Parameters:
fullPath - directory path on the dav server
Returns:
ChannelWebdavResource array
Throws:
NotExistsResourceException
ApplicationException
NotAuthorizedException

ls

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

Parameters:
path - directory path on the dav server
targetDirectory - the directory name to list
Returns:
ChannelWebdavResource array
Throws:
NotExistsResourceException
ApplicationException
NotAuthorizedException

upload

public abstract boolean upload(org.jasig.portal.MultipartDataSource inputFile,
                               java.lang.String path)
                        throws ApplicationException,
                               ServerException,
                               NotExistsResourceException,
                               StillExistsException,
                               BadFormatException,
                               UploadException,
                               EmptyFileOnUploadException,
                               OverQuotaException,
                               NotAuthorizedDeleteException,
                               NotAuthorizedUploadException,
                               NotAuthorizedException
Upload a file to the path given in argument

Parameters:
inputFile - the input file
path - the path
Returns:
boolean true if no problem, else false
Throws:
ApplicationException
ServerException
NotExistsResourceException
StillExistsException
BadFormatException
UploadException
EmptyFileOnUploadException
OverQuotaException
NotAuthorizedDeleteException
NotAuthorizedUploadException
NotAuthorizedException

delete

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

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 abstract boolean rename(java.lang.String oldName,
                               java.lang.String newName,
                               java.lang.String path)
                        throws StillExistsException,
                               BadFormatException,
                               ApplicationException,
                               RenameException,
                               NotAuthorizedRenameException,
                               NotExistsResourceException,
                               NotAuthorizedException
Rename the resource

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

createDir

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

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

canPaste

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

Parameters:
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

copy

public abstract boolean copy(java.lang.String resource,
                             java.lang.String fromPath,
                             java.lang.String toPath)
                      throws CopyException,
                             ApplicationException,
                             OverQuotaException,
                             NotAuthorizedException,
                             NotExistsResourceException,
                             PasteNotAuthorizedResourceException,
                             NotAuthorizedUploadException
Copy method

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
NotAuthorizedException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedUploadException

move

public abstract boolean move(java.lang.String resource,
                             java.lang.String fromPath,
                             java.lang.String toPath)
                      throws ApplicationException,
                             MoveException,
                             NotAuthorizedException,
                             NotExistsResourceException,
                             PasteNotAuthorizedResourceException,
                             NotAuthorizedUploadException
Move method

Parameters:
resource - resource to move
fromPath - path where is the resource
toPath - path to move the resource
Returns:
boolean true if well done else false
Throws:
ApplicationException
MoveException
NotAuthorizedException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedUploadException

dowload

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

Parameters:
name - the file name
path - the path where to find the file
Returns:
the ChannelWebdavResource
Throws:
DownloadException

exists

public abstract boolean exists(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

exists

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

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

canRead

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

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 abstract boolean canRead(java.lang.String path)
                         throws ApplicationException
Check if we are authorized to read this resource

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

isDirectory

public abstract 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

Parameters:
name - the name of the resource
path - the path
Returns:
true if directory, false else
Throws:
ApplicationException
NotAuthorizedException
NotExistsResourceException

isEmpty

public abstract 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

Parameters:
dir - the name of the directory
path - the path
Returns:
true if empty, false else
Throws:
ApplicationException
NotExistsResourceException
NotAuthorizedException

getRedirectionPath

public abstract 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

Parameters:
path - the context path, for example /slide/~bidon
Returns:
the redirection path, for example: /slide/files/storage/users/n/no/bidon