CStockage 4.2_beta-RC-1
API Documentation

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

java.lang.Object
  extended byorg.esupportail.portal.channels.CStockage.provider.access.ServerAccess
Direct Known Subclasses:
CifsAccessImpl, WebdavAccessImpl

public abstract class ServerAccess
extends java.lang.Object

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


Constructor Summary
ServerAccess()
           
 
Method Summary
abstract  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
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  boolean[] checkPrivileges(java.lang.String path)
          Check The privileges for the current user
abstract  void connect()
          Connect this object to the server
 boolean copy(java.lang.String resource, Space fromSpace, java.lang.String fromPath, java.lang.String toSpaceKey, 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  org.esupportail.portal.utils.webdav.acl.EsupPermissions deny(java.lang.String path, java.lang.String principal, java.lang.String permissionType, boolean inheritable)
          Add a deny permission on a resource for a user role specified
abstract  void disconnect()
          Disconnection of the server
abstract  ChannelResource download(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.io.InputStream getMethodData(java.lang.String fullPath)
          Return the stream from a resource
abstract  org.esupportail.portal.utils.webdav.acl.EsupPermissions getPermissions(java.lang.String path)
          Get a resource permissions as an EsupPermissions object
abstract  org.esupportail.portal.utils.webdav.acl.EsupPermissions getPermissions(java.lang.String path, java.lang.String permissionType)
          Get a resource permissions as an EsupPermissions object
abstract  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
abstract  org.esupportail.portal.utils.webdav.acl.EsupPermissions grant(java.lang.String path, java.lang.String principal, java.lang.String permissionType, boolean inheritable)
          Add a grant permission on a resource for a user role specified
abstract  java.util.Vector hasInheritedPermission(java.lang.String path, java.lang.String principal, java.lang.String permissionType, boolean negative, boolean inheritable)
          Check if the specified resource has the inherited permission given in parameter
abstract  boolean hasNotInheritedPermission(java.lang.String path, java.lang.String principal, java.lang.String permissionType, boolean negative, boolean inheritable)
          Check if the specified resource has the not inherited permission given in parameter
abstract  void init(Space space)
          This method initializes 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  ChannelResource[] ls(java.lang.String fullPath)
          List all ressources for a given path
abstract  ChannelResource[] ls(java.lang.String path, java.lang.String targetDirectory)
          List all ressources for a given path
 boolean move(java.lang.String resource, Space fromSpace, java.lang.String fromPath, java.lang.String toSpaceKey, 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  org.esupportail.portal.utils.webdav.acl.EsupPermissions revoke(java.lang.String path, java.lang.String principal, java.lang.String permissionType, boolean inheritable)
          Revoke permission on a resource for a user role specified
abstract  void revokeAllPermissons(java.lang.String path)
          Revoke all the permissions on a resource
abstract  boolean setProperty(java.lang.String namespace, java.lang.String path, java.lang.String propertyName, java.lang.String propertyValue)
          Set the property of resource
abstract  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 java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerAccess

public ServerAccess()
Method Detail

init

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

Parameters:
space - the space corresponding to the server access
Throws:
java.net.MalformedURLException
PropertiesException

connect

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

Throws:
ServerException
BadConnexionParameters

disconnect

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

Throws:
ServerException

ls

public abstract ChannelResource[] 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 ChannelResource[] 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(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

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

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,
                               PropertiesException
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
PropertiesException

createDir

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

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

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

copy

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

Parameters:
resource - resource to copy
fromSpace - the space from witch we want to move
fromPath - path where is the resource
toSpaceKey - the space key to witch we want to move
toPath - path to copy the resource
Returns:
boolean true if well done else false
Throws:
ChannelException
CopyException
ApplicationException
OverQuotaException
PasteNotAuthorizedResourceException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedException
NotAuthorizedUploadException

move

public boolean move(java.lang.String resource,
                    Space fromSpace,
                    java.lang.String fromPath,
                    java.lang.String toSpaceKey,
                    java.lang.String toPath)
             throws ChannelException,
                    MoveException,
                    ApplicationException,
                    OverQuotaException,
                    PasteNotAuthorizedResourceException,
                    NotExistsResourceException,
                    PasteNotAuthorizedResourceException,
                    NotAuthorizedException,
                    NotAuthorizedUploadException
Move method

Parameters:
resource - resource to move
fromSpace - the space from witch we want to move
fromPath - path where is the resource
toSpaceKey - the space key to witch we want to move
toPath - path to move the resource
Returns:
boolean true if well done else false
Throws:
ChannelException
ApplicationException
MoveException
PasteNotAuthorizedResourceException
NotExistsResourceException
PasteNotAuthorizedResourceException
NotAuthorizedException
NotAuthorizedUploadException
OverQuotaException

download

public abstract ChannelResource download(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

getMethodData

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

Parameters:
fullPath - the full resource path
Returns:
the InputStream
Throws:
java.io.IOException

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

getProperty

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

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

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

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 abstract org.esupportail.portal.utils.webdav.acl.EsupPermissions getPermissions(java.lang.String path)
                                                                                throws AclReadException,
                                                                                       AclAccessException,
                                                                                       NotSupportedAclException
Get a resource permissions as an EsupPermissions object

Parameters:
path - the resource path
Returns:
an EsupPermissions object representing the permissions
Throws:
AclReadException
AclAccessException
NotSupportedAclException

grant

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

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 abstract org.esupportail.portal.utils.webdav.acl.EsupPermissions deny(java.lang.String path,
                                                                             java.lang.String principal,
                                                                             java.lang.String permissionType,
                                                                             boolean inheritable)
                                                                      throws AclReadException,
                                                                             AclAccessException,
                                                                             AclWriteException,
                                                                             NotSupportedAclException
Add a deny permission on a resource for a user role specified

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 abstract org.esupportail.portal.utils.webdav.acl.EsupPermissions revoke(java.lang.String path,
                                                                               java.lang.String principal,
                                                                               java.lang.String permissionType,
                                                                               boolean inheritable)
                                                                        throws AclReadException,
                                                                               AclAccessException,
                                                                               AclWriteException,
                                                                               NotSupportedAclException
Revoke permission on a resource for a user role specified

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

revokeAllPermissons

public abstract void revokeAllPermissons(java.lang.String path)
                                  throws AclReadException,
                                         AclAccessException,
                                         AclWriteException,
                                         NotSupportedAclException
Revoke all the permissions on a resource

Parameters:
path - the resource path
Throws:
java.io.IOException
org.esupportail.portal.utils.webdav.acl.exception.ReadAclException
org.esupportail.portal.utils.webdav.acl.exception.WriteAclException
AclReadException
AclAccessException
AclWriteException
NotSupportedAclException

hasInheritedPermission

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

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 abstract boolean hasNotInheritedPermission(java.lang.String path,
                                                  java.lang.String principal,
                                                  java.lang.String permissionType,
                                                  boolean negative,
                                                  boolean inheritable)
                                           throws AclReadException,
                                                  AclAccessException,
                                                  NotSupportedAclException
Check if the specified resource has the not inherited permission given in parameter

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

checkPrivileges

public abstract boolean[] checkPrivileges(java.lang.String path)
Check The privileges for the current user

Parameters:
path - the path of the space
Returns:
an array containing the values of reading, writing and sharing

CStockage 4.2_beta-RC-1
API Documentation