public class DbConnectionManagementHandler extends java.lang.Object implements Handler<java.lang.Object,java.lang.Object>, InboundHandleable, OutboundHandleable
デフォルトの設定では、トランザクションが暗黙的に使用する接続名 (TransactionContext.DEFAULT_TRANSACTION_CONTEXT_KEY) に対して接続オブジェクトを登録する。 接続名を明示的に指定する場合は、属性dbConnectionNameにその値を設定する。
<!-- 設定例 --> <component class="nablarch.common.handler.DbConnectionManagementHandler"> <!-- DbConnectionFactory --> <property name="dbConnectionFactory" ref="dbConnectionFactory"/> <!-- 追加するデータベース接続オブジェクトの名称 --> <property name="dbConnectionName" value="db"/> </component>
| Constructor and Description | 
|---|
DbConnectionManagementHandler()  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
after()
復路処理を行う。 
 | 
void | 
before()
 | 
java.lang.Object | 
handle(java.lang.Object inputData,
      ExecutionContext ctx)
入力データに対する処理を実行する。 
 | 
Result | 
handleInbound(ExecutionContext context)
前処理を実装する。 
 | 
Result | 
handleOutbound(ExecutionContext context)
後処理を実装する。 
 | 
DbConnectionManagementHandler | 
setConnectionFactory(ConnectionFactory connectionFactory)
データベース接続オブジェクトを生成するためのファクトリを設定する。 
 | 
void | 
setConnectionName(java.lang.String connectionName)
データベース接続のスレッドコンテキスト上の登録名を設定する。 
 | 
public DbConnectionManagementHandler setConnectionFactory(ConnectionFactory connectionFactory)
connectionFactory - データベース接続オブジェクトを生成するためのファクトリpublic void setConnectionName(java.lang.String connectionName)
 デフォルトでは既定のトランザクション名
 (TransactionContext.DEFAULT_TRANSACTION_CONTEXT_KEY)を使用する。
 connectionName - データベース接続のスレッドコンテキスト上の登録名public java.lang.Object handle(java.lang.Object inputData,
                               ExecutionContext ctx)
このクラスの実装では後続ハンドラに対する処理委譲の前後に、 データベース接続オブジェクトの初期化と終了の処理をそれぞれ行う。
public void before()
public void after()
 DbConnectionContextからデータベース接続を削除し、リソースの開放処理を行う。
public Result handleInbound(ExecutionContext context)
InboundHandleablehandleInbound in interface InboundHandleablecontext - ExecutionContextpublic Result handleOutbound(ExecutionContext context)
OutboundHandleablehandleOutbound in interface OutboundHandleablecontext - ExecutionContext