Xindice API

org.apache.xindice.server.components
Class DBConduit

java.lang.Object
  |
  +--org.apache.xindice.util.SimpleConfigurable
        |
        +--org.apache.xindice.server.SimpleScriptComponent
              |
              +--org.apache.xindice.server.components.DBConduit
All Implemented Interfaces:
Configurable, Disposable, KernelAccess, Named, ScriptComponent, Versioning

public final class DBConduit
extends SimpleScriptComponent

DBConduit provides a JDBC Connection pooling mechanism. It also allows driver and connection information to be accessed via centrally managed friendly alias names instead of hardcoded JDBC URLs.


Fields inherited from class org.apache.xindice.server.SimpleScriptComponent
NAME, PACKAGE
 
Constructor Summary
DBConduit()
           
 
Method Summary
 DBQueryResult executeQuery(java.lang.String alias, java.lang.String sql)
          executeQuery
 int getAvailableConnections(java.lang.String alias)
          getAvailableConnections returns the number of open Connections available in the connection queue.
 java.sql.Connection getConnection(java.lang.String alias)
          getConnection returns the next available Connection from the connection queue or creates one if necessary.
 int getCreatedConnections(java.lang.String alias)
          getCreatedConnections returns the number of open connections for the specified alias.
 java.lang.String getDescription(java.lang.String alias)
          getDescription returns a description for the specified alias.
 java.lang.String getDriver(java.lang.String alias)
          getDriver returns the driver class name for the specified alias.
 int getMaximumConnections(java.lang.String alias)
          getMaximumConnections returns the maximum allowable number of open connections for the specified alias.
 java.lang.String getPingStatement(java.lang.String alias)
          getPingStatement returns the SQL ping statement for the specified alias.
 int getTotalCreatedConnections(java.lang.String alias)
          getTotalCreatedConnections returns the total number of connections that have been opened during the lifetime of the DBConduit.
 java.lang.String[] listAliases()
          listAliases retrieves a list of the aliases available to the DBConduit
 void putConnection(java.lang.String alias, java.sql.Connection connection)
          putConnection returns a Connection to the connection queue.
 void removeConnection(java.lang.String alias, java.sql.Connection connection)
          removeConnection closes a connection and relieves the connection queue of the task of maintaining it.
 void setConfig(Configuration config)
          setConfig sets the configuration information for the Configurable object instance.
 
Methods inherited from class org.apache.xindice.server.SimpleScriptComponent
dispose, getName, getPackageName, getVersion, setKernel
 
Methods inherited from class org.apache.xindice.util.SimpleConfigurable
getConfig
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBConduit

public DBConduit()
Method Detail

setConfig

public void setConfig(Configuration config)
               throws XindiceException
Description copied from interface: Configurable
setConfig sets the configuration information for the Configurable object instance.
Overrides:
setConfig in class SimpleConfigurable
Following copied from interface: org.apache.xindice.util.Configurable
Parameters:
config - The configuration Node

listAliases

public java.lang.String[] listAliases()
listAliases retrieves a list of the aliases available to the DBConduit
Returns:
A list of Aliases

getDescription

public java.lang.String getDescription(java.lang.String alias)
getDescription returns a description for the specified alias.
Parameters:
alias - The alias name
Returns:
The description

getDriver

public java.lang.String getDriver(java.lang.String alias)
getDriver returns the driver class name for the specified alias.
Parameters:
alias - The alias name
Returns:
The driver class name

getPingStatement

public java.lang.String getPingStatement(java.lang.String alias)
getPingStatement returns the SQL ping statement for the specified alias.
Parameters:
alias - The alias name
Returns:
The ping statement

getMaximumConnections

public int getMaximumConnections(java.lang.String alias)
getMaximumConnections returns the maximum allowable number of open connections for the specified alias.
Parameters:
alias - The alias name
Returns:
The maximum number of connections

getCreatedConnections

public int getCreatedConnections(java.lang.String alias)
getCreatedConnections returns the number of open connections for the specified alias.
Parameters:
alias - The alias name
Returns:
The number of connections

getTotalCreatedConnections

public int getTotalCreatedConnections(java.lang.String alias)
getTotalCreatedConnections returns the total number of connections that have been opened during the lifetime of the DBConduit.
Parameters:
alias - The alias name
Returns:
The total number of connections

getAvailableConnections

public int getAvailableConnections(java.lang.String alias)
getAvailableConnections returns the number of open Connections available in the connection queue.
Parameters:
alias - The alias name
Returns:
The number of available connections

getConnection

public java.sql.Connection getConnection(java.lang.String alias)
                                  throws java.sql.SQLException
getConnection returns the next available Connection from the connection queue or creates one if necessary.
Parameters:
alias - The alias name
Returns:
A JDBC connection

putConnection

public void putConnection(java.lang.String alias,
                          java.sql.Connection connection)
putConnection returns a Connection to the connection queue.
Parameters:
alias - The alias name
connection - A JDBC connection

removeConnection

public void removeConnection(java.lang.String alias,
                             java.sql.Connection connection)
removeConnection closes a connection and relieves the connection queue of the task of maintaining it.
Parameters:
alias - The alias name
connection - A JDBC connection

executeQuery

public DBQueryResult executeQuery(java.lang.String alias,
                                  java.lang.String sql)
                           throws java.sql.SQLException
executeQuery
Parameters:
alias - The alias name
sql - The SQL to execute
Returns:
The DBQueryResult object

Xindice API

Copyright (c) 1999-2001 The Apache Software Foundation