2 |
|
package uk.ac.ukc.iscream.core; |
3 |
|
|
4 |
|
//---IMPORTS--- |
5 |
< |
import java.util.*; |
6 |
< |
import java.io.*; |
5 |
> |
import uk.ac.ukc.iscream.util.*; |
6 |
> |
import java.util.Properties; |
7 |
> |
import java.util.Date; |
8 |
|
import java.text.DateFormat; |
9 |
|
|
10 |
|
/** |
45 |
|
* @param lastModified the most recent last modified value for the file list |
46 |
|
* @param logRef a reference to the logger system |
47 |
|
*/ |
48 |
< |
ConfigurationServant(Properties properties, String fileList, long lastModified, Logger logRef) { |
48 |
> |
ConfigurationServant(Properties properties, String fileList, long lastModified) { |
49 |
|
// assign local variables |
50 |
|
_properties = properties; |
51 |
|
_lastModified = lastModified; |
52 |
|
_fileList = fileList; |
53 |
< |
_logRef = logRef; |
53 |
< |
_logRef.write(this.toString(), Logger.SYSINIT, "created"); |
53 |
> |
_logger.write(toString(), Logger.SYSINIT, "created"); |
54 |
|
String date = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(new Date(getLastModified())); |
55 |
< |
_logRef.write(this.toString(), Logger.SYSMSG, "last modified - " + date); |
56 |
< |
_logRef.write(this.toString(), Logger.DEBUG, "file list - " + _fileList); |
55 |
> |
_logger.write(toString(), Logger.SYSMSG, "last modified - " + date); |
56 |
> |
_logger.write(toString(), Logger.DEBUG, "file list - " + _fileList); |
57 |
|
} |
58 |
|
|
59 |
|
//---PUBLIC METHODS--- |
73 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
74 |
|
* method to provide clean logging (every class should have this). |
75 |
|
* |
76 |
+ |
* This uses the uk.ac.ukc.iscream.util.FormatName class |
77 |
+ |
* to format the toString() |
78 |
+ |
* |
79 |
|
* @return the name of this class and its CVS revision |
80 |
|
*/ |
81 |
|
public String toString() { |
82 |
< |
return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")"; |
82 |
> |
return FormatName.getName( |
83 |
> |
_name, |
84 |
> |
getClass().getName(), |
85 |
> |
REVISION); |
86 |
|
} |
87 |
|
|
88 |
|
//---PRIVATE METHODS--- |
93 |
|
* is destroyed |
94 |
|
*/ |
95 |
|
protected void finalize() throws Throwable { |
96 |
< |
_logRef.write(this.toString(), Logger.DEBUG, "finalized (ick, us english!)"); |
96 |
> |
_logger.write(this.toString(), Logger.DEBUG, "finalized"); |
97 |
|
} |
98 |
|
|
99 |
|
//---ACCESSOR/MUTATOR METHODS--- |
126 |
|
private Properties _properties = new Properties(); |
127 |
|
|
128 |
|
/** |
129 |
< |
* Reference to a Logger |
129 |
> |
* This holds a reference to the |
130 |
> |
* system logger that is being used. |
131 |
|
*/ |
132 |
< |
private Logger _logRef; |
132 |
> |
private Logger _logger = ReferenceManager.getInstance().getLogger(); |
133 |
> |
|
134 |
> |
/** |
135 |
> |
* This is the friendly identifier of the |
136 |
> |
* component this class is running in. |
137 |
> |
* eg, a Filter may be called "filter1", |
138 |
> |
* If this class does not have an owning |
139 |
> |
* component, a name from the configuration |
140 |
> |
* can be placed here. This name could also |
141 |
> |
* be changed to null for utility classes. |
142 |
> |
*/ |
143 |
> |
private String _name = Core.NAME; |
144 |
|
|
145 |
|
/** |
146 |
|
* The date stamp of the configuration file |
147 |
|
* this object is using |
148 |
|
*/ |
149 |
|
private long _lastModified; |
132 |
– |
|
150 |
|
|
151 |
|
/** |
152 |
|
* The list of files that were used to build this configuration |