Class JsrJobParametersConverter
- java.lang.Object
- org.springframework.batch.core.jsr.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 Summary
Fields Modifier and Type Field Description javax.sql.DataSource
dataSource
org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer
incrementer
static java.lang.String
JOB_RUN_ID
java.lang.String
tablePrefix
Constructor Summary
Constructors Constructor Description JsrJobParametersConverter(javax.sql.DataSource dataSource)
Main constructor.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
JobParameters
getJobParameters(java.util.Properties properties)
Get a newJobParameters
instance.java.util.Properties
getProperties(JobParameters params)
The inverse operation: get aProperties
instance.void
setTablePrefix(java.lang.String tablePrefix)
The table prefix used in the currentJobRepository
Field Detail
JOB_RUN_ID
public static final java.lang.String JOB_RUN_ID
- See Also:
- Constant Field Values
incrementer
public org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer incrementer
tablePrefix
public java.lang.String tablePrefix
dataSource
public javax.sql.DataSource dataSource
Method Detail
setTablePrefix
public void setTablePrefix(java.lang.String tablePrefix)
The table prefix used in the currentJobRepository
- Parameters:
tablePrefix
- the table prefix used for the job repository tables
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
java.lang.Exception
getJobParameters
public JobParameters getJobParameters(@Nullable java.util.Properties properties)
Description copied from interface:JobParametersConverter
Get a newJobParameters
instance. If given null, or an empty properties, an empty JobParameters will be returned.- Specified by:
getJobParameters
in interfaceJobParametersConverter
- Parameters:
properties
- the runtime parameters in the form of String literals.- Returns:
- a
JobParameters
properties converted to the correct types.
getProperties
public java.util.Properties getProperties(@Nullable JobParameters params)
Description copied from interface:JobParametersConverter
The inverse operation: get aProperties
instance. If given null or empty JobParameters, an empty Properties should be returned.- Specified by:
getProperties
in interfaceJobParametersConverter
- Parameters:
params
- theJobParameters
instance to be converted.- Returns:
- a representation of the parameters as properties