info.magnolia.context
Class AbstractContext

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

public abstract class AbstractContext
extends java.lang.Object
implements Context, java.io.Serializable

Default implementation of the Context interface

Version:
$Revision: 32667 $ ($Author: gjoseph $)
Author:
Philipp Bracher
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
protected  java.util.Locale locale
          The locale for this context
 
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
AbstractContext()
           
 
Method Summary
 void clear()
          Map implementation
 boolean containsKey(java.lang.Object arg0)
          Map implementation
 boolean containsValue(java.lang.Object value)
          Map implementation.
 java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
          Map implementation
 java.lang.Object get(java.lang.Object key)
          Map implemenation
 AccessManager getAccessManager(java.lang.String repositoryId)
          Get access manager for the specified repository on default workspace
 AccessManager getAccessManager(java.lang.String repositoryId, java.lang.String workspaceId)
          Get access manager for the specified repository on the specified workspace
 java.lang.Object getAttribute(java.lang.String name)
          Get attribute value
 java.lang.Object getAttribute(java.lang.String name, int scope)
          Get attribute value
 java.util.Map<java.lang.String,java.lang.Object> getAttributes()
          Merge the scopes maps
 java.util.Map<java.lang.String,java.lang.Object> getAttributes(int scope)
          Get a map of a attributes set in the scope
 AttributeStrategy getAttributeStrategy()
           
 HierarchyManager getHierarchyManager(java.lang.String repositoryId)
          Get hierarchy manager initialized for this user
 HierarchyManager getHierarchyManager(java.lang.String repositoryId, java.lang.String workspaceId)
          Get hierarchy manager initialized for this user
 java.util.Locale getLocale()
          If not yet set try to get the locale of the user.
 Messages getMessages()
          TODO: This duplicates methods from MessagesManager : remove either
 Messages getMessages(java.lang.String basename)
          TODO: This duplicates methods from MessagesManager : remove either
 QueryManager getQueryManager(java.lang.String repositoryId)
          Get QueryManager created for this user on the specified repository
 QueryManager getQueryManager(java.lang.String repositoryId, java.lang.String workspaceId)
          Get QueryManager created for this user on the specified repository and workspace
 RepositoryAcquiringStrategy getRepositoryStrategy()
           
 User getUser()
          If this is not a UserContext this method will very likely return the system user
 boolean isEmpty()
          Map implementation
 java.util.Set<java.lang.String> keySet()
          Map implementation
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Map implementation
 void putAll(java.util.Map map)
          Map implementation
 void release()
          Release any resource used by this Context (e.g.
 java.lang.Object remove(java.lang.Object key)
          Map implementation
 void removeAttribute(java.lang.String name, int scope)
          Remove an attribute
 void setAttribute(java.lang.String name, java.lang.Object value, int scope)
          Set attribute value, scope of the attribute is defined
 void setAttributeStrategy(AttributeStrategy strategy)
           
 void setLocale(java.util.Locale locale)
           
 void setRepositoryStrategy(RepositoryAcquiringStrategy strategy)
           
 int size()
          Map implementation
 java.util.Collection<java.lang.Object> values()
          Map implementation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

locale

protected java.util.Locale locale
The locale for this context

Constructor Detail

AbstractContext

public AbstractContext()
Method Detail

getUser

public User getUser()
Description copied from interface: Context
If this is not a UserContext this method will very likely return the system user


getAttributeStrategy

public AttributeStrategy getAttributeStrategy()

setAttributeStrategy

public void setAttributeStrategy(AttributeStrategy strategy)

getRepositoryStrategy

public RepositoryAcquiringStrategy getRepositoryStrategy()

setRepositoryStrategy

public void setRepositoryStrategy(RepositoryAcquiringStrategy strategy)

getAttribute

public java.lang.Object getAttribute(java.lang.String name,
                                     int scope)
Description copied from interface: Context
Get attribute value

Parameters:
name - to which value is associated to
scope - the scope (request, session, application)
Returns:
attribute value

getAttributes

public java.util.Map<java.lang.String,java.lang.Object> getAttributes(int scope)
Description copied from interface: Context
Get a map of a attributes set in the scope

Returns:
the map

removeAttribute

public void removeAttribute(java.lang.String name,
                            int scope)
Description copied from interface: Context
Remove an attribute


setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value,
                         int scope)
Description copied from interface: Context
Set attribute value, scope of the attribute is defined

Parameters:
name - is used as a key
scope - , highest level of scope from which this attribute is visible

getAccessManager

public AccessManager getAccessManager(java.lang.String repositoryId,
                                      java.lang.String workspaceId)
Description copied from interface: Context
Get access manager for the specified repository on the specified workspace

Returns:
access manager

getHierarchyManager

public HierarchyManager getHierarchyManager(java.lang.String repositoryId,
                                            java.lang.String workspaceId)
Description copied from interface: Context
Get hierarchy manager initialized for this user

Returns:
hierarchy manager

getQueryManager

public QueryManager getQueryManager(java.lang.String repositoryId,
                                    java.lang.String workspaceId)
Description copied from interface: Context
Get QueryManager created for this user on the specified repository and workspace

Returns:
query manager

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Get attribute value

Parameters:
name - to which value is associated to
Returns:
attribute value

getAttributes

public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Merge the scopes maps

Returns:
the map

getLocale

public java.util.Locale getLocale()
If not yet set try to get the locale of the user. Else use the locale of the system context

See Also:
Context.getLocale()

setLocale

public void setLocale(java.util.Locale locale)

getMessages

public Messages getMessages()
TODO: This duplicates methods from MessagesManager : remove either


getMessages

public Messages getMessages(java.lang.String basename)
TODO: This duplicates methods from MessagesManager : remove either

Parameters:
basename - name of the bundle TODO: This duplicates methods from MessagesManager : remove either

getHierarchyManager

public HierarchyManager getHierarchyManager(java.lang.String repositoryId)
Description copied from interface: Context
Get hierarchy manager initialized for this user

Returns:
hierarchy manager

getAccessManager

public AccessManager getAccessManager(java.lang.String repositoryId)
Description copied from interface: Context
Get access manager for the specified repository on default workspace

Returns:
access manager

getQueryManager

public QueryManager getQueryManager(java.lang.String repositoryId)
Description copied from interface: Context
Get QueryManager created for this user on the specified repository

Returns:
query manager

get

public java.lang.Object get(java.lang.Object key)
Map implemenation

Specified by:
get in interface java.util.Map

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Map implementation

Specified by:
put in interface java.util.Map

clear

public void clear()
Map implementation

Specified by:
clear in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object value)
Map implementation. This implementation is very slow

Specified by:
containsValue in interface java.util.Map

entrySet

public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
Map implementation

Specified by:
entrySet in interface java.util.Map

isEmpty

public boolean isEmpty()
Map implementation

Specified by:
isEmpty in interface java.util.Map

keySet

public java.util.Set<java.lang.String> keySet()
Map implementation

Specified by:
keySet in interface java.util.Map

putAll

public void putAll(java.util.Map map)
Map implementation

Specified by:
putAll in interface java.util.Map

remove

public java.lang.Object remove(java.lang.Object key)
Map implementation

Specified by:
remove in interface java.util.Map

values

public java.util.Collection<java.lang.Object> values()
Map implementation

Specified by:
values in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object arg0)
Map implementation

Specified by:
containsKey in interface java.util.Map

size

public int size()
Map implementation

Specified by:
size in interface java.util.Map

release

public void release()
Release any resource used by this Context (e.g. jcr sessions).



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