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

java.lang.Object
  extended by org.springframework.batch.core.configuration.support.MapJobRegistry
All Implemented Interfaces:
JobLocator, JobRegistry, ListableJobRegistry

public class MapJobRegistry
extends Object
implements ListableJobRegistry

Simple map-based implementation of JobRegistry. Access to the map is synchronized, guarded by an internal lock.

Author:
Dave Syer

Constructor Summary
MapJobRegistry()
           
 
Method Summary
 Job getJob(String name)
          Locates a Job at runtime.
 Collection<String> getJobNames()
          Provides the currently registered job names.
 void register(JobFactory jobFactory)
          Registers a Job at runtime.
 void unregister(String name)
          Unregisters a previously registered Job.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapJobRegistry

public MapJobRegistry()
Method Detail

register

public void register(JobFactory jobFactory)
              throws DuplicateJobException
Description copied from interface: JobRegistry
Registers a Job at runtime.

Specified by:
register in interface JobRegistry
Parameters:
jobFactory - the Job to be registered
Throws:
DuplicateJobException - if a factory with the same job name has already been registered.

unregister

public void unregister(String name)
Description copied from interface: JobRegistry
Unregisters a previously registered Job. If it was not previously registered there is no error.

Specified by:
unregister in interface JobRegistry
Parameters:
name - the Job to unregister.

getJob

public Job getJob(String name)
           throws NoSuchJobException
Description copied from interface: JobLocator
Locates a Job at runtime.

Specified by:
getJob in interface JobLocator
Parameters:
name - the name of the Job which should be unique
Returns:
a Job identified by the given name
Throws:
NoSuchJobException - if the required configuration can not be found.

getJobNames

public Collection<String> getJobNames()
Description copied from interface: ListableJobRegistry
Provides the currently registered job names. The return value is unmodifiable and disconnected from the underlying registry storage.

Specified by:
getJobNames in interface ListableJobRegistry
Returns:
a collection of String. Empty if none are registered.


Copyright © 2009 SpringSource. All Rights Reserved.