|
|||||||||
| Home >> All >> com >> jcorporate >> expresso >> core >> [ registry overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.jcorporate.expresso.core.registry
Class RequestRegistry

java.lang.Objectcom.jcorporate.expresso.core.registry.RequestRegistry
- Direct Known Subclasses:
- MutableRequestRegistry
- public abstract class RequestRegistry
- extends java.lang.Object
The request registry provides several useful utility functions that allow isolation of Expresso specifics away from the domain model where they don't belong. To use it, use the static methods, which in turn return threadlocal data.
Example Usage:
String dataContext = RequestRegistry.getDataContext();
The pattern for this class is originally defined by Martin Fowler in his book Patterns of Enterprise Application Architecture as the registry pattern. Supplemental information for the casual reader can be found at: http://www.martinfowler.com/eaaCatalog/registry.html
In the concept of Interface vs Concrete Class. In this case, the static methods for this class are the interface to the class. Actual member manipulation is done in subclasses to the RequestRegistry.Dependencies: Note that ExpressoThreadContext depends heavily on the RequestRegistry. If you change the interface of this class by adding new members, you MUST change the ExpressoThreadContext and MutableRequestRegistry as well.
- Version:
- 1.0
| Field Summary | |
protected java.lang.String |
dataContext
The data context for the Expresso request. |
private java.util.Stack |
superUserStack
A stack for allowing credential changes mid-request. |
private static java.lang.ThreadLocal |
threadLocal
The threadlocal instance for this class. |
protected com.jcorporate.expresso.core.security.User |
user
The security context for the Expresso request. |
| Constructor Summary | |
protected |
RequestRegistry()
Default constructor. |
| Method Summary | |
static java.lang.String |
getDataContext()
Retrieves the current thread's data context. |
protected static RequestRegistry |
getInstance()
Method that gets the actual registry threadlocal instance and makes sure that it has been built prior to getting. |
static com.jcorporate.expresso.core.security.User |
getUser()
Retrieves the current thread's user. |
protected java.util.Stack |
getUserStack()
Retrieves the user stack, constructing a new one if necessary. |
protected void |
releaseSettings()
Releases all data associated with this registry. |
static com.jcorporate.expresso.core.security.User |
revertUser()
Reverts the user credentials |
static void |
superUser(com.jcorporate.expresso.core.security.User newUser)
Changes user credentials mid-thread request. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
dataContext
protected java.lang.String dataContext
- The data context for the Expresso request.
user
protected com.jcorporate.expresso.core.security.User user
- The security context for the Expresso request.
superUserStack
private java.util.Stack superUserStack
- A stack for allowing credential changes mid-request. Use superUser()
and revertUser() to push and pop users off the stack, much the
way that unix
superforms.
threadLocal
private static java.lang.ThreadLocal threadLocal
- The threadlocal instance for this class.
| Constructor Detail |
RequestRegistry
protected RequestRegistry()
- Default constructor. Adds this class to the threadlocal context.
| Method Detail |
getDataContext
public static java.lang.String getDataContext()
- Retrieves the current thread's data context.
getInstance
protected static RequestRegistry getInstance() throws java.lang.IllegalStateException
- Method that gets the actual registry threadlocal instance and makes
sure that it has been built prior to getting.
getUser
public static com.jcorporate.expresso.core.security.User getUser()
- Retrieves the current thread's user.
superUser
public static void superUser(com.jcorporate.expresso.core.security.User newUser)
- Changes user credentials mid-thread request. It allows for
su-like abilities. The old user context is stored in a stack that may be reverted by callingrevertUser()55 . restrict who can su based on a java security policy.
getUserStack
protected java.util.Stack getUserStack()
- Retrieves the user stack, constructing a new one if necessary.
revertUser
public static com.jcorporate.expresso.core.security.User revertUser()
- Reverts the user credentials
releaseSettings
protected void releaseSettings()
- Releases all data associated with this registry.
|
|||||||||
| Home >> All >> com >> jcorporate >> expresso >> core >> [ registry overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.jcorporate.expresso.core.registry.RequestRegistry