Network Deployment (Distributed operating systems), v8.0 > Reference > Developer detailed usage information


PureQueryReaderPattern

Use this pattern is used to read data from a database using IBM Optim pureQuery Runtime. The batch data stream (BDS) framework completes the administrative tasks of opening and closing connections.


Support classes

The PureQueryReader class implements the basic operations of opening and closing database connections and obtaining the IBM Optim pureQuery Runtime data.


Required properties

The following properties are required for the pattern.

Required properties. The table includes the name and value of each required property for the pattern.

Property name Value
PATTERN_IMPL_CLASS Class implementing PureQueryReaderPattern interface
PQ_DATA_BEAN_INTERFACE PureQuery data bean interface
ds_jndi_name Java Naming and Directory Interface (JNDI) name of the data source to access the database


Optional properties

The following properties are optional for the pattern.

Optional properties. The table includes the name, value, and description of each optional property for the pattern.

Property name Value Description
debug true or false (The default is false.) Enables detailed tracing on this batch data stream
DB_SCHEMA null Database schema name
EnablePerformanceMeasurement true or false (The default is false.) Calculates the total time spent in the batch data-streams and the processRecord method, if you are using the GenericXDBatchStep


Interface definition

The PureQueryReaderPattern Interface definition shows the methods that implement to support the PureQueryReaderPattern interface.

public interface PureQueryReaderPattern
{

 /**
  * This method is called by the batch container during step setup. The properties passed
  * in are the ones that provided 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 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 used in case
     * of a restart
     * @return
     */
    public  String getRestartTokens();
}


xJCL example

The example shows xJCL that you can use to define a batch datastream which implements the PureQueryReaderPattern interface in the application.

<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>

Batch data stream framework and patterns
Use the batch data stream (BDS) framework

New feature: Task overview: IBM Optim pureQuery Runtime
JDBCReaderPattern
JPAReaderPattern
JPAWriterPattern
ByteReaderPattern
ByteWriterPattern
FileReaderPattern
FileWriterPattern
PureQueryWriterPattern

+

Search Tips   |   Advanced Search