Java Doc for TransactionAspectSupport.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) 


java.lang.Object
   org.springframework.transaction.interceptor.TransactionAspectSupport

All known Subclasses:   org.springframework.transaction.interceptor.TransactionInterceptor,
TransactionAspectSupport
abstract public class TransactionAspectSupport implements InitializingBean(Code)
Base class for transactional aspects, such as the AOP Alliance TransactionInterceptor or an AspectJ aspect.

This enables the underlying Spring transaction infrastructure to be used easily to implement an aspect for any aspect system.

Subclasses are responsible for calling methods in this class in the correct order.

If no transaction name has been specified in the TransactionAttribute, the exposed name will be the fully-qualified class name + "." + method name (by default).

Uses the Strategy design pattern. A PlatformTransactionManager implementation will perform the actual transaction management, and a TransactionAttributeSource is used for determining transaction definitions.

A transaction aspect is serializable if it's PlatformTransactionManager and TransactionAttributeSource are serializable.
author:
   Rod Johnson
author:
   Juergen Hoeller
since:
   1.1
See Also:   TransactionAspectSupport.setTransactionManager
See Also:   TransactionAspectSupport.setTransactionAttributes
See Also:   TransactionAspectSupport.setTransactionAttributeSource


Inner Class :protected class TransactionInfo

Field Summary
final protected  Loglogger
    


Method Summary
public  voidafterPropertiesSet()
     Check that required properties were set.
protected  voidcleanupTransactionInfo(TransactionInfo txInfo)
     Reset the TransactionInfo ThreadLocal.
protected  voidcommitTransactionAfterReturning(TransactionInfo txInfo)
     Execute after successful completion of call, but not after an exception was handled.
protected  voidcompleteTransactionAfterThrowing(TransactionInfo txInfo, Throwable ex)
     Handle a throwable, completing the transaction.
protected  TransactionInfocreateTransactionIfNecessary(Method method, Class targetClass)
     Create a transaction if necessary, based on the given method and class.
protected  TransactionInfocreateTransactionIfNecessary(TransactionAttribute txAttr, String joinpointIdentification)
     Create a transaction if necessary based on the given TransactionAttribute.
protected static  TransactionInfocurrentTransactionInfo()
     Subclasses can use this to return the current TransactionInfo.
public static  TransactionStatuscurrentTransactionStatus()
     Return the transaction status of the current method invocation.
public  TransactionAttributeSourcegetTransactionAttributeSource()
     Return the transaction attribute source.
public  PlatformTransactionManagergetTransactionManager()
     Return the transaction manager.
protected  StringmethodIdentification(Method method)
     Convenience method to return a String representation of this Method for use in logging.
protected  TransactionInfoprepareTransactionInfo(TransactionAttribute txAttr, String joinpointIdentification, TransactionStatus status)
     Prepare a TransactionInfo for the given attribute and status object.
public  voidsetTransactionAttributeSource(TransactionAttributeSource transactionAttributeSource)
     Set the transaction attribute source which is used to find transaction attributes.
public  voidsetTransactionAttributeSources(TransactionAttributeSource[] transactionAttributeSources)
     Set multiple transaction attribute sources which are 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.

Field Detail
logger
final protected Log logger(Code)





Method Detail
afterPropertiesSet
public void afterPropertiesSet()(Code)
Check that required properties were set.



cleanupTransactionInfo
protected void cleanupTransactionInfo(TransactionInfo txInfo)(Code)
Reset the TransactionInfo ThreadLocal.

Call this in all cases: exception or normal return!
Parameters:
  txInfo - information about the current transaction (may be null)




commitTransactionAfterReturning
protected void commitTransactionAfterReturning(TransactionInfo txInfo)(Code)
Execute after successful completion of call, but not after an exception was handled. Do nothing if we didn't create a transaction.
Parameters:
  txInfo - information about the current transaction



completeTransactionAfterThrowing
protected void completeTransactionAfterThrowing(TransactionInfo txInfo, Throwable ex)(Code)
Handle a throwable, completing the transaction. We may commit or roll back, depending on the configuration.
Parameters:
  txInfo - information about the current transaction
Parameters:
  ex - throwable encountered



createTransactionIfNecessary
protected TransactionInfo createTransactionIfNecessary(Method method, Class targetClass)(Code)
Create a transaction if necessary, based on the given method and class.

Performs a default TransactionAttribute lookup for the given method.
Parameters:
  method - method about to execute
Parameters:
  targetClass - class the method is on a TransactionInfo object, whether or not a transaction was created.The hasTransaction() method on TransactionInfo can be used to tell if therewas a transaction created.
See Also:   TransactionAspectSupport.getTransactionAttributeSource()




createTransactionIfNecessary
protected TransactionInfo createTransactionIfNecessary(TransactionAttribute txAttr, String joinpointIdentification)(Code)
Create a transaction if necessary based on the given TransactionAttribute.

Allows callers to perform custom TransactionAttribute lookups through the TransactionAttributeSource.
Parameters:
  txAttr - the TransactionAttribute (may be null)
Parameters:
  joinpointIdentification - the fully qualified method name(used for monitoring and logging purposes) a TransactionInfo object, whether or not a transaction was created.The hasTransaction() method on TransactionInfo can be used totell if there was a transaction created.
See Also:   TransactionAspectSupport.getTransactionAttributeSource()




currentTransactionInfo
protected static TransactionInfo currentTransactionInfo() throws NoTransactionException(Code)
Subclasses can use this to return the current TransactionInfo. Only subclasses that cannot handle all operations in one method, such as an AspectJ aspect involving distinct before and after advice, need to use this mechanism to get at the current TransactionInfo. An around advice such as an AOP Alliance MethodInterceptor can hold a reference to the TransactionInfo throughout the aspect method.

A TransactionInfo will be returned even if no transaction was created. The TransactionInfo.hasTransaction() method can be used to query this.

To find out about specific transaction characteristics, consider using TransactionSynchronizationManager's isSynchronizationActive() and/or isActualTransactionActive() methods. TransactionInfo bound to this thread, or null if none
See Also:   TransactionInfo.hasTransaction
See Also:   org.springframework.transaction.support.TransactionSynchronizationManager.isSynchronizationActive
See Also:   org.springframework.transaction.support.TransactionSynchronizationManager.isActualTransactionActive




currentTransactionStatus
public static TransactionStatus currentTransactionStatus() throws NoTransactionException(Code)
Return the transaction status of the current method invocation. Mainly intended for code that wants to set the current transaction rollback-only but not throw an application exception.
throws:
  NoTransactionException - if the transaction info cannot be found,because the method was invoked outside an AOP invocation context



getTransactionAttributeSource
public TransactionAttributeSource getTransactionAttributeSource()(Code)
Return the transaction attribute source.



getTransactionManager
public PlatformTransactionManager getTransactionManager()(Code)
Return the transaction manager.



methodIdentification
protected String methodIdentification(Method method)(Code)
Convenience method to return a String representation of this Method for use in logging. Can be overridden in subclasses to provide a different identifier for the given method.
Parameters:
  method - the method we're interested in log message identifying this method
See Also:   org.springframework.util.ClassUtils.getQualifiedMethodName



prepareTransactionInfo
protected TransactionInfo prepareTransactionInfo(TransactionAttribute txAttr, String joinpointIdentification, TransactionStatus status)(Code)
Prepare a TransactionInfo for the given attribute and status object.
Parameters:
  txAttr - the TransactionAttribute (may be null)
Parameters:
  joinpointIdentification - the fully qualified method name(used for monitoring and logging purposes)
Parameters:
  status - the TransactionStatus for the current transaction the prepared TransactionInfo object



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:   TransactionAttributeSourceEditor
See Also:   MethodMapTransactionAttributeSource
See Also:   NameMatchTransactionAttributeSource
See Also:   AttributesTransactionAttributeSource
See Also:   org.springframework.transaction.annotation.AnnotationTransactionAttributeSource



setTransactionAttributeSources
public void setTransactionAttributeSources(TransactionAttributeSource[] transactionAttributeSources)(Code)
Set multiple transaction attribute sources which are used to find transaction attributes. Will build a CompositeTransactionAttributeSource for the given sources.
See Also:   CompositeTransactionAttributeSource
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:   TransactionAspectSupport.setTransactionAttributeSource
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.



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.