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.4
Committed: Thu Mar 22 17:57:06 2001 UTC (23 years, 2 months ago) by ajm
Branch: MAIN
Changes since 1.3: +25 -3 lines
Log Message:
Modified to use the new style queuing in the local client

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 tdb 1.2 * @author $Author: tdb1 $
14 ajm 1.4 * @version $Id: WebFeeder__Monitor.java,v 1.3 2001/03/14 23:25:29 tdb1 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.4 public static final String REVISION = "$Revision: 1.3 $";
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     try {
40     analysePacket((XMLPacket) getQueue().get(getQueueId()));
41     } catch (InvalidQueueException e) {
42     _logger.write(this.toString(), Logger.ERROR, "Unable to get queue.");
43     }
44     }
45    
46 tdb 1.1 public void analysePacket(XMLPacket packet) {
47 tdb 1.2 try {
48     ConfigurationProxy.getInstance().getProperty("WebFeeder", "WebFeeder.latestActive");
49     _webFeeder.receiveXMLPacket(packet);
50     } catch (PropertyNotFoundException e) {
51     // we don't care, this means we shouldn't be active
52     }
53 tdb 1.1 }
54    
55     public String getDescription() {
56     return DESC;
57     }
58    
59     /**
60     * Overrides the {@link java.lang.Object#toString() Object.toString()}
61     * method to provide clean logging (every class should have this).
62     *
63 tdb 1.3 * This uses the uk.org.iscream.util.FormatName class
64 tdb 1.1 * to format the toString()
65     *
66     * @return the name of this class and its CVS revision
67     */
68     public String toString() {
69     return FormatName.getName(
70     _name,
71     getClass().getName(),
72     REVISION);
73     }
74    
75     //---PRIVATE METHODS---
76    
77     //---ACCESSOR/MUTATOR METHODS---
78    
79 ajm 1.4 protected Queue getQueue() {
80     return MonitorManager.getInstance().getAllQueue();
81     }
82    
83     protected int getQueueId() {
84     if (_qID == -1) {
85     _qID = getQueue().getQueue();
86     }
87     return _qID;
88     }
89    
90 tdb 1.1 //---ATTRIBUTES---
91    
92     // reference to the WebFeeder
93     WebFeeder _webFeeder;
94    
95     /**
96     * This is the friendly identifier of the
97     * component this class is running in.
98     * eg, a Filter may be called "filter1",
99     * If this class does not have an owning
100     * component, a name from the configuration
101     * can be placed here. This name could also
102     * be changed to null for utility classes.
103     */
104     private String _name = "WebFeeder";
105    
106     /**
107     * This holds a reference to the
108     * system logger that is being used.
109     */
110     private Logger _logger = ReferenceManager.getInstance().getLogger();
111 ajm 1.4
112     protected int _qID = -1;
113 tdb 1.1
114     //---STATIC ATTRIBUTES---
115    
116     }