it.eng.spagobi.container
Class ContextManager

java.lang.Object
  extended by it.eng.spagobi.container.AbstractContainer
      extended by it.eng.spagobi.container.ContextManager
All Implemented Interfaces:
IContainer

public class ContextManager
extends AbstractContainer

This class provides useful methods to manage context on a ISessionContainer

Author:
Zerbetto (davide.zerbetto@eng.it)

Field Summary
protected  ISessionContainer _session
           
protected  IContextRetrieverStrategy _strategy
           
 
Constructor Summary
ContextManager(ISessionContainer session, IContextRetrieverStrategy strategy)
           
 
Method Summary
 void cleanOldContexts(int minutes)
          Destroys all contexts older than the number of minutes specified at input.
 void destroyCurrentContext()
          Destroys current context.
 java.lang.Object get(java.lang.String key)
          Retrieves a generic object from context using the given key.
 java.util.List getKeys()
          Returns a List of all the String keys of the objects stored on context.
 void print()
          Print all the contexts with all personal objects
 void remove(java.lang.String key)
          Removes an object (given its key at input) from context.
 void set(java.lang.String key, java.lang.Object object)
          Sets a generic object into context using the given key.
 
Methods inherited from class it.eng.spagobi.container.AbstractContainer
getBIObject, getBoolean, getExecutionInstance, getInteger, getList, getString, isBlankOrNull, isNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_session

protected ISessionContainer _session

_strategy

protected IContextRetrieverStrategy _strategy
Constructor Detail

ContextManager

public ContextManager(ISessionContainer session,
                      IContextRetrieverStrategy strategy)
Method Detail

get

public java.lang.Object get(java.lang.String key)
Retrieves a generic object from context using the given key.

Parameters:
key - The key of the object in context
Returns:
The object in context with the given key

set

public void set(java.lang.String key,
                java.lang.Object object)
Sets a generic object into context using the given key.

Parameters:
key - The key to be used to store object in context

remove

public void remove(java.lang.String key)
Removes an object (given its key at input) from context.

Parameters:
key - The key of the object on context.

destroyCurrentContext

public void destroyCurrentContext()
Destroys current context.


cleanOldContexts

public void cleanOldContexts(int minutes)
Destroys all contexts older than the number of minutes specified at input.


getKeys

public java.util.List getKeys()
Returns a List of all the String keys of the objects stored on context.

Returns:
all the string keys of the objects stored into this container

print

public void print()
Print all the contexts with all personal objects