HDIV API 2.0.4

org.hdiv.session
Class SessionHDIV

java.lang.Object
  extended by org.hdiv.session.SessionHDIV
All Implemented Interfaces:
ISession, org.springframework.beans.factory.BeanFactoryAware

public class SessionHDIV
extends java.lang.Object
implements ISession, org.springframework.beans.factory.BeanFactoryAware

A custom wrapper for http session request that returns a wrapped http session.

Author:
Roberto Velasco

Constructor Summary
SessionHDIV()
           
 
Method Summary
 void addPage(java.lang.String pageId, IPage page)
          It adds a new page to the user session.
 java.lang.Integer generateInitialPageId()
          Generates a random number for the first page identifier
 java.lang.String getCacheName()
           
 java.lang.String getCipherName()
           
 ICipherHTTP getDecryptCipher()
          Inilitializes the data decrypter.
 ICipherHTTP getEncryptCipher()
          Initializes the data cipher.
 java.lang.String getKeyName()
           
 IPage getPage(java.lang.String pageId)
          Returns the page with id pageId.
 java.lang.String getPageId()
          Obtains from the user session the page identifier where the current request or form is
 java.lang.String getRequestName()
           
 IState getState(java.lang.String pageId, java.lang.String stateId)
          Obtains the state identifier stateId related to the page identifier pageId.
 java.lang.String getStateHash(java.lang.String pageId, java.lang.String stateId)
          Obtains the hash of the state identifier stateId related to page identifier pageId.
 javax.servlet.http.HttpSession getWebSession()
           
 void init()
          SessionHDIV initialization with HTTP session.
 void initTesting()
          Testing initialization
 void removeEndedPages(java.lang.String conversationId)
          Deletes from session the data related to the finished flows.
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
          Callback that supplies the owning factory to a bean instance.
 void setCacheName(java.lang.String cacheName)
           
 void setCipherName(java.lang.String cipherName)
           
 void setKeyName(java.lang.String keyName)
           
 void setRequestName(java.lang.String requestName)
           
 void setWebSession(javax.servlet.http.HttpSession webSession)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionHDIV

public SessionHDIV()
Method Detail

init

public void init()
SessionHDIV initialization with HTTP session.


initTesting

public void initTesting()
Testing initialization


getPageId

public java.lang.String getPageId()
Obtains from the user session the page identifier where the current request or form is

Specified by:
getPageId in interface ISession
Returns:
Returns the pageId.

getPage

public IPage getPage(java.lang.String pageId)
Returns the page with id pageId.

Specified by:
getPage in interface ISession
Parameters:
pageId - page id
Returns:
Returns the page with id pageId.
Since:
HDIV 2.0.4

generateInitialPageId

public java.lang.Integer generateInitialPageId()
Generates a random number for the first page identifier

Returns:
init page identifier
Since:
HDIV 1.1

addPage

public void addPage(java.lang.String pageId,
                    IPage page)
It adds a new page to the user session. To do this it adds a new page identifier to the cache and if it has reached the maximun size allowed, the oldest page is deleted from the session and from the cache itself.

Specified by:
addPage in interface ISession
Parameters:
pageId - Page identifier
page - Page with all the information about states

removeEndedPages

public void removeEndedPages(java.lang.String conversationId)
Deletes from session the data related to the finished flows. This means a memory consumption optimization because useless objects of type IPage are deleted.

Specified by:
removeEndedPages in interface ISession
Parameters:
conversationId - finished flow identifier
Since:
HDIV 2.0.3

getState

public IState getState(java.lang.String pageId,
                       java.lang.String stateId)
Obtains the state identifier stateId related to the page identifier pageId.

Specified by:
getState in interface ISession
Returns:
State identifier stateId throws HDIVException If the state doesn't exist a new HDIV exception is thrown.

getStateHash

public java.lang.String getStateHash(java.lang.String pageId,
                                     java.lang.String stateId)
Obtains the hash of the state identifier stateId related to page identifier pageId.

Specified by:
getStateHash in interface ISession
Returns:
Hash of the state identifier stateId
Throws:
HDIVException - If the state doesn't exist a new HDIV exception is thrown.

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Callback that supplies the owning factory to a bean instance. Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method.

Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
Parameters:
beanFactory - owning BeanFactory (may not be null). The bean can immediately call methods on the factory.

getEncryptCipher

public ICipherHTTP getEncryptCipher()
Initializes the data cipher.

Specified by:
getEncryptCipher in interface ISession
Returns:
Returns the data cipher initialized with the symmetric key
Throws:
HDIVException - If the state doesn't exist a new HDIV exception is thrown.

getDecryptCipher

public ICipherHTTP getDecryptCipher()
Inilitializes the data decrypter.

Specified by:
getDecryptCipher in interface ISession
Returns:
Returns the data decrypter initialized with the symmetric key.
Throws:
HDIVException - if there is an error in cipher initialization.

getWebSession

public javax.servlet.http.HttpSession getWebSession()
Specified by:
getWebSession in interface ISession
Returns:
Returns the HTTP session.

setWebSession

public void setWebSession(javax.servlet.http.HttpSession webSession)
Parameters:
webSession - The webSession to set.

getCacheName

public java.lang.String getCacheName()
Returns:
Returns the cacheName.

setCacheName

public void setCacheName(java.lang.String cacheName)
Parameters:
cacheName - The cacheName to set.

getCipherName

public java.lang.String getCipherName()
Returns:
Returns the cipherName.

setCipherName

public void setCipherName(java.lang.String cipherName)
Parameters:
cipherName - The cipherName to set.

getRequestName

public java.lang.String getRequestName()
Returns:
Returns the requestName.

setRequestName

public void setRequestName(java.lang.String requestName)
Parameters:
requestName - The requestName to set.

getKeyName

public java.lang.String getKeyName()
Returns:
Returns the keyName.

setKeyName

public void setKeyName(java.lang.String keyName)
Parameters:
keyName - The keyName to set.

HDIV 2.0.4

Copyright © 2008 hdiv.org. All Rights Reserved.