Class MapJobRegistry
- java.lang.Object
- org.springframework.batch.core.configuration.support.MapJobRegistry
- All Implemented Interfaces:
JobLocator
,JobRegistry
,ListableJobLocator
public class MapJobRegistry extends java.lang.Object implements JobRegistry
Simple, thread-safe, map-based implementation ofJobRegistry
.- Author:
- Dave Syer, Robert Fischer, Mahmoud Ben Hassine
Constructor Summary
Constructors Constructor Description MapJobRegistry()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Job
getJob(java.lang.String name)
Locates aJob
at runtime.java.util.Set<java.lang.String>
getJobNames()
Provides an unmodifiable view of the job names.void
register(JobFactory jobFactory)
Registers aJob
at runtime.void
unregister(java.lang.String name)
Unregisters a previously registeredJob
.
Method Detail
register
public void register(JobFactory jobFactory) throws DuplicateJobException
Description copied from interface:JobRegistry
Registers aJob
at runtime.- Specified by:
register
in interfaceJobRegistry
- Parameters:
jobFactory
- theJob
to be registered- Throws:
DuplicateJobException
- if a factory with the same job name has already been registered.
unregister
public void unregister(java.lang.String name)
Description copied from interface:JobRegistry
Unregisters a previously registeredJob
. If it was not previously registered there is no error.- Specified by:
unregister
in interfaceJobRegistry
- Parameters:
name
- theJob
to unregister.
getJob
public Job getJob(java.lang.String name) throws NoSuchJobException
Description copied from interface:JobLocator
Locates aJob
at runtime.- Specified by:
getJob
in interfaceJobLocator
- Parameters:
name
- the name of theJob
which should be unique- Returns:
- a
Job
identified by the given name - Throws:
NoSuchJobException
- if the required configuration can not be found.
getJobNames
public java.util.Set<java.lang.String> getJobNames()
Provides an unmodifiable view of the job names.- Specified by:
getJobNames
in interfaceListableJobLocator
- Returns:
- a collection of String. Empty if none are registered.