org.nakedobjects.runtime.session
Class NakedObjectSessionDefault

java.lang.Object
  extended by org.nakedobjects.runtime.session.NakedObjectSessionDefault
All Implemented Interfaces:
Component, SessionScopedComponent, NakedObjectSession

public class NakedObjectSessionDefault
extends java.lang.Object
implements NakedObjectSession

Analogous to a Hibernate Session, holds the current set of components for a specific execution context (such as on a thread).

The NakedObjectsContext class (in nof-core) is responsible for locating the current execution context.

See Also:
NakedObjectSessionFactory

Constructor Summary
NakedObjectSessionDefault(NakedObjectSessionFactory sessionFactory, AuthenticationSession authenticationSession, PersistenceSession persistenceSession, UserProfile userProfile)
           
 
Method Summary
 void appendState(ToString asString)
           
 void close()
          Closes session.
 void closeAll()
          Shuts down all components.
 void debug(DebugString debug)
           
 void debugAll(DebugString debug)
           
 void debugState(DebugString debug)
           
 AuthenticationSession getAuthenticationSession()
          Returns the security session representing this user for this execution context.
 NakedObjectConfiguration getConfiguration()
          Convenience method.
 NakedObjectTransaction getCurrentTransaction()
          Convenience method that returns the NakedObjectTransaction of the session, if any.
 DeploymentType getDeploymentType()
          Convenience method.
 java.lang.String getId()
          Returns an descriptive identifier for this NakedObjectSessionDefault.
 PersistenceSession getPersistenceSession()
          The PersistenceSession within this NakedObjectSession.
 NakedObjectSessionFactory getSessionFactory()
          The creating factory.
protected  long getSessionOpenTime()
           
 SpecificationLoader getSpecificationLoader()
          Convenience method.
 TemplateImageLoader getTemplateImageLoader()
          Convenience method.
 UserProfile getUserProfile()
          Returns the adapted Perspective for the user who is using this NakedObjectSession.
 void open()
           
 void takeSnapshot()
           
 void testSetObjectPersistor(PersistenceSession objectPersistor)
          Should only be called in tests.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NakedObjectSessionDefault

public NakedObjectSessionDefault(NakedObjectSessionFactory sessionFactory,
                                 AuthenticationSession authenticationSession,
                                 PersistenceSession persistenceSession,
                                 UserProfile userProfile)
Method Detail

open

public void open()
Specified by:
open in interface SessionScopedComponent

close

public void close()
Closes session.

Specified by:
close in interface SessionScopedComponent

closeAll

public void closeAll()
Shuts down all components.

Specified by:
closeAll in interface NakedObjectSession

getSessionFactory

public NakedObjectSessionFactory getSessionFactory()
Description copied from interface: NakedObjectSession
The creating factory.

Note that from the factory we can get to the NakedObjectsSystem, and thus other ApplicationScopedComponents.

Specified by:
getSessionFactory in interface NakedObjectSession

getDeploymentType

public DeploymentType getDeploymentType()
Convenience method.


getConfiguration

public NakedObjectConfiguration getConfiguration()
Convenience method.


getSpecificationLoader

public SpecificationLoader getSpecificationLoader()
Convenience method.


getTemplateImageLoader

public TemplateImageLoader getTemplateImageLoader()
Convenience method.


getAuthenticationSession

public AuthenticationSession getAuthenticationSession()
Returns the security session representing this user for this execution context.

Specified by:
getAuthenticationSession in interface NakedObjectSession

getId

public java.lang.String getId()
Returns an descriptive identifier for this NakedObjectSessionDefault.

Specified by:
getId in interface NakedObjectSession

getPersistenceSession

public PersistenceSession getPersistenceSession()
Description copied from interface: NakedObjectSession
The PersistenceSession within this NakedObjectSession.

Would have been created by the owning factory's

Specified by:
getPersistenceSession in interface NakedObjectSession

getUserProfile

public UserProfile getUserProfile()
Description copied from interface: NakedObjectSession
Returns the adapted Perspective for the user who is using this NakedObjectSession.

Specified by:
getUserProfile in interface NakedObjectSession

getSessionOpenTime

protected long getSessionOpenTime()

getCurrentTransaction

public NakedObjectTransaction getCurrentTransaction()
Convenience method that returns the NakedObjectTransaction of the session, if any.

Specified by:
getCurrentTransaction in interface NakedObjectSession

testSetObjectPersistor

public void testSetObjectPersistor(PersistenceSession objectPersistor)
Should only be called in tests.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

debugAll

public void debugAll(DebugString debug)
Specified by:
debugAll in interface NakedObjectSession

debug

public void debug(DebugString debug)
Specified by:
debug in interface NakedObjectSession

takeSnapshot

public void takeSnapshot()

appendState

public void appendState(ToString asString)

debugState

public void debugState(DebugString debug)
Specified by:
debugState in interface NakedObjectSession


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