Top Description Methods
javax.batch.runtime.context

public Interface StepContext

Imports
java.io.Serializable, java.util.Properties, javax.batch.runtime.BatchStatus, .Metric

A StepContext provides information about the current step of a job execution.

Method Summary

Modifier and TypeMethod and Description
public BatchStatus

Returns:

batch status string
getBatchStatus
()

The getBatchStatus method returns the current batch status of the current step.

public Exception

Returns:

the last exception
getException
()

The getException method returns the last exception thrown from a step level batch artifact to the batch runtime.

public String

Returns:

exit status string
getExitStatus
()

The getExitStatus method simply returns the exit status value stored into the step context through the setExitStatus method or null.

public Metric[]

Returns:

metrics array
getMetrics
()

The getMetrics method returns an array of step level metrics.

public Serializable

Returns:

user-specified type
getPersistentUserData
()

The getPersistentUserData method returns a persistent data object belonging to the current step.

public Properties

Returns:

step level properties
getProperties
()

The getProperties method returns the step level properties specified in a job definition.

public long

Returns:

step execution id
getStepExecutionId
()

The getStepExecutionId method returns the current step's execution id.

public String

Returns:

value of 'id' attribute from <step>
getStepName
()

Get step name.

public Object

Returns:

user-specified type
getTransientUserData
()

The getTransientUserData method returns a transient data object belonging to the current Job XML execution element.

public void
setExitStatus(String
string
status
)

The setExitStatus method assigns the user-specified exit status for the current step.

public void
setPersistentUserData(Serializable
is the user-specified type
data
)

The setPersistentUserData method stores a persistent data object into the current step.

public void
setTransientUserData(Object
is the user-specified type
data
)

The setTransientUserData method stores a transient data object into the current batch context.

Method Detail

getBatchStatusback to summary
public BatchStatus getBatchStatus()

The getBatchStatus method returns the current batch status of the current step. This value is set by the batch runtime and changes as the batch status changes.

Returns:BatchStatus

batch status string

getExceptionback to summary
public Exception getException()

The getException method returns the last exception thrown from a step level batch artifact to the batch runtime.

Returns:Exception

the last exception

getExitStatusback to summary
public String getExitStatus()

The getExitStatus method simply returns the exit status value stored into the step context through the setExitStatus method or null.

Returns:String

exit status string

getMetricsback to summary
public Metric[] getMetrics()

The getMetrics method returns an array of step level metrics. These are things like commits, skips, etc.

Returns:Metric[]

metrics array

See Also
for definition of standard metrics.
getPersistentUserDataback to summary
public Serializable getPersistentUserData()

The getPersistentUserData method returns a persistent data object belonging to the current step. The user data type must implement java.util.Serializable. This data is saved as part of a step's checkpoint. For a step that does not do checkpoints, it is saved after the step ends. It is available upon restart.

Returns:Serializable

user-specified type

getPropertiesback to summary
public Properties getProperties()

The getProperties method returns the step level properties specified in a job definition.

A couple notes:
  • There is no guarantee that the same Properties object instance is always returned in the same (step) scope.
  • Besides the properties which are defined in JSL within a child <properties> element of a <step> element, the batch runtime implementation may choose to include additional, implementation-defined properties.
Returns:Properties

step level properties

getStepExecutionIdback to summary
public long getStepExecutionId()

The getStepExecutionId method returns the current step's execution id.

Returns:long

step execution id

getStepNameback to summary
public String getStepName()

Get step name.

Returns:String

value of 'id' attribute from <step>

getTransientUserDataback to summary
public Object getTransientUserData()

The getTransientUserData method returns a transient data object belonging to the current Job XML execution element.

Returns:Object

user-specified type

setExitStatusback to summary
public void setExitStatus(String status)

The setExitStatus method assigns the user-specified exit status for the current step. When the step ends, the exit status of the step is the value specified through setExitStatus. If setExitStatus was not called or was called with a null value, then the exit status defaults to the batch status of the step.

Parameters
status:String

string

setPersistentUserDataback to summary
public void setPersistentUserData(Serializable data)

The setPersistentUserData method stores a persistent data object into the current step. The user data type must implement java.util.Serializable. This data is saved as part of a step's checkpoint. For a step that does not do checkpoints, it is saved after the step ends. It is available upon restart.

Parameters
data:Serializable

is the user-specified type

setTransientUserDataback to summary
public void setTransientUserData(Object data)

The setTransientUserData method stores a transient data object into the current batch context.

Parameters
data:Object

is the user-specified type