Source Code Cross Referenced for LockEntry.java in  » Database-ORM » db-ojb » org » apache » ojb » odmg » locking » 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 » db ojb » org.apache.ojb.odmg.locking 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.ojb.odmg.locking;
002:
003:        /* Copyright 2002-2005 The Apache Software Foundation
004:         *
005:         * Licensed under the Apache License, Version 2.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        import org.apache.ojb.odmg.TransactionImpl;
019:
020:        import java.io.Serializable;
021:
022:        /**
023:         * a persistent entry for locks. All locks that are hold from
024:         * transaction on objects are represented by a LockENtry and made
025:         * persistent to the database.
026:         * @author Thomas Mahler
027:         */
028:        public class LockEntry implements  Serializable {
029:            static final long serialVersionUID = 8060850552557793930L;
030:            /**
031:             * marks a Read Lock.
032:             */
033:            public static int LOCK_READ = 0;
034:
035:            /**
036:             * marks a Write Lock.
037:             */
038:            public static int LOCK_WRITE = 1;
039:
040:            /**
041:             * the unique OID of the object to be locked.
042:             */
043:            private String oidString;
044:
045:            /**
046:             * the GUID of the transaction that holds the lock
047:             */
048:            private String transactionId;
049:
050:            /**
051:             * the timestamp marking the time of acquisition of this lock
052:             */
053:            private long timestamp;
054:
055:            /**
056:             * the isolationlevel for this lock.
057:             */
058:            private int isolationLevel;
059:
060:            /**
061:             * marks if this is a read or a write lock.
062:             * LOCK_READ = 0;
063:             * LOCK_WRITE = 1;
064:             */
065:            private int lockType;
066:
067:            /**
068:             * Multiargument constructor for fast loading of LockEntries by OJB.
069:             */
070:            public LockEntry(String oidString, String transactionId,
071:                    long timestamp, int isolationLevel, int lockType) {
072:                this .oidString = oidString;
073:                this .transactionId = transactionId;
074:                this .timestamp = timestamp;
075:                this .isolationLevel = isolationLevel;
076:                this .lockType = lockType;
077:
078:            }
079:
080:            /**
081:             * build a LockEntry from an OID and a Transaction ID
082:             */
083:            public LockEntry(String oidString, String transactionId) {
084:                this .oidString = oidString;
085:                this .transactionId = transactionId;
086:            }
087:
088:            /**
089:             * default constructor
090:             */
091:            public LockEntry() {
092:            }
093:
094:            /**
095:             * returns the OID STring of the locked object.
096:             */
097:            public String getOidString() {
098:                return oidString;
099:            }
100:
101:            /**
102:             * returns the GUID string of the locking transaction.
103:             */
104:            public String getTransactionId() {
105:                return transactionId;
106:            }
107:
108:            /**
109:             * returns the timestamp of the acqusition of the lock.
110:             */
111:            public long getTimestamp() {
112:                return timestamp;
113:            }
114:
115:            /**
116:             * returns the isolation level of this lock
117:             */
118:            public int getIsolationLevel() {
119:                return isolationLevel;
120:            }
121:
122:            /**
123:             * returns the locktype of this lock.
124:             * @return LOCK_READ if lock is a readlock,
125:             * LOCK_WRITE if lock is a Write lock.
126:             */
127:            public int getLockType() {
128:                return lockType;
129:            }
130:
131:            /**
132:             * sets the locktype of this lockentry.
133:             * @param locktype LOCK_READ for read, LOCK_WRITE for write lock.
134:             */
135:            public void setLockType(int locktype) {
136:                this .lockType = locktype;
137:            }
138:
139:            /**
140:             * returns true if this lock is owned by transaction tx, else false.
141:             */
142:            public boolean isOwnedBy(TransactionImpl tx) {
143:                return this .getTransactionId().equals(tx.getGUID());
144:            }
145:
146:            /**
147:             * Sets the isolationLevel.
148:             * @param isolationLevel The isolationLevel to set
149:             */
150:            public void setIsolationLevel(int isolationLevel) {
151:                this .isolationLevel = isolationLevel;
152:            }
153:
154:            /**
155:             * Sets the oidString.
156:             * @param oidString The oidString to set
157:             */
158:            public void setOidString(String oidString) {
159:                this .oidString = oidString;
160:            }
161:
162:            /**
163:             * Sets the timestamp.
164:             * @param timestamp The timestamp to set
165:             */
166:            public void setTimestamp(long timestamp) {
167:                this .timestamp = timestamp;
168:            }
169:
170:            /**
171:             * Sets the transactionId.
172:             * @param transactionId The transactionId to set
173:             */
174:            public void setTransactionId(String transactionId) {
175:                this.transactionId = transactionId;
176:            }
177:
178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.