org.apache.commons.scaffold.sql
Class ServletAdaptor
java.lang.Object
org.apache.commons.scaffold.sql.ConnectionAdaptor
org.apache.commons.scaffold.sql.ServletAdaptor
- public class ServletAdaptor
- extends ConnectionAdaptor
Connection adaptor for a connection pool that is exposed
through the servlet context, like the Struts generic
connection pool.
The ConnectionServlet will automatically set a reference
to itself if an instance of this class is specified
as the ConnectionAdaptor.
- Version:
- $Revision: 1.5 $ $Date: 2004/03/21 21:10:27 $
|
Method Summary |
protected javax.sql.DataSource |
getDataSource(java.lang.String key)
Return datasource from the servlet context using
key as the attribute name. |
void |
setServlet(javax.servlet.http.HttpServlet servlet)
Set a reference to a servlet in the application
to allow access to the servlet context. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ServletAdaptor
public ServletAdaptor()
setServlet
public void setServlet(javax.servlet.http.HttpServlet servlet)
- Set a reference to a servlet in the application
to allow access to the servlet context.
getDataSource
protected javax.sql.DataSource getDataSource(java.lang.String key)
throws java.sql.SQLException
- Return datasource from the servlet context using
key as the attribute name.
- Overrides:
getDataSource in class ConnectionAdaptor
- Parameters:
key - The attribute name for the resource.
If null is passed, null is returned.
- Returns:
- null or the datasource object related to "key"
TODO: Add cache to store references to the datasources by key.
- Throws:
java.sql.SQLException
Copyright © 2002-2005 The Apache Software Foundation. All Rights Reserved.