1 |
+ |
/* |
2 |
+ |
* i-scream central monitoring system |
3 |
+ |
* http://www.i-scream.org |
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.alerters; |
22 |
> |
package uk.org.iscream.cms.server.client.alerters; |
23 |
|
|
24 |
|
//---IMPORTS--- |
25 |
< |
import uk.org.iscream.client.*; |
26 |
< |
import uk.org.iscream.core.*; |
27 |
< |
import uk.org.iscream.util.*; |
28 |
< |
import uk.org.iscream.componentmanager.*; |
25 |
> |
import uk.org.iscream.cms.server.client.*; |
26 |
> |
import uk.org.iscream.cms.server.core.*; |
27 |
> |
import uk.org.iscream.cms.util.*; |
28 |
> |
import uk.org.iscream.cms.server.componentmanager.*; |
29 |
|
import java.io.*; |
30 |
|
import java.util.StringTokenizer; |
31 |
|
|
45 |
|
*/ |
46 |
|
public final String REVISION = "$Revision$"; |
47 |
|
|
48 |
+ |
/** |
49 |
+ |
* A description of this alerter |
50 |
+ |
*/ |
51 |
|
public final String DESC = "Sends alerts over e-mail."; |
52 |
|
|
30 |
– |
public final String NOT_CONFIGURED = "<NOT CONFIGURED>"; |
31 |
– |
|
53 |
|
//---STATIC METHODS--- |
54 |
|
|
55 |
|
//---CONSTRUCTORS--- |
56 |
|
|
57 |
|
//---PUBLIC METHODS--- |
58 |
|
|
59 |
+ |
/** |
60 |
+ |
* Implements the abstract method from the skeleton class. |
61 |
+ |
* This method will attempt to send an alert |
62 |
+ |
* message using the configured email configuration. |
63 |
+ |
* |
64 |
+ |
* @param alert the alert to send |
65 |
+ |
*/ |
66 |
|
public void sendAlert(Alert alert) { |
67 |
|
// get the subject and replace fields |
68 |
|
String subject; |
122 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
123 |
|
* method to provide clean logging (every class should have this). |
124 |
|
* |
125 |
< |
* This uses the uk.org.iscream.util.NameFormat class |
125 |
> |
* This uses the uk.org.iscream.cms.util.NameFormat class |
126 |
|
* to format the toString() |
127 |
|
* |
128 |
|
* @return the name of this class and its CVS revision |
135 |
|
} |
136 |
|
|
137 |
|
/** |
138 |
< |
* return the String representation of what the alerter does |
138 |
> |
* Return the String representation of what the alerter does |
139 |
> |
* |
140 |
> |
* @return the description |
141 |
|
*/ |
142 |
|
public String getDescription(){ |
143 |
|
return DESC; |
146 |
|
//---PRIVATE METHODS--- |
147 |
|
|
148 |
|
//---ACCESSOR/MUTATOR METHODS--- |
149 |
+ |
|
150 |
+ |
/** |
151 |
+ |
* Returns the "friendly" name of this class. This |
152 |
+ |
* is simply an accessor for _name, required due to |
153 |
+ |
* inheritance issues with extending AlerterSkeleton. |
154 |
+ |
* |
155 |
+ |
* @return the friendly name |
156 |
+ |
*/ |
157 |
+ |
protected String getFName() { |
158 |
+ |
return _name; |
159 |
+ |
} |
160 |
|
|
161 |
|
//---ATTRIBUTES--- |
162 |
|
|
170 |
|
* be changed to null for utility classes. |
171 |
|
*/ |
172 |
|
protected String _name = "EMail"; |
132 |
– |
|
133 |
– |
/** |
134 |
– |
* This holds a reference to the |
135 |
– |
* system logger that is being used. |
136 |
– |
*/ |
137 |
– |
private Logger _logger = ReferenceManager.getInstance().getLogger(); |
173 |
|
|
174 |
|
//---STATIC ATTRIBUTES--- |
175 |
|
|