KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.Date JavaDoc;
20
21 /**
22  * Disk Volume Information Class
23  */

24 public class VolumeInfo
25 {
26
27     // Volume label
28

29     private String JavaDoc m_label;
30
31     // Serial number
32

33     private int m_serno = -1;
34
35     // Creation date/time
36

37     private Date JavaDoc m_created;
38
39     /**
40      * Default constructor
41      */

42     public VolumeInfo()
43     {
44     }
45
46     /**
47      * Class constructor
48      *
49      * @param label String
50      */

51     public VolumeInfo(String JavaDoc label)
52     {
53         setVolumeLabel(label);
54     }
55
56     /**
57      * Class constructor
58      *
59      * @param label String
60      * @param serno int
61      * @param created Date
62      */

63     public VolumeInfo(String JavaDoc label, int serno, Date JavaDoc created)
64     {
65         setVolumeLabel(label);
66         setSerialNumber(serno);
67         setCreationDateTime(created);
68     }
69
70     /**
71      * Return the volume label
72      *
73      * @return String
74      */

75     public final String JavaDoc getVolumeLabel()
76     {
77         return m_label;
78     }
79
80     /**
81      * Determine if the serial number is valid
82      *
83      * @return boolean
84      */

85     public final boolean hasSerialNumber()
86     {
87         return m_serno != -1 ? true : false;
88     }
89
90     /**
91      * Return the serial number
92      *
93      * @return int
94      */

95     public final int getSerialNumber()
96     {
97         return m_serno;
98     }
99
100     /**
101      * Determine if the creation date/time is valid
102      *
103      * @return boolean
104      */

105     public final boolean hasCreationDateTime()
106     {
107         return m_created != null ? true : false;
108     }
109
110     /**
111      * Return the volume creation date/time
112      *
113      * @return Date
114      */

115     public final Date JavaDoc getCreationDateTime()
116     {
117         return m_created;
118     }
119
120     /**
121      * Set the volume label
122      *
123      * @param label
124      */

125     public final void setVolumeLabel(String JavaDoc label)
126     {
127         m_label = label;
128     }
129
130     /**
131      * Set the serial number
132      *
133      * @param serno int
134      */

135     public final void setSerialNumber(int serno)
136     {
137         m_serno = serno;
138     }
139
140     /**
141      * Set the volume creation date/time
142      *
143      * @param created Date
144      */

145     public final void setCreationDateTime(Date JavaDoc created)
146     {
147         m_created = created;
148     }
149
150     /**
151      * Return the volume information as a string
152      *
153      * @return String
154      */

155     public String JavaDoc toString()
156     {
157         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
158
159         str.append("[");
160         str.append(getVolumeLabel());
161         str.append(",");
162         str.append(getSerialNumber());
163         str.append(",");
164         str.append(getCreationDateTime());
165         str.append("]");
166
167         return str.toString();
168     }
169 }
170
Popular Tags