Source Code Cross Referenced for AbstractClientTransaction.java in  » Net » Terracotta » com » tc » object » tx » 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 » Net » Terracotta » com.tc.object.tx 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003:         * notice. All rights reserved.
004:         */
005:        package com.tc.object.tx;
006:
007:        import com.tc.object.ObjectID;
008:        import com.tc.object.TCObject;
009:        import com.tc.object.lockmanager.api.LockID;
010:        import com.tc.util.SequenceID;
011:
012:        /**
013:         * Base class for client transaction implementations
014:         */
015:        abstract class AbstractClientTransaction implements  ClientTransaction {
016:
017:            private SequenceID seqID = SequenceID.NULL_ID;
018:            private final TransactionID txID;
019:            private TransactionContext transactionContext;
020:            private boolean alreadyCommittedFlag;
021:
022:            AbstractClientTransaction(TransactionID txID) {
023:                this .txID = txID;
024:            }
025:
026:            public synchronized void setSequenceID(SequenceID sequenceID) {
027:                if (!seqID.isNull())
028:                    throw new AssertionError(
029:                            "Attempt to set sequence id more than once.");
030:                if (sequenceID == null || sequenceID.isNull())
031:                    throw new AssertionError(
032:                            "Attempt to set sequence id to null: " + sequenceID);
033:                this .seqID = sequenceID;
034:            }
035:
036:            public synchronized SequenceID getSequenceID() {
037:                return this .seqID;
038:            }
039:
040:            public void setTransactionContext(
041:                    TransactionContext transactionContext) {
042:                this .transactionContext = transactionContext;
043:            }
044:
045:            public TxnType getTransactionType() {
046:                return transactionContext.getType();
047:            }
048:
049:            public LockID[] getAllLockIDs() {
050:                return transactionContext.getAllLockIDs();
051:            }
052:
053:            public TransactionID getTransactionID() {
054:                return txID;
055:            }
056:
057:            public LockID getLockID() {
058:                return transactionContext.getLockID();
059:            }
060:
061:            public final void createObject(TCObject source) {
062:                if (transactionContext.getType() == TxnType.READ_ONLY) {
063:                    throw new AssertionError(source.getClass().getName()
064:                            + " was already checked to have write access!");
065:                }
066:                alreadyCommittedCheck();
067:                basicCreate(source);
068:            }
069:
070:            public final void createRoot(String name, ObjectID rootID) {
071:                if (transactionContext.getType() == TxnType.READ_ONLY) {
072:                    throw new AssertionError(name
073:                            + " was already checked to have write access!");
074:                }
075:                alreadyCommittedCheck();
076:                basicCreateRoot(name, rootID);
077:            }
078:
079:            public final void fieldChanged(TCObject source, String classname,
080:                    String fieldname, Object newValue, int index) {
081:                assertNotReadOnlyTxn();
082:                if (source.getTCClass().isEnum()) {
083:                    throw new AssertionError("fieldChanged() on an enum type "
084:                            + source.getTCClass().getPeerClass().getName());
085:                }
086:
087:                alreadyCommittedCheck();
088:                basicFieldChanged(source, classname, fieldname, newValue, index);
089:            }
090:
091:            public final void literalValueChanged(TCObject source,
092:                    Object newValue, Object oldValue) {
093:                assertNotReadOnlyTxn();
094:                alreadyCommittedCheck();
095:                basicLiteralValueChanged(source, newValue, oldValue);
096:            }
097:
098:            public final void arrayChanged(TCObject source, int startPos,
099:                    Object array, int length) {
100:                assertNotReadOnlyTxn();
101:                alreadyCommittedCheck();
102:                basicArrayChanged(source, startPos, array, length);
103:            }
104:
105:            public final void logicalInvoke(TCObject source, int method,
106:                    Object[] parameters, String methodName) {
107:                assertNotReadOnlyTxn();
108:                alreadyCommittedCheck();
109:                basicLogicalInvoke(source, method, parameters);
110:            }
111:
112:            public boolean isNull() {
113:                return false;
114:            }
115:
116:            protected void alreadyCommittedCheck() {
117:                if (alreadyCommittedFlag) {
118:                    throw new AssertionError("Transaction " + txID
119:                            + " already commited.");
120:                }
121:            }
122:
123:            private void assertNotReadOnlyTxn() {
124:                if (transactionContext.getType() == TxnType.READ_ONLY) {
125:                    throw new AssertionError("fail to perform read only check");
126:                }
127:            }
128:
129:            public void setAlreadyCommitted() {
130:                alreadyCommittedCheck();
131:                this .alreadyCommittedFlag = true;
132:            }
133:
134:            abstract protected void basicCreate(TCObject object);
135:
136:            abstract protected void basicCreateRoot(String name, ObjectID rootID);
137:
138:            abstract protected void basicFieldChanged(TCObject source,
139:                    String classname, String fieldname, Object newValue,
140:                    int index);
141:
142:            abstract protected void basicLiteralValueChanged(TCObject source,
143:                    Object newValue, Object oldValue);
144:
145:            abstract protected void basicArrayChanged(TCObject source,
146:                    int startPos, Object array, int length);
147:
148:            abstract protected void basicLogicalInvoke(TCObject source,
149:                    int method, Object[] parameters);
150:
151:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.