it.amattioli.dominate.sessions
Class CompositeSessionManager

Show UML class diagram
java.lang.Object
  extended by it.amattioli.dominate.sessions.CompositeSessionManager
All Implemented Interfaces:
SessionManager

public class CompositeSessionManager
extends Object
implements SessionManager

This SessionManager implementation is able to delegate its behavior to other session managers so sessions of various types can be retrieved.

Author:
andrea

Constructor Summary
CompositeSessionManager(SessionMode mode)
           
 
Method Summary
<S> S
getSession(Class<S> sessionClass)
          Retrieves a session associated with this SessionManager.
 SessionMode getSessionMode()
          Retrieves the SessionMode associated with this SessionManager
 boolean hasSessionMode(SessionMode sMode)
          Check if this SessionManager has a certain SessionMode
 boolean isReleased()
          Check if this SessionManager has been released.
 void release()
          Release this SessionManager and close all the associated sessions.
 void reset()
          Close all the associated sessions.
 void setSessionMode(SessionMode sessionMode)
           
 org.apache.commons.collections.Closure transactionalClosure(org.apache.commons.collections.Closure toBeDone)
          Decorate a closure so that it will be executed in a transactional context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeSessionManager

public CompositeSessionManager(SessionMode mode)
Method Detail

setSessionMode

public void setSessionMode(SessionMode sessionMode)
Specified by:
setSessionMode in interface SessionManager

getSession

public <S> S getSession(Class<S> sessionClass)
Description copied from interface: SessionManager
Retrieves a session associated with this SessionManager. If this SessionManager has an associated session whose class is the same as the given class it will be returned, otherwise null will be returned.

Specified by:
getSession in interface SessionManager
Parameters:
sessionClass - the class of the needed session
Returns:
the session associated with this SessionManager whose class is the same as the given class if it exists, null otherwise

getSessionMode

public SessionMode getSessionMode()
Description copied from interface: SessionManager
Retrieves the SessionMode associated with this SessionManager

Specified by:
getSessionMode in interface SessionManager
Returns:
the SessionMode associated with this SessionManager

hasSessionMode

public boolean hasSessionMode(SessionMode sMode)
Description copied from interface: SessionManager
Check if this SessionManager has a certain SessionMode

Specified by:
hasSessionMode in interface SessionManager
Parameters:
sMode - the SessionMode to check
Returns:
true if this SessionManager has a certain SessionMode

release

public void release()
Description copied from interface: SessionManager
Release this SessionManager and close all the associated sessions. After this, when the SessionManager.getSession(Class) method is called an IllegalStateException will be thrown

Specified by:
release in interface SessionManager

isReleased

public boolean isReleased()
Description copied from interface: SessionManager
Check if this SessionManager has been released.

Specified by:
isReleased in interface SessionManager
Returns:
true if this SessionManager has been released, false otherwise
See Also:
#release()}

reset

public void reset()
Description copied from interface: SessionManager
Close all the associated sessions. After this, when the SessionManager.getSession(Class) method is called a new session will be opened.

Specified by:
reset in interface SessionManager

transactionalClosure

public org.apache.commons.collections.Closure transactionalClosure(org.apache.commons.collections.Closure toBeDone)
Description copied from interface: SessionManager
Decorate a closure so that it will be executed in a transactional context. A transaction will be open before the closure is executed and the same transaction will be committed after the execution.

Specified by:
transactionalClosure in interface SessionManager
Parameters:
toBeDone - the closure to be decorated
Returns:
the decorated closure


Copyright © 2011. All Rights Reserved.