|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.barracuda.core.util.data.DefaultStateMap | +--org.enhydra.barracuda.core.util.data.ObjectRepository
This class provides access to several different generic statemap repositories, scoped for Global, Session, Local, or custom (NameSpace or Name...you provide the cleanup). The basic idea here is to make it easy to access object repositories without having to pass references around. The Global object repository represents a common (threadsafe) statemap that is shared across the JVM. You would typically put things here like DataSources, global variables, etc. Any objects that you make available globally need to be threadsafe. The Session object repository is a statemap wrapper around HttpSession. This provides a convenient bridge to the Session interface, without having to have a reference to the HttpServletRequest. Storing items in this object places them in the underlying session. Note that ApplicationGateway and ComponentGateway classes invoke the setupSessionRepository() call for you, so all you have to do is call getSessionRepository() and you're in business. The Local object repository is a statemap object that lasts for the duration of a req-resp cycle. Note that the ApplicationGateway and ComponentGateway classes clean up both Session and Local repositories. You can also get non-scoped ObjectRepositories by using either NameSpace or String keys. IF you use this approach, its up to you to manually remove the repositories when you're done with them (or else you'll end up leaving them in memory taking up space).
Field Summary | |
protected static java.util.Map |
custom
|
protected static ObjectRepository |
global
|
protected static java.util.Map |
local
|
protected static org.apache.log4j.Logger |
logger
|
protected java.lang.String |
name
|
protected static java.util.Map |
session
|
protected static java.util.Map |
weaksession
|
Fields inherited from class org.enhydra.barracuda.core.util.data.DefaultStateMap |
props |
Constructor Summary | |
protected |
ObjectRepository()
protected constructor |
protected |
ObjectRepository(java.lang.String iname)
|
Method Summary | |
static ObjectRepository |
getGlobalRepository()
Get a reference to the Global repository. |
static ObjectRepository |
getLocalRepository()
Get a reference to the Local repository. |
java.lang.String |
getName()
Return the name of this object repository |
static ObjectRepository |
getObjectRepository(NameSpace ns)
Get an object repository associated with a given NameSpace. |
static ObjectRepository |
getObjectRepository(java.lang.String name)
Get an object repository based on a given name. |
static ObjectRepository |
getSessionRepository()
Get a reference to the Session repository. |
static ObjectRepository |
getWeakSessionRepository()
Get a reference to a Weak Session repository. |
static void |
removeLocalRepository()
Release the Local repository. |
static void |
removeObjectRepository(NameSpace ns)
Release an object repository associated with a given NameSpace |
static void |
removeObjectRepository(java.lang.String name)
Release an object repository associated with a given name |
static void |
removeSessionRepository()
Release the Session repository |
static void |
setupSessionRepository(javax.servlet.http.HttpServletRequest req)
Set up the Session repository for this particular thread. |
Methods inherited from class org.enhydra.barracuda.core.util.data.DefaultStateMap |
getState, getStateKeys, getStateValues, putState, removeState |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static org.apache.log4j.Logger logger
protected static ObjectRepository global
protected static java.util.Map session
protected static java.util.Map weaksession
protected static java.util.Map local
protected static java.util.Map custom
protected java.lang.String name
Constructor Detail |
protected ObjectRepository()
protected ObjectRepository(java.lang.String iname)
Method Detail |
public static ObjectRepository getGlobalRepository()
public static void setupSessionRepository(javax.servlet.http.HttpServletRequest req)
public static ObjectRepository getSessionRepository()
public static void removeSessionRepository()
public static ObjectRepository getWeakSessionRepository()
public static ObjectRepository getLocalRepository()
public static void removeLocalRepository()
public static ObjectRepository getObjectRepository(NameSpace ns)
public static void removeObjectRepository(NameSpace ns)
public static ObjectRepository getObjectRepository(java.lang.String name)
public static void removeObjectRepository(java.lang.String name)
public java.lang.String getName()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |