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

Comparing projects/cms/source/server/uk/org/iscream/cms/server/client/monitors/WebFeeder__Monitor.java (file contents):
Revision 1.1 by tdb, Wed Mar 7 01:55:59 2001 UTC vs.
Revision 1.5 by ajm, Thu Mar 22 18:28:24 2001 UTC

# Line 1 | Line 1
1   //---PACKAGE DECLARATION---
2 < package uk.ac.ukc.iscream.client.monitors;
2 > package uk.org.iscream.client.monitors;
3  
4   //---IMPORTS---
5 < import uk.ac.ukc.iscream.client.*;
6 < import uk.ac.ukc.iscream.core.*;
7 < import uk.ac.ukc.iscream.util.*;
8 < import uk.ac.ukc.iscream.componentmanager.*;
5 > import uk.org.iscream.client.*;
6 > import uk.org.iscream.core.*;
7 > import uk.org.iscream.util.*;
8 > import uk.org.iscream.componentmanager.*;
9  
10   /**
11   * Provides a full XMLPacket feed to the WebFeeder
# Line 13 | Line 13 | import uk.ac.ukc.iscream.componentmanager.*;
13   * @author  $Author$
14   * @version $Id$
15   */
16 < public class WebFeeder__Monitor implements PluginMonitor {
16 > public class WebFeeder__Monitor extends Thread implements PluginMonitor {
17  
18   //---FINAL ATTRIBUTES---
19  
# Line 30 | Line 30 | public class WebFeeder__Monitor implements PluginMonit
30  
31      public WebFeeder__Monitor() {
32          _webFeeder = WebFeeder.getInstance();
33 +        this.start();
34      }
35  
36   //---PUBLIC METHODS---
37  
38 +    public void run() {
39 +        while(_running) {
40 +            try {
41 +                analysePacket((XMLPacket) getQueue().get(getQueueId()));
42 +            } catch (InvalidQueueException e) {
43 +                _logger.write(this.toString(), Logger.ERROR, "Unable to get queue.");
44 +            }
45 +        }
46 +    }
47 +
48      public void analysePacket(XMLPacket packet) {
49 <        _webFeeder.receiveXMLPacket(packet);
49 >        try {
50 >            ConfigurationProxy.getInstance().getProperty("WebFeeder", "WebFeeder.latestActive");
51 >            _webFeeder.receiveXMLPacket(packet);
52 >        } catch (PropertyNotFoundException e) {
53 >            // we don't care, this means we shouldn't be active
54 >        }
55      }
56  
57      public String getDescription() {
# Line 46 | Line 62 | public class WebFeeder__Monitor implements PluginMonit
62       * Overrides the {@link java.lang.Object#toString() Object.toString()}
63       * method to provide clean logging (every class should have this).
64       *
65 <     * This uses the uk.ac.ukc.iscream.util.FormatName class
65 >     * This uses the uk.org.iscream.util.FormatName class
66       * to format the toString()
67       *
68       * @return the name of this class and its CVS revision
# Line 62 | Line 78 | public class WebFeeder__Monitor implements PluginMonit
78  
79   //---ACCESSOR/MUTATOR METHODS---
80  
81 +    protected Queue getQueue() {
82 +        return MonitorManager.getInstance().getAllQueue();
83 +    }
84 +
85 +    protected int getQueueId() {
86 +        if (_qID == -1) {
87 +            _qID = getQueue().getQueue();
88 +        }
89 +        return _qID;
90 +    }
91 +
92   //---ATTRIBUTES---
93      
94      // reference to the WebFeeder
# Line 83 | Line 110 | public class WebFeeder__Monitor implements PluginMonit
110       * system logger that is being used.
111       */
112      private Logger _logger = ReferenceManager.getInstance().getLogger();
113 +    
114 +    protected int _qID = -1;
115 +    
116 +    protected boolean _running = true;
117  
118   //---STATIC ATTRIBUTES---
119  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines