org.nakedobjects.runtime.context
Class NakedObjectsContextThreadLocal

java.lang.Object
  extended by org.nakedobjects.runtime.context.NakedObjectsContext
      extended by org.nakedobjects.runtime.context.NakedObjectsContextMultiUser
          extended by org.nakedobjects.runtime.context.NakedObjectsContextThreadLocal
All Implemented Interfaces:
DebugInfo

public class NakedObjectsContextThreadLocal
extends NakedObjectsContextMultiUser

Basic multi-user implementation of NakedObjects that stores a set of components for each thread in use.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.nakedobjects.runtime.context.NakedObjectsContext
NakedObjectsContext.ContextReplacePolicy, NakedObjectsContext.SessionClosePolicy
 
Constructor Summary
protected NakedObjectsContextThreadLocal(NakedObjectSessionFactory sessionFactory)
           
 
Method Summary
 java.lang.String[] allSessionIds()
          All known session Ids.
 void closeAllSessionsInstance()
          Shutdown the application.
protected  NakedObjectSession createAndOpenSession(java.lang.Thread thread, AuthenticationSession authenticationSession)
           
static NakedObjectsContext createInstance(NakedObjectSessionFactory sessionFactory)
           
 void debugData(DebugString debug)
           
 java.lang.String debugTitle()
           
protected  void doClose()
          Overridable hook method called from NakedObjectsContext.closeSessionInstance(), allowing subclasses to clean up (for example datastructures).
 NakedObjectSession getSessionInstance()
          Get execution context used by the current thread.
protected  NakedObjectSession getSessionInstance(java.lang.String executionContextId)
          The NakedObjectSession for specified NakedObjectSession.getId().
 NakedObjectSession openSessionInstance(AuthenticationSession authenticationSession)
          Is only intended to be called through NakedObjectsContext.openSession(AuthenticationSession).
protected  void shutdownAllThreads()
           
 
Methods inherited from class org.nakedobjects.runtime.context.NakedObjectsContext
applySessionClosePolicy, closeAllSessions, closeSession, closeSessionInstance, debugSession, debugSystem, exists, getAuthenticationManager, getAuthenticationSession, getAuthorizationManager, getConfiguration, getCurrentTransaction, getDeploymentType, getInstance, getMessageBroker, getPersistenceSession, getServices, getSession, getSession, getSessionFactory, getSessionFactoryInstance, getSessionId, getSpecificationLoader, getTemplateImageLoader, getTransactionManager, getUpdateNotifier, getUserProfile, getUserProfileLoader, inSession, inTransaction, isContextReplaceable, isSessionAutocloseable, openSession, setConfiguration, testReset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NakedObjectsContextThreadLocal

protected NakedObjectsContextThreadLocal(NakedObjectSessionFactory sessionFactory)
Method Detail

createInstance

public static NakedObjectsContext createInstance(NakedObjectSessionFactory sessionFactory)

closeAllSessionsInstance

public void closeAllSessionsInstance()
Description copied from class: NakedObjectsContext
Shutdown the application.

Specified by:
closeAllSessionsInstance in class NakedObjectsContext

shutdownAllThreads

protected void shutdownAllThreads()

doClose

protected void doClose()
Description copied from class: NakedObjectsContext
Overridable hook method called from NakedObjectsContext.closeSessionInstance(), allowing subclasses to clean up (for example datastructures).

The current NakedObjectSession will already have been closed.

Overrides:
doClose in class NakedObjectsContext

allSessionIds

public java.lang.String[] allSessionIds()
Description copied from class: NakedObjectsContext
All known session Ids.

Provided primarily for debugging.

Specified by:
allSessionIds in class NakedObjectsContext

debugTitle

public java.lang.String debugTitle()

debugData

public void debugData(DebugString debug)
Specified by:
debugData in interface DebugInfo
Overrides:
debugData in class NakedObjectsContext

getSessionInstance

protected NakedObjectSession getSessionInstance(java.lang.String executionContextId)
Description copied from class: NakedObjectsContext
The NakedObjectSession for specified NakedObjectSession.getId().

Specified by:
getSessionInstance in class NakedObjectsContext

openSessionInstance

public NakedObjectSession openSessionInstance(AuthenticationSession authenticationSession)
Is only intended to be called through NakedObjectsContext.openSession(AuthenticationSession).

Implementation note: an alternative design would have just been to bind onto a thread local.

Specified by:
openSessionInstance in class NakedObjectsContext

createAndOpenSession

protected NakedObjectSession createAndOpenSession(java.lang.Thread thread,
                                                  AuthenticationSession authenticationSession)

getSessionInstance

public NakedObjectSession getSessionInstance()
Get execution context used by the current thread.

If no set exists then throws an IllegalStateException (must call openSessionInstance(AuthenticationSession) first).

Specified by:
getSessionInstance in class NakedObjectsContext
See Also:
openSessionInstance(AuthenticationSession)


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.