net.sf.shineframework.common.tx.context
Class TlsUserContextFactory

java.lang.Object
  extended by net.sf.shineframework.common.tx.context.TlsUserContextFactory
All Implemented Interfaces:
UserContextFactory
Direct Known Subclasses:
TlsUserContextFactory

public abstract class TlsUserContextFactory
extends java.lang.Object
implements UserContextFactory

Thread Local Storage (tls) user context factory. This user context factory stores the user context on the TLS. This type of factory is usefule usually when running outside an application server.

Author:
amirk

Nested Class Summary
protected static class TlsUserContextFactory.UserContextThreadLocal
          a private implementation of a ThreadLocal that assigns an initial value
 
Field Summary
protected static TlsUserContextFactory.UserContextThreadLocal storage
           
 
Constructor Summary
TlsUserContextFactory(java.lang.String userContextClassname)
          constructs a user context factory.
 
Method Summary
 void clearUserContext()
          clears the user context
 UserContext getUserContext()
          retrieves the user context from the TLS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

storage

protected static TlsUserContextFactory.UserContextThreadLocal storage
Constructor Detail

TlsUserContextFactory

public TlsUserContextFactory(java.lang.String userContextClassname)
constructs a user context factory. This constructor is here to make the user (which is usually a Spring bean definition) to pass the classname of the user context. This is usually a StandardUserContext.

Parameters:
userContextClassname - user context classname
See Also:
StandardUserContext
Method Detail

clearUserContext

public void clearUserContext()
clears the user context

Specified by:
clearUserContext in interface UserContextFactory

getUserContext

public UserContext getUserContext()
retrieves the user context from the TLS

Specified by:
getUserContext in interface UserContextFactory
Returns:
the current user context


Copyright © 2007 sourceforge.net. All Rights Reserved.