4 |
|
//---IMPORTS--- |
5 |
|
import uk.ac.ukc.iscream.util.*; |
6 |
|
import uk.ac.ukc.iscream.core.*; |
7 |
+ |
import uk.ac.ukc.iscream.componentmanager.*; |
8 |
|
import uk.ac.ukc.iscream.clientinterface.*; |
9 |
|
|
10 |
|
/** |
18 |
|
* @author $Author$ |
19 |
|
* @version $Id$ |
20 |
|
*/ |
21 |
< |
public class RootFilter implements uk.ac.ukc.iscream.util.Component { |
21 |
> |
public class RootFilter implements Component { |
22 |
|
|
23 |
|
//---FINAL ATTRIBUTES--- |
24 |
|
|
37 |
|
* This starts the Root Filter for the system |
38 |
|
*/ |
39 |
|
public void start() throws ComponentStartException { |
40 |
< |
|
40 |
> |
// get references to key objects |
41 |
> |
_refman = ReferenceManager.getInstance(); |
42 |
> |
_logger = ReferenceManager.getInstance().getLogger(); |
43 |
> |
|
44 |
|
_logger.write(toString(), Logger.SYSINIT, "coming up"); |
45 |
|
|
46 |
|
// configuration variables we require |
47 |
|
String ourName = null; |
48 |
|
String realInterface = null; |
49 |
|
String dbInterface = null; |
50 |
+ |
int queueMonitorInterval = 0; |
51 |
|
|
52 |
|
Configuration config = _refman.getCM().getConfiguration("RootFilter"); |
53 |
|
if (config == null) { |
54 |
< |
System.err.println("CRITICAL:Unable to obtain configuration" + |
55 |
< |
"\n Advise you check the i-scream log for more information."); |
56 |
< |
_logger.write(toString(), Logger.FATAL, "ERROR - unable to obtain configuration"); |
52 |
< |
System.exit(1); |
53 |
< |
} else { |
54 |
> |
throw new ComponentStartException("Unable to obtain configuration for component"); |
55 |
> |
} |
56 |
> |
else { |
57 |
|
try { |
58 |
+ |
// get the configuration properties we need |
59 |
|
ourName = config.getProperty("RootFilter.name"); |
60 |
|
realInterface = config.getProperty("RootFilter.realtimeInterfaceName"); |
61 |
|
dbInterface = config.getProperty("RootFilter.dbInterfaceName"); |
62 |
+ |
queueMonitorInterval = Integer.parseInt(config.getProperty("Queue.MonitorInterval")); |
63 |
|
} catch (org.omg.CORBA.MARSHAL e) { |
64 |
< |
System.err.println ("CRITICAL:Unable to obtain required configuration property" + |
60 |
< |
"\n Advise you check the i-scream log for more information."); |
61 |
< |
_logger.write(toString(), Logger.FATAL, "ERROR - required configuration property not present"); |
62 |
< |
System.exit(1); |
64 |
> |
throw new ComponentStartException("Unable to obtain requried configuration property for component"); |
65 |
|
} |
66 |
|
} |
67 |
+ |
|
68 |
|
// now we have the name of the Root Filter we set it |
69 |
|
NAME = ourName; |
70 |
|
|
81 |
|
} |
82 |
|
|
83 |
|
Queue queue = new Queue(); |
84 |
+ |
// startup a monitor on this queue, every minute |
85 |
+ |
String queueName = NAME + " RootFilter"; |
86 |
+ |
queue.startMonitor(queueMonitorInterval*1000, queueName); |
87 |
|
|
88 |
|
if (realInterface == null) { |
89 |
|
_logger.write(toString(), Logger.DEBUG, "hooked to interfaces - " + dbInterface); |
108 |
|
_refman.bindToOrb(filterServant, "iscream.Filter." + RootFilter.NAME); |
109 |
|
|
110 |
|
_logger.write(toString(), Logger.SYSINIT, "started"); |
111 |
+ |
|
112 |
|
} |
113 |
|
|
114 |
|
/** |
137 |
|
* This holds a reference to the |
138 |
|
* system logger that is being used. |
139 |
|
*/ |
140 |
< |
private Logger _logger = ReferenceManager.getInstance().getLogger(); |
140 |
> |
private Logger _logger; |
141 |
|
|
142 |
|
/** |
143 |
|
* A reference to the reference manager in use |
144 |
|
*/ |
145 |
< |
private ReferenceManager _refman = ReferenceManager.getInstance(); |
145 |
> |
private ReferenceManager _refman; |
146 |
|
|
147 |
|
//---STATIC ATTRIBUTES--- |
148 |
|
|