KickJava   Java API By Example, From Geeks To Geeks.

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


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.smb.PCShare;
20
21 /**
22  * <p>
23  * The class extends the client side version of the disk information class to allow values to be set
24  * after construction by a disk interface implementation.
25  * <p>
26  * The class contains information about the total, free and used blocks on a disk device, and the
27  * block size and blocks per allocation unit of the device.
28  */

29 public class SrvDiskInfo extends DiskInfo
30 {
31
32     /**
33      * Create an empty disk information object.
34      */

35     public SrvDiskInfo()
36     {
37     }
38
39     /**
40      * Construct a disk information object.
41      *
42      * @param totunits int
43      * @param blkunit int
44      * @param blksiz int
45      * @param freeunit int
46      */

47     public SrvDiskInfo(int totunits, int blkunit, int blksiz, int freeunit)
48     {
49         super(null, (long) totunits, blkunit, blksiz, (long) freeunit);
50     }
51
52     /**
53      * Construct a disk information object.
54      *
55      * @param totunits long
56      * @param blkunit long
57      * @param blksiz long
58      * @param freeunit long
59      */

60     public SrvDiskInfo(long totunits, long blkunit, long blksiz, long freeunit)
61     {
62         super(null, totunits, (int) blkunit, (int) blksiz, freeunit);
63     }
64
65     /**
66      * Class constructor
67      *
68      * @param shr PCShare
69      * @param totunits int
70      * @param blkunit int
71      * @param blksiz int
72      * @param freeunit int
73      */

74     protected SrvDiskInfo(PCShare shr, int totunits, int blkunit, int blksiz, int freeunit)
75     {
76         super(shr, totunits, blkunit, blksiz, freeunit);
77     }
78
79     /**
80      * Set the block size, in bytes.
81      *
82      * @param siz int
83      */

84     public final void setBlockSize(int siz)
85     {
86         m_blocksize = siz;
87     }
88
89     /**
90      * Set the number of blocks per filesystem allocation unit.
91      *
92      * @param blks int
93      */

94     public final void setBlocksPerAllocationUnit(int blks)
95     {
96         m_blockperunit = blks;
97     }
98
99     /**
100      * Set the number of free units on this shared disk device.
101      *
102      * @param units int
103      */

104     public final void setFreeUnits(int units)
105     {
106         m_freeunits = units;
107     }
108
109     /**
110      * Set the total number of units on this shared disk device.
111      *
112      * @param units int
113      */

114     public final void setTotalUnits(int units)
115     {
116         m_totalunits = units;
117     }
118
119     /**
120      * Set the block size, in bytes.
121      *
122      * @param siz long
123      */

124     public final void setBlockSize(long siz)
125     {
126         m_blocksize = siz;
127     }
128
129     /**
130      * Set the number of blocks per filesystem allocation unit.
131      *
132      * @param blks long
133      */

134     public final void setBlocksPerAllocationUnit(long blks)
135     {
136         m_blockperunit = blks;
137     }
138
139     /**
140      * Set the number of free units on this shared disk device.
141      *
142      * @param units long
143      */

144     public final void setFreeUnits(long units)
145     {
146         m_freeunits = units;
147     }
148
149     /**
150      * Set the total number of units on this shared disk device.
151      *
152      * @param units long
153      */

154     public final void setTotalUnits(long units)
155     {
156         m_totalunits = units;
157     }
158
159     /**
160      * Set the node name.
161      *
162      * @param name java.lang.String
163      */

164     protected final void setNodeName(String JavaDoc name)
165     {
166         m_nodename = name;
167     }
168
169     /**
170      * Set the shared device name.
171      *
172      * @param name java.lang.String
173      */

174     protected final void setShareName(String JavaDoc name)
175     {
176         m_share = name;
177     }
178
179     /**
180      * Copy the disk information details
181      *
182      * @param disk SrvDiskInfo
183      */

184     public final void copyFrom(SrvDiskInfo disk)
185     {
186
187         // Copy the details to this object
188

189         setBlockSize(disk.getBlockSize());
190         setBlocksPerAllocationUnit(disk.getBlocksPerAllocationUnit());
191
192         setFreeUnits(disk.getFreeUnits());
193         setTotalUnits(disk.getTotalUnits());
194     }
195 }
Popular Tags