uk.org.ogsadai.sessions.impl
Class ExplicitSessionStrategy

java.lang.Object
  |
  +--uk.org.ogsadai.sessions.impl.ExplicitSessionStrategy
All Implemented Interfaces:
SessionStrategy

public class ExplicitSessionStrategy
extends java.lang.Object
implements SessionStrategy

A SessionStrategy that creates a new session based on the lifetime settings passed to the constructor.

A SessionListener is attached to the session to ensure that it expires after the last participant has left.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
           
private  SessionSettings mSettings
           
 
Constructor Summary
ExplicitSessionStrategy(SessionSettings settings)
          Constructs a new strategy for creating a new session with specified lifetime settings.
 
Method Summary
(package private)  SessionListener createSessionListener(SessionManager manager)
          Creates a SessionListener that will automatically terminate the session when the last session participant leaves.
 InternalSession obtainSession(SessionManager manager)
          Uses the session manager to create a new session or access an existing session, depending on the session requirements built into the strategy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

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

mSettings

private final SessionSettings mSettings
Constructor Detail

ExplicitSessionStrategy

public ExplicitSessionStrategy(SessionSettings settings)
Constructs a new strategy for creating a new session with specified lifetime settings.

Parameters:
settings - The SessionSettings object containing the specified lifetime settings. The session ID setting in that object is ignored.
Method Detail

obtainSession

public InternalSession obtainSession(SessionManager manager)
                              throws SessionCreationException,
                                     SessionLookupException,
                                     SessionNotFoundException
Description copied from interface: SessionStrategy
Uses the session manager to create a new session or access an existing session, depending on the session requirements built into the strategy.

An implementation of this method should also take necessary measures to ensure that the session ends at the appropriate point, such as after a certain time has passed.

Specified by:
obtainSession in interface SessionStrategy
Parameters:
manager - The SessionManagement to use for interactions.
Returns:
A SessionAccess object to the session thus obtained.
Throws:
SessionNotFoundException - if a specific named session does not exist.
SessionCreationException - if some problem arises when creating a new session.
SessionLookupException - if some problem arises when accessing an existing session.

createSessionListener

SessionListener createSessionListener(SessionManager manager)
Creates a SessionListener that will automatically terminate the session when the last session participant leaves.

This method is given package level accessiblity for testing purposes.

Parameters:
manager - SessionManager managing session.
Returns:
SessionListener.