org.apache.commons.dbcp.cpdsadapter
クラス DriverAdapterCPDS

java.lang.Object
  拡張org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS
すべての実装インタフェース:
ConnectionPoolDataSource, ObjectFactory, Referenceable, Serializable

public class DriverAdapterCPDS
extends Object
implements ConnectionPoolDataSource, Referenceable, Serializable, ObjectFactory

ConnectionPoolDataSource の実装は持っていないが DriverManager の実装は持っているJDBCドライバのためのアダプタです。 ConnectionPoolDataSource は、(まだ)一般的なアプリケーションでは使用されていません。 これらは Jdbc2PoolDataSource と同じように Connection をプールする DataSource の実装に使用されます。 J2EE コンテナは普通 ConnectionPoolDataSource を初期化するためのいくつかの方法を提供し、 初期化の為の属性は bean のゲッタ/セッタにて参照され、JNDI を経てデプロイされます。 これはプールを行っている DataSource が新たな接続を必要とした時のデータベースに対する物理的な接続の生成元として利用することができます。

An adapter for jdbc drivers that do not include an implementation of {@link javax.sql.ConnectionPoolDataSource}, but still include a {@link java.sql.DriverManager} implementation. ConnectionPoolDataSources are not used within general applications. They are used by DataSource implementations that pool Connections, such as {@link org.apache.commons.dbcp.jdbc2pool.Jdbc2PoolDataSource}. A J2EE container will normally provide some method of initializing the ConnectionPoolDataSource whose attributes are presented as bean getters/setters and then deploying it via JNDI. It is then available as a source of physical connections to the database, when the pooling DataSource needs to create a new physical connection.

普通、 DriverAdapterCPDS は JNDI 環境で使用されますが、 DriverAdapterCPDS は他の bean と同じようにインスタンス化、初期化され、プールを行う DataSource に直接アタッチされます。 Jdbc2PoolDataSource は JNDI を利用してもしなくても ConnectionPoolDataSource を使用することができます。

Although normally used within a JNDI environment, the DriverAdapterCPDS can be instantiated and initialized as any bean and then attached directly to a pooling DataSource. Jdbc2PoolDataSource can use the ConnectionPoolDataSource with or without the use of JNDI.

また DriverAdapterCPDS は JDBC2 の ConnectionPoolDataSource 実装では一般的に利用できないが JDBC3 の仕様には含まれる PreparedStatement のプーリング機能を提供します。 DriverAdapterCPDS の PreparedStatement のプール(の実装)はいままで dbcp パッケージに含まれていましたが、ここで扱われる設定での広範囲なテストを経ていませんでした。 この機能は実験的なものと考えるべきで、poolPreparedStatements 属性にて切り替えることができます。

The DriverAdapterCPDS also provides PreparedStatement pooling which is not generally available in jbdc2 ConnectionPoolDataSource implementation, but is addressed within the jdbc3 specification. The PreparedStatement pool in DriverAdapterCPDS has been in the dbcp package for some time, but it has not undergone extensive testing in the configuration used here. It should be considered experimental and can be toggled with the poolPreparedStatements attribute.

パッケージドキュメント には catalina と JNDI を使用した例が含まれています。 jdbc2pool パッケージドキュメント には、JNDI を使用せずに Jdbc2PoolDataSource の接続取得元として DriverAdapterCPDS を使用する方法が含まれています。

The package documentation contains an example using catalina and JNDI. The jdbc2pool package documentation shows how to use DriverAdapterCPDS as a source for Jdbc2PoolDataSource without the use of JNDI.

バージョン:
$Id: DriverAdapterCPDS.java,v 1.1.1.1 2004/02/13 10:02:03 hioki Exp $
作成者:
John D. McNally
関連項目:
直列化された形式
翻訳者:
日置 聡
翻訳状況:
初稿(校正者募集中)
翻訳更新日:
2003/09/11

コンストラクタの概要
DriverAdapterCPDS()
          Serialization のための引数のないデフォルトコンストラクタ。
 
メソッドの概要
 String getDescription()
          記述情報(Description)の値を取得します。
 String getDriver()
          ドライバのクラス名を取得します。
 int getLoginTimeout()
          このデータソースがデータベースとの接続を試みる場合に待機する最長時間(秒)を取得します。
 PrintWriter getLogWriter()
          このデータソースのログライターを取得します。
 int getMaxActive()
          このプールから1度に割り当てることのできるアクティブなステートメントの最大数です。
 int getMaxIdle()
          余分なものを開放せずにプール内にアイドル状態で保持できるステートメントの最大数です。
 int getMinEvictableIdleTimeMillis()
          アイドル状態のオブジェクトがプール内に居られる最短時間を返します。
 int getNumTestsPerEvictionRun()
          アイドル状態のオブジェクトを排除するスレッドが1度の動作でチェックの対象とするステートメントの数を返します。
 Object getObjectInstance(Object refObj, Name name, Context context, Hashtable env)
          このクラスのインスタンスを生成するための ObjectFactory の実装です。
 String getPassword()
          デフォルトユーザのパスワードの値を取得します。
 PooledConnection getPooledConnection()
          デフォルトのユーザ、パスワードを使用してデータベースへの接続の確立を試みます。
 PooledConnection getPooledConnection(String username, String password)
          データベースへの接続の確立を試みます。
 Reference getReference()
          Referenceable の実装です。
 int getTimeBetweenEvictionRunsMillis()
          アイドル状態のオブジェクトを排除するスレッドが次の動作までスリープする時間を示すミリセカンドの値を返します。
 String getUrl()
          このデータソースがデータベースの位置を認識するためのURLの値を取得します。
 String getUser()
          デフォルトユーザ(ログイン名 または ユーザ名)の値を取得します。
 boolean isPoolPreparedStatements()
          PreparedStatement のプーリング機能の切り替えフラグです。
 void setDescription(String v)
          記述情報(Description)の値を設定します。
 void setDriver(String v)
          ドライバのクラス名を設定します。
 void setLoginTimeout(int seconds)
          このデータソースがデータベースとの接続を試みる場合に待機する最長時間(秒)を設定します。
 void setLogWriter(PrintWriter out)
          このデータソースのログライターを設定します。
 void setMaxActive(int maxActive)
          このプールから1度に割り当てることのできるアクティブなステートメントの最大数です。
 void setMaxIdle(int maxIdle)
          余分なものを開放せずにプール内にアイドル状態で保持できるステートメントの最大数です。
 void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)
          アイドル状態のオブジェクトがプール内に居られる最短時間を設定します。
 void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
          アイドル状態のオブジェクトを排除するスレッドが1度の動作でチェックの対象とするステートメントの数を返します。
 void setPassword(String v)
          デフォルトユーザのパスワードの値を設定します。
 void setPoolPreparedStatements(boolean v)
          PreparedStatement のプーリング機能の切り替えフラグです。
 void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
          アイドル状態のオブジェクトを排除するスレッドが次の動作までスリープする時間を示すミリセカンドの値を設定します。
 void setUrl(String v)
          このデータソースがデータベースの位置を認識するためのURLの値を設定します。
 void setUser(String v)
          デフォルトユーザ(ログイン名 または ユーザ名)の値を設定します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

DriverAdapterCPDS

public DriverAdapterCPDS()
Serialization のための引数のないデフォルトコンストラクタ。
Default no-arg constructor for Serialization

メソッドの詳細

getDescription

public String getDescription()
記述情報(Description)の値を取得します。 このプロパティはこのデータソースをデプロイする処理のために存在し、内部では使用されません。
Get the value of description. This property is here for use by the code which will deploy this datasource. It is not used internally.

戻り値:
記述情報(Description)の値
value of description.

getDriver

public String getDriver()
ドライバのクラス名を取得します。
Get the driver classname.

戻り値:
ドライバの値
value of driver.

getLoginTimeout

public int getLoginTimeout()
このデータソースがデータベースとの接続を試みる場合に待機する最長時間(秒)を取得します。 この実装では使用されません。
Gets the maximum time in seconds that this data source can wait while attempting to connect to a database. NOT USED.

定義:
インタフェース ConnectionPoolDataSource 内の getLoginTimeout

getLogWriter

public PrintWriter getLogWriter()
このデータソースのログライターを取得します。この実装では使用されません。
Get the log writer for this data source. NOT USED.

定義:
インタフェース ConnectionPoolDataSource 内の getLogWriter

getMaxActive

public int getMaxActive()
このプールから1度に割り当てることのできるアクティブなステートメントの最大数です。 0が設定された場合には制限を行いません。
The maximum number of active statements that can be allocated from this pool at the same time, or zero for no limit.


getMaxIdle

public int getMaxIdle()
余分なものを開放せずにプール内にアイドル状態で保持できるステートメントの最大数です。 0が設定された場合には制限を行いません。
The maximum number of statements that can remain idle in the pool, without extra ones being released, or zero for no limit.


getMinEvictableIdleTimeMillis

public int getMinEvictableIdleTimeMillis()
アイドル状態のオブジェクトがプール内に居られる最短時間を返します。 この時間を過ぎるとアイドル状態のオブジェクトを排除するスレッドのチェック対象となります。
Returns the minimum amount of time a statement may sit idle in the pool before it is eligible for eviction by the idle object evictor (if any).
*see #setMinEvictableIdleTimeMillis *see #setTimeBetweenEvictionRunsMillis


getNumTestsPerEvictionRun

public int getNumTestsPerEvictionRun()
アイドル状態のオブジェクトを排除するスレッドが1度の動作でチェックの対象とするステートメントの数を返します。
Returns the number of statements to examine during each run of the idle object evictor thread (if any).
*see #setNumTestsPerEvictionRun *see #setTimeBetweenEvictionRunsMillis


getObjectInstance

public Object getObjectInstance(Object refObj,
                                Name name,
                                Context context,
                                Hashtable env)
                         throws Exception
このクラスのインスタンスを生成するための ObjectFactory の実装です。
implements ObjectFactory to create an instance of this class

定義:
インタフェース ObjectFactory 内の getObjectInstance
例外:
Exception

getPassword

public String getPassword()
デフォルトユーザのパスワードの値を取得します。
Get the value of password for the default user.

戻り値:
パスワードの値
value of password.

getPooledConnection

public PooledConnection getPooledConnection()
                                     throws SQLException
デフォルトのユーザ、パスワードを使用してデータベースへの接続の確立を試みます。
Attempt to establish a database connection using the default user and password.

定義:
インタフェース ConnectionPoolDataSource 内の getPooledConnection
例外:
SQLException

getPooledConnection

public PooledConnection getPooledConnection(String username,
                                            String password)
                                     throws SQLException
データベースへの接続の確立を試みます。
Attempt to establish a database connection.

定義:
インタフェース ConnectionPoolDataSource 内の getPooledConnection
例外:
SQLException

getReference

public Reference getReference()
                       throws NamingException
Referenceable の実装です。
Referenceable implementation.

定義:
インタフェース Referenceable 内の getReference
例外:
NamingException

getTimeBetweenEvictionRunsMillis

public int getTimeBetweenEvictionRunsMillis()
アイドル状態のオブジェクトを排除するスレッドが次の動作までスリープする時間を示すミリセカンドの値を返します。 マイナスの値が設定されている場合、アイドル状態のオブジェクトを排除するスレッドは動作しません。
Returns the number of milliseconds to sleep between runs of the idle object evictor thread. When non-positive, no idle object evictor thread will be run.
*see #setTimeBetweenEvictionRunsMillis


getUrl

public String getUrl()
このデータソースがデータベースの位置を認識するためのURLの値を取得します。
Get the value of url used to locate the database for this datasource.

戻り値:
URLの値
value of url.

getUser

public String getUser()
デフォルトユーザ(ログイン名 または ユーザ名)の値を取得します。
Get the value of default user (login or username).

戻り値:
ユーザの値
value of user.

isPoolPreparedStatements

public boolean isPoolPreparedStatements()
PreparedStatement のプーリング機能の切り替えフラグです。
Flag to toggle the pooling of PreparedStatements

戻り値:
poolPreparedStatements の値
value of poolPreparedStatements.

setDescription

public void setDescription(String v)
記述情報(Description)の値を設定します。 このプロパティはこのデータソースをデプロイする処理のために存在し、内部では使用されません。
Set the value of description. This property is here for use by the code which will deploy this datasource. It is not used internally.

パラメータ:
v - 記述情報(Description)に割り当てる値
Value to assign to description.

setDriver

public void setDriver(String v)
               throws ClassNotFoundException
ドライバのクラス名を設定します。 ドライバクラス名の設定は DriverManager に登録されたドライバに影響します。
Set the driver classname. Setting the driver classname cause the driver to be registered with the DriverManager.

パラメータ:
v - ドライバに割り当てる値
Value to assign to driver.
例外:
ClassNotFoundException

setLoginTimeout

public void setLoginTimeout(int seconds)
このデータソースがデータベースとの接続を試みる場合に待機する最長時間(秒)を設定します。 この実装では使用されません。
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. NOT USED.

定義:
インタフェース ConnectionPoolDataSource 内の setLoginTimeout

setLogWriter

public void setLogWriter(PrintWriter out)
このデータソースのログライターを設定します。この実装では使用されません。
Set the log writer for this data source. NOT USED.

定義:
インタフェース ConnectionPoolDataSource 内の setLogWriter

setMaxActive

public void setMaxActive(int maxActive)
このプールから1度に割り当てることのできるアクティブなステートメントの最大数です。 0が設定された場合には制限を行いません。
The maximum number of active statements that can be allocated from this pool at the same time, or zero for no limit.


setMaxIdle

public void setMaxIdle(int maxIdle)
余分なものを開放せずにプール内にアイドル状態で保持できるステートメントの最大数です。 0が設定された場合には制限を行いません。
The maximum number of statements that can remain idle in the pool, without extra ones being released, or zero for no limit.


setMinEvictableIdleTimeMillis

public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)
アイドル状態のオブジェクトがプール内に居られる最短時間を設定します。 この時間を過ぎるとアイドル状態のオブジェクトを排除するスレッドのチェック対象となります。 マイナスの値が設定された場合、アイドル状態で居た時間ではオブジェクトはプールから排除されません。
Sets the minimum amount of time a statement may sit idle in the pool before it is eligable for eviction by the idle object evictor (if any). When non-positive, no objects will be evicted from the pool due to idle time alone.
*see #getMinEvictableIdleTimeMillis *see #setTimeBetweenEvictionRunsMillis


setNumTestsPerEvictionRun

public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
アイドル状態のオブジェクトを排除するスレッドが1度の動作でチェックの対象とするステートメントの数を返します。
Sets the number of statements to examine during each run of the idle object evictor thread (if any).

マイナスの値が設定された場合、ceil({*link #numIdle})/abs({*link #getNumTestsPerEvictionRun}) の数のテストが実施されます。 例えば値が -n の場合にはアイドル状態のステートメントのうち 1/n が1度の動作でテストされます。

When a negative value is supplied, ceil({*link #numIdle
)/abs({*link #getNumTestsPerEvictionRun}) tests will be run. I.e., when the value is -n, roughly one nth of the idle objects will be tested per run.} *see #getNumTestsPerEvictionRun *see #setTimeBetweenEvictionRunsMillis


setPassword

public void setPassword(String v)
デフォルトユーザのパスワードの値を設定します。
Set the value of password for the default user.

パラメータ:
v - パスワードに割り当てる値
Value to assign to password.

setPoolPreparedStatements

public void setPoolPreparedStatements(boolean v)
PreparedStatement のプーリング機能の切り替えフラグです。
Flag to toggle the pooling of PreparedStatements

パラメータ:
v - true の場合、ステートメントをプールします。
true to pool statements.

setTimeBetweenEvictionRunsMillis

public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
アイドル状態のオブジェクトを排除するスレッドが次の動作までスリープする時間を示すミリセカンドの値を設定します。 マイナスの値が設定されている場合、アイドル状態のオブジェクトを排除するスレッドは動作しません。
Sets the number of milliseconds to sleep between runs of the idle object evictor thread. When non-positive, no idle object evictor thread will be run.
*see #getTimeBetweenEvictionRunsMillis


setUrl

public void setUrl(String v)
このデータソースがデータベースの位置を認識するためのURLの値を設定します。
Set the value of url used to locate the database for this datasource.

パラメータ:
v - URLに割り当てる値
Value to assign to url.

setUser

public void setUser(String v)
デフォルトユーザ(ログイン名 または ユーザ名)の値を設定します。
Set the value of default user (login or username).

パラメータ:
v - ユーザに割り当てる値
Value to assign to user.


このドキュメントは、Ja-Jakartaにより訳されました。 コメントがある場合は report@jajakarta.orgまでお願いします。
Translated into Japanese by jajakarta.org. The original page is here.
Copyright (c) 2002-2003 - Apache Software Foundation