org.xins.server.frontend
Class SessionManager

java.lang.Object
  extended byorg.xins.common.manageable.Manageable
      extended byorg.xins.server.frontend.SessionManager

public class SessionManager
extends Manageable

Manager for the sessions and session properties for the XINS front-end framework.

Since:
XINS 1.5.0.
Version:
$Revision: 1.19.2.4 $ $Date: 2006/11/20 13:17:35 $
Author:
Anthony Goubard

Nested Class Summary
 
Nested classes inherited from class org.xins.common.manageable.Manageable
Manageable.State
 
Field Summary
 
Fields inherited from class org.xins.common.manageable.Manageable
BOOTSTRAPPED, BOOTSTRAPPING, DEINITIALIZING, INITIALIZING, UNUSABLE, USABLE
 
Constructor Summary
SessionManager(API api)
          Creates the session manager.
 
Method Summary
protected  void bootstrapImpl(PropertyReader bootstrapProperties)
          Performs the bootstrap procedure (actual implementation).
 boolean getBoolProperty(String name)
          Gets the value of a boolean session property.
 Map getProperties()
          Gets the session properties.
 Object getProperty(String name)
          Gets the value of a session property.
 String getSessionId()
          Gets the session id.
 void removeProperties()
          Removes all session properties for the customer.
 void removeProperty(String name)
          Removes a session property.
protected  void request(HttpServletRequest request)
          Method called when the request is received.
protected  void result(boolean successful)
          Sets the input parameters in the session is the execution of the function is successful.
 void setProperty(String name, boolean value)
          Adds or sets a new session property.
 void setProperty(String name, Object value)
          Adds a new session property.
 boolean shouldLogIn()
          Returns true if the user needs to log in to access the page.
 
Methods inherited from class org.xins.common.manageable.Manageable
assertUsable, bootstrap, deinit, deinitImpl, getState, init, initImpl, isBootstrapped, isUsable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionManager

public SessionManager(API api)
Creates the session manager.

Parameters:
api - the API.
Method Detail

bootstrapImpl

protected void bootstrapImpl(PropertyReader bootstrapProperties)
                      throws MissingRequiredPropertyException,
                             InvalidPropertyValueException,
                             BootstrapException
Description copied from class: Manageable
Performs the bootstrap procedure (actual implementation). When this method is called from Manageable.bootstrap(PropertyReader), the state and the argument will have been checked and the state will have been set to Manageable.BOOTSTRAPPING.

The implementation of this method in class Manageable is empty.

Overrides:
bootstrapImpl in class Manageable
Parameters:
bootstrapProperties - the bootstrap properties, not null.
Throws:
BootstrapException - if the bootstrapping failed for any other reason.
MissingRequiredPropertyException - if a required property is not given.
InvalidPropertyValueException - if the value of a certain property is invalid.

request

protected void request(HttpServletRequest request)
Method called when the request is received. This method will take care of creating a sessionId if needed and putting the input parameters in the session.

Parameters:
request - the HTTP request, cannot be null.

result

protected void result(boolean successful)
Sets the input parameters in the session is the execution of the function is successful.

Parameters:
successful - true if the function is successful, false otherwise.

shouldLogIn

public boolean shouldLogIn()
Returns true if the user needs to log in to access the page.

Returns:
whether the user should log in.

getSessionId

public String getSessionId()
Gets the session id.

Returns:
the session ID, can be null.

getProperties

public Map getProperties()
Gets the session properties.

Returns:
a map where the key is the property name and the value is the session property value.

setProperty

public void setProperty(String name,
                        Object value)
                 throws IllegalArgumentException
Adds a new session property. Any previous property is replaced. If the value is null, the property is removed.

Parameters:
name - the name of the session property, cannot be null.
value - the value of the session property, can be null.
Throws:
IllegalArgumentException - if name == null.

setProperty

public void setProperty(String name,
                        boolean value)
                 throws IllegalArgumentException
Adds or sets a new session property.

Parameters:
name - the name of the session property, cannot be null.
value - the value of the session property.
Throws:
IllegalArgumentException - if name == null.

getProperty

public Object getProperty(String name)
                   throws IllegalArgumentException
Gets the value of a session property.

Parameters:
name - the name of the session property, cannot be null.
Returns:
the property value or null if the property does not exist.
Throws:
IllegalArgumentException - if name == null.

getBoolProperty

public boolean getBoolProperty(String name)
                        throws IllegalArgumentException
Gets the value of a boolean session property.

Parameters:
name - the name of the session property, cannot be null.
Returns:
true if the value of the property is "true" or Boolean.TRUE, false otherwise.
Throws:
IllegalArgumentException - if name == null.

removeProperty

public void removeProperty(String name)
                    throws IllegalArgumentException
Removes a session property.

Parameters:
name - the name of the session property, cannot be null.
Throws:
IllegalArgumentException - if name == null.

removeProperties

public void removeProperties()
Removes all session properties for the customer.



See http://www.xins.org/.