KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.alfresco.filesys.server.core.DeviceInterface;
20 import org.alfresco.filesys.server.core.ShareType;
21 import org.alfresco.filesys.server.core.SharedDevice;
22
23 /**
24  * <p>
25  * A disk shared device has a name, a driver class and a context for the driver.
26  */

27 public class DiskSharedDevice extends SharedDevice
28 {
29
30     /**
31      * Construct a disk share with the specified name and device interface.
32      *
33      * @param name Disk share name.
34      * @param iface Disk device interface.
35      * @param ctx Context that will be passed to the device interface.
36      */

37     public DiskSharedDevice(String JavaDoc name, DeviceInterface iface, DiskDeviceContext ctx)
38     {
39         super(name, ShareType.DISK, ctx);
40         setInterface(iface);
41     }
42
43     /**
44      * Construct a disk share with the specified name and device interface.
45      *
46      * @param name java.lang.String
47      * @param iface DeviceInterface
48      * @param ctx DeviceContext
49      * @param attrib int
50      */

51     public DiskSharedDevice(String JavaDoc name, DeviceInterface iface, DiskDeviceContext ctx, int attrib)
52     {
53         super(name, ShareType.DISK, ctx);
54         setInterface(iface);
55         setAttributes(attrib);
56     }
57
58     /**
59      * Return the disk device context
60      *
61      * @return DiskDeviceContext
62      */

63     public final DiskDeviceContext getDiskContext()
64     {
65         return (DiskDeviceContext) getContext();
66     }
67
68     /**
69      * Return the disk interface
70      *
71      * @return DiskInterface
72      */

73     public final DiskInterface getDiskInterface()
74     {
75         try
76         {
77             if (getInterface() instanceof DiskInterface)
78                 return (DiskInterface) getInterface();
79         }
80         catch (Exception JavaDoc ex)
81         {
82         }
83         return null;
84     }
85 }
Popular Tags