4 |
|
import uk.ac.ukc.iscream.core.*; |
5 |
|
import java.util.*; |
6 |
|
import java.io.*; |
7 |
+ |
import java.text.DateFormat; |
8 |
|
|
9 |
|
/** |
10 |
|
* An implementation of the Configuration IDL |
41 |
|
* |
42 |
|
* @param propertiesStream an InputStream connected to the configuration |
43 |
|
*/ |
44 |
< |
ConfigurationServant(File configurationFile, Logger logRef) { |
45 |
< |
_lastModified = configurationFile.lastModified(); |
46 |
< |
|
44 |
> |
ConfigurationServant(Properties properties, String fileList, long lastModified, Logger logRef) { |
45 |
> |
_properties = properties; |
46 |
> |
_lastModified = lastModified; |
47 |
> |
_fileList = fileList; |
48 |
|
_logRef = logRef; |
49 |
< |
_logRef.write(this.toString(), "created - last modified:" + getLastModified()); |
50 |
< |
|
51 |
< |
try { |
52 |
< |
InputStream configurationStream = new FileInputStream(configurationFile); |
51 |
< |
_properties.load(configurationStream); |
52 |
< |
} catch (Exception e) { |
53 |
< |
// **************************************** |
54 |
< |
// either IOException from the .load() or |
55 |
< |
// a SecurityException or FileNotFoundException from |
56 |
< |
// the inputStream, not sure what to do yet!!! |
57 |
< |
} |
49 |
> |
_logRef.write(this.toString(), Logger.SYSINIT, "created"); |
50 |
> |
String date = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(new Date(getLastModified())); |
51 |
> |
_logRef.write(this.toString(), Logger.SYSMSG, "last modified - " + date); |
52 |
> |
_logRef.write(this.toString(), Logger.DEBUG, "file list - " + _fileList); |
53 |
|
} |
54 |
|
|
55 |
|
//---PUBLIC METHODS--- |
66 |
|
} |
67 |
|
|
68 |
|
/** |
69 |
< |
* Overrides the {@link #java.lang.Object.toString() Object.toString()} |
69 |
> |
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
70 |
|
* method to provide clean logging (every class should have this). |
71 |
|
* |
72 |
|
* @return the name of this class and its CVS revision |
73 |
|
*/ |
74 |
|
public String toString() { |
75 |
< |
return this.getClass().getName() + ":" + REVISION; |
75 |
> |
return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")"; |
76 |
|
} |
77 |
|
|
78 |
|
//---PRIVATE METHODS--- |
79 |
|
|
80 |
+ |
protected void finalize() throws Throwable { |
81 |
+ |
_logRef.write(this.toString(), Logger.DEBUG, "finalized (ick, us english!)"); |
82 |
+ |
} |
83 |
+ |
|
84 |
|
//---ACCESSOR/MUTATOR METHODS--- |
85 |
|
|
86 |
|
/** |
93 |
|
return _lastModified; |
94 |
|
} |
95 |
|
|
96 |
+ |
public String getFileList() { |
97 |
+ |
return _fileList; |
98 |
+ |
} |
99 |
+ |
|
100 |
|
//---ATTRIBUTES--- |
101 |
|
|
102 |
|
/** |
114 |
|
* this object is using |
115 |
|
*/ |
116 |
|
private long _lastModified; |
117 |
+ |
|
118 |
+ |
private String _fileList; |
119 |
|
|
120 |
|
//---STATIC ATTRIBUTES--- |
121 |
|
|