Class GroupAwareJob
java.lang.Object
org.springframework.batch.core.configuration.support.GroupAwareJob
- All Implemented Interfaces:
Job
A
Job that can optionally prepend a group name to another job's name, to make
it fit a naming convention for type or origin. For example, the source job might be
overnightJob and the group might be financeDepartment, which
would result in a Job with identical functionality but named
financeDepartment.overnightJob . The use of a "." separator for elements
is deliberate, since it is a "safe" character in a
URL.- Author:
- Dave Syer, Mahmoud Ben Hassine
-
Constructor Summary
ConstructorsConstructorDescriptionGroupAwareJob(String groupName, Job delegate) Create a newJobwith the given group name and delegate.GroupAwareJob(Job delegate) Create a newJobwith the delegate and no group name. -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidexecute(JobExecution execution) Run theJobExecutionand update the meta information, such as status and statistics, as necessary.If clients need to generate new parameters for the next execution in a sequence, they can use this incrementer.A validator for the job parameters of aJobExecution.getName()Concatenates the group name and the delegate job name (joining with a ".").inthashCode()booleanFlag to indicate if this job can be restarted, at least in principle.toString()
-
Constructor Details
-
GroupAwareJob
Create a newJobwith the delegate and no group name.- Parameters:
delegate- a delegate for the features of a regular Job
-
GroupAwareJob
Create a newJobwith the given group name and delegate.- Parameters:
groupName- the group name to prepend (can benull)delegate- a delegate for the features of a regular Job
-
-
Method Details
-
execute
Description copied from interface:JobRun theJobExecutionand update the meta information, such as status and statistics, as necessary. This method should not throw any exceptions for failed execution. Clients should be careful to inspect theJobExecutionstatus to determine success or failure.- Specified by:
executein interfaceJob- Parameters:
execution- aJobExecution
-
getName
Concatenates the group name and the delegate job name (joining with a "."). -
isRestartable
public boolean isRestartable()Description copied from interface:JobFlag to indicate if this job can be restarted, at least in principle.- Specified by:
isRestartablein interfaceJob- Returns:
- true if this job can be restarted after a failure. Defaults to
true.
-
getJobParametersIncrementer
Description copied from interface:JobIf clients need to generate new parameters for the next execution in a sequence, they can use this incrementer. The return value may benull, when this job does not have a natural sequence.- Specified by:
getJobParametersIncrementerin interfaceJob- Returns:
- an incrementer to be used for creating new parameters. Defaults to
null.
-
getJobParametersValidator
Description copied from interface:JobA validator for the job parameters of aJobExecution. Clients of aJobmay need to validate the parameters for a launch or before or during the execution.- Specified by:
getJobParametersValidatorin interfaceJob- Returns:
- a validator that can be used to check parameter values (never
null). Defaults toDefaultJobParametersValidator.
-
equals
-
hashCode
public int hashCode() -
toString
-