edu.rice.rubis.servlets
Class RubisHttpServlet

edu.rice.rubis.servlets.RubisHttpServlet
Direct Known Subclasses:
AboutMe, BrowseCategories, BrowseRegions, BuyNow, PutBid, PutComment, RegisterItem, RegisterUser, SearchItemsByCategory, SearchItemsByRegion, StoreBid, StoreBuyNow, StoreComment, ViewBidHistory, ViewItem, ViewUserInfo

public abstract class RubisHttpServlet

Provides the method to initialize connection to the database. All the servlets inherit from this class


Constructor Summary
RubisHttpServlet()
           
 
Method Summary
 void closeConnection(java.sql.Connection connection)
          Closes a Connection.
 void destroy()
          Clean up database connections.
 void doGet(edu.rice.rubis.servlets.HttpServletRequest request, edu.rice.rubis.servlets.HttpServletResponse response)
           
 void doPost(edu.rice.rubis.servlets.HttpServletRequest request, edu.rice.rubis.servlets.HttpServletResponse response)
           
 void finalizeConnections()
          Release all the connections to the database.
 java.sql.Connection getConnection()
          Gets a connection from the pool (round-robin)
abstract  int getPoolSize()
           
 void init()
          Load the driver and get a connection to the database
 void initializeConnections()
          Initialize the pool of connections to the database.
 void releaseConnection(java.sql.Connection c)
          Releases a connection to the pool.
 

Constructor Detail

RubisHttpServlet

public RubisHttpServlet()
Method Detail

getPoolSize

public abstract int getPoolSize()

init

public void init()
          throws edu.rice.rubis.servlets.ServletException
Load the driver and get a connection to the database

initializeConnections

public void initializeConnections()
                           throws java.sql.SQLException
Initialize the pool of connections to the database. The caller must ensure that the driver has already been loaded else an exception will be thrown.
Throws:
java.sql.SQLException - if an error occurs

closeConnection

public void closeConnection(java.sql.Connection connection)
Closes a Connection.
Parameters:
connection - to close

getConnection

public java.sql.Connection getConnection()
Gets a connection from the pool (round-robin)
Returns:
a Connection or null if no connection is available

releaseConnection

public void releaseConnection(java.sql.Connection c)
Releases a connection to the pool.
Parameters:
c - the connection to release

finalizeConnections

public void finalizeConnections()
                         throws java.sql.SQLException
Release all the connections to the database.
Throws:
java.sql.SQLException - if an error occurs

doGet

public void doGet(edu.rice.rubis.servlets.HttpServletRequest request,
                  edu.rice.rubis.servlets.HttpServletResponse response)
           throws java.io.IOException,
                  edu.rice.rubis.servlets.ServletException

doPost

public void doPost(edu.rice.rubis.servlets.HttpServletRequest request,
                   edu.rice.rubis.servlets.HttpServletResponse response)
            throws java.io.IOException,
                   edu.rice.rubis.servlets.ServletException

destroy

public void destroy()
Clean up database connections.


Copyright © 2003 - ObjectWeb Consortium - All Rights Reserved.