PAJES 3.0.21

org.pajes.db
Class ConnectionPoolConfiguration

java.lang.Object
  extended by org.pajes.db.ConnectionPoolConfiguration

public class ConnectionPoolConfiguration
extends java.lang.Object

Reads an XML-based deployment descriptor that defines ConnectionPool instances.

The deployment descriptor must have the following format:

 <db>
  <pool>
   <name>The logical name of the connection pool</name>
   <driver>The JDBC driver class</driver>
   <server>The address of a JDBC data source</server>
   <user>The database userid</user>
   <password>The Base64 encoded database user's password</password>
   <init>The number of connections to initially open</init>
   <max>The maximum number of connections to open</max>
   <interval>The number of milliseconds between checking for a free connection when one is not available</interval>
   <timeout>The maximum number of milliseconds to wait for a free connection to become available</timeout>
   <destroy>A string of SQL that will be executed when the pool is destroyed</timeout>
  </pool>
 <db>
 

The encoded password may be obtained by calling the Base64Encoder class from the command line and passing the password. For example:

  java org.pajes.util.Base64Encoder password
 

The timeout, interval and destroy elements are optional, and default to 60000, 1000, and null respectively.

As many pools may be specified in the deployment descriptor as are required.


Field Summary
static java.lang.String DB_ELEMENT
          The root element
static java.lang.String DESTROY_ELEMENT
          The element containing a string of SQL that will be executed when the pool is destroyed.
static java.lang.String DRIVER_ELEMENT
          The element containing the JDBC driver class.
static java.lang.String INIT_ELEMENT
          The element containing the number of connections to initially open.
static java.lang.String INTERVAL_ELEMENT
          The element containing the number of milliseconds between checking for a free connection when one is not available.
static java.lang.String MAX_ELEMENT
          The element containing the maximum number of connections to open.
static java.lang.String NAME_ELEMENT
          The element containing the logical name of the connection pool.
static java.lang.String PASSWORD_ELEMENT
          The element containing the Base64 encoded database user's password.
static java.lang.String POOL_ELEMENT
          The element containing a pool definition.
static java.lang.String SERVER_ELEMENT
          The element containing the address of a JDBC data source.
static java.lang.String TIMEOUT_ELEMENT
          The element containing the maximum number of milliseconds to wait for a free connection to become available.
static java.lang.String USER_ELEMENT
          The element containing the database userid.
 
Constructor Summary
ConnectionPoolConfiguration(java.io.InputStream in, javax.servlet.ServletContext context)
          Reads the specified input stream and creates ConnectionPool instances within the nominated ConnectionManager.
 
Method Summary
 ConnectionPoolDefinition getPoolDefinition(java.lang.String pool)
          Returns the ConnectionPoolDefinition for the specified pool.
 java.lang.String[] getPoolNames()
          Returns the names of the connection pools added to the ConnectionManager from this deployment descriptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DB_ELEMENT

public static final java.lang.String DB_ELEMENT
The root element

See Also:
Constant Field Values

DESTROY_ELEMENT

public static final java.lang.String DESTROY_ELEMENT
The element containing a string of SQL that will be executed when the pool is destroyed.

See Also:
Constant Field Values

DRIVER_ELEMENT

public static final java.lang.String DRIVER_ELEMENT
The element containing the JDBC driver class.

See Also:
Constant Field Values

INIT_ELEMENT

public static final java.lang.String INIT_ELEMENT
The element containing the number of connections to initially open.

See Also:
Constant Field Values

INTERVAL_ELEMENT

public static final java.lang.String INTERVAL_ELEMENT
The element containing the number of milliseconds between checking for a free connection when one is not available.

See Also:
Constant Field Values

MAX_ELEMENT

public static final java.lang.String MAX_ELEMENT
The element containing the maximum number of connections to open.

See Also:
Constant Field Values

NAME_ELEMENT

public static final java.lang.String NAME_ELEMENT
The element containing the logical name of the connection pool.

See Also:
Constant Field Values

PASSWORD_ELEMENT

public static final java.lang.String PASSWORD_ELEMENT
The element containing the Base64 encoded database user's password.

See Also:
Constant Field Values

POOL_ELEMENT

public static final java.lang.String POOL_ELEMENT
The element containing a pool definition.

See Also:
Constant Field Values

SERVER_ELEMENT

public static final java.lang.String SERVER_ELEMENT
The element containing the address of a JDBC data source.

See Also:
Constant Field Values

TIMEOUT_ELEMENT

public static final java.lang.String TIMEOUT_ELEMENT
The element containing the maximum number of milliseconds to wait for a free connection to become available.

See Also:
Constant Field Values

USER_ELEMENT

public static final java.lang.String USER_ELEMENT
The element containing the database userid.

See Also:
Constant Field Values
Constructor Detail

ConnectionPoolConfiguration

public ConnectionPoolConfiguration(java.io.InputStream in,
                                   javax.servlet.ServletContext context)
                            throws java.io.IOException
Reads the specified input stream and creates ConnectionPool instances within the nominated ConnectionManager.

Parameters:
in - the input stream from which the XML deployment descriptor will be read.
context - the Servlet Context.
Throws:
java.io.IOException - if an error occurs reading or parsing the deployment descriptor.
ConnectionPoolException - if an error is detected in the deployment descriptor.
Method Detail

getPoolDefinition

public ConnectionPoolDefinition getPoolDefinition(java.lang.String pool)
Returns the ConnectionPoolDefinition for the specified pool.

Parameters:
pool - the name of the required pool.
Returns:
an array of Connection Pool names.

getPoolNames

public java.lang.String[] getPoolNames()
Returns the names of the connection pools added to the ConnectionManager from this deployment descriptor.

Returns:
an array of Connection Pool names.

PAJES 3.0.21

Copyright © 1998-2007 Viridian Pty Limited. All Rights Reserved.