ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/client/Register.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/client/Register.java (file contents):
Revision 1.14 by ajm, Wed Mar 21 23:54:31 2001 UTC vs.
Revision 1.18 by tdb, Sat May 18 18:16:00 2002 UTC

# Line 1 | Line 1
1 + /*
2 + * i-scream central monitoring system
3 + * Copyright (C) 2000-2002 i-scream
4 + *
5 + * This program is free software; you can redistribute it and/or
6 + * modify it under the terms of the GNU General Public License
7 + * as published by the Free Software Foundation; either version 2
8 + * of the License, or (at your option) any later version.
9 + *
10 + * This program is distributed in the hope that it will be useful,
11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 + * GNU General Public License for more details.
14 + *
15 + * You should have received a copy of the GNU General Public License
16 + * along with this program; if not, write to the Free Software
17 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 + */
19 +
20   //---PACKAGE DECLARATION---
21 < package uk.org.iscream.client;
21 > package uk.org.iscream.cms.server.client;
22  
23   //---IMPORTS---
24 < import uk.org.iscream.util.*;
25 < import uk.org.iscream.componentmanager.*;
24 > import uk.org.iscream.cms.server.util.*;
25 > import uk.org.iscream.cms.server.componentmanager.*;
26  
27   /**
28   * The Register class holds theshold values,
# Line 185 | Line 204 | public class Register {
204          // -1.0 means we don't use an alert level
205          double threshold = -1.0;
206          try {
207 <            String thresholdString = getThresholdConfig(level, _attributeName);
207 >            String thresholdString = "";
208 >            try {
209 >                thresholdString = getThresholdConfig(level, _attributeName);
210 >            } catch (PropertyNotFoundException e) {
211 >                thresholdString = getThresholdConfig(level, null);
212 >            }
213              threshold = Double.parseDouble(thresholdString);
214          } catch (PropertyNotFoundException e) {
215              threshold = -1.0;
# Line 201 | Line 225 | public class Register {
225       * and is converted from the value in the config,
226       * which should be seconds.
227       *
228 +     * Note that if the alert timeout for the current monitor
229 +     * is not configured, it will try to obtain the default
230 +     * timeout for all Monitor's.  If there is no alert timeout
231 +     * for either the monitor or a default setting this returns 0.
232 +     *
233       * Note that this is dependant on the threshold value
234       * given, the timeout is obatined from the config, then
235       * divided by the threshold value, this allows alerts to
236       * progress faster should a higher threshold value be passed
237       *
209     * If there is no alert timeout for a
210     * given level, this returns 0
211     *
238       * @param level the alert level
239       * @param thresholdLevel the threshold leve we are on
240       */
# Line 216 | Line 242 | public class Register {
242          // 0 means we don't use this value
243          long timeout = 0;
244          try {
245 <            String timeoutString = _cp.getProperty("Host." + _hostname, "Monitor." + _monitorName + ".alertTimeout." + Alert.alertLevels[level]);
245 >            String timeoutString;
246 >            try {
247 >                timeoutString = _cp.getProperty("Host." + _hostname, "Monitor." + _monitorName + ".alertTimeout." + Alert.alertLevels[level]);
248 >            } catch (PropertyNotFoundException e) {
249 >                // if there is no timeout for the monitor
250 >                // check for a default
251 >                timeoutString = _cp.getProperty("Host." + _hostname, "Monitor.alertTimeout." + Alert.alertLevels[level]);
252 >            }    
253              int threshold = getLastThresholdLevel();
254              if (threshold > 0) {
255                  timeout = (Long.parseLong(timeoutString) / threshold) * 1000;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines