org.esupportail.portal.utils.injac.injacSpacesCreation
Class InjacSpacesCreation

java.lang.Object
  extended byorg.esupportail.portal.utils.injac.injacSpacesCreation.InjacSpacesCreation

public class InjacSpacesCreation
extends java.lang.Object

injacSpacesCreation [spaceName] [authors] [editors]
[authors] = user1:user2:user3...
[editors] = user1:user2:user3...
action of the script :
Variables between {} are defined in the configuration file : /properties/config.xml
1> Create two directories : /{injacPath}/{editorSpacesPath}/[spaceName]
/{injacPath}/{publicationSpacesPath}/[spaceName]
2> Create the role {AuthorsGroupPrefix}[spaceName]
Add the authors [authors] to this role
Grant write and read for this role to /{injacPath}/{editorSpacesPath}/[spaceName]
3> Create the role {EditorsGroupPrefix}[spaceName]
Add the editors [editors] to this role
Grant write and read for this role to /{injacPath}/{publicationSpacesPath}/[spaceName]
Grant read for this role to /{injacPath}/{editorSpacesPath}/[spaceName]


Field Summary
private  org.esupportail.portal.utils.injac.tools.ACLManager aclManager
           
private  java.lang.String authorsGroupPrefix
           
private  java.lang.String context
           
private static java.lang.String EDITOR_SPACE
           
private  java.lang.String editorsGroupPrefix
           
private  java.lang.String editorSpacesPath
           
private  org.apache.commons.httpclient.HttpURL httpUrl
           
private  java.lang.String injacPath
           
private  org.apache.log4j.Logger logger
           
private static java.lang.String PUBLICATION_SPACE
           
private  java.lang.String publicationSpacesPath
           
private  java.lang.String roleDirectoryRootDirectory
           
private  java.lang.String userDirectoryRootDirectory
           
private  org.apache.webdav.lib.WebdavResource webDavResource
           
private  java.lang.String webdavServerLogin
           
private  java.lang.String webdavServerPassword
           
private  java.lang.String webdavServerUrl
           
private  java.lang.String webdavServerUsersRole
           
 
Constructor Summary
InjacSpacesCreation()
           
 
Method Summary
private  void addUserToRole(org.apache.webdav.lib.WebdavResource webDavResource, java.lang.String roleName, java.util.Enumeration userList)
          Add a String Enumeration of users to a role
private  void createInjacSpace(org.apache.webdav.lib.WebdavResource webDavResource, java.lang.String spaceName, java.lang.String spaceType)
          Create an Injac space with the specified type.
private  void createRole(org.apache.webdav.lib.WebdavResource webDavResource, java.lang.String roleName)
          Create a role
private  void init()
          Initialize all the variables and connect to the WebDAV server
static void main(java.lang.String[] args)
           
private  java.util.Enumeration parseUserList(java.lang.String userList)
          Parse a user list given in parameter of the application
private  boolean pathExist(org.apache.webdav.lib.WebdavResource webDavResource, java.lang.String path)
          Verify if the WebDAV ressource exits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDITOR_SPACE

private static java.lang.String EDITOR_SPACE

PUBLICATION_SPACE

private static java.lang.String PUBLICATION_SPACE

httpUrl

private org.apache.commons.httpclient.HttpURL httpUrl

webDavResource

private org.apache.webdav.lib.WebdavResource webDavResource

context

private java.lang.String context

aclManager

private org.esupportail.portal.utils.injac.tools.ACLManager aclManager

injacPath

private java.lang.String injacPath

editorSpacesPath

private java.lang.String editorSpacesPath

publicationSpacesPath

private java.lang.String publicationSpacesPath

authorsGroupPrefix

private java.lang.String authorsGroupPrefix

editorsGroupPrefix

private java.lang.String editorsGroupPrefix

webdavServerUrl

private java.lang.String webdavServerUrl

webdavServerLogin

private java.lang.String webdavServerLogin

webdavServerPassword

private java.lang.String webdavServerPassword

webdavServerUsersRole

private java.lang.String webdavServerUsersRole

userDirectoryRootDirectory

private java.lang.String userDirectoryRootDirectory

roleDirectoryRootDirectory

private java.lang.String roleDirectoryRootDirectory

logger

private org.apache.log4j.Logger logger
Constructor Detail

InjacSpacesCreation

public InjacSpacesCreation()
Method Detail

init

private void init()
Initialize all the variables and connect to the WebDAV server


pathExist

private boolean pathExist(org.apache.webdav.lib.WebdavResource webDavResource,
                          java.lang.String path)
Verify if the WebDAV ressource exits

Parameters:
webDavResource -
path - syntax: /{context}/path - exemple: /slide/files/myRessource
Returns:
true if the path exists, else false

createInjacSpace

private void createInjacSpace(org.apache.webdav.lib.WebdavResource webDavResource,
                              java.lang.String spaceName,
                              java.lang.String spaceType)
                       throws WrongPathException
Create an Injac space with the specified type. spaceType = EDITOR_SPACE spaceType = PUBLICATION_SPACE

Parameters:
webDavResource -
spaceName - the name of the space to create
spaceType - the type of the space to create
Throws:
WrongPathException

createRole

private void createRole(org.apache.webdav.lib.WebdavResource webDavResource,
                        java.lang.String roleName)
                 throws WrongPathException
Create a role

Parameters:
webDavResource -
roleName - the name of the role to create
Throws:
WrongPathException

addUserToRole

private void addUserToRole(org.apache.webdav.lib.WebdavResource webDavResource,
                           java.lang.String roleName,
                           java.util.Enumeration userList)
Add a String Enumeration of users to a role

Parameters:
webDavResource -
roleName - the target role
userList - the String Enumeration of users to add in the role

parseUserList

private java.util.Enumeration parseUserList(java.lang.String userList)
Parse a user list given in parameter of the application

Parameters:
userList - syntax: user1:user2:user3:...
Returns:
an Enumeration of String with Element1=user1 Element2=user2...

main

public static void main(java.lang.String[] args)