8 |
|
import java.net.InetAddress; |
9 |
|
|
10 |
|
/** |
11 |
< |
* A test FilterServant, just prints it out. |
11 |
> |
* Passes inbound data from other Filters to a FilterThread |
12 |
|
* |
13 |
|
* @author $Author$ |
14 |
|
* @version $Id$ |
53 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
54 |
|
* method to provide clean logging (every class should have this). |
55 |
|
* |
56 |
+ |
* This uses the uk.ac.ukc.iscream.util.NameFormat class |
57 |
+ |
* to format the toString() |
58 |
+ |
* |
59 |
|
* @return the name of this class and its CVS revision |
60 |
|
*/ |
61 |
|
public String toString() { |
62 |
< |
return this.getClass().getName() + "{" + _name + "}(" + REVISION.substring(11, REVISION.length() - 2) + ")"; |
62 |
> |
return FormatName.getName( |
63 |
> |
_name, |
64 |
> |
getClass().getName(), |
65 |
> |
REVISION); |
66 |
|
} |
67 |
|
|
68 |
|
//---PRIVATE METHODS--- |
69 |
|
|
70 |
|
//---ACCESSOR/MUTATOR METHODS--- |
71 |
|
|
72 |
+ |
/** |
73 |
+ |
* Provides information to the FilterManager |
74 |
+ |
*/ |
75 |
|
public String getUDPPort() { |
76 |
|
return new Integer(_UDPListenPort).toString(); |
77 |
|
} |
78 |
|
|
79 |
+ |
/** |
80 |
+ |
* Provides information to the FilterManager |
81 |
+ |
*/ |
82 |
|
public String getTCPPort() { |
83 |
|
return new Integer(_TCPListenPort).toString(); |
84 |
|
} |
85 |
|
|
86 |
+ |
/** |
87 |
+ |
* Provides information to the FilterManager |
88 |
+ |
*/ |
89 |
|
public String getHostName() { |
90 |
|
try { |
91 |
|
return InetAddress.getLocalHost().getHostName(); |
99 |
|
//---ATTRIBUTES--- |
100 |
|
|
101 |
|
/** |
102 |
< |
* Reference to a Logger |
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 Logger _logger = ReferenceManager.getInstance().getLogger(); |
111 |
< |
|
110 |
> |
private String _name = FilterMain.NAME; |
111 |
> |
|
112 |
|
/** |
113 |
< |
* Our name |
113 |
> |
* This holds a reference to the |
114 |
> |
* system logger that is being used. |
115 |
|
*/ |
116 |
< |
private String _name = ReferenceManager.getInstance().getName(); |
116 |
> |
private Logger _logger = ReferenceManager.getInstance().getLogger(); |
117 |
|
|
118 |
|
/** |
119 |
|
* Our parent filter |
120 |
|
*/ |
121 |
|
private Filter _parent; |
122 |
|
|
123 |
+ |
/** |
124 |
+ |
* The UDP port we're listening on |
125 |
+ |
*/ |
126 |
|
private int _UDPListenPort; |
127 |
+ |
|
128 |
+ |
/** |
129 |
+ |
* The TCP port we're listening on |
130 |
+ |
*/ |
131 |
|
private int _TCPListenPort; |
132 |
|
|
133 |
|
//---STATIC ATTRIBUTES--- |