01: package org.apache.ojb.odmg.locking;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: import org.apache.ojb.odmg.TransactionImpl;
19:
20: /**
21: * this interface defines method that a Locking Strategy must implement
22: * according to the transaction isolation level it represents.
23: * @deprecated
24: */
25: public interface LockStrategy {
26:
27: /**
28: * acquire a read lock on Object obj for Transaction tx.
29: * @param tx the transaction requesting the lock
30: * @param obj the Object to be locked
31: * @return true if successful, else false
32: *
33: */
34: public boolean readLock(TransactionImpl tx, Object obj);
35:
36: /**
37: * acquire a write lock on Object obj for Transaction tx.
38: * @param tx the transaction requesting the lock
39: * @param obj the Object to be locked
40: * @return true if successful, else false
41: *
42: */
43: public boolean writeLock(TransactionImpl tx, Object obj);
44:
45: /**
46: * acquire a lock upgrade (from read to write) lock on Object obj for Transaction tx.
47: * @param tx the transaction requesting the lock
48: * @param obj the Object to be locked
49: * @return true if successful, else false
50: *
51: */
52: public boolean upgradeLock(TransactionImpl tx, Object obj);
53:
54: /**
55: * release a lock on Object obj for Transaction tx.
56: * @param tx the transaction releasing the lock
57: * @param obj the Object to be unlocked
58: * @return true if successful, else false
59: *
60: */
61: public boolean releaseLock(TransactionImpl tx, Object obj);
62:
63: /**
64: * checks whether the specified Object obj is read-locked by Transaction tx.
65: * @param tx the transaction
66: * @param obj the Object to be checked
67: * @return true if lock exists, else false
68: */
69: public boolean checkRead(TransactionImpl tx, Object obj);
70:
71: /**
72: * checks whether the specified Object obj is write-locked by Transaction tx.
73: * @param tx the transaction
74: * @param obj the Object to be checked
75: * @return true if lock exists, else false
76: */
77: public boolean checkWrite(TransactionImpl tx, Object obj);
78: }
|