org.figure8.join.control
Class UserContainer

java.lang.Object
  extended by org.figure8.join.control.UserContainer
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, javax.servlet.http.HttpSessionBindingListener

public class UserContainer
extends java.lang.Object
implements java.io.Serializable, javax.servlet.http.HttpSessionBindingListener

Used to store information about a specific user. This class is used so that the information is not scattered throughout the HttpSession. Only this object is stored in the session for the user. This class implements the HttpSession BindingListener so that it can be notified of session timeoutand perform cleanup.

Version:
$Revision: 1.1 $
Author:
Laurent Broudoux
See Also:
Serialized Form

Constructor Summary
UserContainer()
          Creates a new instance of UserContainer
 
Method Summary
protected  void cleanup()
          Cleanup any opened resources
 UserView getView()
           
 boolean isUserInRole(Role role)
          Check if user has the required role.
 boolean isUserInRoleForResource(Role role, java.lang.Object resource)
          Check if user has the required role for given resource.
 void setView(UserView view)
           
 void valueBound(javax.servlet.http.HttpSessionBindingEvent httpSessionBindingEvent)
          The container calls this method when this object is being bound to the user's session.
 void valueUnbound(javax.servlet.http.HttpSessionBindingEvent httpSessionBindingEvent)
          The container calls this method when this object is being unbound from the user's session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserContainer

public UserContainer()
Creates a new instance of UserContainer

Method Detail

getView

public UserView getView()
Returns:
The associated user view

setView

public void setView(UserView view)
Parameters:
view - The user view to associate with container

isUserInRole

public boolean isUserInRole(Role role)
Check if user has the required role. Delegates call to UserView if present.

Parameters:
role - Security role the user should endorse
Returns:
True if user has specified role, false otherwise

isUserInRoleForResource

public boolean isUserInRoleForResource(Role role,
                                       java.lang.Object resource)
Check if user has the required role for given resource.

Parameters:
role - Security role the user should endorse
resource - Resource that user has to be granted to for the role
Returns:
True is user has specified role for specified resource, false otherwise

cleanup

protected void cleanup()
Cleanup any opened resources


valueBound

public void valueBound(javax.servlet.http.HttpSessionBindingEvent httpSessionBindingEvent)
The container calls this method when this object is being bound to the user's session.

Specified by:
valueBound in interface javax.servlet.http.HttpSessionBindingListener
Parameters:
httpSessionBindingEvent - The binding event raised by servlet container

valueUnbound

public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent httpSessionBindingEvent)
The container calls this method when this object is being unbound from the user's session.

Specified by:
valueUnbound in interface javax.servlet.http.HttpSessionBindingListener
Parameters:
httpSessionBindingEvent - The binding event raised by servlet container


Copyright © 2005-2008 Join. All Rights Reserved.