You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by th...@apache.org on 2003/05/02 11:05:50 UTC
cvs commit: db-ojb/src/java/org/apache/ojb/odmg/locking LockEntry.java
thma 2003/05/02 02:05:50
Modified: src/java/org/apache/ojb/odmg/locking LockEntry.java
Log:
OJB158: add setters to be Properties compliant.
Revision Changes Path
1.3 +181 -145 db-ojb/src/java/org/apache/ojb/odmg/locking/LockEntry.java
Index: LockEntry.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/locking/LockEntry.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LockEntry.java 17 Jun 2002 19:34:30 -0000 1.2
+++ LockEntry.java 2 May 2003 09:05:50 -0000 1.3
@@ -1,4 +1,4 @@
-package org.apache.ojb.odmg.locking;
+package org.apache.ojb.odmg.locking;
/* ====================================================================
* The Apache Software License, Version 1.1
@@ -53,147 +53,183 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-
-import org.apache.ojb.odmg.TransactionImpl;
-
-import java.io.Serializable;
-
-/**
- * a persistent entry for locks. All locks that are hold from
- * transaction on objects are represented by a LockENtry and made
- * persistent to the database.
- * @author Thomas Mahler
- */
-public class LockEntry implements Serializable
-{
- /**
- * marks a Read Lock.
- */
- public static int LOCK_READ = 0;
-
- /**
- * marks a Write Lock.
- */
- public static int LOCK_WRITE = 1;
-
- /**
- * the unique OID of the object to be locked.
- */
- private String oidString;
-
- /**
- * the GUID of the transaction that holds the lock
- */
- private String transactionId;
-
- /**
- * the timestamp marking the time of acquisition of this lock
- */
- private long timestamp;
-
- /**
- * the isolationlevel for this lock.
- */
- private int isolationLevel;
-
- /**
- * marks if this is a read or a write lock.
- * LOCK_READ = 0;
- * LOCK_WRITE = 1;
- */
- private int lockType;
-
- /**
- * Multiargument constructor for fast loading of LockEntries by OJB.
- */
- public LockEntry(String oidString,
- String transactionId,
- long timestamp,
- int isolationLevel,
- int lockType)
- {
- this.oidString = oidString;
- this.transactionId = transactionId;
- this.timestamp = timestamp;
- this.isolationLevel = isolationLevel;
- this.lockType = lockType;
-
- }
-
- /**
- * build a LockEntry from an OID and a Transaction ID
- */
- public LockEntry(String oidString, String transactionId)
- {
- this.oidString = oidString;
- this.transactionId = transactionId;
- }
-
- /**
- * default constructor
- */
- public LockEntry()
- {
- }
-
- /**
- * returns the OID STring of the locked object.
- */
- public String getOidString()
- {
- return oidString;
- }
-
- /**
- * returns the GUID string of the locking transaction.
- */
- public String getTransactionId()
- {
- return transactionId;
- }
-
- /**
- * returns the timestamp of the acqusition of the lock.
- */
- public long getTimestamp()
- {
- return timestamp;
- }
-
- /**
- * returns the isolation level of this lock
- */
- public int getIsolationLevel()
- {
- return isolationLevel;
- }
-
- /**
- * returns the locktype of this lock.
- * @return LOCK_READ if lock is a readlock,
- * LOCK_WRITE if lock is a Write lock.
- */
- public int getLockType()
- {
- return lockType;
- }
-
- /**
- * sets the locktype of this lockentry.
- * @param locktype LOCK_READ for read, LOCK_WRITE for write lock.
- */
- public void setLockType(int locktype)
- {
- this.lockType = locktype;
- }
-
- /**
- * returns true if this lock is owned by transaction tx, else false.
- */
- public boolean isOwnedBy(TransactionImpl tx)
- {
- return this.getTransactionId().equals(tx.getGUID());
- }
-
-
-}
+
+import org.apache.ojb.odmg.TransactionImpl;
+
+import java.io.Serializable;
+
+/**
+ * a persistent entry for locks. All locks that are hold from
+ * transaction on objects are represented by a LockENtry and made
+ * persistent to the database.
+ * @author Thomas Mahler
+ */
+public class LockEntry implements Serializable
+{
+ /**
+ * marks a Read Lock.
+ */
+ public static int LOCK_READ = 0;
+
+ /**
+ * marks a Write Lock.
+ */
+ public static int LOCK_WRITE = 1;
+
+ /**
+ * the unique OID of the object to be locked.
+ */
+ private String oidString;
+
+ /**
+ * the GUID of the transaction that holds the lock
+ */
+ private String transactionId;
+
+ /**
+ * the timestamp marking the time of acquisition of this lock
+ */
+ private long timestamp;
+
+ /**
+ * the isolationlevel for this lock.
+ */
+ private int isolationLevel;
+
+ /**
+ * marks if this is a read or a write lock.
+ * LOCK_READ = 0;
+ * LOCK_WRITE = 1;
+ */
+ private int lockType;
+
+ /**
+ * Multiargument constructor for fast loading of LockEntries by OJB.
+ */
+ public LockEntry(String oidString,
+ String transactionId,
+ long timestamp,
+ int isolationLevel,
+ int lockType)
+ {
+ this.oidString = oidString;
+ this.transactionId = transactionId;
+ this.timestamp = timestamp;
+ this.isolationLevel = isolationLevel;
+ this.lockType = lockType;
+
+ }
+
+ /**
+ * build a LockEntry from an OID and a Transaction ID
+ */
+ public LockEntry(String oidString, String transactionId)
+ {
+ this.oidString = oidString;
+ this.transactionId = transactionId;
+ }
+
+ /**
+ * default constructor
+ */
+ public LockEntry()
+ {
+ }
+
+ /**
+ * returns the OID STring of the locked object.
+ */
+ public String getOidString()
+ {
+ return oidString;
+ }
+
+ /**
+ * returns the GUID string of the locking transaction.
+ */
+ public String getTransactionId()
+ {
+ return transactionId;
+ }
+
+ /**
+ * returns the timestamp of the acqusition of the lock.
+ */
+ public long getTimestamp()
+ {
+ return timestamp;
+ }
+
+ /**
+ * returns the isolation level of this lock
+ */
+ public int getIsolationLevel()
+ {
+ return isolationLevel;
+ }
+
+ /**
+ * returns the locktype of this lock.
+ * @return LOCK_READ if lock is a readlock,
+ * LOCK_WRITE if lock is a Write lock.
+ */
+ public int getLockType()
+ {
+ return lockType;
+ }
+
+ /**
+ * sets the locktype of this lockentry.
+ * @param locktype LOCK_READ for read, LOCK_WRITE for write lock.
+ */
+ public void setLockType(int locktype)
+ {
+ this.lockType = locktype;
+ }
+
+ /**
+ * returns true if this lock is owned by transaction tx, else false.
+ */
+ public boolean isOwnedBy(TransactionImpl tx)
+ {
+ return this.getTransactionId().equals(tx.getGUID());
+ }
+
+
+ /**
+ * Sets the isolationLevel.
+ * @param isolationLevel The isolationLevel to set
+ */
+ public void setIsolationLevel(int isolationLevel)
+ {
+ this.isolationLevel = isolationLevel;
+ }
+
+ /**
+ * Sets the oidString.
+ * @param oidString The oidString to set
+ */
+ public void setOidString(String oidString)
+ {
+ this.oidString = oidString;
+ }
+
+ /**
+ * Sets the timestamp.
+ * @param timestamp The timestamp to set
+ */
+ public void setTimestamp(long timestamp)
+ {
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * Sets the transactionId.
+ * @param transactionId The transactionId to set
+ */
+ public void setTransactionId(String transactionId)
+ {
+ this.transactionId = transactionId;
+ }
+
+}