Java Doc for ProxyFactoryBean.java in  » J2EE » spring-framework-2.0.6 » org » springframework » aop » framework » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.0.6 » org.springframework.aop.framework 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.aop.framework.ProxyConfig
      org.springframework.aop.framework.AdvisedSupport
         org.springframework.aop.framework.ProxyCreatorSupport
            org.springframework.aop.framework.ProxyFactoryBean

ProxyFactoryBean
public class ProxyFactoryBean extends ProxyCreatorSupport implements FactoryBean,BeanClassLoaderAware,BeanFactoryAware(Code)
org.springframework.beans.factory.FactoryBean implementation that builds an AOP proxy based on beans in Spring org.springframework.beans.factory.BeanFactory .

org.aopalliance.intercept.MethodInterceptor MethodInterceptors and org.springframework.aop.Advisor Advisors are identified by a list of bean names in the current bean factory, specified through the "interceptorNames" property. The last entry in the list can be the name of a target bean or a org.springframework.aop.TargetSource ; however, it is normally preferable to use the "targetName"/"target"/"targetSource" properties instead.

Global interceptors and advisors 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 org.springframework.core.Ordered interface.

Creates a JDK proxy when proxy interfaces are given, and a CGLIB proxy for the actual target class if not. Note that the latter will only work if the target class does not have final methods, as a dynamic subclass will be created at runtime.

It's possible to cast a proxy obtained from this factory to Advised , or to obtain the ProxyFactoryBean reference and programmatically manipulate it. This won't work for existing prototype references, which are independent. However, it will work for prototypes subsequently obtained from the factory. Changes to interception will work immediately on singletons (including existing references). However, to change interfaces or target it's necessary to obtain a new instance from the factory. This means that singleton instances obtained from the factory do not have the same object identity. However, they do have the same interceptors and target, and changing any reference will change all objects.
author:
   Rod Johnson
author:
   Juergen Hoeller
See Also:   ProxyFactoryBean.setInterceptorNames
See Also:   ProxyFactoryBean.setProxyInterfaces
See Also:   org.aopalliance.intercept.MethodInterceptor
See Also:   org.springframework.aop.Advisor
See Also:   Advised



Field Summary
final public static  StringGLOBAL_SUFFIX
     This suffix in a value in an interceptor list indicates to expand globals.
final protected  Loglogger
    


Method Summary
protected  voidadviceChanged()
     Blow away and recache singleton on an advice change.
protected  ClasscreateCompositeInterface(Class[] interfaces)
     Create a composite interface Class for the given interfaces, implementing the given interfaces in one single Class.
public  ObjectgetObject()
     Return a proxy.
public  ClassgetObjectType()
     Return the type of the proxy.
protected  ObjectgetProxy(AopProxy aopProxy)
     Return the proxy object to expose.

The default implementation uses a getProxy call with the factory's bean class loader.

public  booleanisSingleton()
    
public  voidsetAdvisorAdapterRegistry(AdvisorAdapterRegistry advisorAdapterRegistry)
     Specify the AdvisorAdapterRegistry to use.
public  voidsetAutodetectInterfaces(boolean autodetectInterfaces)
     Set whether to autodetect proxy interfaces if none specified.

Default is "true".

public  voidsetBeanClassLoader(ClassLoader classLoader)
    
public  voidsetBeanFactory(BeanFactory beanFactory)
    
public  voidsetFrozen(boolean frozen)
    
public  voidsetInterceptorNames(String[] interceptorNames)
     Set the list of Advice/Advisor bean names.
public  voidsetProxyInterfaces(Class[] proxyInterfaces)
     Set the names of the interfaces we're proxying.
public  voidsetSingleton(boolean singleton)
     Set the value of the singleton property.
public  voidsetTargetName(String targetName)
     Set the name of the target bean.

Field Detail
GLOBAL_SUFFIX
final public static String GLOBAL_SUFFIX(Code)
This suffix in a value in an interceptor list indicates to expand globals.



logger
final protected Log logger(Code)





Method Detail
adviceChanged
protected void adviceChanged()(Code)
Blow away and recache singleton on an advice change.



createCompositeInterface
protected Class createCompositeInterface(Class[] interfaces)(Code)
Create a composite interface Class for the given interfaces, implementing the given interfaces in one single Class.

The default implementation builds a JDK proxy class for the given interfaces.
Parameters:
  interfaces - the interfaces to merge the merged interface as Class
See Also:   java.lang.reflect.Proxy.getProxyClass




getObject
public Object getObject() throws BeansException(Code)
Return a proxy. Invoked when clients obtain beans from this factory bean. Create an instance of the AOP proxy to be returned by this factory. The instance will be cached for a singleton, and create on each call to getObject() for a proxy. a fresh AOP proxy reflecting the current state of this factory



getObjectType
public Class getObjectType()(Code)
Return the type of the proxy. Will check the singleton instance if already created, else fall back to the proxy interface (in case of just a single one), the target bean type, or the TargetSource's target class.
See Also:   org.springframework.aop.TargetSource.getTargetClass



getProxy
protected Object getProxy(AopProxy aopProxy)(Code)
Return the proxy object to expose.

The default implementation uses a getProxy call with the factory's bean class loader. Can be overridden to specify a custom class loader.
Parameters:
  aopProxy - the prepared AopProxy instance to get the proxy from the proxy object to expose
See Also:   AopProxy.getProxy(ClassLoader)




isSingleton
public boolean isSingleton()(Code)



setAdvisorAdapterRegistry
public void setAdvisorAdapterRegistry(AdvisorAdapterRegistry advisorAdapterRegistry)(Code)
Specify the AdvisorAdapterRegistry to use. Default is the global AdvisorAdapterRegistry.
See Also:   org.springframework.aop.framework.adapter.GlobalAdvisorAdapterRegistry



setAutodetectInterfaces
public void setAutodetectInterfaces(boolean autodetectInterfaces)(Code)
Set whether to autodetect proxy interfaces if none specified.

Default is "true". Turn this flag off to create a CGLIB proxy for the full target class if no interfaces specified.
See Also:   ProxyFactoryBean.setProxyTargetClass




setBeanClassLoader
public void setBeanClassLoader(ClassLoader classLoader)(Code)



setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)(Code)



setFrozen
public void setFrozen(boolean frozen)(Code)



setInterceptorNames
public void setInterceptorNames(String[] interceptorNames)(Code)
Set the list of Advice/Advisor bean names. This must always be set to use this factory bean in a bean factory.

The referenced beans should be of type Interceptor, Advisor or Advice The last entry in the list can be the name of any bean in the factory. If it's neither an Advice nor an Advisor, a new SingletonTargetSource is added to wrap it. Such a target bean cannot be used if the "target" or "targetSource" or "targetName" property is set, in which case the "interceptorNames" array must contain only Advice/Advisor bean names.
See Also:   org.aopalliance.intercept.MethodInterceptor
See Also:   org.springframework.aop.Advisor
See Also:   org.aopalliance.aop.Advice
See Also:   org.springframework.aop.target.SingletonTargetSource




setProxyInterfaces
public void setProxyInterfaces(Class[] proxyInterfaces) throws ClassNotFoundException(Code)
Set the names of the interfaces we're proxying. If no interface is given, a CGLIB for the actual class will be created.

This is essentially equivalent to the "setInterfaces" method, but mirrors TransactionProxyFactoryBean's "setProxyInterfaces".
See Also:   ProxyFactoryBean.setInterfaces
See Also:   AbstractSingletonProxyFactoryBean.setProxyInterfaces




setSingleton
public void setSingleton(boolean singleton)(Code)
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.



setTargetName
public void setTargetName(String targetName)(Code)
Set the name of the target bean. This is an alternative to specifying the target name at the end of the "interceptorNames" array.

You can also specify a target object or a TargetSource object directly, via the "target"/"targetSource" property, respectively.
See Also:   ProxyFactoryBean.setInterceptorNames(String[])
See Also:   ProxyFactoryBean.setTarget(Object)
See Also:   ProxyFactoryBean.setTargetSource(org.springframework.aop.TargetSource)




Methods inherited from org.springframework.aop.framework.ProxyCreatorSupport
public void addListener(AdvisedSupportListener listener)(Code)(Java Doc)
protected void adviceChanged()(Code)(Java Doc)
final protected synchronized AopProxy createAopProxy()(Code)(Java Doc)
public AopProxyFactory getAopProxyFactory()(Code)(Java Doc)
final protected synchronized boolean isActive()(Code)(Java Doc)
public void removeListener(AdvisedSupportListener listener)(Code)(Java Doc)
public void setAopProxyFactory(AopProxyFactory aopProxyFactory)(Code)(Java Doc)

Fields inherited from org.springframework.aop.framework.AdvisedSupport
final public static TargetSource EMPTY_TARGET_SOURCE(Code)(Java Doc)
transient AdvisorChainFactory advisorChainFactory(Code)(Java Doc)
TargetSource targetSource(Code)(Java Doc)

Methods inherited from org.springframework.aop.framework.AdvisedSupport
public void addAdvice(Advice advice) throws AopConfigException(Code)(Java Doc)
public void addAdvice(int pos, Advice advice) throws AopConfigException(Code)(Java Doc)
public void addAdvisor(Advisor advisor)(Code)(Java Doc)
public void addAdvisor(int pos, Advisor advisor) throws AopConfigException(Code)(Java Doc)
public void addAllAdvisors(Advisor[] advisors)(Code)(Java Doc)
public void addInterface(Class intf)(Code)(Java Doc)
protected void adviceChanged()(Code)(Java Doc)
public boolean adviceIncluded(Advice advice)(Code)(Java Doc)
protected void copyConfigurationFrom(AdvisedSupport other)(Code)(Java Doc)
protected void copyConfigurationFrom(AdvisedSupport other, TargetSource targetSource, List advisors)(Code)(Java Doc)
public int countAdvicesOfType(Class adviceClass)(Code)(Java Doc)
public AdvisorChainFactory getAdvisorChainFactory()(Code)(Java Doc)
final public Advisor[] getAdvisors()(Code)(Java Doc)
final protected List getAdvisorsInternal()(Code)(Java Doc)
public List getInterceptorsAndDynamicInterceptionAdvice(Method method, Class targetClass)(Code)(Java Doc)
public Class[] getProxiedInterfaces()(Code)(Java Doc)
public Class getTargetClass()(Code)(Java Doc)
public TargetSource getTargetSource()(Code)(Java Doc)
public int indexOf(Advisor advisor)(Code)(Java Doc)
public int indexOf(Advice advice)(Code)(Java Doc)
public boolean isInterfaceProxied(Class intf)(Code)(Java Doc)
public boolean removeAdvice(Advice advice) throws AopConfigException(Code)(Java Doc)
public boolean removeAdvisor(Advisor advisor)(Code)(Java Doc)
public void removeAdvisor(int index) throws AopConfigException(Code)(Java Doc)
public boolean removeInterface(Class intf)(Code)(Java Doc)
public boolean replaceAdvisor(Advisor a, Advisor b) throws AopConfigException(Code)(Java Doc)
public void setAdvisorChainFactory(AdvisorChainFactory advisorChainFactory)(Code)(Java Doc)
public void setInterfaces(Class[] interfaces)(Code)(Java Doc)
public void setTarget(Object target)(Code)(Java Doc)
public void setTargetClass(Class targetClass)(Code)(Java Doc)
public void setTargetSource(TargetSource targetSource)(Code)(Java Doc)
public String toProxyConfigString()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final protected void updateAdvisorArray()(Code)(Java Doc)
protected Object writeReplace()(Code)(Java Doc)

Fields inherited from org.springframework.aop.framework.ProxyConfig
boolean exposeProxy(Code)(Java Doc)
boolean opaque(Code)(Java Doc)

Methods inherited from org.springframework.aop.framework.ProxyConfig
public void copyFrom(ProxyConfig other)(Code)(Java Doc)
public boolean isExposeProxy()(Code)(Java Doc)
public boolean isFrozen()(Code)(Java Doc)
public boolean isOpaque()(Code)(Java Doc)
public boolean isOptimize()(Code)(Java Doc)
public boolean isProxyTargetClass()(Code)(Java Doc)
public void setExposeProxy(boolean exposeProxy)(Code)(Java Doc)
public void setFrozen(boolean frozen)(Code)(Java Doc)
public void setOpaque(boolean opaque)(Code)(Java Doc)
public void setOptimize(boolean optimize)(Code)(Java Doc)
public void setProxyTargetClass(boolean proxyTargetClass)(Code)(Java Doc)
public String toString()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.