ts.query
クラス QueryExecutionConfig

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

public class QueryExecutionConfig
extends java.lang.Object
implements java.io.Serializable

クエリ実行設定を保持するクラス。
一回の照会又は更新処理を表すIQueryExecutionオブジェクトを作成する ために必要な設定情報を格納する。
引数なしのコンストラクタを使った場合は、空の設定オブジェクトが作成され、 getResource()メソッドにより得られるリソース・オブジェクトに設定情報 を登録して使用する。
引数に実行IDをとるコンストラクタを使った場合は、自動的にQueryEnvironmentConfigオブジェクトから取得したディレクトリから実行IDを ファイル・タイトルに持つXMLファイル(.xml)又はJavaプロパティ・ファイル (.properties)をロードするので、その設定情報を使用する。
設定情報は各実行クラスによって異なるが、それに依らない共通の設定情報として、

がある。

バージョン:
$Id: QueryExecutionConfig.java,v 1.16 2012-03-14 07:49:20 tayu Exp $
作成者:
佐藤隆之
関連項目:
直列化された形式

入れ子のクラスの概要
static class QueryExecutionConfig.Error
          このクラスで発生しうるエラーを定義する列挙型。
 
コンストラクタの概要
QueryExecutionConfig()
          デフォルト・コンストラクタ。
QueryExecutionConfig(java.lang.String execId)
          実行IDを引数にとるコンストラクタ。
 
メソッドの概要
<T extends IQueryExecution>
T
create()
          IQueryExecutionオブジェクトを作成する。
<T extends IQueryExecution>
T
create(IQueryConnection conn)
          IQueryExecutionオブジェクトを作成する。
<T extends IQueryExecution>
T
create(IQueryTransaction tran)
          IQueryExecutionオブジェクトを作成する。
protected static int executeCommand(java.lang.String[] args, QueryExecutionConfig config)
          実行設定ファイルのサンプルを出力するコマンドを実行する。
protected  java.lang.String getConnectionId()
          IQueryExecutionオブジェクトが使用するコネクションの接続先IDを取得 する。
protected  java.lang.String getExecutionClass()
          このオブジェクトから作成されるIQueryExecutionオブジェクトのクラス 名を取得する。
 java.lang.String getExecutionId()
          実行IDを取得する。
protected  int getLimitFetchCount()
          このオブジェクトから作成されるIQueryExecutionオブジェクトの取得 データ件数の制限値を取得する。
protected  long getLimitSpentTime()
          このオブジェクトから作成されるIQueryExecutionオブジェクトの 制限時間を取得する。
protected  ts.util.resource.Resource getResource()
          実行設定を保持するリソース・オブジェクトを取得する。
protected  ts.util.resource.Resource loadResource()
          実行設定ファイルをロードしたリソース・オブジェクトを作成する。
protected  ts.util.AbstractTypedGetter<java.lang.String,java.lang.String> newTypedGetter()
          設定情報を型変換して取得するためのTypedGetterオブジェクトを作成 する。
protected  void outputSampleProp(java.io.PrintWriter pw)
          実行設定ファイルのJavaプロパティ形式のサンプルをPrintWriter オブジェクトに出力する。
protected  void outputSamplePropEntries(java.io.PrintWriter pw)
          実行設定ファイルのプロパティ・エントリのサンプルをPrintWriter オブジェクトに出力する。
protected  void outputSampleXml(java.io.PrintWriter pw, java.lang.String encoding)
          実行設定ファイルのXML形式のサンプルをPrintWriterオブジェクトに 出力する。
protected  void outputSampleXmlEntries(java.io.PrintWriter pw)
          実行設定ファイルのXMLエントリのサンプルをPrintWriterオブジェクト に出力する。
protected  ts.util.AbstractTypedGetter<java.lang.String,java.lang.String> typedGetter()
          設定情報を型変換して取得するためのTypedGetterオブジェクトを取得 する。
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

QueryExecutionConfig

public QueryExecutionConfig()
デフォルト・コンストラクタ。


QueryExecutionConfig

public QueryExecutionConfig(java.lang.String execId)
実行IDを引数にとるコンストラクタ。

パラメータ:
execId - 実行ID。
例外:
java.lang.AssertionError - 引数がヌルの場合(デバッグ・モードのみ)。
メソッドの詳細

getExecutionId

public java.lang.String getExecutionId()
実行IDを取得する。

戻り値:
実行ID。

loadResource

protected ts.util.resource.Resource loadResource()
                                          throws ts.util.ReasonedRuntimeException
実行設定ファイルをロードしたリソース・オブジェクトを作成する。

戻り値:
実行設定ファイルをロードしたリソース・オブジェクト。
例外:
ts.util.ReasonedRuntimeException - 実行設定ファイルのロードに失敗した場合。

newTypedGetter

protected ts.util.AbstractTypedGetter<java.lang.String,java.lang.String> newTypedGetter()
設定情報を型変換して取得するためのTypedGetterオブジェクトを作成 する。

戻り値:
TypedGetterオブジェクト。

getResource

protected ts.util.resource.Resource getResource()
実行設定を保持するリソース・オブジェクトを取得する。

戻り値:
実行設定を保持するリソース・オブジェクト。

typedGetter

protected ts.util.AbstractTypedGetter<java.lang.String,java.lang.String> typedGetter()
設定情報を型変換して取得するためのTypedGetterオブジェクトを取得 する。

戻り値:
TypedGetterオブジェクト。

create

public <T extends IQueryExecution> T create()
                                 throws ts.util.ReasonedException,
                                        ts.util.ReasonedRuntimeException
IQueryExecutionオブジェクトを作成する。
このオブジェクトが保持する実行設定を使って、IQueryExecutionの派生 クラスのインスタンスを作成する。 派生クラスの名前は、実行設定 ts-query.execution.classに指定された クラス名が使用される。

戻り値:
IQueryExecutionオブジェクト。
例外:
ts.util.ReasonedException - IQueryExecutionオブジェクト又はそれが 使用するIQueryConnectionオブジェクトの作成に失敗した場合。
ts.util.ReasonedRuntimeException - 実行設定又は接続設定が不正だった場合。

create

public <T extends IQueryExecution> T create(IQueryTransaction tran)
                                 throws ts.util.ReasonedException,
                                        ts.util.ReasonedRuntimeException
IQueryExecutionオブジェクトを作成する。
このオブジェクトが保持する実行設定と引数のトランザクションを使って、IQueryExecutionの派生クラスのインスタンスを作成する。 派生クラスの名前は、実行設定 ts-query.execution.classに指定された クラス名が使用される。
IQueryExecutionオブジェクトが使用するコネクション・オブジェクトは 引数のトランザクション・オブジェクトから取得する。

パラメータ:
tran - トランザクション・オブジェクト。
戻り値:
IQueryExecutionオブジェクト。
例外:
ts.util.ReasonedException - IQueryExecutionオブジェクト又はそれが 使用するIQueryConnectionオブジェクトの作成に失敗した場合。
ts.util.ReasonedRuntimeException - 実行設定又は接続設定が不正だった場合。

create

public <T extends IQueryExecution> T create(IQueryConnection conn)
                                 throws ts.util.ReasonedException,
                                        ts.util.ReasonedRuntimeException
IQueryExecutionオブジェクトを作成する。
このオブジェクトが保持する実行設定と引数のコネクションを使って、IQueryExecutionの派生クラスのインスタンスを作成する。 派生クラスの名前は、実行設定 ts-query.execution.classに指定された クラス名が使用される。
引数のコネクション・オブジェクトからは、IQueryHistoryオブジェクト トランザクション開始からの制限時間を受け取って使用する。

パラメータ:
conn - コネクション・オブジェクト。
戻り値:
IQueryExecutionオブジェクト。
例外:
ts.util.ReasonedException - IQueryExecutionオブジェクトの作成に失敗 した場合。
ts.util.ReasonedRuntimeException - 実行設定が不正だった場合。

getExecutionClass

protected java.lang.String getExecutionClass()
このオブジェクトから作成されるIQueryExecutionオブジェクトのクラス 名を取得する。

戻り値:
IQueryExecutionクラスの名前。

getConnectionId

protected java.lang.String getConnectionId()
IQueryExecutionオブジェクトが使用するコネクションの接続先IDを取得 する。

戻り値:
IQueryExecutionオブジェクトが使用するコネクションの 接続先ID。

getLimitFetchCount

protected int getLimitFetchCount()
このオブジェクトから作成されるIQueryExecutionオブジェクトの取得 データ件数の制限値を取得する。
取得された制限件数がゼロ以下の場合は、制限がないものとする。
このオブジェクトに制限件数の設定がない場合は、制限なしとして-1を 返す。

戻り値:
IQueryExecutionオブジェクトの結果データ件数の制限値。

getLimitSpentTime

protected long getLimitSpentTime()
このオブジェクトから作成されるIQueryExecutionオブジェクトの 制限時間を取得する。
取得された制限時間がゼロ以下の場合は、制限がないものとする。
このオブジェクトに制限時間の設定がない場合は、制限なしとして-1を 返す。

戻り値:
IQueryExecutionオブジェクトの制限時間 [msec]。

outputSampleXml

protected void outputSampleXml(java.io.PrintWriter pw,
                               java.lang.String encoding)
                        throws java.io.IOException
実行設定ファイルのXML形式のサンプルをPrintWriterオブジェクトに 出力する。

パラメータ:
pw - PrintWriterオブジェクト。
例外:
java.io.IOException - 出力に失敗した場合。

outputSampleXmlEntries

protected void outputSampleXmlEntries(java.io.PrintWriter pw)
                               throws java.io.IOException
実行設定ファイルのXMLエントリのサンプルをPrintWriterオブジェクト に出力する。

パラメータ:
pw - PrintWriterオブジェクト。
例外:
java.io.IOException - 出力に失敗した場合。

outputSampleProp

protected void outputSampleProp(java.io.PrintWriter pw)
                         throws java.io.IOException
実行設定ファイルのJavaプロパティ形式のサンプルをPrintWriter オブジェクトに出力する。

パラメータ:
pw - PrintWriterオブジェクト。
例外:
java.io.IOException - 出力に失敗した場合。

outputSamplePropEntries

protected void outputSamplePropEntries(java.io.PrintWriter pw)
                                throws java.io.IOException
実行設定ファイルのプロパティ・エントリのサンプルをPrintWriter オブジェクトに出力する。

パラメータ:
pw - PrintWriterオブジェクト。
例外:
java.io.IOException - 出力に失敗した場合。

executeCommand

protected static int executeCommand(java.lang.String[] args,
                                    QueryExecutionConfig config)
実行設定ファイルのサンプルを出力するコマンドを実行する。
コマンドライン引数の配列の構成は以下の通りである:
  1. args[0] - コマンド名
  2. args[1] - 出力ファイル・パス
  3. args[2] - 出力ファイル形式 ("xml":XML形式、"prop" :Javaプロパティ形式、但し大文字小文字は区別しない)
  4. args[3] - 出力ファイルの文字エンコーディング
また、終了コードは以下の値をとりうる:

パラメータ:
args - コマンドライン引数の配列。
config - 実行設定オブジェクト。
戻り値:
コマンドの終了コード。


Copyright (C) SATOH Takayuki All Rights Reserved.