1 |
|
//---PACKAGE DECLARATION--- |
2 |
+ |
package uk.org.iscream.rootfilter; |
3 |
|
|
4 |
|
//---IMPORTS--- |
5 |
< |
import uk.ac.ukc.iscream.core.*; |
6 |
< |
import uk.ac.ukc.iscream.filter.*; |
5 |
> |
import uk.org.iscream.core.*; |
6 |
> |
import uk.org.iscream.componentmanager.*; |
7 |
> |
import uk.org.iscream.filter.*; |
8 |
> |
import uk.org.iscream.clientinterface.*; |
9 |
> |
import uk.org.iscream.util.*; |
10 |
|
|
11 |
|
/** |
12 |
< |
* A test RootFilterServant, just prints it out. |
12 |
> |
* A root filter servant has an array |
13 |
> |
* of client interfaces where data should be |
14 |
> |
* piped. |
15 |
|
* |
16 |
|
* @author $Author$ |
17 |
|
* @version $Id$ |
32 |
|
/** |
33 |
|
* Creates a new RootFilter. |
34 |
|
* |
35 |
< |
* @param logger a Logger to use |
35 |
> |
* @param queue a Queue to use |
36 |
|
*/ |
37 |
< |
public RootFilterServant(Logger logger, String name) { |
38 |
< |
_logRef = logger; |
39 |
< |
_name = name; |
34 |
< |
_logRef.write(this.toString(), Logger.DEBUG, "created"); |
37 |
> |
public RootFilterServant(Queue queue) { |
38 |
> |
_queue = queue; |
39 |
> |
_logger.write(toString(), Logger.SYSINIT, "created"); |
40 |
|
} |
41 |
|
|
42 |
|
//---PUBLIC METHODS--- |
44 |
|
/** |
45 |
|
* Method to receive a string over corba. |
46 |
|
* |
47 |
< |
* @param xml the String of XML to print out |
47 |
> |
* @param xml the String of XML to send on |
48 |
|
*/ |
49 |
|
public void receiveXML(String xml) { |
50 |
< |
_logRef.write(this.toString(), Logger.SYSMSG, "received XML: "+xml); |
46 |
< |
RootFilterThread t = new RootFilterThread(xml, _logRef); |
47 |
< |
t.start(); |
50 |
> |
_queue.add(xml); |
51 |
|
} |
52 |
|
|
50 |
– |
public String getUDPPort() { |
51 |
– |
return null; |
52 |
– |
} |
53 |
– |
|
54 |
– |
public String getTCPPort() { |
55 |
– |
return null; |
56 |
– |
} |
57 |
– |
|
58 |
– |
public String getHostName() { |
59 |
– |
return null; |
60 |
– |
} |
61 |
– |
|
53 |
|
/** |
54 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
55 |
|
* method to provide clean logging (every class should have this). |
56 |
|
* |
57 |
+ |
* This uses the uk.org.iscream.util.NameFormat class |
58 |
+ |
* to format the toString() |
59 |
+ |
* |
60 |
|
* @return the name of this class and its CVS revision |
61 |
|
*/ |
62 |
|
public String toString() { |
63 |
< |
return this.getClass().getName() + "{" + _name + "}(" + REVISION.substring(11, REVISION.length() - 2) + ")"; |
63 |
> |
return FormatName.getName( |
64 |
> |
_name, |
65 |
> |
getClass().getName(), |
66 |
> |
REVISION); |
67 |
|
} |
68 |
|
|
69 |
|
//---PRIVATE METHODS--- |
70 |
|
|
71 |
|
//---ACCESSOR/MUTATOR METHODS--- |
72 |
|
|
73 |
+ |
/** |
74 |
+ |
* This method is provided because the RootFilter appears |
75 |
+ |
* as another Filter to the rest of the Filter tree. This |
76 |
+ |
* method is required by the interface, although it actually |
77 |
+ |
* returns null. |
78 |
+ |
* |
79 |
+ |
* @return null |
80 |
+ |
*/ |
81 |
+ |
public String getUDPPort() { |
82 |
+ |
return null; |
83 |
+ |
} |
84 |
+ |
|
85 |
+ |
/** |
86 |
+ |
* This method is provided because the RootFilter appears |
87 |
+ |
* as another Filter to the rest of the Filter tree. This |
88 |
+ |
* method is required by the interface, although it actually |
89 |
+ |
* returns null. |
90 |
+ |
* |
91 |
+ |
* @return null |
92 |
+ |
*/ |
93 |
+ |
public String getTCPPort() { |
94 |
+ |
return null; |
95 |
+ |
} |
96 |
+ |
|
97 |
+ |
/** |
98 |
+ |
* This method is provided because the RootFilter appears |
99 |
+ |
* as another Filter to the rest of the Filter tree. This |
100 |
+ |
* method is required by the interface, although it actually |
101 |
+ |
* returns null. |
102 |
+ |
* |
103 |
+ |
* @return null |
104 |
+ |
*/ |
105 |
+ |
public String getHostName() { |
106 |
+ |
return null; |
107 |
+ |
} |
108 |
+ |
|
109 |
|
//---ATTRIBUTES--- |
110 |
|
|
111 |
|
/** |
112 |
< |
* Reference to a Logger |
112 |
> |
* This is the friendly identifier of the |
113 |
> |
* component this class is running in. |
114 |
> |
* eg, a Filter may be called "filter1", |
115 |
> |
* If this class does not have an owning |
116 |
> |
* component, a name from the configuration |
117 |
> |
* can be placed here. This name could also |
118 |
> |
* be changed to null for utility classes. |
119 |
|
*/ |
120 |
< |
private Logger _logRef; |
120 |
> |
private String _name = RootFilter.NAME; |
121 |
> |
|
122 |
> |
/** |
123 |
> |
* This holds a reference to the |
124 |
> |
* system logger that is being used. |
125 |
> |
*/ |
126 |
> |
private Logger _logger = ReferenceManager.getInstance().getLogger(); |
127 |
|
|
128 |
|
/** |
129 |
< |
* Our name |
129 |
> |
* A reference to the Queue being used. |
130 |
|
*/ |
131 |
< |
private String _name; |
131 |
> |
private Queue _queue; |
132 |
|
|
133 |
|
//---STATIC ATTRIBUTES--- |
134 |
|
|