ch.elca.el4j.services.persistence.jpa.dao
Class JpaExtentFetcherInjectorBeanPostProcessor

java.lang.Object
  extended by ch.elca.el4j.services.persistence.jpa.dao.JpaExtentFetcherInjectorBeanPostProcessor
All Implemented Interfaces:
BeanPostProcessor, ApplicationContextAware, Ordered, PriorityOrdered

public class JpaExtentFetcherInjectorBeanPostProcessor
extends Object
implements BeanPostProcessor, PriorityOrdered, ApplicationContextAware

Inject the ExtentFetcher in GenericDaos. It gets the extentFetcher from the spring context by using the default name EXTENT_FETCHER_BEAN_DEFAULT_NAME.

Author:
Simon Stelling (SST)
File-location:
JpaExtentFetcherInjectorBeanPostProcessor
Last check-in date:
2010-12-21 11:08:04 +0100 (Di, 21. Dez 2010) by swismer for revision 4253

Field Summary
static String EXTENT_FETCHER_BEAN_DEFAULT_NAME
          The default name for the property of the session factory.
protected  ExtentFetcher extentFetcher
          Caches the 'extentFetcher' bean from the application context.
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
JpaExtentFetcherInjectorBeanPostProcessor()
           
 
Method Summary
 ExtentFetcher getExtentFetcher()
          Gets the session factory (from spring context if needed).
 int getOrder()
          
protected  void initDao(GenericJpaDao<?,?> dao)
          Try to inject the extentFetcher into the given dao.
 Object postProcessAfterInitialization(Object bean, String beanName)
          
 Object postProcessBeforeInitialization(Object bean, String beanName)
          Initiates the real work.
 void setApplicationContext(ApplicationContext applicationContext)
          
 void setExtentFetcher(ExtentFetcher extentFetcher)
          If you do not set the extent fetcher explicitly, it will be obtained from the application's context.
 void setOrder(int order)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTENT_FETCHER_BEAN_DEFAULT_NAME

public static final String EXTENT_FETCHER_BEAN_DEFAULT_NAME
The default name for the property of the session factory.

See Also:
Constant Field Values

extentFetcher

protected ExtentFetcher extentFetcher
Caches the 'extentFetcher' bean from the application context.

Constructor Detail

JpaExtentFetcherInjectorBeanPostProcessor

public JpaExtentFetcherInjectorBeanPostProcessor()
Method Detail

postProcessBeforeInitialization

public Object postProcessBeforeInitialization(Object bean,
                                              String beanName)
                                       throws BeansException
Initiates the real work.

Specified by:
postProcessBeforeInitialization in interface BeanPostProcessor
Parameters:
bean - the bean to postprocess
beanName - the name of the bean
Returns:
the bean
Throws:
BeansException

postProcessAfterInitialization

public Object postProcessAfterInitialization(Object bean,
                                             String beanName)
                                      throws BeansException

Specified by:
postProcessAfterInitialization in interface BeanPostProcessor
Throws:
BeansException

initDao

protected void initDao(GenericJpaDao<?,?> dao)
Try to inject the extentFetcher into the given dao.

Parameters:
dao - the dao to inject the extentFetcher

getExtentFetcher

public ExtentFetcher getExtentFetcher()
Gets the session factory (from spring context if needed).

Returns:
the extentFetcher

setExtentFetcher

public void setExtentFetcher(ExtentFetcher extentFetcher)
If you do not set the extent fetcher explicitly, it will be obtained from the application's context.

Parameters:
extentFetcher - the fetcher to use

setOrder

public void setOrder(int order)


getOrder

public int getOrder()

Specified by:
getOrder in interface Ordered

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
                           throws BeansException

Specified by:
setApplicationContext in interface ApplicationContextAware
Throws:
BeansException


Copyright © 2005-2011 ELCA. All Rights Reserved.