org.firebirdsql.pool
Class FBWrappingDataSource

java.lang.Object
  extended byorg.firebirdsql.pool.FBWrappingDataSource
All Implemented Interfaces:
javax.sql.DataSource, javax.naming.spi.ObjectFactory, javax.naming.Referenceable, javax.resource.Referenceable, java.io.Serializable

public class FBWrappingDataSource
extends java.lang.Object
implements javax.sql.DataSource, javax.naming.spi.ObjectFactory, javax.resource.Referenceable, java.io.Serializable

Implementation of DataSource including connection pooling. Following properties are supported:

Author:
Roman Rokytskyy
See Also:
Serialized Form

Constructor Summary
FBWrappingDataSource()
          Create instance of this class.
 
Method Summary
protected  void finalize()
          Finalize this instance.
 int getBlobBufferSize()
           
 int getBlockingTimeout()
           
 java.lang.String getCharSet()
           
 java.sql.Connection getConnection()
          Get JDBC connection from this data source.
 java.sql.Connection getConnection(java.lang.String user, java.lang.String password)
          Get JDBC connection for the specified user name and password.
 int getConnectionCount()
           
 java.lang.String getDatabase()
           
 javax.naming.Reference getDefaultReference()
          Get default JNDI reference for this datasource.
 java.lang.String getDescription()
           
 java.lang.String getEncoding()
           
 int getIdleTimeout()
           
 int getIdleTimeoutMinutes()
           
 int getLoginTimeout()
          Get login timeout.
 java.io.PrintWriter getLogWriter()
          Get log writer.
 int getMaxSize()
           
 int getMinSize()
           
 java.lang.String getNonStandardProperty(java.lang.String key)
           
 java.lang.Object getObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable environment)
          Get object instance for the specified name in the specified context.
 java.lang.String getPassword()
           
 int getPingInterval()
           
 boolean getPooling()
           
 javax.naming.Reference getReference()
          Get JDNI reference.
 int getSocketBufferSize()
           
 java.lang.String getSqlRole()
           
 java.lang.String getTpbMapping()
           
 java.lang.String getType()
           
 java.lang.String getUserName()
           
 void setBlobBufferSize(int blobBufferSizeValue)
           
 void setBlockingTimeout(int blockingTimeoutValue)
           
 void setCharSet(java.lang.String charSet)
           
 void setDatabase(java.lang.String databaseValue)
           
 void setDescription(java.lang.String descriptionValue)
           
 void setEncoding(java.lang.String encodingValue)
           
 void setIdleTimeout(int idleTimeoutValue)
           
 void setIdleTimeoutMinutes(int timeout)
           
 void setLoginTimeout(int seconds)
          Set login timeout.
 void setLogWriter(java.io.PrintWriter printWriter)
          Set log writer.
 void setMaxSize(int maxSizeValue)
           
 void setMinSize(int minSizeValue)
           
 void setNonStandardProperty(java.lang.String key, java.lang.String value)
           
 void setPassword(java.lang.String passwordValue)
           
 void setPingInterval(int pingIntervalValue)
           
 void setPooling(boolean pooling)
           
 void setReference(javax.naming.Reference reference)
          Set JNDI reference for this data source.
 void setSocketBufferSize(int socketBufferSize)
           
 void setSqlRole(java.lang.String sqlRole)
           
 void setTpbMapping(java.lang.String tpbMappingValue)
           
 void setType(java.lang.String typeValue)
           
 void setUserName(java.lang.String userNameValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FBWrappingDataSource

public FBWrappingDataSource()
                     throws java.sql.SQLException
Create instance of this class.

Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Finalize this instance. This method will shut the pool down.

Throws:
java.lang.Throwable - if something went wrong.

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Get JDBC connection from this data source.

Specified by:
getConnection in interface javax.sql.DataSource
Returns:
instance of Connection.
Throws:
java.sql.SQLException - if connection cannot be obtained due to some reason.

getConnection

public java.sql.Connection getConnection(java.lang.String user,
                                         java.lang.String password)
                                  throws java.sql.SQLException
Get JDBC connection for the specified user name and password.

Specified by:
getConnection in interface javax.sql.DataSource
Throws:
java.sql.SQLException - if something went wrong.

getLoginTimeout

public int getLoginTimeout()
Get login timeout.

Specified by:
getLoginTimeout in interface javax.sql.DataSource
Returns:
login timeout.

getLogWriter

public java.io.PrintWriter getLogWriter()
Get log writer.

Specified by:
getLogWriter in interface javax.sql.DataSource
Returns:
instance of PrintWriter.

setLoginTimeout

public void setLoginTimeout(int seconds)
Set login timeout.

Specified by:
setLoginTimeout in interface javax.sql.DataSource
Parameters:
seconds - login timeout.

setLogWriter

public void setLogWriter(java.io.PrintWriter printWriter)
Set log writer.

Specified by:
setLogWriter in interface javax.sql.DataSource
Parameters:
printWriter - instance of PrintWriter.

getBlockingTimeout

public int getBlockingTimeout()

setBlockingTimeout

public void setBlockingTimeout(int blockingTimeoutValue)

getDatabase

public java.lang.String getDatabase()

setDatabase

public void setDatabase(java.lang.String databaseValue)

getDescription

public java.lang.String getDescription()

setDescription

public void setDescription(java.lang.String descriptionValue)

getEncoding

public java.lang.String getEncoding()

setEncoding

public void setEncoding(java.lang.String encodingValue)

getCharSet

public java.lang.String getCharSet()

setCharSet

public void setCharSet(java.lang.String charSet)
                throws java.sql.SQLException
Throws:
java.sql.SQLException

getIdleTimeout

public int getIdleTimeout()

setIdleTimeout

public void setIdleTimeout(int idleTimeoutValue)

getMaxSize

public int getMaxSize()

setMaxSize

public void setMaxSize(int maxSizeValue)

getMinSize

public int getMinSize()

setMinSize

public void setMinSize(int minSizeValue)

getPassword

public java.lang.String getPassword()

setPassword

public void setPassword(java.lang.String passwordValue)

getTpbMapping

public java.lang.String getTpbMapping()

setTpbMapping

public void setTpbMapping(java.lang.String tpbMappingValue)

getUserName

public java.lang.String getUserName()

setUserName

public void setUserName(java.lang.String userNameValue)

getBlobBufferSize

public int getBlobBufferSize()

setBlobBufferSize

public void setBlobBufferSize(int blobBufferSizeValue)

getType

public java.lang.String getType()

setType

public void setType(java.lang.String typeValue)
             throws java.sql.SQLException
Throws:
java.sql.SQLException

getPingInterval

public int getPingInterval()

setPingInterval

public void setPingInterval(int pingIntervalValue)

getSocketBufferSize

public int getSocketBufferSize()

getSqlRole

public java.lang.String getSqlRole()

setSocketBufferSize

public void setSocketBufferSize(int socketBufferSize)

setSqlRole

public void setSqlRole(java.lang.String sqlRole)

getNonStandardProperty

public java.lang.String getNonStandardProperty(java.lang.String key)

setNonStandardProperty

public void setNonStandardProperty(java.lang.String key,
                                   java.lang.String value)

getPooling

public boolean getPooling()

setPooling

public void setPooling(boolean pooling)

getIdleTimeoutMinutes

public int getIdleTimeoutMinutes()

setIdleTimeoutMinutes

public void setIdleTimeoutMinutes(int timeout)

getConnectionCount

public int getConnectionCount()
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

getObjectInstance

public java.lang.Object getObjectInstance(java.lang.Object obj,
                                          javax.naming.Name name,
                                          javax.naming.Context nameCtx,
                                          java.util.Hashtable environment)
                                   throws java.lang.Exception
Get object instance for the specified name in the specified context. This method constructs new datasource if obj represents Reference, whose factory class is equal to this class.

Specified by:
getObjectInstance in interface javax.naming.spi.ObjectFactory
Throws:
java.lang.Exception

getReference

public javax.naming.Reference getReference()
Get JDNI reference.

Specified by:
getReference in interface javax.naming.Referenceable
Returns:
instance of Reference.

setReference

public void setReference(javax.naming.Reference reference)
Set JNDI reference for this data source.

Specified by:
setReference in interface javax.resource.Referenceable
Parameters:
reference - JNDI reference.

getDefaultReference

public javax.naming.Reference getDefaultReference()
Get default JNDI reference for this datasource. This method is called if datasource is used in non-JCA environment.

Returns:
instance of Reference containing all information that allows to reconstruct the datasource.


Copyright © 2001 David Jencks and other authors. All rights reserved.