KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > filesys > smb > LockingAndX


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.smb;
18
19 /**
20  * LockingAndX SMB Constants Class
21  */

22 public class LockingAndX
23 {
24
25     // Lock type flags
26

27     public static final int SharedLock = 0x0001;
28     public static final int OplockBreak = 0x0002;
29     public static final int ChangeType = 0x0004;
30     public static final int Cancel = 0x0008;
31     public static final int LargeFiles = 0x0010;
32
33     /**
34      * Check if this is a normal lock/unlock, ie. no flags except the LargeFiles flag may be set
35      *
36      * @param flags
37      * @return boolean
38      */

39     public final static boolean isNormalLockUnlock(int flags)
40     {
41         return (flags & 0x000F) == 0 ? true : false;
42     }
43
44     /**
45      * Check if the large files flag is set
46      *
47      * @param flags int
48      * @return boolean
49      */

50     public final static boolean hasLargeFiles(int flags)
51     {
52         return (flags & LargeFiles) != 0 ? true : false;
53     }
54
55     /**
56      * Check if the shared lock flag is set
57      *
58      * @param flags int
59      * @return boolean
60      */

61     public final static boolean hasSharedLock(int flags)
62     {
63         return (flags & SharedLock) != 0 ? true : false;
64     }
65
66     /**
67      * Check if the oplock break flag is set
68      *
69      * @param flags int
70      * @return boolean
71      */

72     public final static boolean hasOplockBreak(int flags)
73     {
74         return (flags & OplockBreak) != 0 ? true : false;
75     }
76
77     /**
78      * Check if the change type flag is set
79      *
80      * @param flags int
81      * @return boolean
82      */

83     public final static boolean hasChangeType(int flags)
84     {
85         return (flags & ChangeType) != 0 ? true : false;
86     }
87
88     /**
89      * Check if the cancel flag is set
90      *
91      * @param flags int
92      * @return boolean
93      */

94     public final static boolean hasCancel(int flags)
95     {
96         return (flags & Cancel) != 0 ? true : false;
97     }
98 }
99
Popular Tags