org.springframework.batch.core.configuration.support
Class GroupAwareJob

java.lang.Object
  extended by org.springframework.batch.core.configuration.support.GroupAwareJob
All Implemented Interfaces:
Job

public class GroupAwareJob
extends Object
implements 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. E.g. the source job might be overnightJob and the group 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

Constructor Summary
GroupAwareJob(Job delegate)
          Create a new Job with the delegate and no group name.
GroupAwareJob(String groupName, Job delegate)
          Create a new Job with the given group name and delegate.
 
Method Summary
 boolean equals(Object obj)
           
 void execute(JobExecution execution)
          Run the JobExecution and update the meta information like status and statistics as necessary.
 JobParametersIncrementer getJobParametersIncrementer()
          If clients need to generate new parameters for the next execution in a sequence they can use this incrementer.
 JobParametersValidator getJobParametersValidator()
          A validator for the job parameters of a JobExecution.
 String getName()
          Concatenates the group name and the delegate job name (joining with a ".").
 int hashCode()
           
 boolean isRestartable()
          Flag to indicate if this job can be restarted, at least in principle.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GroupAwareJob

public GroupAwareJob(Job delegate)
Create a new Job with the delegate and no group name.

Parameters:
delegate - a delegate for the features of a regular Job

GroupAwareJob

public GroupAwareJob(String groupName,
                     Job delegate)
Create a new Job with the given group name and delegate.

Parameters:
groupName - the group name to prepend
delegate - a delegate for the features of a regular Job
Method Detail

execute

public void execute(JobExecution execution)
Description copied from interface: Job
Run the JobExecution and update the meta information like status and statistics as necessary. This method should not throw any exceptions for failed execution. Clients should be careful to inspect the JobExecution status to determine success or failure.

Specified by:
execute in interface Job
Parameters:
execution - a JobExecution

getName

public String getName()
Concatenates the group name and the delegate job name (joining with a ".").

Specified by:
getName in interface Job
See Also:
Job.getName()

isRestartable

public boolean isRestartable()
Description copied from interface: Job
Flag to indicate if this job can be restarted, at least in principle.

Specified by:
isRestartable in interface Job
Returns:
true if this job can be restarted after a failure

getJobParametersIncrementer

public JobParametersIncrementer getJobParametersIncrementer()
Description copied from interface: Job
If clients need to generate new parameters for the next execution in a sequence they can use this incrementer. The return value may be null, in the case that this job does not have a natural sequence.

Specified by:
getJobParametersIncrementer in interface Job
Returns:
in incrementer to be used for creating new parameters

getJobParametersValidator

public JobParametersValidator getJobParametersValidator()
Description copied from interface: Job
A validator for the job parameters of a JobExecution. Clients of a Job may need to validate the parameters for a launch, before or during the execution.

Specified by:
getJobParametersValidator in interface Job
Returns:
a validator that can be used to check parameter values (never null)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 SpringSource. All Rights Reserved.