com.ibm.websphere.batch.devframework.datastreams.bdsadapter

Class AbstractBatchDataStream

  1. java.lang.Object
  2. extended bycom.ibm.websphere.batch.devframework.datastreams.bdsadapter.AbstractBatchDataStream
All implemented interfaces:
com.ibm.batch.api.BatchDataStream
Direct known subclasses:
AbstractBatchDataInputStreamRecordMetrics, AbstractBatchDataOutputStreamRecordMetrics

  1. public abstract class AbstractBatchDataStream
  2. extends java.lang.Object
  3. implements BatchDataStream
Base implementation of BatchDataStream.

Field Summary

Modifier and Type Field and Description
  1. protected
  2. java.lang.String
jobStepKey

Constructor Summary

Constructor and Description
AbstractBatchDataStream()

Method Summary

Modifier and Type Method and Description
  1. abstract
  2. void
close()
Close underlying implementation stream.
  1. abstract
  2. java.lang.String
externalizeCheckpointInformation()
This method is called just before a checkpoint is to be taken by the batch container.
  1. java.lang.String
getJobstepId()
  1. java.lang.String
getName()
  1. java.util.Properties
getProperties()
  1. protected
  2. java.lang.String
getProperty(java.lang.String key)
Convenience method to return a property value.
  1. protected
  2. java.lang.String
getRequiredProperty(java.util.Properties props,java.lang.String key)
  1. protected
  2. java.lang.String
getRequiredProperty(java.lang.String key)
Convenience method to return a property value.
  1. protected abstract
  2. void
initialize(java.util.Properties props)
This method is invoked during stream initialization.
  1. void
initialize(java.lang.String name,java.lang.String jobstepId)
Called during stream initialization.
  1. void
intermediateCheckpoint()
LREE calls this method after a checkpoint is taken
This implementation does nothing; subclasses may override.
  1. abstract
  2. void
internalizeCheckpointInformation(java.lang.String token)
Parse restart token supplied by LREE.
  1. java.lang.Boolean
isRestart()
  1. protected
  2. java.lang.Object
loadClass(java.lang.String className)
  1. abstract
  2. void
open()
Opens delegate stream.
  1. abstract
  2. void
positionAtInitialCheckpoint()
Positions the stream to the initial checkpoint (i.e., the beginning of the stream).
  1. void
setProperties(java.util.Properties props)
LREE calls this method to tell us our properties as specified in the xJCL.
  1. protected
  2. void
setRestart(boolean restart)
Sets the 'restarting' flag on this BDS.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.ibm.websphere.batch.BatchDataStream
positionAtCurrentCheckpoint

Field Detail

jobStepKey

  1. protected java.lang.String jobStepKey

Constructor Detail

AbstractBatchDataStream

  1. public AbstractBatchDataStream( )

Method Detail

close

  1. public abstract void close()
  2. throws BatchContainerDataStreamException
Close underlying implementation stream.
Specified by:
close in interface com.ibm.batch.api.BatchDataStream
Throws:
BatchContainerDataStreamException - Underlying implementation stream threw an exception in its close() method.

internalizeCheckpointInformation

  1. public abstract void internalizeCheckpointInformation( java.lang.String token)
  2. throws java.lang.RuntimeException
Parse restart token supplied by LREE.
This implementation assumes the restart token is a record cound, parseable as an integer.
Specified by:
internalizeCheckpointInformation in interface com.ibm.batch.api.BatchDataStream
Parameters:
token - - 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.
Throws:
java.lang.RuntimeException - Restart token could not be parsed as an integer.

open

  1. public abstract void open()
  2. throws BatchContainerDataStreamException
Opens delegate stream.
Specified by:
open in interface com.ibm.batch.api.BatchDataStream
Throws:
BatchContainerDataStreamException - Error opening delegate stream.

positionAtInitialCheckpoint

  1. public abstract void positionAtInitialCheckpoint( )
  2. throws BatchContainerDataStreamException
Positions the stream to the initial checkpoint (i.e., the beginning of the stream).
This implementation simply sets the record counter to zero. Overriding subclasses should call the parent implementation.
Specified by:
positionAtInitialCheckpoint in interface com.ibm.batch.api.BatchDataStream
Throws:
BatchContainerDataStreamException - Error positioning the stream.

initialize

  1. protected abstract void initialize( java.util.Properties props)
This method is invoked during stream initialization. Properties specified in the xJCL are passed as input
Parameters:
props -

externalizeCheckpointInformation

  1. public abstract java.lang.String externalizeCheckpointInformation( )
This method is called just before a checkpoint is to be taken by the batch container. This allows the stream to save any information that can be used by the container in case of a restart.
Specified by:
externalizeCheckpointInformation in interface com.ibm.batch.api.BatchDataStream
Returns:
- This is a string that is created to record the BDS's position in the stream being processed. This String is opaque to anyone but the BDS, so only the BDS can interpret its content.

getJobstepId

  1. public java.lang.String getJobstepId( )
Returns:
Our job/step id.

getName

  1. public java.lang.String getName( )
Description copied from interface: BatchDataStream
The getName method returns the logical name of the BDS that was received in the initialize method.
Specified by:
getName in interface com.ibm.batch.api.BatchDataStream
Returns:
Our logical name as specified in the xJCL.

getProperties

  1. public java.util.Properties getProperties( )
Description copied from interface: BatchDataStream

The getProperties method returns the bds properties specified in the xJCL and received in the setProperties method.

Specified by:
getProperties in interface com.ibm.batch.api.BatchDataStream
Returns:
Our properties as specified in the xJCL.

getProperty

  1. protected java.lang.String getProperty( java.lang.String key)
Convenience method to return a property value.
Parameters:
key - Property key.
Returns:
Property value.

getRequiredProperty

  1. protected java.lang.String getRequiredProperty( java.lang.String key)
Convenience method to return a property value. Throws an exception if the property was not set, or was set to an empty value.
Parameters:
key - Property key.
Returns:
Property value.
Throws:
java.lang.RuntimeException - No value was specified for the given key.

getRequiredProperty

  1. protected java.lang.String getRequiredProperty( java.util.Properties props,
  2. java.lang.String key)

initialize

  1. public void initialize(java.lang.String name,
  2. java.lang.String jobstepId)
  3. throws BatchContainerDataStreamException
Called during stream initialization.
Specified by:
initialize in interface com.ibm.batch.api.BatchDataStream
Parameters:
name - the logical name of the BDS, this name is used to locate the resource in the job's xJCL.
jobstepId - 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.
Throws:

intermediateCheckpoint

  1. public void intermediateCheckpoint( )
LREE calls this method after a checkpoint is taken
This implementation does nothing; subclasses may override.
Specified by:
intermediateCheckpoint in interface com.ibm.batch.api.BatchDataStream

setProperties

  1. public void setProperties(java.util.Properties props)
LREE calls this method to tell us our properties as specified in the xJCL.
Specified by:
setProperties in interface com.ibm.batch.api.BatchDataStream
Parameters:
props - Stream properties from xJCL.

isRestart

  1. public java.lang.Boolean isRestart( )
Returns:
  • Boolean.FALSE if we are not restarting
  • Boolean.TRUE if we are restarting
  • null if not yet known

setRestart

  1. protected void setRestart(boolean restart)
Sets the 'restarting' flag on this BDS. Should be called by subclasses, in their BatchDataStream.positionAtCurrentCheckpoint() (set to true) or BatchDataStream.positionAtInitialCheckpoint() (set to false) methods, respectively.
Parameters:
restart -

loadClass

  1. protected java.lang.Object loadClass( java.lang.String className)