info.magnolia.context
Interface Context

All Superinterfaces:
org.apache.commons.chain.Context, java.util.Map
All Known Subinterfaces:
SystemContext, ThreadDependentSystemContext, UserContext, WebContext
All Known Implementing Classes:
AbstractSystemContext, JCRSessionPerThreadSystemContext, SingleJCRSessionSystemContext, UserContextImpl, WebContextImpl

public interface Context
extends org.apache.commons.chain.Context

This interface defines all the methods which should be implemented by any configured magnolia context. Implementing class should never be accessible directly but only via MgnlContext static methods which work on a local (Thread) copy of the implementation.

Version:
$Revision $ ($Author $)
Author:
Sameer Charles

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
static int APPLICATION_SCOPE
          Attribute visibility scope, its visible to all sessions of this application.
static java.lang.String ATTRIBUTE_COMMENT
           
static java.lang.String ATTRIBUTE_EXCEPTION
           
static java.lang.String ATTRIBUTE_MESSAGE
           
static java.lang.String ATTRIBUTE_PATH
           
static java.lang.String ATTRIBUTE_RECURSIVE
           
static java.lang.String ATTRIBUTE_REPOSITORY
           
static java.lang.String ATTRIBUTE_UUID
           
static java.lang.String ATTRIBUTE_VERSION
           
static java.lang.String ATTRIBUTE_VERSION_MAP
           
static int LOCAL_SCOPE
          Attribute visibility scope.
static int SESSION_SCOPE
          Attribute visibility scope Shared by all requests from this session.
 
Method Summary
 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 without passing a scope.
 java.lang.Object getAttribute(java.lang.String name, int scope)
          Get attribute value.
 java.util.Map<java.lang.String,java.lang.Object> getAttributes()
          Get an over all map.
 java.util.Map<java.lang.String,java.lang.Object> getAttributes(int scope)
          Get a map of a attributes set in the scope.
 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()
          Get the current locale.
 Messages getMessages()
          Get the default messages.
 Messages getMessages(java.lang.String basename)
          Get the messages of the named bundle.
 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.
 User getUser()
          If this is not a UserContext this method will very likely return the system user.
 void release()
          Release any resource used by this Context (e.g.
 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 setLocale(java.util.Locale locale)
           
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Field Detail

LOCAL_SCOPE

static final int LOCAL_SCOPE
Attribute visibility scope.

See Also:
Constant Field Values

SESSION_SCOPE

static final int SESSION_SCOPE
Attribute visibility scope Shared by all requests from this session.

See Also:
Constant Field Values

APPLICATION_SCOPE

static final int APPLICATION_SCOPE
Attribute visibility scope, its visible to all sessions of this application.

See Also:
Constant Field Values

ATTRIBUTE_REPOSITORY

static final java.lang.String ATTRIBUTE_REPOSITORY
See Also:
Constant Field Values

ATTRIBUTE_PATH

static final java.lang.String ATTRIBUTE_PATH
See Also:
Constant Field Values

ATTRIBUTE_VERSION

static final java.lang.String ATTRIBUTE_VERSION
See Also:
Constant Field Values

ATTRIBUTE_VERSION_MAP

static final java.lang.String ATTRIBUTE_VERSION_MAP
See Also:
Constant Field Values

ATTRIBUTE_UUID

static final java.lang.String ATTRIBUTE_UUID
See Also:
Constant Field Values

ATTRIBUTE_RECURSIVE

static final java.lang.String ATTRIBUTE_RECURSIVE
See Also:
Constant Field Values

ATTRIBUTE_COMMENT

static final java.lang.String ATTRIBUTE_COMMENT
See Also:
Constant Field Values

ATTRIBUTE_MESSAGE

static final java.lang.String ATTRIBUTE_MESSAGE
See Also:
Constant Field Values

ATTRIBUTE_EXCEPTION

static final java.lang.String ATTRIBUTE_EXCEPTION
See Also:
Constant Field Values
Method Detail

getUser

User getUser()
If this is not a UserContext this method will very likely return the system user.


setLocale

void setLocale(java.util.Locale locale)
Parameters:
locale -

getLocale

java.util.Locale getLocale()
Get the current locale.


getHierarchyManager

HierarchyManager getHierarchyManager(java.lang.String repositoryId)
Get hierarchy manager initialized for this user.

Parameters:
repositoryId -
Returns:
hierarchy manager

getHierarchyManager

HierarchyManager getHierarchyManager(java.lang.String repositoryId,
                                     java.lang.String workspaceId)
Get hierarchy manager initialized for this user.

Parameters:
repositoryId -
workspaceId -
Returns:
hierarchy manager

getAccessManager

AccessManager getAccessManager(java.lang.String repositoryId)
Get access manager for the specified repository on default workspace.

Parameters:
repositoryId -
Returns:
access manager

getAccessManager

AccessManager getAccessManager(java.lang.String repositoryId,
                               java.lang.String workspaceId)
Get access manager for the specified repository on the specified workspace.

Parameters:
repositoryId -
workspaceId -
Returns:
access manager

getQueryManager

QueryManager getQueryManager(java.lang.String repositoryId)
Get QueryManager created for this user on the specified repository.

Parameters:
repositoryId -
Returns:
query manager

getQueryManager

QueryManager getQueryManager(java.lang.String repositoryId,
                             java.lang.String workspaceId)
Get QueryManager created for this user on the specified repository and workspace.

Parameters:
repositoryId -
workspaceId -
Returns:
query manager

setAttribute

void setAttribute(java.lang.String name,
                  java.lang.Object value,
                  int scope)
Set attribute value, scope of the attribute is defined.

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

getAttribute

java.lang.Object getAttribute(java.lang.String name,
                              int scope)
Get attribute value.

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

getAttribute

java.lang.Object getAttribute(java.lang.String name)
Get attribute value without passing a scope. the scopes are searched from bottom up (request, session, application)

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

getAttributes

java.util.Map<java.lang.String,java.lang.Object> getAttributes(int scope)
Get a map of a attributes set in the scope.

Parameters:
scope -
Returns:
the map

removeAttribute

void removeAttribute(java.lang.String name,
                     int scope)
Remove an attribute.

Parameters:
name -
scope -

getAttributes

java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Get an over all map.

Returns:
the map

getMessages

Messages getMessages()
Get the default messages. It uses the locale set on this context TODO: This duplicates methods from MessagesManager : remove either


getMessages

Messages getMessages(java.lang.String basename)
Get the messages of the named bundle. It uses the locale set on this context

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

release

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



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