org.esupportail.portal.channels.CStockage
Class CStockageAdministration

java.lang.Object
  extended byorg.jasig.portal.channels.BaseChannel
      extended byorg.esupportail.portal.channels.CStockage.CStockageAdministration
All Implemented Interfaces:
org.jasig.portal.ICacheable, org.jasig.portal.IChannel

public class CStockageAdministration
extends org.jasig.portal.channels.BaseChannel
implements org.jasig.portal.ICacheable

Id: CStockageAdministration.java,v 1.0 2 mai 2005
Copyright (c) 2004 Esup Portail (www.esup-portail.org)
Classes: CStockageAdministration
Original Author: Yohan Colmant
Channel used to manage personal files on a webdav server through the portal


Field Summary
private  AdministrationTool adminTool
          The tool used to manage the administration of the servers
private  Server currentServer
          The server we are editing
private  Space currentSpace
          The space we are editing
protected static Log log
          Logger object
private  java.lang.String portalLogin
          User login
private  java.util.Vector serverAttributes
          The attributes to set the server
private  java.util.Vector servers
          The list of the servers
private  ChannelException setStaticDataException
          Error at the beginning of the channel
private  org.jasig.portal.IServant slave
          The servant channel used for groups and users selection
private  java.util.Vector spaceAttributes
          The attributes to set the space
private  org.jasig.portal.ChannelStaticData staticData
           
private  java.lang.StringBuffer stylesheet
          The stylesheet used for the transformation
private  Server tempAdminServer
          The server we are editing
private  Space tempAdminSpace
          sharing directory properties used during the sharing management
 
Fields inherited from class org.jasig.portal.channels.BaseChannel
runtimeData
 
Constructor Summary
CStockageAdministration()
          Constructor
 
Method Summary
private static boolean checkServerAttibutes(org.jasig.portal.ChannelRuntimeData runtimeData, java.util.Vector serverAttributes, Server server)
          Check if the attributes are well set
private static void checkServerAttributesRules(java.util.Vector serverAttributes)
          If somme attributes change, we have to change others ones
private static boolean checkSpaceAttibutes(org.jasig.portal.ChannelRuntimeData runtimeData, java.util.Vector spaceAttributes)
          Check if the attributes are well set
private  void checkUsersAndGroups(org.jasig.portal.ChannelRuntimeData runtimeData)
          When valid the sharing
private  void deleteServer(org.jasig.portal.ChannelRuntimeData runtimeData)
          delete a server
private  void deleteSpace(org.jasig.portal.ChannelRuntimeData runtimeData)
          delete a space
 org.jasig.portal.ChannelCacheKey generateKey()
           
 java.lang.StringBuffer getDefaultServerXml(org.jasig.portal.ChannelRuntimeData runtimeData)
          Return the xml for the default spaces mode
 java.lang.StringBuffer getDefaultSpaceXml(org.jasig.portal.ChannelRuntimeData runtimeData)
          Return the xml for the default space mode
private static java.util.Vector getNewServerAttributesList(Server server)
          Get a new list of attributes to set to the server
private static java.util.Vector getNewSpaceAttributesList(Space space)
          Get a new list of attributes to set to the space
private static java.lang.StringBuffer getServerAttributesXml(java.util.Vector serverAttributes)
          Get the XML for the attributes
private static java.lang.StringBuffer getServerSpacesXml(java.util.ArrayList serverSpaces)
          Get the XML for the spaces
private static java.lang.StringBuffer getSpaceAttributesXml(java.util.Vector spaceAttributes)
          Get the XML for the attributes
private static java.lang.StringBuffer getSpaceUsersAndGroupsXml(DirectorySharingProperties sharingProperties)
          Get the XML for the users ans groups
 boolean isCacheValid(java.lang.Object validity)
           
private  void loadServers()
          Load the servers from the database
private  void renameServer(org.jasig.portal.ChannelRuntimeData runtimeData)
          Rename a server
 void renderXML(org.xml.sax.ContentHandler out)
          Output channel content to the portal
 java.lang.StringBuffer renderXmlChannelException(ChannelException e)
          Return the xml when we have a ChannelException exception
private  java.lang.StringBuffer renderXmlConfirmDeleteServer(org.jasig.portal.ChannelRuntimeData runtimeData)
          Confirm when we ask to delete a server
private  java.lang.StringBuffer renderXmlConfirmDeleteSpace(org.jasig.portal.ChannelRuntimeData runtimeData)
          Confirm when we ask to delete a space
private  java.lang.StringBuffer renderXmlConfirmRenameServer(org.jasig.portal.ChannelRuntimeData runtimeData)
          Confirm when we ask to rename a server
 java.lang.StringBuffer renderXmlDefault(org.jasig.portal.ChannelRuntimeData runtimeData, ChannelException e)
          Return the xml for the default mode
private  java.lang.StringBuffer renderXmlDefaultServer(org.jasig.portal.ChannelRuntimeData runtimeData, org.xml.sax.ContentHandler out)
          Return the xml for the default spaces mode
private  java.lang.StringBuffer renderXmlDefaultSpace(org.jasig.portal.ChannelRuntimeData runtimeData, org.xml.sax.ContentHandler out)
          Return the xml for the default space mode
 java.lang.StringBuffer renderXmlNewServer(org.jasig.portal.ChannelRuntimeData runtimeData, org.xml.sax.ContentHandler out)
          Return the xml for the new server mode
private  java.lang.StringBuffer renderXmlShareDirectoryAddGroup(org.jasig.portal.ChannelRuntimeData runtimeData, org.jasig.portal.ChannelStaticData staticData, org.xml.sax.ContentHandler out)
          When we want to add a group
private  java.lang.StringBuffer renderXmlShareDirectoryAddUser(org.jasig.portal.ChannelRuntimeData runtimeData, org.jasig.portal.ChannelStaticData staticData, org.xml.sax.ContentHandler out)
          When we want to add a user
private  java.lang.StringBuffer renderXmlShareDirectoryDeleteGroup(org.jasig.portal.ChannelRuntimeData runtimeData)
          When we delete a group
private  java.lang.StringBuffer renderXmlShareDirectoryDeleteUser(org.jasig.portal.ChannelRuntimeData runtimeData)
          When we delete a user
private  java.lang.StringBuffer renderXmlValidServantResults(org.jasig.portal.ChannelRuntimeData runtimeData, org.jasig.portal.ChannelStaticData staticData, org.xml.sax.ContentHandler out)
          When we check the servant results
 java.lang.StringBuffer renderXmlWithInformation(java.lang.String informationCode)
          Return the xml when we have to show a information message
 void setStaticData(org.jasig.portal.ChannelStaticData sd)
          Receive static channel data from the portal.
private  void validServer(org.jasig.portal.ChannelRuntimeData runtimeData)
          Valid the server's settings
private  void validSpace(org.jasig.portal.ChannelRuntimeData runtimeData)
          Valid the space's settings
static void xsltTransformation(org.jasig.portal.utils.XSLT xslt, java.lang.StringBuffer xmlTemp, org.xml.sax.ContentHandler out, org.jasig.portal.ChannelRuntimeData runtimeData, java.lang.StringBuffer stylesheet)
          Do the XSLT transformation in the channel
 
Methods inherited from class org.jasig.portal.channels.BaseChannel
getRuntimeProperties, receiveEvent, setRuntimeData
 
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


staticData

private org.jasig.portal.ChannelStaticData staticData

setStaticDataException

private ChannelException setStaticDataException
Error at the beginning of the channel


stylesheet

private java.lang.StringBuffer stylesheet
The stylesheet used for the transformation


portalLogin

private java.lang.String portalLogin
User login


adminTool

private AdministrationTool adminTool
The tool used to manage the administration of the servers


slave

private org.jasig.portal.IServant slave
The servant channel used for groups and users selection


servers

private java.util.Vector servers
The list of the servers


currentServer

private Server currentServer
The server we are editing


tempAdminServer

private Server tempAdminServer
The server we are editing


serverAttributes

private java.util.Vector serverAttributes
The attributes to set the server


spaceAttributes

private java.util.Vector spaceAttributes
The attributes to set the space


currentSpace

private Space currentSpace
The space we are editing


tempAdminSpace

private Space tempAdminSpace
sharing directory properties used during the sharing management

Constructor Detail

CStockageAdministration

public CStockageAdministration()
Constructor

Method Detail

setStaticData

public void setStaticData(org.jasig.portal.ChannelStaticData sd)
Receive static channel data from the portal. Satisfies implementation of IChannel Interface.

Specified by:
setStaticData in interface org.jasig.portal.IChannel
Parameters:
sd - ChannelStaticData static channel data

renderXML

public void renderXML(org.xml.sax.ContentHandler out)
               throws org.jasig.portal.PortalException
Output channel content to the portal

Specified by:
renderXML in interface org.jasig.portal.IChannel
Parameters:
out - a sax document handler
Throws:
org.jasig.portal.PortalException

xsltTransformation

public static void xsltTransformation(org.jasig.portal.utils.XSLT xslt,
                                      java.lang.StringBuffer xmlTemp,
                                      org.xml.sax.ContentHandler out,
                                      org.jasig.portal.ChannelRuntimeData runtimeData,
                                      java.lang.StringBuffer stylesheet)
                               throws org.jasig.portal.PortalException
Do the XSLT transformation in the channel

Parameters:
xslt - the XSLT object
xmlTemp - the XML generated
out - the ContentHandler object
runtimeData - the ChannelRuntimeData object
stylesheet - the stylesheet used
Throws:
org.jasig.portal.PortalException

renderXmlWithInformation

public java.lang.StringBuffer renderXmlWithInformation(java.lang.String informationCode)
                                                throws PropertiesException
Return the xml when we have to show a information message

Parameters:
informationCode - the code for the information message
Returns:
the xml when we have to show a information message
Throws:
PropertiesException

renderXmlChannelException

public java.lang.StringBuffer renderXmlChannelException(ChannelException e)
Return the xml when we have a ChannelException exception

Parameters:
e - the throwed exception
Returns:
the xml when we have a ChannelException exception

loadServers

private void loadServers()
                  throws DataBaseException,
                         PropertiesException,
                         ServerException
Load the servers from the database

Throws:
DataBaseException
PropertiesException
ServerException

renderXmlDefault

public java.lang.StringBuffer renderXmlDefault(org.jasig.portal.ChannelRuntimeData runtimeData,
                                               ChannelException e)
                                        throws DataBaseException,
                                               PropertiesException,
                                               ServerException
Return the xml for the default mode

Parameters:
runtimeData - the ChannelRuntimeData object
e - exception throwed
Returns:
the xml for the default mode
Throws:
DataBaseException
PropertiesException
ServerException

renderXmlNewServer

public java.lang.StringBuffer renderXmlNewServer(org.jasig.portal.ChannelRuntimeData runtimeData,
                                                 org.xml.sax.ContentHandler out)
                                          throws CancelException,
                                                 StillExistsServerException,
                                                 DataBaseException,
                                                 PropertiesException,
                                                 ServerException,
                                                 org.jasig.portal.PortalException
Return the xml for the new server mode

Parameters:
runtimeData - the ChannelRuntimeData object
Returns:
the xml for the new server mode
Throws:
CancelException
StillExistsServerException
DataBaseException
PropertiesException
ServerException
org.jasig.portal.PortalException

renderXmlDefaultServer

private java.lang.StringBuffer renderXmlDefaultServer(org.jasig.portal.ChannelRuntimeData runtimeData,
                                                      org.xml.sax.ContentHandler out)
                                               throws CancelException,
                                                      DataBaseException,
                                                      PropertiesException,
                                                      ServerException,
                                                      org.jasig.portal.PortalException
Return the xml for the default spaces mode

Parameters:
runtimeData - the ChannelRuntimeData object
Returns:
the xml for the default spaces mode
Throws:
CancelException
DataBaseException
PropertiesException
ServerException
org.jasig.portal.PortalException

getDefaultServerXml

public java.lang.StringBuffer getDefaultServerXml(org.jasig.portal.ChannelRuntimeData runtimeData)
Return the xml for the default spaces mode

Parameters:
runtimeData - the ChannelRuntimeData object
Returns:
the xml for the default spaces mode

getServerAttributesXml

private static java.lang.StringBuffer getServerAttributesXml(java.util.Vector serverAttributes)
Get the XML for the attributes

Parameters:
serverAttributes - the list of attributes to set
Returns:
the xml generated

getServerSpacesXml

private static java.lang.StringBuffer getServerSpacesXml(java.util.ArrayList serverSpaces)
Get the XML for the spaces

Parameters:
serverSpaces - the list of spaces to set
Returns:
the xml generated

validServer

private void validServer(org.jasig.portal.ChannelRuntimeData runtimeData)
                  throws DataBaseException
Valid the server's settings

Parameters:
runtimeData -
Throws:
DataBaseException

getNewServerAttributesList

private static java.util.Vector getNewServerAttributesList(Server server)
Get a new list of attributes to set to the server

Returns:
a new list of attributes to set to the server

checkServerAttibutes

private static boolean checkServerAttibutes(org.jasig.portal.ChannelRuntimeData runtimeData,
                                            java.util.Vector serverAttributes,
                                            Server server)
Check if the attributes are well set

Parameters:
runtimeData - the ChannelRuntimeData object
serverAttributes - the list of attributes to set
Returns:
true if ok, false else

checkServerAttributesRules

private static void checkServerAttributesRules(java.util.Vector serverAttributes)
If somme attributes change, we have to change others ones

Parameters:
serverAttributes -

renderXmlConfirmDeleteServer

private java.lang.StringBuffer renderXmlConfirmDeleteServer(org.jasig.portal.ChannelRuntimeData runtimeData)
Confirm when we ask to delete a server

Parameters:
runtimeData - the ChannelRuntimeData object
Returns:
the xml

deleteServer

private void deleteServer(org.jasig.portal.ChannelRuntimeData runtimeData)
                   throws DataBaseException
delete a server

Parameters:
runtimeData - the ChannelRuntimeData object
Throws:
DataBaseException

renderXmlConfirmRenameServer

private java.lang.StringBuffer renderXmlConfirmRenameServer(org.jasig.portal.ChannelRuntimeData runtimeData)
Confirm when we ask to rename a server

Parameters:
runtimeData - the ChannelRuntimeData object
Returns:
the xml

renameServer

private void renameServer(org.jasig.portal.ChannelRuntimeData runtimeData)
                   throws DataBaseException,
                          StillExistsServerException
Rename a server

Parameters:
runtimeData - the ChannelRuntimeData object
Throws:
DataBaseException
StillExistsServerException

renderXmlDefaultSpace

private java.lang.StringBuffer renderXmlDefaultSpace(org.jasig.portal.ChannelRuntimeData runtimeData,
                                                     org.xml.sax.ContentHandler out)
                                              throws DataBaseException,
                                                     PropertiesException,
                                                     org.jasig.portal.PortalException,
                                                     CancelException
Return the xml for the default space mode

Parameters:
runtimeData - the ChannelRuntimeData object
Returns:
the xml for the default space mode
Throws:
CancelException
DataBaseException
PropertiesException
org.jasig.portal.PortalException

getDefaultSpaceXml

public java.lang.StringBuffer getDefaultSpaceXml(org.jasig.portal.ChannelRuntimeData runtimeData)
Return the xml for the default space mode

Parameters:
runtimeData - the ChannelRuntimeData object
Returns:
the xml for the default space mode

getSpaceAttributesXml

private static java.lang.StringBuffer getSpaceAttributesXml(java.util.Vector spaceAttributes)
Get the XML for the attributes

Parameters:
spaceAttributes - the list of attributes to set
Returns:
the xml generated

getSpaceUsersAndGroupsXml

private static java.lang.StringBuffer getSpaceUsersAndGroupsXml(DirectorySharingProperties sharingProperties)
Get the XML for the users ans groups

Parameters:
sharingProperties - the properties for the sharing
Returns:
the xml generated

validSpace

private void validSpace(org.jasig.portal.ChannelRuntimeData runtimeData)
Valid the space's settings

Parameters:
runtimeData -

getNewSpaceAttributesList

private static java.util.Vector getNewSpaceAttributesList(Space space)
Get a new list of attributes to set to the space

Returns:
a new list of attributes to set to the space

checkSpaceAttibutes

private static boolean checkSpaceAttibutes(org.jasig.portal.ChannelRuntimeData runtimeData,
                                           java.util.Vector spaceAttributes)
Check if the attributes are well set

Parameters:
runtimeData - the ChannelRuntimeData object
spaceAttributes - the list of attributes to set
Returns:
true if ok, false else

checkUsersAndGroups

private void checkUsersAndGroups(org.jasig.portal.ChannelRuntimeData runtimeData)
When valid the sharing

Parameters:
runtimeData -

renderXmlShareDirectoryAddUser

private java.lang.StringBuffer renderXmlShareDirectoryAddUser(org.jasig.portal.ChannelRuntimeData runtimeData,
                                                              org.jasig.portal.ChannelStaticData staticData,
                                                              org.xml.sax.ContentHandler out)
                                                       throws PropertiesException,
                                                              org.jasig.portal.PortalException
When we want to add a user

Parameters:
runtimeData - the runtime data object used in this channel
staticData - the static data object used in this channel
out - the output object used for the rendering
Returns:
the xml when we add somebody
Throws:
PropertiesException
org.jasig.portal.PortalException

renderXmlShareDirectoryAddGroup

private java.lang.StringBuffer renderXmlShareDirectoryAddGroup(org.jasig.portal.ChannelRuntimeData runtimeData,
                                                               org.jasig.portal.ChannelStaticData staticData,
                                                               org.xml.sax.ContentHandler out)
                                                        throws PropertiesException,
                                                               org.jasig.portal.PortalException
When we want to add a group

Parameters:
runtimeData - the runtime data object used in this channel
staticData - the static data object used in this channel
out - the output object used for the rendering
Returns:
the xml when we add somebody
Throws:
PropertiesException
org.jasig.portal.PortalException

renderXmlShareDirectoryDeleteUser

private java.lang.StringBuffer renderXmlShareDirectoryDeleteUser(org.jasig.portal.ChannelRuntimeData runtimeData)
                                                          throws PropertiesException
When we delete a user

Parameters:
runtimeData - the runtime data object used in the channel
Returns:
the xml when we delete somebody
Throws:
PropertiesException

renderXmlShareDirectoryDeleteGroup

private java.lang.StringBuffer renderXmlShareDirectoryDeleteGroup(org.jasig.portal.ChannelRuntimeData runtimeData)
                                                           throws PropertiesException
When we delete a group

Parameters:
runtimeData - the runtime data object used in the channel
Returns:
the xml when we delete somebody
Throws:
PropertiesException

renderXmlValidServantResults

private java.lang.StringBuffer renderXmlValidServantResults(org.jasig.portal.ChannelRuntimeData runtimeData,
                                                            org.jasig.portal.ChannelStaticData staticData,
                                                            org.xml.sax.ContentHandler out)
                                                     throws PropertiesException,
                                                            org.jasig.portal.PortalException,
                                                            DataBaseException,
                                                            CancelException
When we check the servant results

Parameters:
runtimeData - the runtime data object used in this channel
staticData - the static data object used in this channel
Returns:
the xml after getting the servant results
Throws:
PropertiesException
org.jasig.portal.PortalException
DataBaseException
CancelException

renderXmlConfirmDeleteSpace

private java.lang.StringBuffer renderXmlConfirmDeleteSpace(org.jasig.portal.ChannelRuntimeData runtimeData)
Confirm when we ask to delete a space

Parameters:
runtimeData - the ChannelRuntimeData object
Returns:
the xml

deleteSpace

private void deleteSpace(org.jasig.portal.ChannelRuntimeData runtimeData)
delete a space

Parameters:
runtimeData - the ChannelRuntimeData object

generateKey

public org.jasig.portal.ChannelCacheKey generateKey()
Specified by:
generateKey in interface org.jasig.portal.ICacheable

isCacheValid

public boolean isCacheValid(java.lang.Object validity)
Specified by:
isCacheValid in interface org.jasig.portal.ICacheable