1 |
+ |
/* |
2 |
+ |
* i-scream central monitoring system |
3 |
+ |
* http://www.i-scream.org.uk |
4 |
+ |
* Copyright (C) 2000-2002 i-scream |
5 |
+ |
* |
6 |
+ |
* This program is free software; you can redistribute it and/or |
7 |
+ |
* modify it under the terms of the GNU General Public License |
8 |
+ |
* as published by the Free Software Foundation; either version 2 |
9 |
+ |
* of the License, or (at your option) any later version. |
10 |
+ |
* |
11 |
+ |
* This program is distributed in the hope that it will be useful, |
12 |
+ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
+ |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
+ |
* GNU General Public License for more details. |
15 |
+ |
* |
16 |
+ |
* You should have received a copy of the GNU General Public License |
17 |
+ |
* along with this program; if not, write to the Free Software |
18 |
+ |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 |
+ |
*/ |
20 |
+ |
|
21 |
|
//---PACKAGE DECLARATION--- |
22 |
< |
package uk.org.iscream.client; |
22 |
> |
package uk.org.iscream.cms.server.client; |
23 |
|
|
24 |
|
//---IMPORTS--- |
25 |
< |
import uk.org.iscream.componentmanager.*; |
26 |
< |
import uk.org.iscream.core.*; |
27 |
< |
import uk.org.iscream.util.*; |
25 |
> |
import uk.org.iscream.cms.server.componentmanager.*; |
26 |
> |
import uk.org.iscream.cms.server.core.*; |
27 |
> |
import uk.org.iscream.cms.server.util.*; |
28 |
|
import java.util.*; |
29 |
|
|
30 |
|
/** |
31 |
|
* A manager for the Alerters. |
32 |
|
* |
33 |
+ |
* This class starts by loading all the alerters as specificed in the configuration. |
34 |
+ |
* These alerters should implement the PluginAlerter interface. |
35 |
+ |
* |
36 |
+ |
* This class is then simply a reference point for the Alerters to get hooks on |
37 |
+ |
* the various parts of the system that they require. |
38 |
+ |
* |
39 |
|
* @author $Author$ |
40 |
|
* @version $Id$ |
41 |
|
*/ |
54 |
|
* Return a reference to the single class. |
55 |
|
* Construct it if it does not already exist, otherwise just return the reference. |
56 |
|
*/ |
57 |
< |
public static AlerterManager getInstance() { |
57 |
> |
public synchronized static AlerterManager getInstance() { |
58 |
|
if (_instance == null){ |
59 |
|
_instance = new AlerterManager(); |
60 |
|
} |
62 |
|
} |
63 |
|
|
64 |
|
//---CONSTRUCTORS--- |
65 |
< |
|
65 |
> |
|
66 |
> |
/** |
67 |
> |
* Constructs a new AlerterManager. |
68 |
> |
* This initialises all the queues and loads |
69 |
> |
* all the Alerters that have been specified in the configuration |
70 |
> |
*/ |
71 |
|
private AlerterManager() { |
72 |
|
// set our name |
73 |
|
setName("client.AlerterManager"); |
74 |
|
|
44 |
– |
_queue = ClientMain._alerterQueue; |
45 |
– |
_qID = _queue.getQueue(); |
75 |
|
_logger.write(toString(), Logger.SYSINIT, "Initialising"); |
76 |
|
_logger.write(toString(), Logger.SYSMSG, "Creating alerter pipeline for plugin alerters ..."); |
77 |
|
|
121 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
122 |
|
* method to provide clean logging (every class should have this). |
123 |
|
* |
124 |
< |
* This uses the uk.org.iscream.util.FormatName class |
124 |
> |
* This uses the uk.org.iscream.cms.server.util.FormatName class |
125 |
|
* to format the toString() |
126 |
|
* |
127 |
|
* @return the name of this class and its CVS revision |
145 |
|
* @return a reference to the alert queue |
146 |
|
*/ |
147 |
|
public Queue getQueue() { |
148 |
< |
return _queue; |
148 |
> |
return ClientMain._alerterQueue; |
149 |
|
} |
150 |
|
|
151 |
|
//---ATTRIBUTES--- |
171 |
|
* A reference to the reference manager in use |
172 |
|
*/ |
173 |
|
private ReferenceManager _refman = ReferenceManager.getInstance(); |
145 |
– |
|
146 |
– |
/** |
147 |
– |
* A reference to our Queue |
148 |
– |
*/ |
149 |
– |
private Queue _queue; |
150 |
– |
|
151 |
– |
/** |
152 |
– |
* Our queue ID |
153 |
– |
*/ |
154 |
– |
private int _qID; |
174 |
|
|
175 |
|
/** |
176 |
|
* file name suffix for plugin alerter classes: |