Class JsrStepContext
- java.lang.Object
- org.springframework.batch.core.jsr.JsrStepContext
- All Implemented Interfaces:
javax.batch.runtime.context.StepContext
public class JsrStepContext extends java.lang.Object implements javax.batch.runtime.context.StepContext
Wrapper class to provide theStepContext
functionality as specified in JSR-352. Wrapper delegates to the underlyingStepExecution
to obtain the related contextual information.- Since:
- 3.0
- Author:
- Michael Minella, Chris Schaefer
Constructor Summary
Constructors Constructor Description JsrStepContext(StepExecution stepExecution, java.util.Properties properties)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.batch.runtime.BatchStatus
getBatchStatus()
java.lang.Exception
getException()
To support both JSR-352's requirement to return the most recent exception and Spring Batch's support forThrowable
, this implementation will return the most recent exception in the underlyingStepExecution
's failure exceptions list.java.lang.String
getExitStatus()
javax.batch.runtime.Metric[]
getMetrics()
java.io.Serializable
getPersistentUserData()
java.util.Properties
getProperties()
long
getStepExecutionId()
java.lang.String
getStepName()
java.lang.Object
getTransientUserData()
void
setExitStatus(java.lang.String status)
void
setPersistentUserData(java.io.Serializable data)
void
setTransientUserData(java.lang.Object data)
Constructor Detail
JsrStepContext
public JsrStepContext(StepExecution stepExecution, java.util.Properties properties)
Method Detail
getStepName
public java.lang.String getStepName()
- Specified by:
getStepName
in interfacejavax.batch.runtime.context.StepContext
getTransientUserData
public java.lang.Object getTransientUserData()
- Specified by:
getTransientUserData
in interfacejavax.batch.runtime.context.StepContext
setTransientUserData
public void setTransientUserData(java.lang.Object data)
- Specified by:
setTransientUserData
in interfacejavax.batch.runtime.context.StepContext
getStepExecutionId
public long getStepExecutionId()
- Specified by:
getStepExecutionId
in interfacejavax.batch.runtime.context.StepContext
getProperties
public java.util.Properties getProperties()
- Specified by:
getProperties
in interfacejavax.batch.runtime.context.StepContext
getPersistentUserData
public java.io.Serializable getPersistentUserData()
- Specified by:
getPersistentUserData
in interfacejavax.batch.runtime.context.StepContext
setPersistentUserData
public void setPersistentUserData(java.io.Serializable data)
- Specified by:
setPersistentUserData
in interfacejavax.batch.runtime.context.StepContext
getBatchStatus
public javax.batch.runtime.BatchStatus getBatchStatus()
- Specified by:
getBatchStatus
in interfacejavax.batch.runtime.context.StepContext
getExitStatus
public java.lang.String getExitStatus()
- Specified by:
getExitStatus
in interfacejavax.batch.runtime.context.StepContext
setExitStatus
public void setExitStatus(java.lang.String status)
- Specified by:
setExitStatus
in interfacejavax.batch.runtime.context.StepContext
getException
public java.lang.Exception getException()
To support both JSR-352's requirement to return the most recent exception and Spring Batch's support forThrowable
, this implementation will return the most recent exception in the underlyingStepExecution
's failure exceptions list. If the exception there extendsThrowable
instead ofException
, it will be wrapped in anException
and then returned.- Specified by:
getException
in interfacejavax.batch.runtime.context.StepContext
- See Also:
StepContext.getException()
getMetrics
public javax.batch.runtime.Metric[] getMetrics()
- Specified by:
getMetrics
in interfacejavax.batch.runtime.context.StepContext