PureQueryReaderPattern
このパターンは、IBM® Optim™ pureQuery Runtime を使用してデータベースからデータを読み取るために使用します。バッチ・データ・ストリーム (BDS) フレームワークは、接続をオープンおよびクローズする管理用タスクを完了させます。
サポートされるクラス
PureQueryReader クラスは、データベース接続のオープンとクローズ、および IBM Optim pureQuery Runtime データの取得を行う基本操作を実装します。
必須プロパティー
以下は、このパターンの必須のプロパティーです。
プロパティー名 | 値 |
---|---|
PATTERN_IMPL_CLASS | PureQueryReaderPattern インターフェースを実装するクラス |
PQ_DATA_BEAN_INTERFACE | PureQuery データ Bean インターフェース |
ds_jndi_name | データベースにアクセスするためのデータ・ソースの Java™ Naming and Directory Interface (JNDI) 名 |
オプション・プロパティー
以下は、このパターンのオプションのプロパティーです。
プロパティー名 | 値 | 説明 |
---|---|---|
debug | true または false (デフォルトは false) | このバッチ・データ・ストリームに対する詳細トレースを使用可能にします。 |
DB_SCHEMA | null | データベース・スキーマ名 |
EnablePerformanceMeasurement | true または false (デフォルトは false) | GenericXDBatchStep を使用している場合に、バッチ・データ・ストリームおよび processRecord メソッドに費やされた合計時間を計算します。 |
インターフェース定義
PureQueryReaderPattern インターフェース定義は、PureQueryReaderPattern インターフェースをサポートするために実装する必要のあるメソッドを表示します。
public interface PureQueryReaderPattern
{
/**
* This method is called by the batch container during step setup. The properties passed
* in are the ones that you provide in the xJCL BDS level properties.
* @param properties
*/
public void initialize(Properties properties);
/**
* Invoked by the container during each iteration of the batch loop. This code obtains
* the next record using the given iterator object.
* @param iterator
* @return
*/
public Object fetchRecord(Iterator iterator);
/**
* Returns the iterator based on the passed data object that is used to iterate
* over the records
* @param data
* @return
*/
public Iterator getInitialIterator(Data data);
/**
* Returns the iterator based on the passed data object repositioned based on the restart
* token of restartToken.
* @param data
* @param s
* @return
*/
public Iterator getRestartIterator(Data data, String restartToken);
/**
* Invoked before a checkpoint is taken to save the restart token that is used in case
* of a restart
* @return
*/
public String getRestartTokens();
}
xJCL の例
次の例は、PureQueryReaderPattern インターフェースをアプリケーションに実装するバッチ・データ・ストリームを定義するために使用できる xJCL を示しています。
<batch-data-streams>
<bds>
<logical-name>outputStream</logical-name>
<props>
<prop name="IMPLCLASS" value="com.ibm.MyWriterPattern"/>
<prop name="ds_jndi_name" value="jdbc/crreport"/>
<prop name="debug" value="true"/>
<prop name="DB_SCHEMA" value="PQDS"/>
<prop name="PQ_DATA_BEAN_INTERFACE" value="com.ibm.MyEmployeeData"/>
</props>
<impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.PureQueryReader</impl-class>
</bds></batch-data-streams>