Package se.ikama.bauta.batch.tasklet.php
Class PhpTasklet
- java.lang.Object
-
- org.springframework.batch.core.listener.StepExecutionListenerSupport
-
- se.ikama.bauta.batch.tasklet.php.PhpTasklet
-
- All Implemented Interfaces:
org.springframework.batch.core.step.tasklet.StoppableTasklet,org.springframework.batch.core.step.tasklet.Tasklet,org.springframework.batch.core.StepExecutionListener,org.springframework.batch.core.StepListener,org.springframework.beans.factory.InitializingBean
public class PhpTasklet extends org.springframework.batch.core.listener.StepExecutionListenerSupport implements org.springframework.batch.core.step.tasklet.StoppableTasklet, org.springframework.beans.factory.InitializingBean
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringreportDir
-
Constructor Summary
Constructors Constructor Description PhpTasklet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()org.springframework.batch.repeat.RepeatStatusexecute(org.springframework.batch.core.StepContribution contribution, org.springframework.batch.core.scope.context.ChunkContext chunkContext)Execute system executable (php ..) and map its exit code toExitStatususingSystemProcessExitCodeMapper.voidsetEnvironmentParams(java.util.Map<java.lang.String,java.lang.String> envp)voidsetExecutable(java.lang.String executable)voidsetKillProcessesOnStop(boolean killProcessesOnStop)voidsetKillSignal(java.lang.String killSignal)voidsetLogSuffix(java.lang.String logSuffix)voidsetReportName(java.lang.String reportName)voidsetScriptDir(java.lang.String dir)voidsetScriptFile(java.lang.String scriptFile)For convenience and for backward compatibility, if you have only one single script file, you can use this method.voidsetScriptFiles(java.util.List<java.lang.String> scriptFiles)voidsetScriptParameters(java.util.List<java.lang.String> scriptParameters)A list of script parameters to be passed to the script.voidsetSetExplicitCodepage(boolean setExplicitCodepage)voidsetTerminationCheckInterval(long checkInterval)The time interval how often the tasklet will check for termination status.voidsetTimeout(long timeout)Timeout in milliseconds.voidstop()Will try to interrupt the thread executing the system executable.
-
-
-
Method Detail
-
execute
public org.springframework.batch.repeat.RepeatStatus execute(org.springframework.batch.core.StepContribution contribution, org.springframework.batch.core.scope.context.ChunkContext chunkContext) throws java.lang.ExceptionExecute system executable (php ..) and map its exit code toExitStatususingSystemProcessExitCodeMapper.- Specified by:
executein interfaceorg.springframework.batch.core.step.tasklet.Tasklet- Throws:
java.lang.Exception
-
setExecutable
public void setExecutable(java.lang.String executable)
- Parameters:
executable- executable to be executed in a separate system process
-
setEnvironmentParams
public void setEnvironmentParams(java.util.Map<java.lang.String,java.lang.String> envp)
- Parameters:
envp- environment parameter values, inherited from parent process when not set (or set to null).
-
setScriptDir
public void setScriptDir(java.lang.String dir)
- Parameters:
dir- working directory of the spawned process, inherited from parent process when not set (or set to null).
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
java.lang.Exception
-
setTimeout
public void setTimeout(long timeout)
Timeout in milliseconds.- Parameters:
timeout- upper limit for how long the execution of the external program is allowed to last.
-
setTerminationCheckInterval
public void setTerminationCheckInterval(long checkInterval)
The time interval how often the tasklet will check for termination status.- Parameters:
checkInterval- time interval in milliseconds (1 second by default).
-
stop
public void stop()
Will try to interrupt the thread executing the system executable.- Specified by:
stopin interfaceorg.springframework.batch.core.step.tasklet.StoppableTasklet- See Also:
StoppableTasklet.stop()
-
setScriptFile
public void setScriptFile(java.lang.String scriptFile)
For convenience and for backward compatibility, if you have only one single script file, you can use this method. Makes it a bit more convenient in the Spring configuration.
-
setScriptFiles
public void setScriptFiles(java.util.List<java.lang.String> scriptFiles)
-
setScriptParameters
public void setScriptParameters(java.util.List<java.lang.String> scriptParameters)
A list of script parameters to be passed to the script. Equivalent to "php myscript.php param1 param2".- Parameters:
scriptParameters- A list of identifiers for either a job-parameter or a spring property. A job parameter is identified by jobparam.[job-param-key]. A spring property is identified by env.[spring-property-key]
-
setKillProcessesOnStop
public void setKillProcessesOnStop(boolean killProcessesOnStop)
-
setKillSignal
public void setKillSignal(java.lang.String killSignal)
-
setSetExplicitCodepage
public void setSetExplicitCodepage(boolean setExplicitCodepage)
-
setLogSuffix
public void setLogSuffix(java.lang.String logSuffix)
-
setReportName
public void setReportName(java.lang.String reportName)
-
-