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: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $
- Author:
- Ted Husted
Method Summary |
protected DataSource |
getDataSource(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 DataSource getDataSource(String key)
throws 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:
SQLException
Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.