Class 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.String reportDir  
    • Constructor Summary

      Constructors 
      Constructor Description
      PhpTasklet()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterPropertiesSet()  
      org.springframework.batch.repeat.RepeatStatus execute​(org.springframework.batch.core.StepContribution contribution, org.springframework.batch.core.scope.context.ChunkContext chunkContext)
      Execute system executable (php ..) and map its exit code to ExitStatus using SystemProcessExitCodeMapper.
      void setEnvironmentParams​(java.util.Map<java.lang.String,​java.lang.String> envp)  
      void setExecutable​(java.lang.String executable)  
      void setKillProcessesOnStop​(boolean killProcessesOnStop)  
      void setKillSignal​(java.lang.String killSignal)  
      void setLogSuffix​(java.lang.String logSuffix)  
      void setReportName​(java.lang.String reportName)  
      void setScriptDir​(java.lang.String dir)  
      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.
      void setScriptFiles​(java.util.List<java.lang.String> scriptFiles)  
      void setScriptParameters​(java.util.List<java.lang.String> scriptParameters)
      A list of script parameters to be passed to the script.
      void setSetExplicitCodepage​(boolean setExplicitCodepage)  
      void setTerminationCheckInterval​(long checkInterval)
      The time interval how often the tasklet will check for termination status.
      void setTimeout​(long timeout)
      Timeout in milliseconds.
      void stop()
      Will try to interrupt the thread executing the system executable.
      • Methods inherited from class org.springframework.batch.core.listener.StepExecutionListenerSupport

        afterStep, beforeStep
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • reportDir

        @Value("${bauta.reportDir}")
        protected java.lang.String reportDir
    • Constructor Detail

      • PhpTasklet

        public PhpTasklet()
    • 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.Exception
        Execute system executable (php ..) and map its exit code to ExitStatus using SystemProcessExitCodeMapper.
        Specified by:
        execute in interface org.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:
        afterPropertiesSet in interface org.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:
        stop in interface org.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)