ts.query
クラス QueryTransaction

java.lang.Object
  上位を拡張 ts.query.QueryTransaction
すべての実装されたインタフェース:
IQueryTransaction

public class QueryTransaction
extends java.lang.Object
implements IQueryTransaction

トランザクションを表すクラス。

バージョン:
$Id: QueryTransaction.java,v 1.24 2012-02-24 18:02:50 tayu Exp $
作成者:
佐藤隆之

入れ子のクラスの概要
 
インタフェース ts.query.IQueryTransaction から継承された入れ子のクラス/インタフェース
IQueryTransaction.Error, IQueryTransaction.State
 
コンストラクタの概要
protected QueryTransaction()
          デフォルト・コンストラクタ。
 
メソッドの概要
 void begin()
          トランザクションの開始処理を実行する。
protected  void changeState(IQueryTransaction.State[] froms, IQueryTransaction.State to)
          トランザクションの状態を変更する。
protected  void checkState(IQueryTransaction.State[] allows)
          現在の状態が、指定された状態のいずれかに含まれるかどうかを判定する。
 void commit()
          トランザクション内のクエリの実行結果の確定処理を実行する。
 void end()
          トランザクションを終了する。
protected  IQueryConnection findConnection(java.lang.String connId)
          指定された接続先IDに対応するIQueryConnectionオブジェクトを取得 する。
 long getBeginTimeMillis()
          トランザクションの開始時刻を取得する。
 long getLimitTimeMillis()
          トランザクションの制限時刻を取得する。
 IQuery getQuery(java.lang.String queryId)
          指定されたクエリIDに対応するクエリ・オブジェクトを取得する。
 IQueryConnection getQueryConnection(java.lang.String connId)
          指定された接続先IDに対応するクエリ・コネクション・オブジェクトを取得する。
 IQueryExecution getQueryExecution(java.lang.String execId)
          指定された実行IDに対応するクエリ実行ブジェクトを取得する。
 IQueryHistory getQueryHistory()
          このトランザクションの中で実行されたクエリの実行履歴を格納するIQueryHistoryオブジェクトを取得する。
 IQueryTransaction.State getState()
          トランザクションの状態を取得する。
 long getTimeoutMillis()
          トランザクションのタイムアウト時間を取得する。
protected  java.util.Map<java.lang.String,IQueryConnection> newConnectionMap()
          IQueryConnectionオブジェクトを格納するマップを作成する。
protected  QueryHistory newQueryHistory()
          クエリの実行履歴を作成する。
 void rollback()
          トランザクション内のクエリの実行結果の取消処理を実行する。
 void setTimeoutMillis(long millis)
          トランザクションのタイムアウト時間を設定する。
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

QueryTransaction

protected QueryTransaction()
デフォルト・コンストラクタ。
このクラスのインスタンスはQueryTransactionManagerクラスによって 生成されることを意図しているため、アクセス指定子をprotectedに している。

メソッドの詳細

newConnectionMap

protected java.util.Map<java.lang.String,IQueryConnection> newConnectionMap()
IQueryConnectionオブジェクトを格納するマップを作成する。

戻り値:
IQueryConnectionオブジェクトを格納するマップ。

newQueryHistory

protected QueryHistory newQueryHistory()
クエリの実行履歴を作成する。

戻り値:
クエリの実行履歴を格納するQueryHistoryオブジェクト。

getBeginTimeMillis

public long getBeginTimeMillis()
トランザクションの開始時刻を取得する。

定義:
インタフェース IQueryTransaction 内の getBeginTimeMillis
戻り値:
トランザクションの開始時刻 [msec]。

getLimitTimeMillis

public long getLimitTimeMillis()
トランザクションの制限時刻を取得する。
値がゼロ以下の場合は制限なしとする。

定義:
インタフェース IQueryTransaction 内の getLimitTimeMillis
戻り値:
トランザクションの制限時刻 [msec]。

getTimeoutMillis

public long getTimeoutMillis()
トランザクションのタイムアウト時間を取得する。
値がゼロ以下の場合は制限なしとする。

定義:
インタフェース IQueryTransaction 内の getTimeoutMillis
戻り値:
トランザクションのタイムアウト時間 [msec]。

setTimeoutMillis

public void setTimeoutMillis(long millis)
トランザクションのタイムアウト時間を設定する。
引数の値がゼロ以下の場合は制限なしとする。

定義:
インタフェース IQueryTransaction 内の setTimeoutMillis
パラメータ:
millis - トランザクションのタイムアウト時間 [msec]。

getQueryHistory

public IQueryHistory getQueryHistory()
このトランザクションの中で実行されたクエリの実行履歴を格納するIQueryHistoryオブジェクトを取得する。

定義:
インタフェース IQueryTransaction 内の getQueryHistory
戻り値:
IQueryHistoryオブジェクト。

getState

public IQueryTransaction.State getState()
トランザクションの状態を取得する。

定義:
インタフェース IQueryTransaction 内の getState
戻り値:
トランザクションの状態。

changeState

protected final void changeState(IQueryTransaction.State[] froms,
                                 IQueryTransaction.State to)
                          throws ts.util.ReasonedRuntimeException
トランザクションの状態を変更する。
現在の状態が、第一引数に指定された状態に含まれていない場合は、例外をスロー する。

パラメータ:
froms - 許される現在の状態。
to - 変更後の状態。
例外:
ts.util.ReasonedRuntimeException - 現在の状態が、第一引数に指定された状態の いずれにも含まれていない場合。

checkState

protected final void checkState(IQueryTransaction.State[] allows)
                         throws ts.util.ReasonedRuntimeException
現在の状態が、指定された状態のいずれかに含まれるかどうかを判定する。

パラメータ:
allows - 許される現在の状態。
例外:
ts.util.ReasonedRuntimeException - 現在の状態が、指定された状態のいずれにも 含まれていない場合。
java.lang.AssertionError - 引数がヌルの場合(デバッグ・モードのみ)。

begin

public void begin()
           throws ts.util.ReasonedException,
                  ts.util.ReasonedRuntimeException
トランザクションの開始処理を実行する。
このメソッドの実行すると、トランザクションの開始時刻が設定され、その開始 時刻とタイムアウト時間を加算して制限時刻が設定される。 制限時間はクエリの実行中のタイムアウト判定に使用される。

定義:
インタフェース IQueryTransaction 内の begin
例外:
ts.util.ReasonedException - トランザクションの開始処理に失敗した場合。
ts.util.ReasonedRuntimeException - トランザクションの状態が不正な場合。

commit

public void commit()
            throws ts.util.ReasonedException,
                   ts.util.ReasonedRuntimeException
トランザクション内のクエリの実行結果の確定処理を実行する。

定義:
インタフェース IQueryTransaction 内の commit
例外:
ts.util.ReasonedException - トランザクションの確定処理に失敗した場合。
ts.util.ReasonedRuntimeException - トランザクションの状態が不正な場合。

rollback

public void rollback()
              throws ts.util.ReasonedRuntimeException
トランザクション内のクエリの実行結果の取消処理を実行する。
途中で例外が発生してもこの処理は続行され、この処理が完了した所で例外が スローされる。

定義:
インタフェース IQueryTransaction 内の rollback
例外:
ts.util.ReasonedRuntimeException - トランザクションの取消処理に失敗した場合、 又はトランザクションの状態が不正な場合。

end

public void end()
         throws ts.util.ReasonedRuntimeException
トランザクションを終了する。
トランザクションが確定又は取消されていない場合は、取消を実行してから終了 する。

定義:
インタフェース IQueryTransaction 内の end
例外:
ts.util.ReasonedRuntimeException - トランザクションの終了処理に失敗した場合、 又はトランザクションの状態が不正な場合。

findConnection

protected IQueryConnection findConnection(java.lang.String connId)
                                   throws ts.util.ReasonedException,
                                          ts.util.ReasonedRuntimeException
指定された接続先IDに対応するIQueryConnectionオブジェクトを取得 する。
対応するIQueryConnectionオブジェクトがこのトランザクション内に存在 したら、それを返す。 存在しなかった場合は新規に作成し、このトランザクションに登録して返す。

パラメータ:
connId - 接続先ID。
戻り値:
IQueryConnectionオブジェクト。
例外:
ts.util.ReasonedException - IQueryConnectionオブジェクトの開始処理に 失敗した場合。
ts.util.ReasonedRuntimeException - IQueryConnectionオブジェクトの 作成に失敗した場合。

getQueryConnection

public IQueryConnection getQueryConnection(java.lang.String connId)
                                    throws ts.util.ReasonedException,
                                           ts.util.ReasonedRuntimeException
指定された接続先IDに対応するクエリ・コネクション・オブジェクトを取得する。

定義:
インタフェース IQueryTransaction 内の getQueryConnection
パラメータ:
connId - 接続先ID。
戻り値:
コネクション・オブジェクト。
例外:
ts.util.ReasonedException - コネクションの開始処理に失敗した場合。
ts.util.ReasonedRuntimeException - コネクション・オブジェクトの作成に失敗 した場合、又はトランザクションの状態が不正な場合。

getQueryExecution

public IQueryExecution getQueryExecution(java.lang.String execId)
                                  throws ts.util.ReasonedException,
                                         ts.util.ReasonedRuntimeException
指定された実行IDに対応するクエリ実行ブジェクトを取得する。

定義:
インタフェース IQueryTransaction 内の getQueryExecution
パラメータ:
execId - 実行ID。
戻り値:
クエリ実行オブジェクト。
例外:
ts.util.ReasonedException - クエリが使用するコネクションの開始処理に失敗した 場合。
ts.util.ReasonedRuntimeException - クエリ実行オブジェクトの作成に失敗した 場合、又はトランザクションの状態が不正な場合。

getQuery

public IQuery getQuery(java.lang.String queryId)
                throws ts.util.ReasonedException,
                       ts.util.ReasonedRuntimeException
指定されたクエリIDに対応するクエリ・オブジェクトを取得する。

定義:
インタフェース IQueryTransaction 内の getQuery
パラメータ:
queryId - クエリID。
戻り値:
クエリ・オブジェクト。
例外:
ts.util.ReasonedException - クエリが使用するコネクションの開始処理に失敗した 場合。
ts.util.ReasonedRuntimeException - クエリ・オブジェクトの作成に失敗した場合、 又はトランザクションの状態が不正な場合。


Copyright (C) SATOH Takayuki All Rights Reserved.