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.4
Committed: Thu Nov 23 01:44:41 2000 UTC (23 years, 6 months ago) by tdb
Branch: MAIN
Changes since 1.3: +27 -3 lines
Log Message:
This needed to be able to provide port details, and the hostname.

File Contents

# User Rev Content
1 tdb 1.1 //---PACKAGE DECLARATION---
2    
3     //---IMPORTS---
4     import uk.ac.ukc.iscream.core.*;
5     import uk.ac.ukc.iscream.filter.*;
6 tdb 1.4 import java.net.InetAddress;
7 tdb 1.1
8     /**
9     * A test FilterServant, just prints it out.
10     *
11 tdb 1.2 * @author $Author: tdb1 $
12 tdb 1.4 * @version $Id: FilterServant.java,v 1.3 2000/11/22 09:35:57 tdb1 Exp $
13 tdb 1.1 */
14     class FilterServant extends FilterPOA {
15    
16     //---FINAL ATTRIBUTES---
17    
18     /**
19     * The current CVS revision of this class
20     */
21 tdb 1.4 public final String REVISION = "$Revision: 1.3 $";
22 tdb 1.1
23     //---STATIC METHODS---
24    
25     //---CONSTRUCTORS---
26    
27     /**
28     * Creates a new Filter.
29     *
30     * @param logger a Logger to use
31     */
32 tdb 1.4 public FilterServant(Logger logger, Filter parent, String name, String TCPPort, String UDPPort) {
33 tdb 1.1 _logRef = logger;
34     _name = name;
35 tdb 1.3 _parent = parent;
36 tdb 1.4 _TCPPort = TCPPort;
37     _UDPPort = UDPPort;
38 tdb 1.1 _logRef.write(this.toString(), Logger.SYSINIT, "created");
39     }
40    
41     //---PUBLIC METHODS---
42    
43     /**
44     * Method to receive a string over corba.
45     *
46     * @param xml the String of XML to print out
47     */
48     public void receiveXML(String xml) {
49     _logRef.write(this.toString(), Logger.SYSMSG, "received XML: "+xml);
50 tdb 1.3 FilterThread t = new FilterThread(_parent);
51     t.run(xml);
52 tdb 1.1 }
53    
54     /**
55     * Overrides the {@link java.lang.Object#toString() Object.toString()}
56     * method to provide clean logging (every class should have this).
57     *
58     * @return the name of this class and its CVS revision
59     */
60     public String toString() {
61     return this.getClass().getName() + "{" + _name + "}(" + REVISION.substring(11, REVISION.length() - 2) + ")";
62     }
63    
64     //---PRIVATE METHODS---
65    
66     //---ACCESSOR/MUTATOR METHODS---
67    
68 tdb 1.4 public String getUDPPort() {
69     return _UDPPort;
70     }
71    
72     public String getTCPPort() {
73     return _TCPPort;
74     }
75    
76     public String getHostName() {
77     try {
78     return InetAddress.getLocalHost().getHostName();
79     } catch (java.net.UnknownHostException e) {
80     _logRef.write(toString(), Logger.ERROR, e.getMessage());
81     }
82     return null;
83     }
84    
85    
86 tdb 1.1 //---ATTRIBUTES---
87    
88     /**
89     * Reference to a Logger
90     */
91     private Logger _logRef;
92    
93     /**
94     * Our name
95     */
96     private String _name;
97 tdb 1.3
98     /**
99     * Our parent filter
100     */
101     private Filter _parent;
102 tdb 1.4
103     private String _UDPPort;
104     private String _TCPPort;
105 tdb 1.1
106     //---STATIC ATTRIBUTES---
107    
108     }