ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/filter/FilterServant.java
Revision: 1.16
Committed: Wed Mar 14 23:25:29 2001 UTC (23 years, 2 months ago) by tdb
Branch: MAIN
Changes since 1.15: +8 -8 lines
Log Message:
The whole server package structure has been changed.
Old Package: uk.ac.ukc.iscream.*
New Package: uk.org.iscream.*

File Contents

# Content
1 //---PACKAGE DECLARATION---
2 package uk.org.iscream.filter;
3
4 //---IMPORTS---
5 import uk.org.iscream.core.*;
6 import uk.org.iscream.componentmanager.*;
7 import uk.org.iscream.filter.*;
8 import uk.org.iscream.util.*;
9 import java.net.InetAddress;
10
11 /**
12 * Passes inbound data from other Filters to a FilterThread
13 *
14 * @author $Author: tdb1 $
15 * @version $Id: FilterServant.java,v 1.15 2001/02/01 00:18:42 tdb1 Exp $
16 */
17 class FilterServant extends FilterPOA {
18
19 //---FINAL ATTRIBUTES---
20
21 /**
22 * The current CVS revision of this class
23 */
24 public final String REVISION = "$Revision: 1.15 $";
25
26 //---STATIC METHODS---
27
28 //---CONSTRUCTORS---
29
30 /**
31 * Creates a new FilterServant.
32 *
33 * @param TCPListenPort the TCP port this filter is listening on
34 * @param UDPListenPort the UDP port this filter is listening on
35 * @param queue the Queue this filter is using
36 */
37 public FilterServant(int TCPListenPort, int UDPListenPort, Queue queue) {
38 _TCPListenPort = TCPListenPort;
39 _UDPListenPort = UDPListenPort;
40 _queue = queue;
41 _logger.write(toString(), Logger.SYSINIT, "started");
42 }
43
44 //---PUBLIC METHODS---
45
46 /**
47 * Method to receive a string over corba.
48 *
49 * @param xml the String of XML to queue
50 */
51 public void receiveXML(String xml) {
52 _queue.add(xml);
53 }
54
55 /**
56 * Overrides the {@link java.lang.Object#toString() Object.toString()}
57 * method to provide clean logging (every class should have this).
58 *
59 * This uses the uk.org.iscream.util.NameFormat class
60 * to format the toString()
61 *
62 * @return the name of this class and its CVS revision
63 */
64 public String toString() {
65 return FormatName.getName(
66 _name,
67 getClass().getName(),
68 REVISION);
69 }
70
71 //---PRIVATE METHODS---
72
73 //---ACCESSOR/MUTATOR METHODS---
74
75 /**
76 * Provides information to the FilterManager
77 */
78 public String getUDPPort() {
79 return new Integer(_UDPListenPort).toString();
80 }
81
82 /**
83 * Provides information to the FilterManager
84 */
85 public String getTCPPort() {
86 return new Integer(_TCPListenPort).toString();
87 }
88
89 /**
90 * Provides information to the FilterManager
91 */
92 public String getHostName() {
93 try {
94 return InetAddress.getLocalHost().getHostName();
95 } catch (java.net.UnknownHostException e) {
96 _logger.write(toString(), Logger.ERROR, e.getMessage());
97 }
98 return null;
99 }
100
101
102 //---ATTRIBUTES---
103
104 /**
105 * This is the friendly identifier of the
106 * component this class is running in.
107 * eg, a Filter may be called "filter1",
108 * If this class does not have an owning
109 * component, a name from the configuration
110 * can be placed here. This name could also
111 * be changed to null for utility classes.
112 */
113 private String _name = FilterMain.NAME;
114
115 /**
116 * This holds a reference to the
117 * system logger that is being used.
118 */
119 private Logger _logger = ReferenceManager.getInstance().getLogger();
120
121 /**
122 * Our Queue object
123 */
124 private Queue _queue;
125
126 /**
127 * The UDP port we're listening on
128 */
129 private int _UDPListenPort;
130
131 /**
132 * The TCP port we're listening on
133 */
134 private int _TCPListenPort;
135
136 //---STATIC ATTRIBUTES---
137
138 }