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

java.lang.Object
  extended by org.springframework.batch.core.configuration.support.ClassPathXmlJobRegistry
All Implemented Interfaces:
JobLocator, JobRegistry, ListableJobRegistry, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

public class ClassPathXmlJobRegistry
extends java.lang.Object
implements ListableJobRegistry, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean

Implementation of the ListableJobRegistry interface that assumes all Jobs will be loaded from ClassPathXml resources.

Since:
2.0
Author:
Lucas Ward, Dave Syer

Constructor Summary
ClassPathXmlJobRegistry()
           
 
Method Summary
 void afterPropertiesSet()
           
 Job getJob(java.lang.String name)
          Locates a Job at runtime.
 java.util.Collection<java.lang.String> getJobNames()
          Provides the currently registered job names.
 void register(JobFactory jobFactory)
          Registers a Job at runtime.
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setJobPaths(org.springframework.core.io.Resource[] jobPaths)
           
 void unregister(java.lang.String jobName)
          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

ClassPathXmlJobRegistry

public ClassPathXmlJobRegistry()
Method Detail

setJobPaths

public void setJobPaths(org.springframework.core.io.Resource[] jobPaths)

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

getJob

public Job getJob(java.lang.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.

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

getJobNames

public java.util.Collection<java.lang.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.

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(java.lang.String jobName)
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:
jobName - the Job to unregister.


Copyright © 2009. All Rights Reserved.