In JSR352 1.0 Final §9.3 Batch Properties, the batch properties is defined to be type java.lang.String
:
Batch applications need a way to receive parameters when a job is initiated for execution. Properties can be defined by batch programming model artifacts, then have values passed to them when a job is initiated. Batch properties are string values.
And here's an example:
Properties jobProps = new Properties();
jobProps.setProperty("props1", "value1");
jobProps.setProperty("props2", "value2");
// start
jobOperator.start("myjob", jobProps);
However, I need to use other objects for the job. This general "property" could be any object type, so java.lang.Object
. So I'm looking for a work-around solution which meets the below requirements:
- The property stored should be immutable, which means that once passed to the batch runtime, it won't be changed again.
- The property should be persisted when job stopped and can be reused when the job restarted. (Serializable?)
- The work-around solution should not depend on any implementation, e.g. JBeret from JBoss. Because I'm developing a framework, which let the user to choose their own JSR 352 implementation.
Can anybody help?