|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bristle.javalib.sql.ConnectionPoolFinder
public class ConnectionPoolFinder
This class makes it possible for Java servlets to access an existing ConnectionPool that may be stored in the servlet's Session context, the servlet's ServletContext (application context), or as the ConnectionPool global singleton.
Usage: - The typical scenario for using this class is: - To find a ConnectionPool: ConnectionPoolFinder finder = new ConnectionPoolFinder(request); ConnectionPool pool = finder.find(); - To save a ConnectionPool to be found by future calls to find(): finder.saveInSession(pool); finder.saveInServletContext(pool) finder.saveAsGlobalSingleton(pool) Assumptions: Effects: - Can update the servlet's Session context, ServletContext, and/or the ConnectionPool global singleton. Anticipated Changes: Notes: Implementation Notes: Portability Issues: Revision History: $Log$
Nested Class Summary | |
---|---|
static class |
ConnectionPoolFinder.Tester
Each class contains a Tester inner class with a main() for easier unit testing. |
Field Summary | |
---|---|
static HttpServletRequest |
poolFIND_SINGLETON_ONLY
Constant for use as parameter to constructor. |
Constructor Summary | |
---|---|
ConnectionPoolFinder(HttpServletRequest request)
Constructor. |
Method Summary | |
---|---|
ConnectionPool |
find()
Find an existing ConnectionPool, searching first the Session context of the previously specified HttpServletRequest (if any), then the ServletContext (application context) of the servlet associated with that HttpServletRequest (if any), then the ConnectionPool global singleton (if any), returning null if no ConnectionPool is found in any of those places. |
void |
saveAsGlobalSingleton(ConnectionPool pool)
Save the specified ConnectionPool as the ConnectionPool global singleton, to be found by future calls to find(). |
void |
saveInServletContext(ConnectionPool pool)
Save the specified ConnectionPool in the ServletContext to be found by future calls to find(). |
void |
saveInSession(ConnectionPool pool)
Save the specified ConnectionPool in the Session to be found by future calls to find(). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final HttpServletRequest poolFIND_SINGLETON_ONLY
Constructor Detail |
---|
public ConnectionPoolFinder(HttpServletRequest request)
request
- The HttpServletRequest used to locate the contexts to
be searched for the ConnectionPool, or null to cause
find to skip directly to the singleton when searching.Method Detail |
---|
public ConnectionPool find()
public void saveInSession(ConnectionPool pool)
pool
- The ConnectionPool.public void saveInServletContext(ConnectionPool pool)
pool
- The ConnectionPool.public void saveAsGlobalSingleton(ConnectionPool pool)
pool
- The ConnectionPool.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |