KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.alfresco.filesys.util.*;
20
21 /**
22  * Server Type Flags Class
23  */

24 public class ServerType
25 {
26
27     // Server type flags
28

29     public static final int WorkStation = 0x00000001;
30     public static final int Server = 0x00000002;
31     public static final int SQLServer = 0x00000004;
32     public static final int DomainCtrl = 0x00000008;
33     public static final int DomainBakCtrl = 0x00000010;
34     public static final int TimeSource = 0x00000020;
35     public static final int AFPServer = 0x00000040;
36     public static final int NovellServer = 0x00000080;
37     public static final int DomainMember = 0x00000100;
38     public static final int PrintServer = 0x00000200;
39     public static final int DialinServer = 0x00000400;
40     public static final int UnixServer = 0x00000800;
41     public static final int NTServer = 0x00001000;
42     public static final int WfwServer = 0x00002000;
43     public static final int MFPNServer = 0x00004000;
44     public static final int NTNonDCServer = 0x00008000;
45     public static final int PotentialBrowse = 0x00010000;
46     public static final int BackupBrowser = 0x00020000;
47     public static final int MasterBrowser = 0x00040000;
48     public static final int DomainMaster = 0x00080000;
49     public static final int OSFServer = 0x00100000;
50     public static final int VMSServer = 0x00200000;
51     public static final int Win95Plus = 0x00400000;
52     public static final int DFSRoot = 0x00800000;
53     public static final int NTCluster = 0x01000000;
54     public static final int TerminalServer = 0x02000000;
55     public static final int DCEServer = 0x10000000;
56     public static final int AlternateXport = 0x20000000;
57     public static final int LocalListOnly = 0x40000000;
58
59     public static final int DomainEnum = 0x80000000;
60
61     // Server type strings
62

63     private static final String JavaDoc[] _srvType = {
64             "Workstation",
65             "Server",
66             "SQLServer",
67             "DomainController",
68             "BackupDomainController",
69             "TimeSource",
70             "AFPServer",
71             "NovellServer",
72             "DomainMember",
73             "PrintServer",
74             "DialinServer",
75             "UnixServer",
76             "NTServer",
77             "WfwServer",
78             "MFPNServer",
79             "NtNonDCServer",
80             "PotentialBrowse",
81             "BackupBrowser",
82             "MasterBrowser",
83             "DomainMaster",
84             "OSFServer",
85             "VMSServer",
86             "Win95Plus",
87             "DFSRoot",
88             "NTCluster",
89             "TerminalServer",
90             "",
91             "",
92             "DCEServer" };
93
94     /**
95      * Convert server type flags to a list of server type strings
96      *
97      * @param typ int
98      * @return StringList
99      */

100     public static final StringList TypeAsStrings(int typ)
101     {
102         // Allocate the vector for the strings
103

104         StringList strs = new StringList();
105
106         // Test each type bit and add the appropriate type string
107

108         for (int i = 0; i < _srvType.length; i++)
109         {
110             // Check the current type flag
111

112             int mask = 1 << i;
113             if ((typ & mask) != 0)
114                 strs.addString(_srvType[i]);
115         }
116
117         // Return the list of type strings
118

119         return strs;
120     }
121
122     /**
123      * Check if the workstation flag is set
124      *
125      * @param typ int
126      * @return boolean
127      */

128     public static final boolean isWorkStation(int typ)
129     {
130         return (typ & WorkStation) != 0 ? true : false;
131     }
132
133     /**
134      * Check if the server flag is set
135      *
136      * @param typ int
137      * @return boolean
138      */

139     public static final boolean isServer(int typ)
140     {
141         return (typ & Server) != 0 ? true : false;
142     }
143
144     /**
145      * Check if the SQL server flag is set
146      *
147      * @param typ int
148      * @return boolean
149      */

150     public static final boolean isSQLServer(int typ)
151     {
152         return (typ & SQLServer) != 0 ? true : false;
153     }
154
155     /**
156      * Check if the domain controller flag is set
157      *
158      * @param typ int
159      * @return boolean
160      */

161     public static final boolean isDomainController(int typ)
162     {
163         return (typ & DomainCtrl) != 0 ? true : false;
164     }
165
166     /**
167      * Check if the backup domain controller flag is set
168      *
169      * @param typ int
170      * @return boolean
171      */

172     public static final boolean isBackupDomainController(int typ)
173     {
174         return (typ & DomainBakCtrl) != 0 ? true : false;
175     }
176
177     /**
178      * Check if the time source flag is set
179      *
180      * @param typ int
181      * @return boolean
182      */

183     public static final boolean isTimeSource(int typ)
184     {
185         return (typ & TimeSource) != 0 ? true : false;
186     }
187
188     /**
189      * Check if the AFP server flag is set
190      *
191      * @param typ int
192      * @return boolean
193      */

194     public static final boolean isAFPServer(int typ)
195     {
196         return (typ & AFPServer) != 0 ? true : false;
197     }
198
199     /**
200      * Check if the Novell server flag is set
201      *
202      * @param typ int
203      * @return boolean
204      */

205     public static final boolean isNovellServer(int typ)
206     {
207         return (typ & NovellServer) != 0 ? true : false;
208     }
209
210     /**
211      * Check if the domain member flag is set
212      *
213      * @param typ int
214      * @return boolean
215      */

216     public static final boolean isDomainMember(int typ)
217     {
218         return (typ & DomainMember) != 0 ? true : false;
219     }
220
221     /**
222      * Check if the print server flag is set
223      *
224      * @param typ int
225      * @return boolean
226      */

227     public static final boolean isPrintServer(int typ)
228     {
229         return (typ & PrintServer) != 0 ? true : false;
230     }
231
232     /**
233      * Check if the dialin server flag is set
234      *
235      * @param typ int
236      * @return boolean
237      */

238     public static final boolean isDialinServer(int typ)
239     {
240         return (typ & DialinServer) != 0 ? true : false;
241     }
242
243     /**
244      * Check if the Unix server flag is set
245      *
246      * @param typ int
247      * @return boolean
248      */

249     public static final boolean isUnixServer(int typ)
250     {
251         return (typ & UnixServer) != 0 ? true : false;
252     }
253
254     /**
255      * Check if the NT server flag is set
256      *
257      * @param typ int
258      * @return boolean
259      */

260     public static final boolean isNTServer(int typ)
261     {
262         return (typ & NTServer) != 0 ? true : false;
263     }
264
265     /**
266      * Check if the WFW server flag is set
267      *
268      * @param typ int
269      * @return boolean
270      */

271     public static final boolean isWFWServer(int typ)
272     {
273         return (typ & WfwServer) != 0 ? true : false;
274     }
275
276     /**
277      * Check if the MFPN server flag is set
278      *
279      * @param typ int
280      * @return boolean
281      */

282     public static final boolean isMFPNServer(int typ)
283     {
284         return (typ & MFPNServer) != 0 ? true : false;
285     }
286
287     /**
288      * Check if the NT non-domain controller server flag is set
289      *
290      * @param typ int
291      * @return boolean
292      */

293     public static final boolean isNTNonDomainServer(int typ)
294     {
295         return (typ & NTNonDCServer) != 0 ? true : false;
296     }
297
298     /**
299      * Check if the potential browse master flag is set
300      *
301      * @param typ int
302      * @return boolean
303      */

304     public static final boolean isPotentialBrowseMaster(int typ)
305     {
306         return (typ & PotentialBrowse) != 0 ? true : false;
307     }
308
309     /**
310      * Check if the backup browser flag is set
311      *
312      * @param typ int
313      * @return boolean
314      */

315     public static final boolean isBackupBrowser(int typ)
316     {
317         return (typ & BackupBrowser) != 0 ? true : false;
318     }
319
320     /**
321      * Check if the browse master flag is set
322      *
323      * @param typ int
324      * @return boolean
325      */

326     public static final boolean isBrowserMaster(int typ)
327     {
328         return (typ & MasterBrowser) != 0 ? true : false;
329     }
330
331     /**
332      * Check if the domain master flag is set
333      *
334      * @param typ int
335      * @return boolean
336      */

337     public static final boolean isDomainMaster(int typ)
338     {
339         return (typ & DomainMaster) != 0 ? true : false;
340     }
341
342     /**
343      * Check if the OSF server flag is set
344      *
345      * @param typ int
346      * @return boolean
347      */

348     public static final boolean isOSFServer(int typ)
349     {
350         return (typ & OSFServer) != 0 ? true : false;
351     }
352
353     /**
354      * Check if the VMS server flag is set
355      *
356      * @param typ int
357      * @return boolean
358      */

359     public static final boolean isVMSServer(int typ)
360     {
361         return (typ & VMSServer) != 0 ? true : false;
362     }
363
364     /**
365      * Check if the Win95 plus flag is set
366      *
367      * @param typ int
368      * @return boolean
369      */

370     public static final boolean isWin95Plus(int typ)
371     {
372         return (typ & Win95Plus) != 0 ? true : false;
373     }
374
375     /**
376      * Check if the DFS root flag is set
377      *
378      * @param typ int
379      * @return boolean
380      */

381     public static final boolean isDFSRoot(int typ)
382     {
383         return (typ & DFSRoot) != 0 ? true : false;
384     }
385
386     /**
387      * Check if the NT cluster flag is set
388      *
389      * @param typ int
390      * @return boolean
391      */

392     public static final boolean isNTCluster(int typ)
393     {
394         return (typ & NTCluster) != 0 ? true : false;
395     }
396
397     /**
398      * Check if the terminal server flag is set
399      *
400      * @param typ int
401      * @return boolean
402      */

403     public static final boolean isTerminalServer(int typ)
404     {
405         return (typ & TerminalServer) != 0 ? true : false;
406     }
407
408     /**
409      * Check if the DCE server flag is set
410      *
411      * @param typ int
412      * @return boolean
413      */

414     public static final boolean isDCEServer(int typ)
415     {
416         return (typ & DCEServer) != 0 ? true : false;
417     }
418 }
419
Popular Tags