Class JsrJobParametersConverter

  • All Implemented Interfaces:
    JobParametersConverter, org.springframework.beans.factory.InitializingBean

    public class JsrJobParametersConverter
    extends java.lang.Object
    implements JobParametersConverter, org.springframework.beans.factory.InitializingBean
    Provides default conversion methodology for JSR-352's implementation. Since Spring Batch uses job parameters as a way of identifying a job instance, this converter will add an additional identifying parameter if it does not exist already in the list. The id for the identifying parameter will come from the JOB_SEQ sequence as used to generate the unique ids for BATCH_JOB_INSTANCE records.
    Since:
    3.0
    Author:
    Michael Minella, Mahmoud Ben Hassine
    • Field Detail

      • incrementer

        public org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer incrementer
      • tablePrefix

        public java.lang.String tablePrefix
      • dataSource

        public javax.sql.DataSource dataSource
    • Constructor Detail

      • JsrJobParametersConverter

        public JsrJobParametersConverter​(javax.sql.DataSource dataSource)
        Main constructor.
        Parameters:
        dataSource - used to gain access to the database to get unique ids.
    • Method Detail

      • setTablePrefix

        public void setTablePrefix​(java.lang.String tablePrefix)
        The table prefix used in the current JobRepository
        Parameters:
        tablePrefix - the table prefix used for the job repository tables
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        java.lang.Exception
      • getProperties

        public java.util.Properties getProperties​(@Nullable
                                                  JobParameters params)
        Description copied from interface: JobParametersConverter
        The inverse operation: get a Properties instance. If given null or empty JobParameters, an empty Properties should be returned.
        Specified by:
        getProperties in interface JobParametersConverter
        Parameters:
        params - the JobParameters instance to be converted.
        Returns:
        a representation of the parameters as properties