edu.wisc.trace.uch.contextmanager
Class UserContextManager

java.lang.Object
  extended by edu.wisc.trace.uch.contextmanager.UserContextManager

public class UserContextManager
extends Object

Manage contexts, contexts bounded with targets and contexts bounded with URI. Every context contains user profile and controller profile.

Version:
$Revision: 1.1 $
Author:
Parikshit Thakur & Team, Trace R&D Center

Constructor Summary
UserContextManager(UCH uch, String loggedUserContextData, String userName, String password)
          Constructor.
 
Method Summary
 void addUriServiceContexts(String uri, List<Map<String,IProfile>> contexts)
          Add specified contexts for specified URI.
 void closeUserContext(HttpServletRequest request)
          Get session from request and found user from it and close context with that user.
 List<String> getAvailableTargetIds(Map<String,IProfile> context)
          Get available Target Ids for specified context.
 Map<String,IProfile> getContext(String sessionId)
          Get user Context for specified Session Id.
 List<Map<String,IProfile>> getContexts()
          Get all Contexts.
 List<String> getURIs(Map<String,IProfile> context)
          Get a List of URI that allow specified context.
 boolean openUserContext(HttpServletRequest request, String userName, String password)
          Open Context with specified User.
 void removeUriServiceContexts(String uri, List<Map<String,IProfile>> contexts)
          Remove specified contexts for specified URI.
 void targetContextsAdded(String targetId, List<Map<String,IProfile>> contexts)
          Add specified contexts for specified TargetId.
 void targetContextsRemoved(String targetId, List<Map<String,IProfile>> contexts)
          Remove specified contexts for specified TargetId.
 boolean validateUser(HttpServletRequest request, String userName, String password)
          Check whether specified userName and password is valid or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserContextManager

public UserContextManager(UCH uch,
                          String loggedUserContextData,
                          String userName,
                          String password)
Constructor. Provide the reference of UCH to local variable. Instantiate the object of UserProfileManager and ControllerProfileManager.

Parameters:
uch - an Object of UCH
loggedUserContextData - an XML formed String specifies user context data
userName - a String value of userName
password - a String value of password
Method Detail

validateUser

public boolean validateUser(HttpServletRequest request,
                            String userName,
                            String password)
Check whether specified userName and password is valid or not.

Parameters:
request - an Object of HttpServletRequest
userName - a String value of userName
password - a String value of password
Returns:
a boolean value specifies whether userName and password is valid or not.

openUserContext

public boolean openUserContext(HttpServletRequest request,
                               String userName,
                               String password)
Open Context with specified User. Also open a session with same user.

Parameters:
request - an Object of HttpServletRequest
userName - a String value of userName
password - a String value of password
Returns:
a boolean value specifies whether userName and password is valid or not.

closeUserContext

public void closeUserContext(HttpServletRequest request)
Get session from request and found user from it and close context with that user. Also close same session.

Parameters:
request - an Object of HttpServletRequest

getContexts

public List<Map<String,IProfile>> getContexts()
Get all Contexts.

Returns:
an Object of List<Map<String, IProfile>>

targetContextsAdded

public void targetContextsAdded(String targetId,
                                List<Map<String,IProfile>> contexts)
Add specified contexts for specified TargetId. Note : Empty contexts and null contexts has different meaning. If contexts is empty then no user/controller context is allowed to use that Target. If contexts is null then every user/controller context is allowed to use that Target.

Parameters:
targetId - a String value of Target Id
contexts - an Object of List<Map<String, IProfile>>

targetContextsRemoved

public void targetContextsRemoved(String targetId,
                                  List<Map<String,IProfile>> contexts)
Remove specified contexts for specified TargetId.

Parameters:
targetId - a String value of Target Id
contexts - an Object of List<Map<String, IProfile>>

getAvailableTargetIds

public List<String> getAvailableTargetIds(Map<String,IProfile> context)
Get available Target Ids for specified context.

Parameters:
context - an Object of Map<String, IProfile>
Returns:
an Object of List<String>

addUriServiceContexts

public void addUriServiceContexts(String uri,
                                  List<Map<String,IProfile>> contexts)
Add specified contexts for specified URI. Note : Empty contexts and null contexts has different meaning. If contexts is empty then no user/controller context is allowed to use that URI. If contexts is null then every user/controller context is allowed to use that URI.

Parameters:
uri - a String value of URI
contexts - an Object of List<Map<String, IProfile>>

removeUriServiceContexts

public void removeUriServiceContexts(String uri,
                                     List<Map<String,IProfile>> contexts)
Remove specified contexts for specified URI.

Parameters:
uri - a String value of URI
contexts - an Object of List<Map<String, IProfile>>

getURIs

public List<String> getURIs(Map<String,IProfile> context)
Get a List of URI that allow specified context.

Parameters:
context - an Object of Map<String, IProfile>
Returns:
an Object of List<String>

getContext

public Map<String,IProfile> getContext(String sessionId)
Get user Context for specified Session Id.

Parameters:
sessionId - a String value of SessionId
Returns:
an Object of Map<String, IProfile>


Copyright © 2006-2008 Trace R&D Center, University of Wisconsin-Madison. All Rights Reserved.