com.ibm.websphere.batch
Interface BatchDataStream
- public interface BatchDataStream
- extends com.ibm.batch.api.BatchDataStream
The BatchDataStream (BDS) interface provides an abstraction over the data that is processed by a Batch Step. It provides the set of methods that are called by the Batch Execution Environment (BEE) in order to initialize the data stream, retrieve cursor information from the BDS, and position the BDS to a specified cursor during processing of a Batch Step.
This is the order in which methods are called on a BDS during normal execution of a batch step:- setProperties(Properties properties)
- initialize(String ilogicalname, String ijobstepid)
- open()
- positionAtInitialCheckpoint()
- externalizeCheckpointInformation() - this is called at every checkpoint
- intermediateCheckpoint() - this is called right after a checkpoint completes
- close()
- setProperties(Properties properties)
- initialize(String ilogicalname, String ijobstepid)
- open()
- internalizeCheckpointInformation(String chkptinfo) - informs the bds of the previously saved checkpoint information
- positionAtCurrentCheckpoint() - called to position the bds to the cursor indicated by the saved checkpoint in above method
- externalizeCheckpointInformation() - this is called at every checkpoint
- intermediateCheckpoint() - this is called right after a checkpoint completes
- close()
Environment The batch data stream is a java object that will be called from both the Batch Execution Environment and the Batch Job Step EJB.
- Transactional environment: The caller of the BDS will be in a global transaction when any of the methods on the interface are called. There is no guarantee that any two methods on the instance of the object will be called under the same global transactional unit of work. The global transactional unit of work is not owned by the BDS, the only transactional action that can be invoked by the BDS is to mark the global transaction as rollback only.
Method Summary
Modifier and Type | Method and Description |
---|---|
|
close()
The close method is called by the Batch Execution Environment to indicate to the BDS that the
user of the BDS is done working with the BDS.
|
|
externalizeCheckpointInformation()
The externalizeCheckpointInformation method is called by the
Batch Execution Environment (BEE) during the checkpoint completion phase of processing.
|
|
getName()
The getName method returns the logical name of the BDS that was received in the initialize method.
|
|
getProperties()
The getProperties method returns the bds properties specified in the xJCL and received in the setProperties
method.
|
|
initialize(java.lang.String ilogicalname,java.lang.String ijobstepid)
The initialize method is called by the Batch Execution Environment during the initialization of the job step.
|
|
intermediateCheckpoint()
The intermediateCheckpoint method is called by the Batch Execution Environment to indicate
to the BDS that a checkpoint has just completed (i.e. a global transaction has been committed
and a new global transaction has started).
|
|
internalizeCheckpointInformation(java.lang.String chkptinfo)
The internalizeCheckpointInformation method is called by the Batch Execution Environment
during the restart of a Batch Step Bean.
|
|
open()
The open method is called by the Batch Execution Environment to indicate that the
BDS is about to be used and to prepare the BDS for operation.
|
|
positionAtCurrentCheckpoint()
The positionAtCurrentCheckpoint method is called by Batch Execution Environment to provide a signal to the BDS that it
should start processing the stream at the point that was defined in the
internalizeCheckpointInformation method.
|
|
positionAtInitialCheckpoint()
The positionAtInitialCheckpoint is called by the Batch Execution Environment to provide a signal to the BDS that it should
start processing the stream at the initial point as defined by the xJCL inputs.
|
|
setProperties(java.util.Properties properties)
The setProperties method is called by the Batch Execution Environment to pass bds properties specified in xJCL to the
bds as a java.util.Properties object.
|
Method Detail
externalizeCheckpointInformation
- java.lang.String externalizeCheckpointInformation( )
externalizeCheckpointInformation
in interface com.ibm.batch.api.BatchDataStream
internalizeCheckpointInformation
- void internalizeCheckpointInformation( java.lang.String chkptinfo)
The internalizeCheckpointInformation method is called by the Batch Execution Environment during the restart of a Batch Step Bean. This allows the BDS to restart its internal state to the point it was at when the last successful checkpoint was processed. It is at this point in the process that the Batch Step Bean will begin processing.
internalizeCheckpointInformation
in interface com.ibm.batch.api.BatchDataStream
chkptinfo
- - This is a string that was created by the
BDS that was returned to the Batch Execution Environment on the externalizeCheckpointInformation
method. This String is opaque to anyone but the BDS, so only the
BDS can interpret its content. initialize
- void initialize(java.lang.String ilogicalname,
- java.lang.String ijobstepid)
- throws BatchContainerDataStreamException
The initialize method is called by the Batch Execution Environment during the initialization of the job step. This allows the BDS to initialize the stream for use by the Batch Step Bean. The method is passed the logical name of the BDS and the JobStepID. These two pieces of information are used to create a BatchDataStreamConfig object that has the configuration information necessary to establish the stream. The initialize method should configure the stream as defined by the config object and validate the input source or output sink (e.g. is the dataset available? can I connect to the database being processed?). If the BDS is not valid, throw the BatchDataStreamConfigurationFailed exception.
initialize
in interface com.ibm.batch.api.BatchDataStream
ilogicalname
- the logical name of the BDS, this name is used to
locate the resource in the job's xJCL. ijobstepid
- an identifier that represents the step within the batch
job that is being run. This id is used to locate the resource in the job's
xJCL. BatchDataStreamConfigurationFailed
- is throw if the BDS is not
configured properly to access the BDS's source of data or its sink to
put data. positionAtInitialCheckpoint
- void positionAtInitialCheckpoint( )
- throws BatchContainerDataStreamException
The positionAtInitialCheckpoint is called by the Batch Execution Environment to provide a signal to the BDS that it should start processing the stream at the initial point as defined by the xJCL inputs.
positionAtInitialCheckpoint
in interface com.ibm.batch.api.BatchDataStream
positionAtCurrentCheckpoint
- void positionAtCurrentCheckpoint( )
- throws BatchContainerDataStreamException
The positionAtCurrentCheckpoint method is called by Batch Execution Environment to provide a signal to the BDS that it should start processing the stream at the point that was defined in the internalizeCheckpointInformation method.
positionAtCurrentCheckpoint
in interface com.ibm.batch.api.BatchDataStream
open
- void open()
- throws BatchContainerDataStreamException
The open method is called by the Batch Execution Environment to indicate that the BDS is about to be used and to prepare the BDS for operation. This includes items such as opening files that are used by the BDS's implementation.
open
in interface com.ibm.batch.api.BatchDataStream
close
- void close()
- throws BatchContainerDataStreamException
close
in interface com.ibm.batch.api.BatchDataStream
getName
- java.lang.String getName()
getName
in interface com.ibm.batch.api.BatchDataStream
setProperties
- void setProperties(java.util.Properties properties)
The setProperties method is called by the Batch Execution Environment to pass bds properties specified in xJCL to the bds as a java.util.Properties object.
setProperties
in interface com.ibm.batch.api.BatchDataStream
getProperties
- java.util.Properties getProperties( )
The getProperties method returns the bds properties specified in the xJCL and received in the setProperties method.
getProperties
in interface com.ibm.batch.api.BatchDataStream
intermediateCheckpoint
- void intermediateCheckpoint()
The intermediateCheckpoint method is called by the Batch Execution Environment to indicate to the BDS that a checkpoint has just completed (i.e. a global transaction has been committed and a new global transaction has started).
intermediateCheckpoint
in interface com.ibm.batch.api.BatchDataStream
The externalizeCheckpointInformation method is called by the Batch Execution Environment (BEE) during the checkpoint completion phase of processing. This allows the BDS to record a set of information with the BEE, that will be committed with the checkpoint's global transaction to the BEE database. The information that is returned needs to contain enough data to allow the BDS to reposition itself during a restart of the Batch Step Bean.
Additional information can be stored in this string as well, but the larger the string, the slower the Batch Execution Environment will be in storing it in the RDB that it is maintaining.