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

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

public class DefaultJobLoader
extends Object
implements JobLoader

Default implementation of JobLoader. Uses a JobRegistry to manage a population of loaded jobs and clears them up when asked.

Author:
Dave Syer

Constructor Summary
DefaultJobLoader()
          Default constructor useful for declarative configuration.
DefaultJobLoader(JobRegistry jobRegistry)
          Create a job loader with the job registry provided.
 
Method Summary
 void clear()
          Unregister all the jobs and close all the contexts created by this loader.
 Collection<Job> load(ApplicationContextFactory factory)
          Load an application context and register all the jobs.
 Collection<Job> reload(ApplicationContextFactory factory)
          Load an application context and register all the jobs, having first unregistered them if already registered.
 void setJobRegistry(JobRegistry jobRegistry)
          The JobRegistry to use for jobs created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultJobLoader

public DefaultJobLoader()
Default constructor useful for declarative configuration.


DefaultJobLoader

public DefaultJobLoader(JobRegistry jobRegistry)
Create a job loader with the job registry provided.

Parameters:
jobRegistry - a JobRegistry
Method Detail

setJobRegistry

public void setJobRegistry(JobRegistry jobRegistry)
The JobRegistry to use for jobs created.

Parameters:
jobRegistry -

clear

public void clear()
Unregister all the jobs and close all the contexts created by this loader.

Specified by:
clear in interface JobLoader
See Also:
JobLoader.clear()

reload

public Collection<Job> reload(ApplicationContextFactory factory)
Description copied from interface: JobLoader
Load an application context and register all the jobs, having first unregistered them if already registered. Implementations should also take care to close and clean up the application context previously created if possible (either from this factory or from one with the same jobs).

Specified by:
reload in interface JobLoader
Parameters:
factory - a factory for an application context (containing jobs)
Returns:
a collection of the jobs created

load

public Collection<Job> load(ApplicationContextFactory factory)
                     throws DuplicateJobException
Description copied from interface: JobLoader
Load an application context and register all the jobs.

Specified by:
load in interface JobLoader
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


Copyright © 2013 SpringSource. All Rights Reserved.