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
Revision: 1.5
Committed: Thu Mar 22 18:28:24 2001 UTC (23 years, 2 months ago) by ajm
Branch: MAIN
Changes since 1.4: +11 -7 lines
Log Message:
now correctly process data from the inbound queue

File Contents

# User Rev Content
1 tdb 1.1 //---PACKAGE DECLARATION---
2 tdb 1.3 package uk.org.iscream.client.monitors;
3 tdb 1.1
4     //---IMPORTS---
5 tdb 1.3 import uk.org.iscream.client.*;
6     import uk.org.iscream.core.*;
7     import uk.org.iscream.util.*;
8     import uk.org.iscream.componentmanager.*;
9 tdb 1.1
10     /**
11     * Provides a full XMLPacket feed to the WebFeeder
12     *
13 ajm 1.5 * @author $Author: ajm4 $
14     * @version $Id: WebFeeder__Monitor.java,v 1.4 2001/03/22 17:57:06 ajm4 Exp $
15 tdb 1.1 */
16 ajm 1.4 public class WebFeeder__Monitor extends Thread implements PluginMonitor {
17 tdb 1.1
18     //---FINAL ATTRIBUTES---
19    
20     /**
21     * The current CVS revision of this class
22     */
23 ajm 1.5 public static final String REVISION = "$Revision: 1.4 $";
24 tdb 1.1
25     public static final String DESC = "Provides a feed to WebFeeder";
26    
27     //---STATIC METHODS---
28    
29     //---CONSTRUCTORS---
30    
31     public WebFeeder__Monitor() {
32     _webFeeder = WebFeeder.getInstance();
33 ajm 1.4 this.start();
34 tdb 1.1 }
35    
36     //---PUBLIC METHODS---
37    
38 ajm 1.4 public void run() {
39 ajm 1.5 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 ajm 1.4 }
46     }
47    
48 tdb 1.1 public void analysePacket(XMLPacket packet) {
49 tdb 1.2 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 tdb 1.1 }
56    
57     public String getDescription() {
58     return DESC;
59     }
60    
61     /**
62     * Overrides the {@link java.lang.Object#toString() Object.toString()}
63     * method to provide clean logging (every class should have this).
64     *
65 tdb 1.3 * This uses the uk.org.iscream.util.FormatName class
66 tdb 1.1 * to format the toString()
67     *
68     * @return the name of this class and its CVS revision
69     */
70     public String toString() {
71     return FormatName.getName(
72     _name,
73     getClass().getName(),
74     REVISION);
75     }
76    
77     //---PRIVATE METHODS---
78    
79     //---ACCESSOR/MUTATOR METHODS---
80    
81 ajm 1.4 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 tdb 1.1 //---ATTRIBUTES---
93    
94     // reference to the WebFeeder
95     WebFeeder _webFeeder;
96    
97     /**
98     * This is the friendly identifier of the
99     * component this class is running in.
100     * eg, a Filter may be called "filter1",
101     * If this class does not have an owning
102     * component, a name from the configuration
103     * can be placed here. This name could also
104     * be changed to null for utility classes.
105     */
106     private String _name = "WebFeeder";
107    
108     /**
109     * This holds a reference to the
110     * system logger that is being used.
111     */
112     private Logger _logger = ReferenceManager.getInstance().getLogger();
113 ajm 1.4
114     protected int _qID = -1;
115 ajm 1.5
116     protected boolean _running = true;
117 tdb 1.1
118     //---STATIC ATTRIBUTES---
119    
120     }