KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > filesys > server > filesys > AccessMode


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.filesys;
18
19 /**
20  * SMB file access mode class.
21  * <p>
22  * The SMB access mode values are used when opening a file using one of the SMBDiskSession OpenFile
23  * (), OpenInputStream () or OpenOutputStream () methods.
24  */

25 public final class AccessMode
26 {
27
28     // Access mode constants
29

30     public static final int ReadOnly = 0x0000;
31     public static final int WriteOnly = 0x0001;
32     public static final int ReadWrite = 0x0002;
33     public static final int Execute = 0x0003;
34     public static final int Compatability = 0x0000;
35     public static final int Exclusive = 0x0010;
36     public static final int DenyWrite = 0x0020;
37     public static final int DenyRead = 0x0030;
38     public static final int DenyNone = 0x0040;
39     public static final int NoCaching = 0x1000;
40     public static final int WriteThrough = 0x4000;
41     protected static final int FCBOpen = 0x00FF;
42
43     // NT access mode constants
44

45     public static final int NTRead = 0x00000001;
46     public static final int NTWrite = 0x00000002;
47     public static final int NTAppend = 0x00000004;
48     public static final int NTReadEA = 0x00000008;
49     public static final int NTWriteEA = 0x00000010;
50     public static final int NTExecute = 0x00000020;
51     public static final int NTDeleteChild = 0x00000040;
52     public static final int NTReadAttrib = 0x00000080;
53     public static final int NTWriteAttrib = 0x00000100;
54
55     public static final int NTDelete = 0x00010000;
56     public static final int NTReadControl = 0x00020000;
57     public static final int NTWriteDAC = 0x00040000;
58     public static final int NTWriteOwner = 0x00080000;
59     public static final int NTSynchronize = 0x00100000;
60     public static final int NTSystemSecurity = 0x01000000;
61
62     public static final int NTGenericRead = 0x80000000;
63     public static final int NTGenericWrite = 0x40000000;
64     public static final int NTGenericExecute = 0x20000000;
65     public static final int NTGenericAll = 0x10000000;
66
67     public static final int NTMaximumAllowed = 0x02000000;
68
69     public static final int NTReadWrite = NTRead + NTWrite;
70
71     /**
72      * Return the file access mode from the specified flags value.
73      *
74      * @param val File flags value.
75      * @return File access mode.
76      */

77     public static final int getAccessMode(int val)
78     {
79         return val & 0x03;
80     }
81
82     /**
83      * Return the file sharing mode from the specified flags value.
84      *
85      * @param val File flags value.
86      * @return File sharing mode.
87      */

88     public static final int getSharingMode(int val)
89     {
90         return val & 0x70;
91     }
92 }
Popular Tags