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/AlerterManager.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/client/AlerterManager.java (file contents):
Revision 1.3 by tdb, Wed Mar 14 23:25:29 2001 UTC vs.
Revision 1.5 by ajm, Thu Mar 22 22:07:14 2001 UTC

# Line 8 | Line 8 | import uk.org.iscream.util.*;
8   import java.util.*;
9  
10   /**
11 < * A manager for the Monitors.
11 > * A manager for the Alerters.
12   *
13   * @author  $Author$
14   * @version $Id$
15   */
16 < class AlerterManager extends Thread {
16 > public class AlerterManager extends Thread {
17  
18   //---FINAL ATTRIBUTES---
19  
# Line 46 | Line 46 | class AlerterManager extends Thread {
46          _logger.write(toString(), Logger.SYSINIT, "Initialising");
47          _logger.write(toString(), Logger.SYSMSG, "Creating alerter pipeline for plugin alerters ...");
48          
49 +        // get the config proxy
50 +        ConfigurationProxy cp = ConfigurationProxy.getInstance();
51 +        
52          // get the configuration for this plug-in setup
53 <        Configuration config = _refman.getCM().getConfiguration(_name);
54 <        String pluginsPackage = config.getProperty("Alerter.PluginsPackage");
55 <        String pluginsList = config.getProperty("Alerter.Plugins");
53 >        String pluginsPackage, pluginsList;
54 >        try {
55 >            pluginsPackage = cp.getProperty(_name, "Alerter.PluginsPackage");
56 >            pluginsList = cp.getProperty(_name, "Alerter.Plugins");
57 >        } catch(PropertyNotFoundException e) {
58 >            _logger.write(toString(), Logger.WARNING, "Unable to get required configuration, Alerter's will not be activated: "+e);
59 >            // setting these will ensure we don't build a pipeline
60 >            pluginsPackage = "";
61 >            pluginsList = "";
62 >        }
63          
64          StringTokenizer st = new StringTokenizer(pluginsList, ";");
65          
# Line 77 | Line 87 | class AlerterManager extends Thread {
87      }
88  
89   //---PUBLIC METHODS---
80    
81    public void run() {
82        
83        boolean run=true;
84        while(run) {
85            // attempt to get some data from the Queue
86            Alert alert = null;
87            try {
88                alert = (Alert) _queue.get(_qID);
89            }
90            catch(InvalidQueueException e) {
91                _logger.write(toString(), Logger.ERROR, "Queue failure: "+e);
92            }
93            
94            // for each alerter in the pipeline...
95            Iterator pluginAlerters = _alerterPipeline.iterator();
96            while (pluginAlerters.hasNext()){
97                PluginAlerter alerter = (PluginAlerter)pluginAlerters.next();
98                alerter.sendAlert(alert);
99            }
100        }
101    }
90  
91      /**
92       * Overrides the {@link java.lang.Object#toString() Object.toString()}
# Line 119 | Line 107 | class AlerterManager extends Thread {
107   //---PRIVATE METHODS---
108  
109   //---ACCESSOR/MUTATOR METHODS---
110 +
111 +    /**
112 +     * Allows alerters to obtain a reference
113 +     * to the alerting queue so that they can
114 +     * process any alerts
115 +     *
116 +     * @return a reference to the alert queue
117 +     */
118 +    public Queue getQueue() {
119 +        return _queue;
120 +    }
121  
122   //---ATTRIBUTES---
123  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines