62 |
|
|
63 |
|
_logger.write(toString(), Logger.SYSINIT, "configured"); |
64 |
|
|
65 |
+ |
// setup the queues, this must be done before both managers are setup |
66 |
+ |
String queueName; |
67 |
|
// setup a Queue for the servant -> monitor manager |
68 |
< |
Queue queue = new Queue(); |
67 |
< |
// startup a monitor on this queue |
68 |
< |
String queueName = NAME + " ServantToMonMan"; |
69 |
< |
queue.startMonitor(queueMonitorInterval*1000, queueName); |
68 |
> |
_monitorQueue = new Queue(); |
69 |
|
|
70 |
+ |
// setup a Queue for the monitors -> alert manager |
71 |
+ |
_alerterQueue = new Queue(); |
72 |
+ |
|
73 |
+ |
|
74 |
+ |
|
75 |
|
// setup the servant and connect |
76 |
|
_logger.write(toString(), Logger.SYSINIT, "starting servant and connecting"); |
77 |
|
try { |
78 |
< |
ClientServant ref = new ClientServant(queue); |
78 |
> |
ClientServant ref = new ClientServant(_monitorQueue); |
79 |
|
org.omg.CORBA.Object objRef = _refman.getRootPOA().servant_to_reference(ref); |
80 |
|
Client client = ClientHelper.narrow(objRef); |
81 |
|
|
94 |
|
} |
95 |
|
|
96 |
|
// setup the MonitorManager |
97 |
< |
MonitorManager monMan = new MonitorManager(queue); |
97 |
> |
MonitorManager monMan = MonitorManager.getInstance(); |
98 |
> |
monMan.start(); |
99 |
|
|
100 |
+ |
// setup the AlerterManager |
101 |
+ |
AlerterManager alertMan = AlerterManager.getInstance(); |
102 |
+ |
alertMan.start(); |
103 |
+ |
|
104 |
|
_logger.write(toString(), Logger.SYSINIT, "started"); |
105 |
|
|
106 |
|
} |
107 |
< |
|
107 |
> |
|
108 |
|
/** |
109 |
+ |
* Does a dependency check. Used mainly at startup to |
110 |
+ |
* see if the required dependencies (components) are up |
111 |
+ |
* and running. |
112 |
+ |
* |
113 |
+ |
* @return a boolean value, true if the depdencies are satisfied |
114 |
+ |
*/ |
115 |
+ |
public boolean depCheck() { |
116 |
+ |
try { |
117 |
+ |
org.omg.CORBA.Object obj; |
118 |
+ |
// first check the ConfigurationManager is alive |
119 |
+ |
obj = _refman.getCORBARef("iscream.ConfigurationManager"); |
120 |
+ |
// then get some info on the CLI |
121 |
+ |
ConfigurationProxy cp = ConfigurationProxy.getInstance(); |
122 |
+ |
String cli = cp.getProperty("RootFilter", "RootFilter.realtimeInterfaceName"); |
123 |
+ |
// finally check the CLI is alive |
124 |
+ |
obj = _refman.getCORBARef("iscream.ClientInterface." + cli); |
125 |
+ |
} catch(ComponentCORBAException e) { |
126 |
+ |
_logger.write(toString(), Logger.WARNING, "Dependency Failure: "+e); |
127 |
+ |
return false; |
128 |
+ |
} catch(PropertyNotFoundException e) { |
129 |
+ |
_logger.write(toString(), Logger.WARNING, "Unable to obtain configuration: "+e); |
130 |
+ |
return false; |
131 |
+ |
} |
132 |
+ |
// dependency check suceeded |
133 |
+ |
return true; |
134 |
+ |
} |
135 |
+ |
|
136 |
+ |
/** |
137 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
138 |
|
* method to provide clean logging (every class should have this). |
139 |
|
* |
167 |
|
private ReferenceManager _refman; |
168 |
|
|
169 |
|
//---STATIC ATTRIBUTES--- |
170 |
+ |
|
171 |
+ |
/** |
172 |
+ |
* A queue for the alerter manager |
173 |
+ |
*/ |
174 |
+ |
public static Queue _alerterQueue; |
175 |
+ |
|
176 |
+ |
/** |
177 |
+ |
* A queue for the monitor manager |
178 |
+ |
*/ |
179 |
+ |
public static Queue _monitorQueue; |
180 |
|
|
181 |
|
} |