|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.core.listener.StepExecutionListenerSupport
org.springframework.batch.core.resource.StepExecutionResourceProxy
public class StepExecutionResourceProxy
Strategy for locating different resources on the file system. For each unique
step execution, the same file handle will be returned. A unique step is
defined as having the same job instance and step name. An external file mover
(such as an EAI solution) should rename and move any input files to conform
to the pattern defined here.
If no pattern is passed in, then following default is used:
data/%JOB_NAME%/%STEP_NAME%.txtThe %% variables are replaced with the corresponding bean property at run time, when the factory method is executed. To insert
JobParameters
use a pattern with the parameter key surrounded by %%, e.g.
//home/jobs/data/%JOB_NAME%/%STEP_NAME%-%schedule.date%.txtNote that the default pattern does not start with a separator. Because of the implementation of the Spring Core Resource abstractions, it would need to start with a double forward slash "//" to resolve to an absolute directory (or else use a full URL with the file: prefix).
StepExecution.
The best way to do that is to register it as a listener in the step that is
going to need it. For this reason the resource implements
StepExecutionListener.
Resource| Constructor Summary | |
|---|---|
StepExecutionResourceProxy()
|
|
| Method Summary | |
|---|---|
void |
beforeStep(StepExecution execution)
Collect the properties of the enclosing StepExecution that will
be needed to create a file name. |
Resource |
createRelative(String relativePath)
|
boolean |
exists()
|
String |
getDescription()
|
File |
getFile()
|
String |
getFilename()
|
InputStream |
getInputStream()
|
URI |
getURI()
|
URL |
getURL()
|
boolean |
isOpen()
|
boolean |
isReadable()
|
boolean |
isSingleton()
Always false because we are expecting to be step scoped. |
void |
setFilePattern(String filePattern)
|
void |
setJobParametersFactory(JobParametersConverter jobParametersConverter)
Public setter for the JobParametersConverter used to translate
JobParameters into Properties. |
void |
setResourceLoader(ResourceLoader resourceLoader)
|
String |
toString()
Delegates to the proxied Resource if set, otherwise returns the value of setFilePattern(String). |
| Methods inherited from class org.springframework.batch.core.listener.StepExecutionListenerSupport |
|---|
afterStep, onErrorInStep |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.springframework.batch.core.StepExecutionListener |
|---|
afterStep, onErrorInStep |
| Constructor Detail |
|---|
public StepExecutionResourceProxy()
| Method Detail |
|---|
public Resource createRelative(String relativePath)
throws IOException
createRelative in interface ResourcerelativePath -
IOExceptionResource.createRelative(java.lang.String)public boolean exists()
exists in interface ResourceResource.exists()public String getDescription()
getDescription in interface ResourceResource.getDescription()
public File getFile()
throws IOException
getFile in interface ResourceIOExceptionResource.getFile()public String getFilename()
getFilename in interface ResourceResource.getFilename()
public InputStream getInputStream()
throws IOException
getInputStream in interface InputStreamSourceIOExceptionInputStreamSource.getInputStream()
public URI getURI()
throws IOException
getURI in interface ResourceIOExceptionResource.getURI()
public URL getURL()
throws IOException
getURL in interface ResourceIOExceptionResource.getURL()public boolean isOpen()
isOpen in interface ResourceResource.isOpen()public boolean isReadable()
isReadable in interface ResourceResource.isReadable()public void setJobParametersFactory(JobParametersConverter jobParametersConverter)
JobParametersConverter used to translate
JobParameters into Properties. Defaults to a
DefaultJobParametersConverter.
jobParametersConverter - the JobParametersConverter to setpublic boolean isSingleton()
AbstractFactoryBean.isSingleton()public void setResourceLoader(ResourceLoader resourceLoader)
setResourceLoader in interface ResourceLoaderAwarepublic void setFilePattern(String filePattern)
public void beforeStep(StepExecution execution)
StepExecution that will
be needed to create a file name.
beforeStep in interface StepExecutionListenerbeforeStep in class StepExecutionListenerSupportStepExecutionListener.beforeStep(org.springframework.batch.core.StepExecution)public String toString()
setFilePattern(String).
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||