org.compass.spring.support
Class CompassContextBeanPostProcessor

java.lang.Object
  extended by org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter
      extended by org.compass.spring.support.CompassContextBeanPostProcessor
All Implemented Interfaces:
org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor, org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor, org.springframework.context.ApplicationContextAware

public class CompassContextBeanPostProcessor
extends org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter
implements org.springframework.context.ApplicationContextAware

BeanPostProcessor that processes CompassContext annotation for injection of Compass interfaces. Any such annotated fields or methods in any Spring-managed object will automatically be injected.

Will inject either a Compass or CompassSession instances.

Author:
kimchy

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
CompassContextBeanPostProcessor()
           
 
Method Summary
protected  Compass findEntityManagerFactoryByName(String compassName)
          Find a Compass with the given name in the current application context
 boolean postProcessAfterInstantiation(Object bean, String beanName)
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 
Methods inherited from class org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter
determineConstructor, postProcessAfterInitialization, postProcessBeforeInitialization, postProcessBeforeInstantiation, postProcessPropertyValues, predictBeanType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

CompassContextBeanPostProcessor

public CompassContextBeanPostProcessor()
Method Detail

setApplicationContext

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

findEntityManagerFactoryByName

protected Compass findEntityManagerFactoryByName(String compassName)
                                          throws org.springframework.beans.factory.NoSuchBeanDefinitionException
Find a Compass with the given name in the current application context

Parameters:
compassName - name of the EntityManagerFactory
Returns:
the EntityManagerFactory or throw NoSuchBeanDefinitionException
Throws:
org.springframework.beans.factory.NoSuchBeanDefinitionException - if there is no such EntityManagerFactory in the context

postProcessAfterInstantiation

public boolean postProcessAfterInstantiation(Object bean,
                                             String beanName)
                                      throws org.springframework.beans.BeansException
Specified by:
postProcessAfterInstantiation in interface org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor
Overrides:
postProcessAfterInstantiation in class org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter
Throws:
org.springframework.beans.BeansException


Copyright (c) 2004-2008 The Compass Project.