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

java.lang.Object
  extended by org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor
All Implemented Interfaces:
org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

public class JobRegistryBeanPostProcessor
extends java.lang.Object
implements org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean

A BeanPostProcessor that registers Job beans with a JobRegistry. Include a bean of this type along with your job configuration, and use the same JobRegistry as a JobLocator when you need to locate a JobLocator to launch.

Author:
Dave Syer

Constructor Summary
JobRegistryBeanPostProcessor()
           
 
Method Summary
 void afterPropertiesSet()
          Make sure the registry is set before use.
 void destroy()
          De-register all the Job instances that were regsistered by this post processor.
 java.lang.Object postProcessAfterInitialization(java.lang.Object bean, java.lang.String beanName)
          If the bean is an instance of Job then register it.
 java.lang.Object postProcessBeforeInitialization(java.lang.Object bean, java.lang.String beanName)
          Do nothing.
 void setJobRegistry(JobRegistry jobRegistry)
          Injection setter for JobRegistry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobRegistryBeanPostProcessor

public JobRegistryBeanPostProcessor()
Method Detail

setJobRegistry

public void setJobRegistry(JobRegistry jobRegistry)
Injection setter for JobRegistry.

Parameters:
jobRegistry - the jobConfigurationRegistry to set

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Make sure the registry is set before use.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception
See Also:
InitializingBean.afterPropertiesSet()

destroy

public void destroy()
             throws java.lang.Exception
De-register all the Job instances that were regsistered by this post processor.

Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
java.lang.Exception
See Also:
DisposableBean.destroy()

postProcessAfterInitialization

public java.lang.Object postProcessAfterInitialization(java.lang.Object bean,
                                                       java.lang.String beanName)
                                                throws org.springframework.beans.BeansException
If the bean is an instance of Job then register it.

Specified by:
postProcessAfterInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
Throws:
org.springframework.beans.FatalBeanException - if there is a DuplicateJobException.
org.springframework.beans.BeansException
See Also:
BeanPostProcessor.postProcessAfterInitialization(java.lang.Object, java.lang.String)

postProcessBeforeInitialization

public java.lang.Object postProcessBeforeInitialization(java.lang.Object bean,
                                                        java.lang.String beanName)
                                                 throws org.springframework.beans.BeansException
Do nothing.

Specified by:
postProcessBeforeInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
Throws:
org.springframework.beans.BeansException
See Also:
BeanPostProcessor.postProcessBeforeInitialization(java.lang.Object, java.lang.String)


Copyright © 2009. All Rights Reserved.