ch.elca.el4j.core.aop
Class ExclusiveBeanNameAutoProxyCreator

java.lang.Object
  extended by org.springframework.aop.framework.ProxyConfig
      extended by org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
          extended by org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator
              extended by ch.elca.el4j.core.aop.ExclusiveBeanNameAutoProxyCreator
All Implemented Interfaces:
Serializable, AopInfrastructureBean, BeanClassLoaderAware, BeanFactoryAware, BeanPostProcessor, InstantiationAwareBeanPostProcessor, SmartInstantiationAwareBeanPostProcessor, InitializingBean, Ordered
Direct Known Subclasses:
IntelligentExclusiveBeanNameAutoProxyCreator

public class ExclusiveBeanNameAutoProxyCreator
extends BeanNameAutoProxyCreator
implements InitializingBean

Auto proxy creator that identifies beans to proxy via a list of names. Additionally, it allows you to specify a list of names that must not be proxied. Both list, beanNames and exclusiveBeanNames check for direct, "xxx*", and "*xxx" matches.

Note if you don't specify an include pattern (i.e. not setting the beanNames property) and you have specified some beans to exclude, then all beans except the excluding ones will be auto-proxied.

Exclusion has higher precedence than inclusions. Additional features of this auto proxy creator:

Author:
Andreas Bur (ABU)
See Also:
BeanNameAutoProxyCreator, Serialized Form
File-location:
ExclusiveBeanNameAutoProxyCreator
Last check-in date:
2010-11-02 11:44:37 +0100 (Di, 02. Nov 2010) by swisswheel for revision 4204

Field Summary
static String[] AUTOPROXY_ALL_BEANS
          Bean names to autoproxy all beans.
 
Fields inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
DO_NOT_PROXY, logger, PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
ExclusiveBeanNameAutoProxyCreator()
           
 
Method Summary
 void afterPropertiesSet()
          
protected  Object createProxy(Class beanClass, String beanName, Object[] specificInterceptors, TargetSource targetSource)
          Will not create a new proxy for a given bean if this bean is already a proxy bean.
protected  Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource)
          
protected  AdvisorAdapterRegistry getAdvisorAdapterRegistry()
           
protected  String[] getInterceptorNames()
           
protected  boolean isApplyCommonInterceptorsFirst()
           
 boolean isProxyFactoryBeanOutput()
           
 void setAdvisorAdapterRegistry(AdvisorAdapterRegistry advisorAdapterRegistry)
          COPYIED FROM SUPERCLASS!
 void setApplyCommonInterceptorsFirst(boolean applyCommonInterceptorsFirst)
          COPYIED FROM SUPERCLASS!
 void setBeanNames(String[] beanNames)
          
 void setExclusiveBeanNames(String[] exclusiveBeanNames)
          Set the names of the beans that must not automatically get wrapped with proxies.
 void setInterceptorNames(String[] interceptorNames)
          COPYIED FROM SUPERCLASS!
 void setProxyFactoryBeanOutput(boolean proxyFactoryBeanOutput)
           
protected  Object wrapIfNecessary(Object bean, String beanName, Object cacheKey)
          Wrap a bean if necessary.
 
Methods inherited from class org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator
isMatch
 
Methods inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
advisorsPreFiltered, buildAdvisors, customizeProxyFactory, determineCandidateConstructors, getBeanFactory, getCacheKey, getCustomTargetSource, getEarlyBeanReference, getOrder, isFrozen, isInfrastructureClass, postProcessAfterInitialization, postProcessAfterInstantiation, postProcessBeforeInitialization, postProcessBeforeInstantiation, postProcessPropertyValues, predictBeanType, setBeanClassLoader, setBeanFactory, setCustomTargetSourceCreators, setFrozen, setOrder, setProxyClassLoader, shouldProxyTargetClass, shouldSkip
 
Methods inherited from class org.springframework.aop.framework.ProxyConfig
copyFrom, isExposeProxy, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setOpaque, setOptimize, setProxyTargetClass, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AUTOPROXY_ALL_BEANS

public static final String[] AUTOPROXY_ALL_BEANS
Bean names to autoproxy all beans.

Constructor Detail

ExclusiveBeanNameAutoProxyCreator

public ExclusiveBeanNameAutoProxyCreator()
Method Detail

setExclusiveBeanNames

public void setExclusiveBeanNames(String[] exclusiveBeanNames)
Set the names of the beans that must not automatically get wrapped with proxies. A name can specify a prefix to match by ending with "*", e.g. "myBean,tx*" will match the bean named "myBean" and all beans whose name start with "tx".

Parameters:
exclusiveBeanNames - The bean names to exclude.

setBeanNames

public void setBeanNames(String[] beanNames)

Overrides:
setBeanNames in class BeanNameAutoProxyCreator

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception

Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

wrapIfNecessary

protected Object wrapIfNecessary(Object bean,
                                 String beanName,
                                 Object cacheKey)
Wrap a bean if necessary. If bean is actually a FactoryBean then wrap it using GenericProxiedFactoryBean.

Overrides:
wrapIfNecessary in class AbstractAutoProxyCreator

createProxy

protected Object createProxy(Class beanClass,
                             String beanName,
                             Object[] specificInterceptors,
                             TargetSource targetSource)
Will not create a new proxy for a given bean if this bean is already a proxy bean.

Overrides:
createProxy in class AbstractAutoProxyCreator

getAdvicesAndAdvisorsForBean

protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass,
                                                String beanName,
                                                TargetSource targetSource)

Overrides:
getAdvicesAndAdvisorsForBean in class BeanNameAutoProxyCreator

getInterceptorNames

protected String[] getInterceptorNames()
Returns:
Returns the interceptorNames.

setInterceptorNames

public void setInterceptorNames(String[] interceptorNames)
COPYIED FROM SUPERCLASS! Added to have access to the interceptor names.

Overrides:
setInterceptorNames in class AbstractAutoProxyCreator

getAdvisorAdapterRegistry

protected AdvisorAdapterRegistry getAdvisorAdapterRegistry()
Returns:
Returns the advisorAdapterRegistry.

setAdvisorAdapterRegistry

public void setAdvisorAdapterRegistry(AdvisorAdapterRegistry advisorAdapterRegistry)
COPYIED FROM SUPERCLASS! Added to have access to the interceptor names.

Overrides:
setAdvisorAdapterRegistry in class AbstractAutoProxyCreator

isApplyCommonInterceptorsFirst

protected boolean isApplyCommonInterceptorsFirst()
Returns:
Returns the applyCommonInterceptorsFirst.

setApplyCommonInterceptorsFirst

public void setApplyCommonInterceptorsFirst(boolean applyCommonInterceptorsFirst)
COPYIED FROM SUPERCLASS! Set whether the common interceptors should be applied before bean-specific ones. Default is "true"; else, bean-specific interceptors will get applied first.

Overrides:
setApplyCommonInterceptorsFirst in class AbstractAutoProxyCreator
Parameters:
applyCommonInterceptorsFirst - See method description.

isProxyFactoryBeanOutput

public boolean isProxyFactoryBeanOutput()
Returns:
Should the output of a FactoryBean be proxied instead of the factory itself?

setProxyFactoryBeanOutput

public void setProxyFactoryBeanOutput(boolean proxyFactoryBeanOutput)
Parameters:
proxyFactoryBeanOutput - Should the output of a FactoryBean be proxied instead of the factory itself?


Copyright © 2005-2011 ELCA. All Rights Reserved.