net.sourceforge.pbeans.servlet
Class ServletAccess

java.lang.Object
  extended by net.sourceforge.pbeans.servlet.ServletAccess

public class ServletAccess
extends java.lang.Object

Utilities that facilitate usage of pBeans in servlet engines.


Constructor Summary
ServletAccess()
           
 
Method Summary
static Store getStore(javax.servlet.ServletConfig servletConfig, java.lang.String storeName, java.lang.ClassLoader classLoader)
          Calls getStore(ServletContext, String, ClassLoader) by passing a servlet context.
static Store getStore(javax.servlet.ServletContext servletContext, java.lang.String storeName, java.lang.ClassLoader classLoader)
          Gets a store based on servlet context parameters.
static Store getStore(javax.servlet.Servlet servlet, java.lang.String storeName)
          Calls getStore(ServletConfig, String, ClassLoader) by passing the servlet configuration of the servlet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletAccess

public ServletAccess()
Method Detail

getStore

public static Store getStore(javax.servlet.Servlet servlet,
                             java.lang.String storeName)
                      throws StoreException
Calls getStore(ServletConfig, String, ClassLoader) by passing the servlet configuration of the servlet. The store will use the class loader that loaded the servlet class by default.

Parameters:
servlet - A servlet.
storeName - The name of the store sought.
Returns:
A Store instance.
Throws:
StoreException

getStore

public static Store getStore(javax.servlet.ServletConfig servletConfig,
                             java.lang.String storeName,
                             java.lang.ClassLoader classLoader)
                      throws StoreException
Calls getStore(ServletContext, String, ClassLoader) by passing a servlet context.

Parameters:
servletConfig - A servlet configuration instance.
storeName - The name of the store sought.
classLoader - The class loader Store will use by default to load classes. This may be null.
Returns:
A Store instance.
Throws:
javax.servlet.ServletException
StoreException

getStore

public static Store getStore(javax.servlet.ServletContext servletContext,
                             java.lang.String storeName,
                             java.lang.ClassLoader classLoader)
                      throws StoreException
Gets a store based on servlet context parameters. First, a parameter named pbeans.stores will be looked up. It should contain a comma-separated list of store names. For each store name mystorename, there should be either a context parameter named mystorename.jdbc.url (defining the JDBC URL for GenericDataSource) or one named mystorename.datasource.def.name (definining a JNDI name identifying a DataSource instance). If mystorename.jdbc.url is defined, mystorename.jdbc.driver should also be defined. Optionally, context parameters mystorename.max.connections and mystorename.connection.timeout may also be provided.

Parameters:
servletContext -
storeName -
classLoader -
Throws:
StoreException