CWebdav 0.1
API Documentation

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

java.lang.Object
  extended byorg.esupportail.portal.channels.CWebdav.provider.DavAccess
      extended byorg.esupportail.portal.channels.CWebdav.provider.DavAccessImpl

public class DavAccessImpl
extends DavAccess

Id: DavAccessImpl.java,v 1.0 14 avr. 2004 Copyright (c) 2004 Esup Portail (www.esup-portail.org) Classes: DavAccessImpl Original Author: Yohan Colmant


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
 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
 java.lang.String getContentType()
          Search content type of the file whiwh will be downloaded
 java.io.InputStream getInputStream()
          Real download WARNING : the method "fileToDownload.getMethodData()" create a tempory file which be delete when the JVM will be stoped
 java.lang.String getLogin()
          Give the user login
 java.lang.String getPassword()
          Give the user password
 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.
 boolean isExist(java.lang.String resourceName, java.lang.String path)
          Check is the resource exists
 org.apache.webdav.lib.WebdavResource[] ls(java.lang.String path)
          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 setFileToDownload(java.lang.String name, java.lang.String path)
          Prepare the file whiwh will be downloaded
 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DavAccessImpl

public DavAccessImpl()
Default constructor

Method Detail

getLogin

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

Specified by:
getLogin in class DavAccess
Returns:
the user login

getPassword

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

Specified by:
getPassword in class DavAccess
Returns:
the user password

getUri

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

Specified by:
getUri in class DavAccess
Returns:
the uri webdav access

init

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

Specified by:
init in class DavAccess
Parameters:
uri - webdav uri
login - connexion login
password - connexioàn password
Throws:
java.net.MalformedURLException

connect

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

Specified by:
connect in class DavAccess
Throws:
ServerException

disconnect

public void disconnect()
                throws ServerException
Disconnection of the server

Specified by:
disconnect in class DavAccess
Throws:
ServerException

ls

public org.apache.webdav.lib.WebdavResource[] ls(java.lang.String path)
                                          throws NotExistsResourceException,
                                                 ApplicationException
All ressources for a given path

Specified by:
ls in class DavAccess
Parameters:
path - directory path on the dav server
Returns:
WebdavResource array
Throws:
NotExistsResourceException
ApplicationException

upload

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

Specified by:
upload in class DavAccess
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

delete

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

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

rename

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

Specified by:
rename in class DavAccess
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

createDir

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

Specified by:
createDir in class DavAccess
Parameters:
path - path where is file/directory
Returns:
boolean true if well done else false
Throws:
ApplicationException
CreateDirectoryException
StillExistsException
BadFormatException

canPaste

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

Specified by:
canPaste in class DavAccess
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

copy

public boolean copy(java.lang.String resource,
                    java.lang.String fromPath,
                    java.lang.String toPath)
             throws CopyException,
                    ApplicationException,
                    OverQuotaException
Copy method

Specified by:
copy in class DavAccess
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:
ApplicationException
CopyException
OverQuotaException

move

public boolean move(java.lang.String resource,
                    java.lang.String fromPath,
                    java.lang.String toPath)
             throws ApplicationException,
                    MoveException
Move method

Specified by:
move in class DavAccess
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

setFileToDownload

public boolean setFileToDownload(java.lang.String name,
                                 java.lang.String path)
Prepare the file whiwh will be downloaded

Specified by:
setFileToDownload in class DavAccess
See Also:
DavAccess.setFileToDownload(java.lang.String, java.lang.String)

getContentType

public java.lang.String getContentType()
Search content type of the file whiwh will be downloaded

Specified by:
getContentType in class DavAccess
See Also:
DavAccess.getContentType()

getInputStream

public java.io.InputStream getInputStream()
Real download WARNING : the method "fileToDownload.getMethodData()" create a tempory file which be delete when the JVM will be stoped

Specified by:
getInputStream in class DavAccess
See Also:
org.esupportail.portal.channels.CWebdav.provider.DavAccess#downloadData(java.io.OutputStream, java.lang.String, java.lang.String)

isExist

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

Specified by:
isExist in class DavAccess
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:
java.io.IOException
org.apache.commons.httpclient.HttpException
ApplicationException

isDirectory

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

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

isEmpty

public boolean isEmpty(java.lang.String dir,
                       java.lang.String path)
                throws ApplicationException,
                       NotExistsResourceException
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 DavAccess
Parameters:
dir - the name of the directory
path - the path
Returns:
true if empty, false else
Throws:
ApplicationException
NotExistsResourceException

CWebdav 0.1
API Documentation