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.5 by ajm, Thu Mar 22 18:28:24 2001 UTC vs.
Revision 1.6 by tdb, Fri Mar 23 02:25:15 2001 UTC

# Line 22 | Line 22 | public class WebFeeder__Monitor extends Thread impleme
22       */
23      public static final String REVISION = "$Revision$";
24      
25 +    /**
26 +     * A description of this monitor
27 +     */
28      public static final String DESC = "Provides a feed to WebFeeder";
29      
30   //---STATIC METHODS---
31  
32   //---CONSTRUCTORS---
33 <
33 >    
34 >    /**
35 >     * Constructs a new instance of this hook for the WebFeeder.
36 >     */
37      public WebFeeder__Monitor() {
32        _webFeeder = WebFeeder.getInstance();
38          this.start();
39      }
40  
41   //---PUBLIC METHODS---
42 <
42 >    
43 >    /**
44 >     * Keeps getting packets from the queue, and analyses
45 >     * them. In reality, this just sends them off to the
46 >     * WebFeeder for further processing.
47 >     */
48      public void run() {
49          while(_running) {
50              try {
# Line 44 | Line 54 | public class WebFeeder__Monitor extends Thread impleme
54              }
55          }
56      }
57 <
57 >    
58 >    /**
59 >     * Sends a packet to the WebFeeder for processing, if
60 >     * we are active.
61 >     *
62 >     * @param packet the XMLPacket to send to the WebFeeder
63 >     */
64      public void analysePacket(XMLPacket packet) {
65          try {
66              ConfigurationProxy.getInstance().getProperty("WebFeeder", "WebFeeder.latestActive");
67 <            _webFeeder.receiveXMLPacket(packet);
67 >            WebFeeder.getInstance().receiveXMLPacket(packet);
68          } catch (PropertyNotFoundException e) {
69              // we don't care, this means we shouldn't be active
70          }
71      }
72 <
72 >    
73 >    /**
74 >     * return the String representation of what the monitor does
75 >     */
76      public String getDescription() {
77          return DESC;
78      }
# Line 77 | Line 96 | public class WebFeeder__Monitor extends Thread impleme
96   //---PRIVATE METHODS---
97  
98   //---ACCESSOR/MUTATOR METHODS---
99 <
99 >    
100 >    /**
101 >     * Returns a reference to a specific Queue for this
102 >     * monitor. This Queue returns only the data packets
103 >     * (based on type) that we want too look at.
104 >     *
105 >     * @return a reference to a Queue
106 >     */
107      protected Queue getQueue() {
108          return MonitorManager.getInstance().getAllQueue();
109      }
110 <
110 >    
111 >    /**
112 >     * Gets us a queue within the Queue we're using.
113 >     *
114 >     * @return a unique queue id number
115 >     */
116      protected int getQueueId() {
117          if (_qID == -1) {
118              _qID = getQueue().getQueue();
119          }
120          return _qID;
121      }
122 <
122 >    
123   //---ATTRIBUTES---
124      
94    // reference to the WebFeeder
95    WebFeeder _webFeeder;
96    
125      /**
126       * This is the friendly identifier of the
127       * component this class is running in.
# Line 111 | Line 139 | public class WebFeeder__Monitor extends Thread impleme
139       */
140      private Logger _logger = ReferenceManager.getInstance().getLogger();
141      
142 +    /**
143 +     * Holds our queue ID number. Starts with -1, which
144 +     * indicates we don't have a queue.
145 +     */
146      protected int _qID = -1;
147      
148 +    /**
149 +     * A flag so we can stop if required.
150 +     */
151      protected boolean _running = true;
152  
153   //---STATIC ATTRIBUTES---

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines