|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.enhydra.barracuda.plankton.data.DefaultStateMap
org.enhydra.barracuda.plankton.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. The Weak and Soft maps are backed by WeakHashMap and SoftHashMap maps respectively (the basic distinction being that weak references will generally be cleaned up as soon as possible while soft references will generally be held on to as long as possible). The soft map is generally a better choice for caching. 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).
Nested Class Summary | |
static class |
ObjectRepository.SessionRepository
The basic idea behind this is that we want to wrap the session as a ObjectRepository object. |
Field Summary | |
protected static Map |
custom
|
protected static ObjectRepository |
global
|
protected static Map |
local
|
protected String |
name
|
protected static SoftHashMap |
rawSessions
|
protected static Map |
session
|
protected static Map |
sessionIDs
|
protected static ObjectRepository |
softGlobal
|
protected static Map |
softsession
|
protected static ObjectRepository |
weakGlobal
|
protected static Map |
weaksession
|
Fields inherited from class org.enhydra.barracuda.plankton.data.DefaultStateMap |
props |
Constructor Summary | |
protected |
ObjectRepository()
protected constructor |
protected |
ObjectRepository(String iname)
|
Method Summary | |
static ObjectRepository |
getGlobalRepository()
Get a reference to the Global repository. |
static ObjectRepository |
getLocalRepository()
Get a reference to the Local repository. |
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(String name)
Get an object repository based on a given name. |
static Map |
getObjectRepositoryStore()
This method gives you direct access to the underlying data structures in which everything related the the object repository is kept. |
static javax.servlet.http.HttpSession |
getRawSession()
get raw session - this gives you access to the underlying session object |
static SoftHashMap |
getRawSessionStore()
This method gives you direct access to the underlying HttpSession data structure. |
static ObjectRepository |
getSessionRepository()
Get a reference to the Session repository. |
protected static ObjectRepository |
getSessionRepository(String key)
|
static Map |
getSessionStore()
This method gives you direct access to the underlying HttpSession data structures (as many as are registered by Barracuda apps). |
static ObjectRepository |
getSoftGlobalRepository()
Get a reference to the Soft Global repository. |
static ObjectRepository |
getSoftSessionRepository()
Get a reference to a Soft Session repository. |
static ObjectRepository |
getWeakGlobalRepository()
Get a reference to the Weak Global repository. |
static ObjectRepository |
getWeakSessionRepository()
Get a reference to a Weak Session repository. |
static void |
invalidateAllSessions()
allows you to invalidate all rawSessions. |
static void |
invalidateSession()
allows you to invalidate a session by its unique identifier. |
static void |
invalidateSession(String sessionID)
allows you to invalidate a session by its unique identifier. |
static void |
printStackTrace()
|
static void |
printStackTrace(String msg)
|
static void |
printStackTrace(String msg,
OutputStream out)
|
static void |
removeLocalRepository()
Release the Local repository. |
static void |
removeObjectRepository(NameSpace ns)
Release an object repository associated with a given NameSpace |
static void |
removeObjectRepository(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.plankton.data.DefaultStateMap |
clearState, 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 ObjectRepository global
protected static ObjectRepository weakGlobal
protected static ObjectRepository softGlobal
protected static SoftHashMap rawSessions
protected static Map session
protected static Map sessionIDs
protected static Map weaksession
protected static Map softsession
protected static Map local
protected static Map custom
protected String name
Constructor Detail |
protected ObjectRepository()
protected ObjectRepository(String iname)
Method Detail |
public static ObjectRepository getGlobalRepository()
public static ObjectRepository getWeakGlobalRepository()
public static ObjectRepository getSoftGlobalRepository()
public static void setupSessionRepository(javax.servlet.http.HttpServletRequest req)
public static ObjectRepository getSessionRepository()
protected static ObjectRepository getSessionRepository(String key)
public static void removeSessionRepository()
public static ObjectRepository getWeakSessionRepository()
public static ObjectRepository getSoftSessionRepository()
public static ObjectRepository getLocalRepository()
public static void removeLocalRepository()
public static ObjectRepository getObjectRepository(NameSpace ns)
public static void removeObjectRepository(NameSpace ns)
public static ObjectRepository getObjectRepository(String name)
public static void removeObjectRepository(String name)
public String getName()
public static javax.servlet.http.HttpSession getRawSession()
public static void invalidateSession()
public static void invalidateSession(String sessionID)
public static void invalidateAllSessions()
public static Map getSessionStore()
public static SoftHashMap getRawSessionStore()
public static Map getObjectRepositoryStore()
public static void printStackTrace()
public static void printStackTrace(String msg)
public static void printStackTrace(String msg, OutputStream out)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |