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.

Supporting 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.
Table 1. 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.
Table 2. 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 you must 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 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 example

The example shows xJCL that you can use to define a batch datastream which implements the PureQueryReaderPattern interface in your 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> 



Related concepts
Batch data stream framework and patterns
Related tasks
Using the batch data stream (BDS) framework
Task overview: IBM Optim pureQuery Runtime
Related information
JDBCReaderPattern
JPAReaderPattern
JPAWriterPattern
ByteReaderPattern
ByteWriterPattern
FileReaderPattern
FileWriterPattern
PureQueryWriterPattern


Terms and conditions for information centers | Feedback

Last updatedLast updated: Jan 30, 2014 9:17:32 AM CST
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-nd-iseries&topic=rgrid_btchpttrn12
File name: rgrid_btchpttrn12.html