info.magnolia.context
Class UserContextImpl

java.lang.Object
  extended by info.magnolia.context.AbstractContext
      extended by info.magnolia.context.UserContextImpl
All Implemented Interfaces:
UserContext, java.io.Serializable, java.util.Map, org.apache.commons.chain.Context
Direct Known Subclasses:
WebContextImpl

public class UserContextImpl
extends AbstractContext
implements UserContext

User aware context implementation able to release and discard all kept info upon user logout. Also changes the locale from default one to the one prefered by the logged in user.

Version:
$Id: $
Author:
had
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class info.magnolia.context.AbstractContext
locale
 
Fields inherited from interface info.magnolia.context.Context
APPLICATION_SCOPE, ATTRIBUTE_COMMENT, ATTRIBUTE_EXCEPTION, ATTRIBUTE_MESSAGE, ATTRIBUTE_PATH, ATTRIBUTE_RECURSIVE, ATTRIBUTE_REPOSITORY, ATTRIBUTE_UUID, ATTRIBUTE_VERSION, ATTRIBUTE_VERSION_MAP, LOCAL_SCOPE, SESSION_SCOPE
 
Constructor Summary
UserContextImpl()
           
 
Method Summary
 java.util.Locale getLocale()
          If not yet set try to get the locale of the user.
 User getUser()
          Create the subject on demand.
 void login(User user)
           
 void logout()
           
protected  void setLocaleFor(User user)
           
 
Methods inherited from class info.magnolia.context.AbstractContext
clear, containsKey, containsValue, entrySet, get, getAccessManager, getAccessManager, getAttribute, getAttribute, getAttributes, getAttributes, getAttributeStrategy, getHierarchyManager, getHierarchyManager, getMessages, getMessages, getQueryManager, getQueryManager, getRepositoryStrategy, isEmpty, keySet, put, putAll, release, remove, removeAttribute, setAttribute, setAttributeStrategy, setLocale, setRepositoryStrategy, size, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.magnolia.context.Context
getAccessManager, getAccessManager, getAttribute, getAttribute, getAttributes, getAttributes, getHierarchyManager, getHierarchyManager, getMessages, getMessages, getQueryManager, getQueryManager, release, removeAttribute, setAttribute, setLocale
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

UserContextImpl

public UserContextImpl()
Method Detail

getLocale

public java.util.Locale getLocale()
Description copied from class: AbstractContext
If not yet set try to get the locale of the user. Else use the locale of the system context.

Overrides:
getLocale in class AbstractContext
See Also:
Context.getLocale()

getUser

public User getUser()
Create the subject on demand.

Overrides:
getUser in class AbstractContext
See Also:
AbstractContext.getUser()

login

public void login(User user)
Specified by:
login in interface UserContext

logout

public void logout()
Specified by:
logout in interface UserContext

setLocaleFor

protected void setLocaleFor(User user)


Copyright © 2003-2010 Magnolia International Ltd.. All Rights Reserved.