org.esupportail.portal.channels.CStockage
Class CStockage

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

public class CStockage
extends org.jasig.portal.channels.BaseChannel
implements org.jasig.portal.IMimeResponse, org.jasig.portal.ICacheable

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


Field Summary
private  java.util.TreeMap availableSpaces
          The avalaible spaces
private  BufferAction buffer
          Object used to keep the objects used between 2 actions, for example, the clipboard
private  Space currentSpace
          The current used space
private  ChannelResource downloadResource
          The resource to download
private  java.lang.String fileId
           
private  boolean isSpacesPersonalization
          if we support the spaces personalization
protected static Log log
          Logger object
private  org.jasig.portal.security.IPerson person
          The current user IPerson object
private  java.lang.String portalLogin
          User login
private  ChannelException setStaticDataException
          Error at the beginning of the channel
private  java.util.ArrayList spaces
          The spaces availables
private  org.jasig.portal.ChannelStaticData staticData
           
private  java.lang.StringBuffer stylesheet
          The stylesheet used for the transformation
private  java.util.TreeMap usedSpaces
          The spaces still in use
private  java.util.Vector userGroups
          The user groups
 
Fields inherited from class org.jasig.portal.channels.BaseChannel
runtimeData
 
Constructor Summary
CStockage()
          Constructor
 
Method Summary
static void addObligedSpacesToList(java.lang.String userPortalLogin, java.util.Vector userGroups, java.util.ArrayList initialSpaces)
          Set the obliged spaces for this user
 void downloadData(java.io.OutputStream arg0)
          Function unused here
 org.jasig.portal.ChannelCacheKey generateKey()
           
static java.util.TreeMap[] getAvailableAndUsedSpaces(PersonalizationTool tool, java.lang.String userPortalLogin, java.util.Vector userGroups)
          Set the used spaces and the avalaible spaces for this user
 java.lang.String getContentType()
          Return the content type of the seleted file
 java.util.Map getHeaders()
          Send HTTP header
 java.util.Map getHeaders2()
          Send HTTP header
 java.io.InputStream getInputStream()
          Get the strem for the file to dowload
 java.lang.String getName()
          Function unused here
private  void initConfigurationSpaces()
          Init the configuration spaces
private  void initPersonalSpacesIntoMenu()
          Init the personal spaces into the menu
private static boolean initSpace(Space space, org.jasig.portal.security.IPerson person, java.lang.String portalLogin, java.util.ArrayList spaces, BufferAction buffer, java.util.Vector userGroups)
          Init the actions and server of a space
 boolean isCacheValid(java.lang.Object validity)
           
 void renderXML(org.xml.sax.ContentHandler out)
          Output channel content to the portal
private  java.lang.StringBuffer renderXmlManageSharedSpaces(org.jasig.portal.ChannelRuntimeData runtimeData)
          Generate the XML when we want to manage the shared spaces
private  java.lang.StringBuffer renderXmlManageSharedSpacesAdd(org.jasig.portal.ChannelRuntimeData runtimeData)
          Generate the XML when we click on "add" when we manage the shared spaces
private  void renderXmlManageSharedSpacesCancel()
          Generate the XML when we click on "cancel" when we manage the shared spaces
private  java.lang.StringBuffer renderXmlManageSharedSpacesDelete(org.jasig.portal.ChannelRuntimeData runtimeData)
          Generate the XML when we click on "delete" when we manage the shared spaces
private  java.lang.StringBuffer renderXmlManageSharedSpacesGetXmlForRender(org.jasig.portal.ChannelRuntimeData runtimeData)
          Generate the XML when we want to manage the shared spaces
private  java.lang.StringBuffer renderXmlManageSharedSpacesGetXmlForRenderOnlySpaces(java.util.TreeMap spaces)
          Generate the XML when we want to manage the shared spaces
private  java.lang.StringBuffer renderXmlManageSharedSpacesValid(org.jasig.portal.ChannelRuntimeData runtimeData)
          Generate the XML when we click on "valid" when we manage the shared spaces
 void reportDownloadError(java.lang.Exception arg0)
          Print the error generated by the download
static Space setSpacesIntoMenu(java.util.ArrayList spaces, Space currentSpace, PersonalizationTool tool, org.jasig.portal.security.IPerson person, java.lang.String userPortalLogin, java.util.Vector userGroups, java.util.TreeMap usedSpaces, BufferAction buffer)
          Set the personal spaces into the spaces menu
 void setStaticData(org.jasig.portal.ChannelStaticData sd)
          Receive static channel data from the portal.
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, BufferAction buffer, boolean isSpacesPersonalization)
          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

fileId

private java.lang.String fileId

spaces

private java.util.ArrayList spaces
The spaces availables


currentSpace

private Space currentSpace
The current used space


isSpacesPersonalization

private boolean isSpacesPersonalization
if we support the spaces personalization


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


userGroups

private java.util.Vector userGroups
The user groups


buffer

private BufferAction buffer
Object used to keep the objects used between 2 actions, for example, the clipboard


person

private org.jasig.portal.security.IPerson person
The current user IPerson object


usedSpaces

private java.util.TreeMap usedSpaces
The spaces still in use


availableSpaces

private java.util.TreeMap availableSpaces
The avalaible spaces


downloadResource

private ChannelResource downloadResource
The resource to download

Constructor Detail

CStockage

public CStockage()
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

initSpace

private static boolean initSpace(Space space,
                                 org.jasig.portal.security.IPerson person,
                                 java.lang.String portalLogin,
                                 java.util.ArrayList spaces,
                                 BufferAction buffer,
                                 java.util.Vector userGroups)
                          throws PropertiesException,
                                 ApplicationException,
                                 ChannelException
Init the actions and server of a space

Parameters:
space - the space to init
Returns:
true if the access is valid, false else
Throws:
PropertiesException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.lang.InstantiationException
ApplicationException
java.net.MalformedURLException
ChannelException

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,
                                      BufferAction buffer,
                                      boolean isSpacesPersonalization)
                               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
buffer - the buffer used in the channel
Throws:
org.jasig.portal.PortalException

initConfigurationSpaces

private void initConfigurationSpaces()
                              throws DataBaseException,
                                     ChannelException
Init the configuration spaces

Throws:
DataBaseException
ChannelException

initPersonalSpacesIntoMenu

private void initPersonalSpacesIntoMenu()
                                 throws DataBaseException,
                                        ChannelException
Init the personal spaces into the menu

Throws:
DataBaseException
ChannelException

addObligedSpacesToList

public static void addObligedSpacesToList(java.lang.String userPortalLogin,
                                          java.util.Vector userGroups,
                                          java.util.ArrayList initialSpaces)
                                   throws DataBaseException,
                                          PropertiesException,
                                          ServerException
Set the obliged spaces for this user

Throws:
DataBaseException
PropertiesException
ServerException

getAvailableAndUsedSpaces

public static java.util.TreeMap[] getAvailableAndUsedSpaces(PersonalizationTool tool,
                                                            java.lang.String userPortalLogin,
                                                            java.util.Vector userGroups)
                                                     throws DataBaseException,
                                                            PropertiesException,
                                                            ServerException
Set the used spaces and the avalaible spaces for this user

Throws:
DataBaseException
PropertiesException
ServerException

setSpacesIntoMenu

public static Space setSpacesIntoMenu(java.util.ArrayList spaces,
                                      Space currentSpace,
                                      PersonalizationTool tool,
                                      org.jasig.portal.security.IPerson person,
                                      java.lang.String userPortalLogin,
                                      java.util.Vector userGroups,
                                      java.util.TreeMap usedSpaces,
                                      BufferAction buffer)
                               throws DataBaseException,
                                      ChannelException
Set the personal spaces into the spaces menu

Throws:
DataBaseException
ChannelException

renderXmlManageSharedSpaces

private java.lang.StringBuffer renderXmlManageSharedSpaces(org.jasig.portal.ChannelRuntimeData runtimeData)
                                                    throws ChannelException,
                                                           PropertiesException,
                                                           CancelException,
                                                           DataBaseException,
                                                           ServerException
Generate the XML when we want to manage the shared spaces

Parameters:
runtimeData - the runtime data channel object
Returns:
the XML for this mode
Throws:
CancelException
DataBaseException
ChannelException
PropertiesException
ServerException

renderXmlManageSharedSpacesGetXmlForRender

private java.lang.StringBuffer renderXmlManageSharedSpacesGetXmlForRender(org.jasig.portal.ChannelRuntimeData runtimeData)
                                                                   throws ServerException,
                                                                          PropertiesException
Generate the XML when we want to manage the shared spaces

Parameters:
runtimeData - the runtime data channel object
Returns:
the XML for this mode
Throws:
CancelException
ServerException
PropertiesException

renderXmlManageSharedSpacesGetXmlForRenderOnlySpaces

private java.lang.StringBuffer renderXmlManageSharedSpacesGetXmlForRenderOnlySpaces(java.util.TreeMap spaces)
                                                                             throws ServerException,
                                                                                    PropertiesException
Generate the XML when we want to manage the shared spaces

Parameters:
spaces - spaces list
Returns:
the XML for this mode
Throws:
ServerException
PropertiesException

renderXmlManageSharedSpacesCancel

private void renderXmlManageSharedSpacesCancel()
                                        throws CancelException
Generate the XML when we click on "cancel" when we manage the shared spaces

Throws:
CancelException

renderXmlManageSharedSpacesValid

private java.lang.StringBuffer renderXmlManageSharedSpacesValid(org.jasig.portal.ChannelRuntimeData runtimeData)
                                                         throws DataBaseException,
                                                                ChannelException
Generate the XML when we click on "valid" when we manage the shared spaces

Parameters:
runtimeData - the runtime data channel object
Returns:
the XML for this mode
Throws:
DataBaseException
ChannelException

renderXmlManageSharedSpacesAdd

private java.lang.StringBuffer renderXmlManageSharedSpacesAdd(org.jasig.portal.ChannelRuntimeData runtimeData)
                                                       throws ServerException,
                                                              PropertiesException
Generate the XML when we click on "add" when we manage the shared spaces

Parameters:
runtimeData - the runtime data channel object
Returns:
the XML for this mode
Throws:
ServerException
PropertiesException

renderXmlManageSharedSpacesDelete

private java.lang.StringBuffer renderXmlManageSharedSpacesDelete(org.jasig.portal.ChannelRuntimeData runtimeData)
                                                          throws ServerException,
                                                                 PropertiesException
Generate the XML when we click on "delete" when we manage the shared spaces

Parameters:
runtimeData - the runtime data channel object
Returns:
the XML for this mode
Throws:
ServerException
PropertiesException

getContentType

public java.lang.String getContentType()
Return the content type of the seleted file

Specified by:
getContentType in interface org.jasig.portal.IMimeResponse
See Also:
IMimeResponse.getContentType()

getHeaders

public java.util.Map getHeaders()
Send HTTP header

Specified by:
getHeaders in interface org.jasig.portal.IMimeResponse
See Also:
IMimeResponse.getHeaders()

getHeaders2

public java.util.Map getHeaders2()
Send HTTP header

See Also:
IMimeResponse.getHeaders()

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Get the strem for the file to dowload

Specified by:
getInputStream in interface org.jasig.portal.IMimeResponse
Throws:
java.io.IOException
See Also:
IMimeResponse.getInputStream()

downloadData

public void downloadData(java.io.OutputStream arg0)
                  throws java.io.IOException
Function unused here

Specified by:
downloadData in interface org.jasig.portal.IMimeResponse
Throws:
java.io.IOException
See Also:
IMimeResponse.downloadData(java.io.OutputStream)

getName

public java.lang.String getName()
Function unused here

Specified by:
getName in interface org.jasig.portal.IMimeResponse
See Also:
IMimeResponse.getName()

reportDownloadError

public void reportDownloadError(java.lang.Exception arg0)
Print the error generated by the download

Specified by:
reportDownloadError in interface org.jasig.portal.IMimeResponse
See Also:
IMimeResponse.reportDownloadError(java.lang.Exception)

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