Class DefaultJobLoader
java.lang.Object
org.springframework.batch.core.configuration.support.DefaultJobLoader
- All Implemented Interfaces:
JobLoader,org.springframework.beans.factory.InitializingBean
public class DefaultJobLoader
extends Object
implements JobLoader, org.springframework.beans.factory.InitializingBean
Default implementation of
JobLoader. Uses a JobRegistry to manage a
population of loaded jobs and clears them up when asked. An optional
StepRegistry might also be set to register the step(s) available for each
registered job.- Author:
- Dave Syer, Stephane Nicoll, Mahmoud Ben Hassine
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.DefaultJobLoader(JobRegistry jobRegistry) Creates a job loader with the job registry provided.DefaultJobLoader(JobRegistry jobRegistry, StepRegistry stepRegistry) Creates a job loader with the job and step registries provided. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclear()Unregister all the jobs and close all the contexts created by this loader.load(ApplicationContextFactory factory) Load an application context and register all the jobs.reload(ApplicationContextFactory factory) Load an application context and register all the jobs, having first unregistered them if already registered.voidsetJobRegistry(JobRegistry jobRegistry) TheJobRegistryto use for jobs created.voidsetStepRegistry(StepRegistry stepRegistry) TheStepRegistryto use for the steps of created jobs.
-
Constructor Details
-
DefaultJobLoader
public DefaultJobLoader()Default constructor. Useful for declarative configuration. -
DefaultJobLoader
Creates a job loader with the job registry provided.- Parameters:
jobRegistry- aJobRegistry
-
DefaultJobLoader
Creates a job loader with the job and step registries provided.- Parameters:
jobRegistry- aJobRegistrystepRegistry- aStepRegistry(can benull)
-
-
Method Details
-
setJobRegistry
TheJobRegistryto use for jobs created.- Parameters:
jobRegistry- the job registry
-
setStepRegistry
TheStepRegistryto use for the steps of created jobs.- Parameters:
stepRegistry- the step registry
-
clear
public void clear()Unregister all the jobs and close all the contexts created by this loader. -
reload
Description copied from interface:JobLoaderLoad an application context and register all the jobs, having first unregistered them if already registered. Implementations should also close and clean up the application context previously created (either from this factory or from one with the same jobs), if possible. -
load
Description copied from interface:JobLoaderLoad an application context and register all the jobs.- Specified by:
loadin interfaceJobLoader- Parameters:
factory- a factory for an application context (containing jobs)- Returns:
- a collection of the jobs created
- Throws:
DuplicateJobException- if a job with the same name was already registered
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-