org.esupportail.portal.channels.CStockage.channelAction.classic.sharing
Class SharingTool

java.lang.Object
  extended byorg.esupportail.portal.channels.CStockage.channelAction.classic.sharing.SharingTool

public class SharingTool
extends java.lang.Object

Id: SharingTool.java,v 1.0 13 janv. 2005 Copyright (c) 2005 Esup Portail (www.esup-portail.org) Classes: SharingTool Original Author: Yohan Colmant This class is a tool used to manage the sharing actions


Field Summary
static java.lang.String ADMINISTRATED_SERVER
          If the server into the database is administrated
private  DataBaseAccess dbAccess
          The object used to access the database
protected static Log log
          Logger object
 
Constructor Summary
SharingTool()
          Constructor
 
Method Summary
 void addStorageAvailableSpace(Space currentSpace, Space sharedSpace, java.lang.String serverUrl, java.lang.String fromKey, java.lang.String path, java.util.Vector users, java.util.Vector groups)
          Add sharing properties for the users and groups into the database
 void delStorageAvailableSpaceForGroups(Space currentSpace, java.util.Vector groups, java.lang.String serverId)
          Delete sharing properties for groups into the database
 void delStorageAvailableSpaceForSpecifiedPath(java.lang.String url, java.lang.String path)
          Delete sharing properties for url and path into the database
 void delStorageAvailableSpaceForUsers(Space currentSpace, java.util.Vector users, java.lang.String serverId)
          Delete sharing properties for users into the database
private static java.lang.String getServerName(java.lang.String serverUrl, java.lang.String path)
          Return the server name with the url of the server and the path
 java.lang.Object[] getTargetsOfAvailableSpace(Space currentSpace, java.lang.String serverUrl, java.lang.String path)
          Get the users for whose the resource is shared
private  java.lang.Object[] getTargetsOfAvailableSpaceFromAcl(Space currentSpace, java.lang.String serverUrl, java.lang.String path)
          Get the users for whose the resource is shared from the acl
private  java.lang.Object[] getTargetsOfAvailableSpaceFromDatabase(Space currentSpace, java.lang.String serverUrl, java.lang.String path)
          Get the users for whose the resource is shared from the database
 void updatePathOfSharing(java.lang.String url, java.lang.String oldPath, java.lang.String newPath)
          Update the path of shared spaces
 void updateReadAndWriteAndShareSpaceGroups(Space currentSpace, java.util.Vector groups)
          Update the "reading" and "writing" attributes for a specifical sharing for a group
 void updateReadAndWriteAndShareSpaceUsers(Space currentSpace, java.util.Vector users)
          Update the "reading" and "writing" attributes for a specifical sharing for a user
 void updateXmlServerAvailableSpace(Space sharedSpace)
          Update the label of the sharing properties into the database for users
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final Log log
Logger object


dbAccess

private DataBaseAccess dbAccess
The object used to access the database


ADMINISTRATED_SERVER

public static final java.lang.String ADMINISTRATED_SERVER
If the server into the database is administrated

See Also:
Constant Field Values
Constructor Detail

SharingTool

public SharingTool()
            throws PropertiesException
Constructor

Throws:
PropertiesException
Method Detail

getServerName

private static java.lang.String getServerName(java.lang.String serverUrl,
                                              java.lang.String path)
Return the server name with the url of the server and the path

Parameters:
serverUrl - the url of the server
path - the path on the server
Returns:
the server name with the url of the server and the path

getTargetsOfAvailableSpace

public java.lang.Object[] getTargetsOfAvailableSpace(Space currentSpace,
                                                     java.lang.String serverUrl,
                                                     java.lang.String path)
                                              throws DataBaseException,
                                                     PropertiesException,
                                                     ServerException,
                                                     AclReadException,
                                                     AclAccessException,
                                                     AclWriteException,
                                                     NotSupportedAclException
Get the users for whose the resource is shared

Parameters:
serverUrl - the url of the server
path - the path of the resource
Returns:
an object array composed by one Space and 2 hashtables. The first hashtable contains users, the second contains groups
Throws:
DataBaseException
PropertiesException
ServerException
AclReadException
AclAccessException
AclWriteException
NotSupportedAclException

getTargetsOfAvailableSpaceFromDatabase

private java.lang.Object[] getTargetsOfAvailableSpaceFromDatabase(Space currentSpace,
                                                                  java.lang.String serverUrl,
                                                                  java.lang.String path)
                                                           throws DataBaseException,
                                                                  PropertiesException,
                                                                  ServerException
Get the users for whose the resource is shared from the database

Parameters:
serverUrl - the url of the server
path - the path of the resource
Returns:
an object array composed by one Space and 2 hashtables. The first hashtable contains users, the second contains groups
Throws:
DataBaseException
PropertiesException
ServerException

getTargetsOfAvailableSpaceFromAcl

private java.lang.Object[] getTargetsOfAvailableSpaceFromAcl(Space currentSpace,
                                                             java.lang.String serverUrl,
                                                             java.lang.String path)
                                                      throws DataBaseException,
                                                             PropertiesException,
                                                             ServerException,
                                                             AclReadException,
                                                             AclAccessException,
                                                             AclWriteException,
                                                             NotSupportedAclException
Get the users for whose the resource is shared from the acl

Parameters:
serverUrl - the url of the server
path - the path of the resource
Returns:
an object array composed by one Space and 2 hashtables. The first hashtable contains users, the second contains groups
Throws:
DataBaseException
PropertiesException
ServerException
AclReadException
AclAccessException
AclWriteException
NotSupportedAclException

addStorageAvailableSpace

public void addStorageAvailableSpace(Space currentSpace,
                                     Space sharedSpace,
                                     java.lang.String serverUrl,
                                     java.lang.String fromKey,
                                     java.lang.String path,
                                     java.util.Vector users,
                                     java.util.Vector groups)
                              throws DataBaseException,
                                     AclAccessException,
                                     AclWriteException,
                                     AclReadException,
                                     NotSupportedAclException,
                                     PropertiesException
Add sharing properties for the users and groups into the database

Parameters:
currentSpace - the current space we are using
sharedSpace - the space we are sharing
serverUrl - the url of the server
fromKey - the key of the people who shares
path - the resource path
users - the target users
groups - the target groups
Throws:
DataBaseException
AclAccessException
AclWriteException
AclReadException
NotSupportedAclException
PropertiesException

delStorageAvailableSpaceForUsers

public void delStorageAvailableSpaceForUsers(Space currentSpace,
                                             java.util.Vector users,
                                             java.lang.String serverId)
                                      throws DataBaseException,
                                             AclAccessException,
                                             AclWriteException,
                                             AclReadException,
                                             NotSupportedAclException,
                                             PropertiesException
Delete sharing properties for users into the database

Parameters:
currentSpace - the current space
users - we want to delete preferences
serverId - the id of the server
Throws:
DataBaseException
AclAccessException
AclWriteException
AclReadException
NotSupportedAclException
PropertiesException

delStorageAvailableSpaceForGroups

public void delStorageAvailableSpaceForGroups(Space currentSpace,
                                              java.util.Vector groups,
                                              java.lang.String serverId)
                                       throws DataBaseException,
                                              AclAccessException,
                                              AclWriteException,
                                              AclReadException,
                                              NotSupportedAclException,
                                              PropertiesException
Delete sharing properties for groups into the database

Parameters:
currentSpace - the current space
groups - the groups we want to delete sharing
serverId - the id of the server
Throws:
DataBaseException
AclAccessException
AclWriteException
AclReadException
NotSupportedAclException
PropertiesException

updateReadAndWriteAndShareSpaceUsers

public void updateReadAndWriteAndShareSpaceUsers(Space currentSpace,
                                                 java.util.Vector users)
                                          throws DataBaseException,
                                                 AclAccessException,
                                                 AclWriteException,
                                                 AclReadException,
                                                 NotSupportedAclException,
                                                 PropertiesException
Update the "reading" and "writing" attributes for a specifical sharing for a user

Parameters:
currentSpace - the current space
users - the target users
Throws:
DataBaseException
AclAccessException
AclWriteException
AclReadException
NotSupportedAclException
PropertiesException

updateReadAndWriteAndShareSpaceGroups

public void updateReadAndWriteAndShareSpaceGroups(Space currentSpace,
                                                  java.util.Vector groups)
                                           throws DataBaseException,
                                                  AclAccessException,
                                                  AclWriteException,
                                                  AclReadException,
                                                  NotSupportedAclException,
                                                  PropertiesException
Update the "reading" and "writing" attributes for a specifical sharing for a group

Parameters:
currentSpace - the current space
groups - the target groups
Throws:
DataBaseException
AclAccessException
AclWriteException
AclReadException
NotSupportedAclException
PropertiesException

updateXmlServerAvailableSpace

public void updateXmlServerAvailableSpace(Space sharedSpace)
                                   throws DataBaseException
Update the label of the sharing properties into the database for users

Parameters:
sharedSpace - the space we are sharing
Throws:
DataBaseException

delStorageAvailableSpaceForSpecifiedPath

public void delStorageAvailableSpaceForSpecifiedPath(java.lang.String url,
                                                     java.lang.String path)
                                              throws DataBaseException
Delete sharing properties for url and path into the database

Parameters:
url - the url of the space
path - the path of the space
Throws:
DataBaseException

updatePathOfSharing

public void updatePathOfSharing(java.lang.String url,
                                java.lang.String oldPath,
                                java.lang.String newPath)
                         throws DataBaseException
Update the path of shared spaces

Parameters:
url - the url of the space
oldPath - the old path of the space
newPath - the new path of the space
Returns:
the result of the query
Throws:
DataBaseException