A - public abstract class AbstractOSGIAnnotationBeanPostProcessor<A extends Annotation>
extends org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter
implements org.springframework.osgi.context.BundleContextAware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware
BeanPostProcessor implementations which need to wire stuff via annotations and need to be functional via OSGI.
Many of this code is borrowed from the spring-dm's class org.springframework.osgi.extensions.annotation.ServiceReferenceInjectionBeanPostProcessor.
*| Modifier and Type | Field and Description |
|---|---|
protected org.springframework.beans.factory.BeanFactory |
beanFactory |
static long |
DEFAULT_TIMEOUT |
| Constructor and Description |
|---|
AbstractOSGIAnnotationBeanPostProcessor() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract Class<A> |
getAnnotation()
Return the class of the
Annotation |
protected abstract Object |
getBeanFromFactory(A a,
Class<?> clazz)
Return the Bean lookup-ed from the
BeanFactory. |
protected abstract String |
getFilter(A annotation)
Return the filter which should get used to lookup the service in the osgi registry.
|
Object |
postProcessAfterInitialization(Object bean,
String beanName)
process FactoryBean created objects, since these will not have had
services injected.
|
org.springframework.beans.PropertyValues |
postProcessPropertyValues(org.springframework.beans.PropertyValues pvs,
PropertyDescriptor[] pds,
Object bean,
String beanName) |
void |
setBeanClassLoader(ClassLoader classLoader) |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
void |
setBundleContext(org.osgi.framework.BundleContext context) |
void |
setLookupBeanFactory(boolean lookupBeanFactory) |
void |
setTimeout(long timeout)
Set the timeout in milliseconds.
|
public static final long DEFAULT_TIMEOUT
protected org.springframework.beans.factory.BeanFactory beanFactory
public AbstractOSGIAnnotationBeanPostProcessor()
public void setTimeout(long timeout)
timeout - public void setLookupBeanFactory(boolean lookupBeanFactory)
public void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader in interface org.springframework.beans.factory.BeanClassLoaderAwareBeanClassLoaderAware.setBeanClassLoader(java.lang.ClassLoader)public Object postProcessAfterInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException
postProcessAfterInitialization in interface org.springframework.beans.factory.config.BeanPostProcessorpostProcessAfterInitialization in class org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapterbean - beanName - org.springframework.beans.BeansExceptionpublic org.springframework.beans.PropertyValues postProcessPropertyValues(org.springframework.beans.PropertyValues pvs,
PropertyDescriptor[] pds,
Object bean,
String beanName)
throws org.springframework.beans.BeansException
postProcessPropertyValues in interface org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorpostProcessPropertyValues in class org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapterorg.springframework.beans.BeansExceptionpublic void setBundleContext(org.osgi.framework.BundleContext context)
setBundleContext in interface org.springframework.osgi.context.BundleContextAwareBundleContextAware.setBundleContext(org.osgi.framework.BundleContext)public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
throws org.springframework.beans.BeansException
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAwareorg.springframework.beans.BeansExceptionBeanFactoryAware.setBeanFactory(org.springframework.beans.factory.BeanFactory)protected abstract Class<A> getAnnotation()
Annotationprotected abstract String getFilter(A annotation)
annotation - Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.