public class StepContext extends SynchronizedAttributeAccessor
StepExecution
and some of its associated properties using expressions
based on bean paths. Has public getters for the step execution and
convenience methods for accessing commonly used properties like the
ExecutionContext
associated with the step or its enclosing job
execution.Constructor and Description |
---|
StepContext(StepExecution stepExecution)
Create a new instance of
StepContext for this
StepExecution . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Clean up the context at the end of a step execution.
|
boolean |
equals(Object other)
Extend the base class method to include the step execution itself as a
key (i.e.
|
String |
getId() |
Map<String,Object> |
getJobExecutionContext() |
String |
getJobName()
Convenient accessor for current job name identifier.
|
Map<String,Object> |
getJobParameters() |
StepExecution |
getStepExecution()
The current
StepExecution that is active in this context. |
Map<String,Object> |
getStepExecutionContext() |
String |
getStepName()
Convenient accessor for current step name identifier.
|
Properties |
getSystemProperties()
Convenient accessor for System properties to make it easy to access them
from placeholder expressions.
|
int |
hashCode()
Overrides the default behaviour to provide a hash code based only on the
step execution.
|
void |
registerDestructionCallback(String name,
Runnable callback)
Allow clients to register callbacks for clean up on close.
|
Object |
removeAttribute(String name)
Override base class behaviour to ensure destruction callbacks are
unregistered as well as the default behaviour.
|
String |
toString() |
attributeNames, getAttribute, hasAttribute, setAttribute, setAttributeIfAbsent
public StepContext(StepExecution stepExecution)
StepContext
for this
StepExecution
.stepExecution
- a step executionpublic String getStepName()
StepExecution
public String getJobName()
JobInstance
associated with the current StepExecution
public Properties getSystemProperties()
public Map<String,Object> getStepExecutionContext()
ExecutionContext
public Map<String,Object> getJobExecutionContext()
ExecutionContext
public Map<String,Object> getJobParameters()
JobParameters
public void registerDestructionCallback(String name, Runnable callback)
name
- the callback id (unique attribute key in this context)callback
- a callback to execute on closepublic Object removeAttribute(String name)
removeAttribute
in interface org.springframework.core.AttributeAccessor
removeAttribute
in class SynchronizedAttributeAccessor
SynchronizedAttributeAccessor.removeAttribute(String)
public void close()
StepScope
.public StepExecution getStepExecution()
StepExecution
that is active in this context.StepExecution
public String getId()
public boolean equals(Object other)
equals
in class SynchronizedAttributeAccessor
SynchronizedAttributeAccessor.equals(Object)
public int hashCode()
hashCode
in class SynchronizedAttributeAccessor
SynchronizedAttributeAccessor.hashCode()
public String toString()
toString
in class SynchronizedAttributeAccessor
Copyright © 2014 Pivotal. All rights reserved.