1 package org.astrogrid.mySpace.mySpaceManager;
2
3 import java.io.*;
4 import java.util.Date;
5 import java.util.Locale;
6 import java.text.*;
7
8 /***
9 * The <code>ServerDetails</code> class represents the details held in the
10 * MySpace registry for a single MySpace server. The details held for
11 * each server are: its name, expiry period, URI and base directory.
12 *
13 * <p>
14 * The class has two constructors. In one values for all the member
15 * variables are passed as arguments. The other is a dummy with no
16 * arguments. There are no <code>set</code> methods, but there is a
17 * <code>get</code> method for every member variable.
18 *
19 * @author A C Davenhall (Edinburgh)
20 * @version Iteration 4.
21 */
22
23 public class ServerDetails
24 {
25 private String name;
26 private int expiryPeriod;
27 private String URI;
28 private String directory;
29
30
31
32
33
34
35
36 /***
37 * Constructor in which arguments comprising the details of the server
38 * are passed.
39 *
40 * @param serverName The name of the server.
41 * @param expiryPeriod The expiry period, in days.
42 * @param URI The URI to access the server.
43 * @param directory The base directory of files on the server
44 */
45
46 public ServerDetails (String name, int expiryPeriod, String URI,
47 String directory)
48 { this.name = name;
49 this.expiryPeriod = expiryPeriod;
50 this.URI = URI;
51 this.directory = directory;
52 }
53
54 /***
55 * Constructor with no arguments. All the member variables are set to
56 * null or -1.
57 */
58
59 public ServerDetails ()
60 { this.name = null;
61 this.expiryPeriod = -1;
62 this.URI = null;
63 this.directory = null;
64 }
65
66
67
68
69
70
71
72
73
74 /***
75 * Return the name of the server.
76 *
77 * @return The name of the server.
78 */
79
80 public String getName()
81 { return name;
82 }
83
84 /***
85 * Return the expiry period of the server.
86 *
87 * @return The expiry period, in days, of the server.
88 */
89
90 public int getExpiryPeriod()
91 { return expiryPeriod;
92 }
93
94 /***
95 * Return the URI to access the server.
96 *
97 * @return The URI of the server.
98 */
99
100 public String getURI()
101 { return URI;
102 }
103
104 /***
105 * Return the base directory for the server.
106 *
107 * @return The base directory of the server.
108 */
109
110 public String getDirectory()
111 { return directory;
112 }
113
114
115
116
117
118
119
120 /***
121 * Produce a reasonable string representation of a
122 * <code>ServerDetails</code>.
123 *
124 * @return A String representation of the server details.
125 */
126
127 public String toString()
128 { String returnString;
129
130 if ( (name== null) && (expiryPeriod == -1) && (URI == null) &&
131 (directory == null) )
132 { returnString = "(The object is undefined.)";
133 }
134 else
135 { returnString = name + " (" + expiryPeriod + " days, " + URI + ").";
136 }
137
138 return returnString;
139 }
140 }