|
Lines 136-144
Link Here
|
| 136 |
* Setup the adapter and validate the configuration file. This method |
136 |
* Setup the adapter and validate the configuration file. This method |
| 137 |
* will not run the adapter and stops after validation. |
137 |
* will not run the adapter and stops after validation. |
| 138 |
* @throws AdapterException if the configuration is invalid |
138 |
* @throws AdapterException if the configuration is invalid |
|
|
139 |
* @throws AdapterBusy if the adapter is already running |
| 139 |
*/ |
140 |
*/ |
| 140 |
public void validate() throws AdapterException { |
141 |
public void validate() throws AdapterBusy, AdapterException { |
| 141 |
synchronized(this) { |
142 |
|
|
|
143 |
synchronized(this) { |
| 144 |
|
| 145 |
/* bugzilla 181090 |
| 146 |
* Only validate the adapter if it is not already running. |
| 147 |
*/ |
| 148 |
if (status.isActive()) { |
| 149 |
throw new AdapterBusy(Messages.getString("HyadesGAAdapter_Already_Running_ERROR_")); |
| 150 |
} |
| 142 |
/* If the controller object already exists and the adapter configuration file has not changed Then |
151 |
/* If the controller object already exists and the adapter configuration file has not changed Then |
| 143 |
* validate the current configuration. |
152 |
* validate the current configuration. |
| 144 |
*/ |
153 |
*/ |
|
Lines 194-207
Link Here
|
| 194 |
* unless the configuration files were specified with setContextConfigPath and setComponentConfigPath methods. |
203 |
* unless the configuration files were specified with setContextConfigPath and setComponentConfigPath methods. |
| 195 |
* @param separateThread Run the adapter in a separate thread |
204 |
* @param separateThread Run the adapter in a separate thread |
| 196 |
* @param daemon Run the adapter as a daemon thread. |
205 |
* @param daemon Run the adapter as a daemon thread. |
| 197 |
* @throws AdapterException If an error occurs during execution. |
206 |
* @throws AdapterException if the configuration is invalid |
|
|
207 |
* @throws AdapterBusy if the adapter is already running |
| 198 |
*/ |
208 |
*/ |
| 199 |
public void start(boolean separateThread, boolean daemon) throws AdapterException { |
209 |
public void start(boolean separateThread, boolean daemon) throws AdapterBusy, AdapterException { |
|
|
210 |
/* bugzilla 181090 |
| 211 |
* Only run the adapter if it is not already running. |
| 212 |
*/ |
| 213 |
synchronized(this) { |
| 214 |
if (status.isActive()) { |
| 215 |
throw new AdapterBusy(Messages.getString("HyadesGAAdapter_Already_Running_ERROR_")); |
| 216 |
} |
| 217 |
|
| 200 |
/* bugzilla 86674 |
218 |
/* bugzilla 86674 |
| 201 |
* Set the active status of the Adapter to true here so we include the configuration time |
219 |
* Set the active status of the Adapter to true here so we include the configuration time |
| 202 |
*/ |
220 |
*/ |
| 203 |
status.setActive(true); |
221 |
status.setActive(true); |
| 204 |
|
222 |
} |
| 205 |
/* If the controller object already exists and the adapter configuration file has not changed Then |
223 |
/* If the controller object already exists and the adapter configuration file has not changed Then |
| 206 |
* use the current configuration. |
224 |
* use the current configuration. |
| 207 |
*/ |
225 |
*/ |
|
Lines 246-252
Link Here
|
| 246 |
/* Run the controller and therefore the adapter in the current thread. */ |
264 |
/* Run the controller and therefore the adapter in the current thread. */ |
| 247 |
rootController.run(); |
265 |
rootController.run(); |
| 248 |
// All contexts have stopped so set the active status to false |
266 |
// All contexts have stopped so set the active status to false |
| 249 |
status.setActive(false); |
267 |
synchronized(this) { |
|
|
268 |
status.setActive(false); |
| 269 |
} |
| 250 |
} |
270 |
} |
| 251 |
else { |
271 |
else { |
| 252 |
/* Run the controller and therefore the adapter in a separate thread */ |
272 |
/* Run the controller and therefore the adapter in a separate thread */ |
|
Lines 265-271
Link Here
|
| 265 |
if (rootController != null) { |
285 |
if (rootController != null) { |
| 266 |
rootController.stop(); |
286 |
rootController.stop(); |
| 267 |
} |
287 |
} |
| 268 |
status.setActive(false); |
288 |
synchronized(this) { |
|
|
289 |
status.setActive(false); |
| 290 |
} |
| 269 |
} |
291 |
} |
| 270 |
|
292 |
|
| 271 |
/** |
293 |
/** |
|
Lines 276-282
Link Here
|
| 276 |
if (rootController != null) { |
298 |
if (rootController != null) { |
| 277 |
rootController.hardStop(); |
299 |
rootController.hardStop(); |
| 278 |
} |
300 |
} |
| 279 |
status.setActive(false); |
301 |
synchronized(this) { |
|
|
302 |
status.setActive(false); |
| 303 |
} |
| 280 |
} |
304 |
} |
| 281 |
|
305 |
|
| 282 |
/** |
306 |
/** |
|
Lines 358-369
Link Here
|
| 358 |
* @return the org.eclipse.hyades.logging.adapter.IStatus object representing the status. |
382 |
* @return the org.eclipse.hyades.logging.adapter.IStatus object representing the status. |
| 359 |
*/ |
383 |
*/ |
| 360 |
public IStatus getStatus() { |
384 |
public IStatus getStatus() { |
| 361 |
// This method may be called before start() is called so check for null rootController |
385 |
synchronized(this) { |
| 362 |
if (rootController != null) { |
386 |
// This method may be called before start() is called so check for null rootController |
| 363 |
status.setChildrenStatus(rootController.getStatus()); |
387 |
if (rootController != null) { |
| 364 |
} |
388 |
status.setChildrenStatus(rootController.getStatus()); |
| 365 |
else { |
389 |
} |
| 366 |
status.setActive(false); |
390 |
else { |
|
|
391 |
status.setActive(false); |
| 392 |
} |
| 367 |
} |
393 |
} |
| 368 |
return status; |
394 |
return status; |
| 369 |
} |
395 |
} |
|
Lines 376-382
Link Here
|
| 376 |
* @param outputter component where GLA will log its messages. |
402 |
* @param outputter component where GLA will log its messages. |
| 377 |
*/ |
403 |
*/ |
| 378 |
public void setLogOutputter(IOutputter outputter) { |
404 |
public void setLogOutputter(IOutputter outputter) { |
| 379 |
logOutputter = outputter; |
405 |
/* bugzilla 181090 |
|
|
406 |
* Only set the log outputter if the adapter is not already running. |
| 407 |
*/ |
| 408 |
synchronized(this) { |
| 409 |
if (!status.isActive()) { |
| 410 |
logOutputter = outputter; |
| 411 |
} |
| 412 |
} |
| 380 |
} |
413 |
} |
| 381 |
|
414 |
|
| 382 |
/** |
415 |
/** |