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.1
Committed: Tue Jan 2 03:18:56 2001 UTC (23 years, 4 months ago) by tdb
Branch: MAIN
Log Message:
A temporary class. Sits between a Queue and a ClientInterface. The CI needs
to be altered to pull data from a Queue, and when this happens this class can
be removed.

File Contents

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