Java Doc for TransactionProxyFactoryBean.java in  » J2EE » spring-framework-2.5 » org » springframework » transaction » interceptor » 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.5 » org.springframework.transaction.interceptor 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.springframework.aop.framework.AbstractSingletonProxyFactoryBean
   org.springframework.transaction.interceptor.TransactionProxyFactoryBean

TransactionProxyFactoryBean
public class TransactionProxyFactoryBean extends AbstractSingletonProxyFactoryBean implements FactoryBean,BeanFactoryAware(Code)
Proxy factory bean for simplified declarative transaction handling. This is a convenient alternative to a standard AOP org.springframework.aop.framework.ProxyFactoryBean with a separate TransactionInterceptor definition.

This class is intended to cover the typical case of declarative transaction demarcation: namely, wrapping a singleton target object with a transactional proxy, proxying all the interfaces that the target implements.

There are three main properties that need to be specified:

If the "transactionManager" property is not set explicitly and this FactoryBean is running in a ListableBeanFactory , a single matching bean of type PlatformTransactionManager will be fetched from the BeanFactory .

In contrast to TransactionInterceptor , the transaction attributes are specified as properties, with method names as keys and transaction attribute descriptors as values. Method names are always applied to the target class.

Internally, a TransactionInterceptor instance is used, but the user of this class does not have to care. Optionally, a method pointcut can be specified to cause conditional invocation of the underlying TransactionInterceptor .

The "preInterceptors" and "postInterceptors" properties can be set to add additional interceptors to the mix, like org.springframework.aop.interceptor.PerformanceMonitorInterceptor or org.springframework.orm.hibernate3.HibernateInterceptor / org.springframework.orm.jdo.JdoInterceptor .

HINT: This class is often used with parent / child bean definitions. Typically, you will define the transaction manager and default transaction attributes (for method name patterns) in an abstract parent bean definition, deriving concrete child bean definitions for specific target objects. This reduces the per-bean definition effort to a minimum.

 <bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
 abstract="true">
 <property name="transactionManager" ref="transactionManager"/>
 <property name="transactionAttributes">
 <props>
 <prop key="insert*">PROPAGATION_REQUIRED</prop>
 <prop key="update*">PROPAGATION_REQUIRED</prop>
 <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
 </props>
 </property>
 </bean>
 <bean id="myProxy" parent="baseTransactionProxy">
 <property name="target" ref="myTarget"/>
 </bean>
 <bean id="yourProxy" parent="baseTransactionProxy">
 <property name="target" ref="yourTarget"/>
 </bean>

author:
   Juergen Hoeller
author:
   Dmitriy Kopylenko
author:
   Rod Johnson
since:
   21.08.2003
See Also:   TransactionProxyFactoryBean.setTransactionManager
See Also:   TransactionProxyFactoryBean.setTarget
See Also:   TransactionProxyFactoryBean.setTransactionAttributes
See Also:   TransactionInterceptor
See Also:   org.springframework.aop.framework.ProxyFactoryBean




Method Summary
protected  ObjectcreateMainInterceptor()
     Creates an advisor for this FactoryBean's TransactionInterceptor.
public  voidsetBeanFactory(BeanFactory beanFactory)
     This callback is optional: If running in a BeanFactory and no transaction manager has been set explicitly, a single matching bean of type PlatformTransactionManager will be fetched from the BeanFactory.
public  voidsetPointcut(Pointcut pointcut)
     Set a pointcut, i.e a bean that can cause conditional invocation of the TransactionInterceptor depending on method and attributes passed.
public  voidsetTransactionAttributeSource(TransactionAttributeSource transactionAttributeSource)
     Set the transaction attribute source which is used to find transaction attributes.
public  voidsetTransactionAttributes(Properties transactionAttributes)
     Set properties with method names as keys and transaction attribute descriptors (parsed via TransactionAttributeEditor) as values: e.g.
public  voidsetTransactionManager(PlatformTransactionManager transactionManager)
     Set the transaction manager.



Method Detail
createMainInterceptor
protected Object createMainInterceptor()(Code)
Creates an advisor for this FactoryBean's TransactionInterceptor.



setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)(Code)
This callback is optional: If running in a BeanFactory and no transaction manager has been set explicitly, a single matching bean of type PlatformTransactionManager will be fetched from the BeanFactory.
See Also:   org.springframework.beans.factory.BeanFactoryUtils.beanOfTypeIncludingAncestors
See Also:   org.springframework.transaction.PlatformTransactionManager



setPointcut
public void setPointcut(Pointcut pointcut)(Code)
Set a pointcut, i.e a bean that can cause conditional invocation of the TransactionInterceptor depending on method and attributes passed. Note: Additional interceptors are always invoked.
See Also:   TransactionProxyFactoryBean.setPreInterceptors
See Also:   TransactionProxyFactoryBean.setPostInterceptors



setTransactionAttributeSource
public void setTransactionAttributeSource(TransactionAttributeSource transactionAttributeSource)(Code)
Set the transaction attribute source which is used to find transaction attributes. If specifying a String property value, a PropertyEditor will create a MethodMapTransactionAttributeSource from the value.
See Also:   TransactionProxyFactoryBean.setTransactionAttributes
See Also:   TransactionInterceptor.setTransactionAttributeSource
See Also:   TransactionAttributeSourceEditor
See Also:   MethodMapTransactionAttributeSource
See Also:   NameMatchTransactionAttributeSource
See Also:   AttributesTransactionAttributeSource
See Also:   org.springframework.transaction.annotation.AnnotationTransactionAttributeSource



setTransactionAttributes
public void setTransactionAttributes(Properties transactionAttributes)(Code)
Set properties with method names as keys and transaction attribute descriptors (parsed via TransactionAttributeEditor) as values: e.g. key = "myMethod", value = "PROPAGATION_REQUIRED,readOnly".

Note: Method names are always applied to the target class, no matter if defined in an interface or the class itself.

Internally, a NameMatchTransactionAttributeSource will be created from the given properties.
See Also:   TransactionProxyFactoryBean.setTransactionAttributeSource
See Also:   TransactionInterceptor.setTransactionAttributes
See Also:   TransactionAttributeEditor
See Also:   NameMatchTransactionAttributeSource




setTransactionManager
public void setTransactionManager(PlatformTransactionManager transactionManager)(Code)
Set the transaction manager. This will perform actual transaction management: This class is just a way of invoking it.
See Also:   TransactionInterceptor.setTransactionManager



Methods inherited from org.springframework.aop.framework.AbstractSingletonProxyFactoryBean
public void afterPropertiesSet()(Code)(Java Doc)
abstract protected Object createMainInterceptor()(Code)(Java Doc)
protected TargetSource createTargetSource(Object target)(Code)(Java Doc)
public Object getObject()(Code)(Java Doc)
public Class getObjectType()(Code)(Java Doc)
protected Object getProxy(AopProxy aopProxy)(Code)(Java Doc)
final public boolean isSingleton()(Code)(Java Doc)
public void setAdvisorAdapterRegistry(AdvisorAdapterRegistry advisorAdapterRegistry)(Code)(Java Doc)
public void setBeanClassLoader(ClassLoader classLoader)(Code)(Java Doc)
public void setPostInterceptors(Object[] postInterceptors)(Code)(Java Doc)
public void setPreInterceptors(Object[] preInterceptors)(Code)(Java Doc)
public void setProxyInterfaces(Class[] proxyInterfaces)(Code)(Java Doc)
public void setTarget(Object target)(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.