ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/rootfilter/CIWrapper.java
Revision: 1.10
Committed: Tue May 29 17:02:35 2001 UTC (23 years ago) by tdb
Branch: MAIN
Changes since 1.9: +7 -7 lines
Log Message:
Major change in the java package naming. This has been held off for some time
now, but it really needed doing. The future packaging of all i-scream products
will be;

uk.org.iscream.<product>.<subpart>.*

In the case of the central monitoring system server this will be;

uk.org.iscream.cms.server.*

The whole server has been changed to follow this structure, and tested to a
smallish extent. Further changes in other parts of the CMS will follow.

File Contents

# Content
1 //---PACKAGE DECLARATION---
2 package uk.org.iscream.cms.server.rootfilter;
3
4 //---IMPORTS---
5 import uk.org.iscream.cms.server.core.*;
6 import uk.org.iscream.cms.server.componentmanager.*;
7 import uk.org.iscream.cms.server.clientinterface.*;
8 import uk.org.iscream.cms.server.util.*;
9
10 /**
11 * A ClientInterface wrapper - the CI objects are pushed data,
12 * yet data is pulled from the queue. This will sit inbetween
13 * for now, until the CI design is changed.
14 *
15 * @author $Author: tdb1 $
16 * @version $Id $
17 */
18 public class CIWrapper extends Thread {
19
20 //---FINAL ATTRIBUTES---
21
22 /**
23 * The current CVS revision of this class
24 */
25 public final String REVISION = "$Revision: 1.9 $";
26
27 //---STATIC METHODS---
28
29 //---CONSTRUCTORS---
30
31 /**
32 * Sets up the wrapper, with a single destination and a queue.
33 *
34 * @param destination the client interface to send the xml to
35 * @param queue a reference to a queue to use
36 */
37 public CIWrapper(ClientInterface destination, Queue queue){
38 // set the Thread name
39 setName("rootfilter.CIWrapper");
40
41 _destination = destination;
42 _queue = queue;
43 _queueID = queue.getQueue();
44 }
45
46 //---PUBLIC METHODS---
47
48 /**
49 * start the thread and thus gets and sends data
50 */
51 public void run() {
52 String xml = null;
53 while(true) {
54 try {
55 xml = (String) _queue.get(_queueID);
56 }
57 catch (InvalidQueueException e) {
58 _logger.write(toString(), Logger.ERROR, "Queue error: "+e);
59 }
60 _destination.receiveXML(xml);
61 }
62 }
63
64 /**
65 * Overrides the {@link java.lang.Object#toString() Object.toString()}
66 * method to provide clean logging (every class should have this).
67 *
68 * This uses the uk.org.iscream.cms.server.util.NameFormat class
69 * to format the toString()
70 *
71 * @return the name of this class and its CVS revision
72 */
73 public String toString() {
74 return FormatName.getName(
75 _name,
76 getClass().getName(),
77 REVISION);
78 }
79
80 //---PRIVATE METHODS---
81
82 //---ACCESSOR/MUTATOR METHODS---
83
84 //---ATTRIBUTES---
85
86 /**
87 * A reference to a Queue object.
88 */
89 private Queue _queue;
90
91 /**
92 * Our Queue id.
93 */
94 private int _queueID;
95
96 /**
97 * the interface this thread is sending data to
98 */
99 private ClientInterface _destination;
100
101 /**
102 * This is the friendly identifier of the
103 * component this class is running in.
104 * eg, a Filter may be called "filter1",
105 * If this class does not have an owning
106 * component, a name from the configuration
107 * can be placed here. This name could also
108 * be changed to null for utility classes.
109 */
110 private String _name = RootFilter.NAME;
111
112 /**
113 * This holds a reference to the
114 * system logger that is being used.
115 */
116 private Logger _logger = ReferenceManager.getInstance().getLogger();
117
118 //---STATIC ATTRIBUTES---
119
120 }