KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > filesys > server > locking > LockManager


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.filesys.server.locking;
18
19 import java.io.IOException JavaDoc;
20
21 import org.alfresco.filesys.locking.FileLock;
22 import org.alfresco.filesys.locking.LockConflictException;
23 import org.alfresco.filesys.locking.NotLockedException;
24 import org.alfresco.filesys.server.SrvSession;
25 import org.alfresco.filesys.server.filesys.NetworkFile;
26 import org.alfresco.filesys.server.filesys.TreeConnection;
27
28 /**
29  * Lock Manager Interface
30  * <p>
31  * A lock manager implementation provides file locking support for a virtual filesystem.
32  */

33 public interface LockManager
34 {
35
36     /**
37      * Lock a byte range within a file, or the whole file.
38      *
39      * @param sess SrvSession
40      * @param tree TreeConnection
41      * @param file NetworkFile
42      * @param lock FileLock
43      * @exception LockConflictException
44      * @exception IOException
45      */

46     public void lockFile(SrvSession sess, TreeConnection tree, NetworkFile file, FileLock lock)
47             throws LockConflictException, IOException JavaDoc;
48
49     /**
50      * Unlock a byte range within a file, or the whole file
51      *
52      * @param sess SrvSession
53      * @param tree TreeConnection
54      * @param file NetworkFile
55      * @param lock FileLock
56      * @exception NotLockedException
57      * @exception IOException
58      */

59     public void unlockFile(SrvSession sess, TreeConnection tree, NetworkFile file, FileLock lock)
60             throws NotLockedException, IOException JavaDoc;
61
62     /**
63      * Create a lock object, allows the FileLock object to be extended
64      *
65      * @param sess SrvSession
66      * @param tree TreeConnection
67      * @param file NetworkFile
68      * @param offset long
69      * @param len long
70      * @param pid int
71      * @return FileLock
72      */

73     public FileLock createLockObject(SrvSession sess, TreeConnection tree, NetworkFile file, long offset, long len,
74             int pid);
75
76     /**
77      * Release all locks that a session has on a file. This method is called to perform cleanup if a
78      * file is closed that has active locks or if a session abnormally terminates.
79      *
80      * @param sess SrvSession
81      * @param tree TreeConnection
82      * @param file NetworkFile
83      */

84     public void releaseLocksForFile(SrvSession sess, TreeConnection tree, NetworkFile file);
85 }
86
Popular Tags