Source Code Cross Referenced for JoiningNullTransactionManagerImpl.java in  » Database-ORM » ODAL » com » completex » objective » components » persistency » transact » impl » 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 » Database ORM » ODAL » com.completex.objective.components.persistency.transact.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.completex.objective.components.persistency.transact.impl;
002:
003:        import com.completex.objective.components.persistency.OdalPersistencyException;
004:        import com.completex.objective.components.persistency.transact.Transaction;
005:        import com.completex.objective.components.persistency.transact.TransactionManager;
006:        import com.completex.objective.components.OdalRuntimeException;
007:
008:        import java.sql.SQLException;
009:
010:        /**
011:         * Transaction manager implementation that always joins current transaction if it exists and
012:         * never commits or rolls back.
013:         *
014:         * @author Gennady Krizhevsky
015:         */
016:        public class JoiningNullTransactionManagerImpl implements 
017:                TransactionManager {
018:
019:            private final TransactionManager coreTransactionManager;
020:
021:            public JoiningNullTransactionManagerImpl(
022:                    TransactionManager coreTransactionManager) {
023:                this .coreTransactionManager = coreTransactionManager;
024:            }
025:
026:            /**
027:             * If transaction exists - returns new instance of JoiningNullTransactionImpl that is
028:             * wrapper for "real" current transaction
029:             *
030:             * @return current transaction
031:             * @throws OdalPersistencyException if no current transaction found
032:             */
033:            public Transaction begin() throws SQLException {
034:                Transaction transaction = getCurrentCoreTransactionSafe();
035:                return newTransaction(transaction);
036:            }
037:
038:            private JoiningNullTransactionImpl newTransaction(
039:                    Transaction transaction) {
040:                return new JoiningNullTransactionImpl(transaction);
041:            }
042:
043:            /**
044:             * Does nothing
045:             */
046:            public void commit(Transaction transaction) throws SQLException {
047:            }
048:
049:            /**
050:             * Does nothing
051:             */
052:            public void rollback(Transaction transaction) throws SQLException {
053:            }
054:
055:            /**
056:             * Does nothing
057:             */
058:            public void rollbackSilently(Transaction transaction) {
059:            }
060:
061:            /**
062:             * Does nothing
063:             */
064:            public void release(Transaction transaction) throws SQLException {
065:                // Do nothing
066:            }
067:
068:            public Transaction beginUnchecked() {
069:                try {
070:                    return begin();
071:                } catch (SQLException e) {
072:                    throw new OdalRuntimeException(e.getClass().getName()
073:                            + ": " + e.getMessage());
074:                }
075:            }
076:
077:            public void commitUnchecked(Transaction transaction) {
078:                try {
079:                    commit(transaction);
080:                } catch (SQLException e) {
081:                    throw new OdalRuntimeException(e.getClass().getName()
082:                            + ": " + e.getMessage());
083:                }
084:            }
085:
086:            public void rollbackUnchecked(Transaction transaction) {
087:                try {
088:                    rollback(transaction);
089:                } catch (SQLException e) {
090:                    throw new OdalRuntimeException(e.getClass().getName()
091:                            + ": " + e.getMessage());
092:                }
093:            }
094:
095:            public void releaseUnchecked(Transaction transaction) {
096:                try {
097:                    release(transaction);
098:                } catch (SQLException e) {
099:                    throw new OdalRuntimeException(e.getClass().getName()
100:                            + ": " + e.getMessage());
101:                }
102:            }
103:
104:            /**
105:             * Does nothing
106:             */
107:            public void shutdown() {
108:                // Do nothing
109:            }
110:
111:            /**
112:             * No guarantee that the method returns the same instance as was receive with begin() method
113:             * since Current Transaction is just a wrapper for the "real" one
114:             *
115:             * @see com.completex.objective.components.persistency.transact.TransactionManager#getCurrentTransaction()
116:             */
117:            public Transaction getCurrentTransaction() {
118:                Transaction coreTransaction = coreTransactionManager
119:                        .getCurrentTransaction();
120:                return coreTransaction == null ? null
121:                        : newTransaction(coreTransaction);
122:            }
123:
124:            public boolean hasCurrentTransaction() {
125:                return coreTransactionManager.hasCurrentTransaction();
126:            }
127:
128:            private Transaction getCurrentCoreTransactionSafe()
129:                    throws OdalPersistencyException {
130:                Transaction currentTransaction = coreTransactionManager
131:                        .getCurrentTransaction();
132:                if (currentTransaction == null) {
133:                    throw new OdalPersistencyException(
134:                            "No currentTransaction found: open transaction first");
135:                }
136:                return currentTransaction;
137:            }
138:
139:        }
ww___w__._j___a___v_a__2s___._c_o___m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.