1 |
|
//---PACKAGE DECLARATION--- |
2 |
+ |
package uk.ac.ukc.iscream.core; |
3 |
|
|
4 |
|
//---IMPORTS--- |
5 |
< |
import uk.ac.ukc.iscream.core.*; |
6 |
< |
import java.util.*; |
7 |
< |
import java.io.*; |
5 |
> |
import uk.ac.ukc.iscream.util.*; |
6 |
> |
import uk.ac.ukc.iscream.componentmanager.*; |
7 |
> |
import java.util.Properties; |
8 |
> |
import java.util.Date; |
9 |
|
import java.text.DateFormat; |
10 |
|
|
11 |
|
/** |
46 |
|
* @param lastModified the most recent last modified value for the file list |
47 |
|
* @param logRef a reference to the logger system |
48 |
|
*/ |
49 |
< |
ConfigurationServant(Properties properties, String fileList, long lastModified, Logger logRef) { |
49 |
> |
ConfigurationServant(Properties properties, String fileList, long lastModified) { |
50 |
|
// assign local variables |
51 |
|
_properties = properties; |
52 |
|
_lastModified = lastModified; |
53 |
|
_fileList = fileList; |
54 |
< |
_logRef = logRef; |
53 |
< |
_logRef.write(this.toString(), Logger.SYSINIT, "created"); |
54 |
> |
_logger.write(toString(), Logger.SYSINIT, "created"); |
55 |
|
String date = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(new Date(getLastModified())); |
56 |
< |
_logRef.write(this.toString(), Logger.SYSMSG, "last modified - " + date); |
57 |
< |
_logRef.write(this.toString(), Logger.DEBUG, "file list - " + _fileList); |
56 |
> |
_logger.write(toString(), Logger.SYSMSG, "last modified - " + date); |
57 |
> |
_logger.write(toString(), Logger.DEBUG, "file list - " + _fileList); |
58 |
|
} |
59 |
|
|
60 |
|
//---PUBLIC METHODS--- |
74 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
75 |
|
* method to provide clean logging (every class should have this). |
76 |
|
* |
77 |
+ |
* This uses the uk.ac.ukc.iscream.util.FormatName class |
78 |
+ |
* to format the toString() |
79 |
+ |
* |
80 |
|
* @return the name of this class and its CVS revision |
81 |
|
*/ |
82 |
|
public String toString() { |
83 |
< |
return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")"; |
83 |
> |
return FormatName.getName( |
84 |
> |
_name, |
85 |
> |
getClass().getName(), |
86 |
> |
REVISION); |
87 |
|
} |
88 |
|
|
89 |
+ |
public void disconnect() { |
90 |
+ |
try { |
91 |
+ |
org.omg.CORBA.Object objRef = _refman.getRootPOA().servant_to_reference(this); |
92 |
+ |
_refman.getORB().disconnect(objRef); |
93 |
+ |
} catch(Exception e) { |
94 |
+ |
_logger.write(this.toString(), Logger.ERROR, "disconnect failed: "+e); |
95 |
+ |
} |
96 |
+ |
} |
97 |
+ |
|
98 |
+ |
|
99 |
|
//---PRIVATE METHODS--- |
100 |
|
|
101 |
|
/** |
104 |
|
* is destroyed |
105 |
|
*/ |
106 |
|
protected void finalize() throws Throwable { |
107 |
< |
_logRef.write(this.toString(), Logger.DEBUG, "finalized (ick, us english!)"); |
107 |
> |
_logger.write(this.toString(), Logger.DEBUG, "finalized"); |
108 |
|
} |
109 |
|
|
110 |
|
//---ACCESSOR/MUTATOR METHODS--- |
137 |
|
private Properties _properties = new Properties(); |
138 |
|
|
139 |
|
/** |
140 |
< |
* Reference to a Logger |
140 |
> |
* This holds a reference to the |
141 |
> |
* system logger that is being used. |
142 |
|
*/ |
143 |
< |
private Logger _logRef; |
143 |
> |
private Logger _logger = ReferenceManager.getInstance().getLogger(); |
144 |
|
|
145 |
|
/** |
146 |
+ |
* A reference to the reference manager in use |
147 |
+ |
*/ |
148 |
+ |
private ReferenceManager _refman = ReferenceManager.getInstance(); |
149 |
+ |
|
150 |
+ |
/** |
151 |
+ |
* This is the friendly identifier of the |
152 |
+ |
* component this class is running in. |
153 |
+ |
* eg, a Filter may be called "filter1", |
154 |
+ |
* If this class does not have an owning |
155 |
+ |
* component, a name from the configuration |
156 |
+ |
* can be placed here. This name could also |
157 |
+ |
* be changed to null for utility classes. |
158 |
+ |
*/ |
159 |
+ |
private String _name = Core.NAME; |
160 |
+ |
|
161 |
+ |
/** |
162 |
|
* The date stamp of the configuration file |
163 |
|
* this object is using |
164 |
|
*/ |
165 |
|
private long _lastModified; |
132 |
– |
|
166 |
|
|
167 |
|
/** |
168 |
|
* The list of files that were used to build this configuration |