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    /**
021     * this interface defines method that a Locking Strategy must implement
022     * according to the transaction isolation level it represents.
023     * @deprecated 
024     */
025    public interface LockStrategy
026    {
027    
028        /**
029         * acquire a read lock on Object obj for Transaction tx.
030         * @param tx the transaction requesting the lock
031         * @param obj the Object to be locked
032         * @return true if successful, else false
033         *
034         */
035        public boolean readLock(TransactionImpl tx, Object obj);
036    
037        /**
038         * acquire a write lock on Object obj for Transaction tx.
039         * @param tx the transaction requesting the lock
040         * @param obj the Object to be locked
041         * @return true if successful, else false
042         *
043         */
044        public boolean writeLock(TransactionImpl tx, Object obj);
045    
046        /**
047         * acquire a lock upgrade (from read to write) lock on Object obj for Transaction tx.
048         * @param tx the transaction requesting the lock
049         * @param obj the Object to be locked
050         * @return true if successful, else false
051         *
052         */
053        public boolean upgradeLock(TransactionImpl tx, Object obj);
054    
055        /**
056         * release a lock on Object obj for Transaction tx.
057         * @param tx the transaction releasing the lock
058         * @param obj the Object to be unlocked
059         * @return true if successful, else false
060         *
061         */
062        public boolean releaseLock(TransactionImpl tx, Object obj);
063    
064        /**
065         * checks whether the specified Object obj is read-locked by Transaction tx.
066         * @param tx the transaction
067         * @param obj the Object to be checked
068         * @return true if lock exists, else false
069         */
070        public boolean checkRead(TransactionImpl tx, Object obj);
071    
072        /**
073         * checks whether the specified Object obj is write-locked by Transaction tx.
074         * @param tx the transaction
075         * @param obj the Object to be checked
076         * @return true if lock exists, else false
077         */
078        public boolean checkWrite(TransactionImpl tx, Object obj);
079    }