com.interface21.aop.framework
Class ProxyFactoryBean
java.lang.Object
|
+--com.interface21.aop.framework.DefaultProxyConfig
|
+--com.interface21.aop.framework.ProxyFactoryBean
- All Implemented Interfaces:
- FactoryBean, InitializingBean, Lifecycle, ProxyConfig
- public class ProxyFactoryBean
- extends DefaultProxyConfig
- implements FactoryBean, Lifecycle
FactoryBean implementation for use to source AOP proxies from a Spring BeanFactory.
Interceptors are identified by a list of bean names in the current bean factory.
These beans should be of type Interceptor or MethodPointcut. The last entry in
the list can be the name of any bean in the factory. If it's neither an Interceptor
or a MethodPointcut, a new InvokerInterceptor is added to wrap it.
Global interceptors can be added at the factory level. The specified ones are
expanded in an interceptor list where an "xxx*" entry is included in the list,
matching the given prefix with the bean names (e.g. "global*" would match both
"globalBean1" and "globalBean2", "*" all defined interceptors). The matching
interceptors get applied according to their returned order value, if they
implement the Ordered interface. An interceptor name list may not conclude
with a global "xxx*" pattern, as global interceptors cannot invoke targets.
- Version:
- $Id: ProxyFactoryBean.java,v 1.6 2003/06/13 17:08:37 jhoeller Exp $
- Author:
- Rod Johnson
|
Field Summary |
static java.lang.String |
GLOBAL_SUFFIX
This suffix in a value in an interceptor list indicates to expand globals. |
|
Method Summary |
java.lang.Object |
getObject()
Return a proxy. |
PropertyValues |
getPropertyValues()
This factory doesn't support pass through properties. |
boolean |
isSingleton()
Is the bean managed by this factory a singleton
or a prototype? |
void |
setBeanFactory(BeanFactory beanFactory)
Lifecycle callback beans used in a BeanFactory can
implement to receive callbacks exposing the factory itself.
|
void |
setInterceptorNames(java.lang.String[] interceptorNames)
Set the list of Interceptor/MethodPointcut bean names. |
void |
setProxyInterfaces(java.lang.String[] interfaceNames)
Set the name of the interface we're proxying |
void |
setSingleton(boolean singleton)
Set the value of the singleton property. |
| Methods inherited from class com.interface21.aop.framework.DefaultProxyConfig |
addInterceptor, addInterceptor, addInterface, addMethodPointcut, addMethodPointcut, afterPropertiesSet, countInterceptorsOfType, getAttributeRegistry, getExposeInvocation, getMethodPointcuts, getProxiedInterfaces, getTarget, interceptorIncluded, removeInterceptor, removeInterface, replaceMethodPointcut, setAttributeRegistry, setExposeInvocation, setInterfaces |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GLOBAL_SUFFIX
public static final java.lang.String GLOBAL_SUFFIX
- This suffix in a value in an interceptor list indicates to expand globals.
ProxyFactoryBean
public ProxyFactoryBean()
setProxyInterfaces
public void setProxyInterfaces(java.lang.String[] interfaceNames)
throws org.aopalliance.AspectException,
java.lang.ClassNotFoundException
- Set the name of the interface we're proxying
setInterceptorNames
public void setInterceptorNames(java.lang.String[] interceptorNames)
- Set the list of Interceptor/MethodPointcut bean names. This must
always be set to use this factory bean in a bean factory.
setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)
- Description copied from interface:
Lifecycle
- Lifecycle callback beans used in a BeanFactory can
implement to receive callbacks exposing the factory itself.
This enables them to obtain other beans from the factory.
If the bean also implements InitializingBean, Lifecycle methods
will be invoked after the afterPropertiesSet
method.
- Specified by:
setBeanFactory in interface Lifecycle
- See Also:
Lifecycle.setBeanFactory(com.interface21.beans.factory.BeanFactory)
getObject
public java.lang.Object getObject()
throws BeansException
- Return a proxy. Invoked when clients obtain beans
from this factory bean.
- Specified by:
getObject in interface FactoryBean
- See Also:
FactoryBean.getObject()
getPropertyValues
public PropertyValues getPropertyValues()
- This factory doesn't support pass through properties.
- Specified by:
getPropertyValues in interface FactoryBean
- See Also:
FactoryBean.getPropertyValues()
isSingleton
public boolean isSingleton()
- Description copied from interface:
FactoryBean
- Is the bean managed by this factory a singleton
or a prototype? That is, will getBean() always
return the same object?
The singleton status of a FactoryBean will generally
be provided by the owning BeanFactory.
- Specified by:
isSingleton in interface FactoryBean
- See Also:
FactoryBean.isSingleton()
setSingleton
public void setSingleton(boolean singleton)
- Set the value of the singleton property. Governs whether this factory
should always return the same proxy instance (which implies the same target)
or whether it should return a new prototype instance, which implies that
the target and interceptors may be new instances also, if they are obtained
from prototype bean definitions.
This allows for fine control of independence/uniqueness in the object graph.
- Parameters:
singleton -
Rod Johnson and Spring contributors 2001-2003.