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
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/filter/FilterServant.java (file contents):
Revision 1.5 by tdb, Fri Nov 24 13:04:14 2000 UTC vs.
Revision 1.12 by tdb, Fri Jan 12 00:45:25 2001 UTC

# Line 1 | Line 1
1   //---PACKAGE DECLARATION---
2 + package uk.ac.ukc.iscream.filter;
3  
4   //---IMPORTS---
5   import uk.ac.ukc.iscream.core.*;
6   import uk.ac.ukc.iscream.filter.*;
7 + import uk.ac.ukc.iscream.util.*;
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$
# Line 29 | Line 31 | class FilterServant extends FilterPOA {
31       *
32       * @param logger a Logger to use
33       */
34 <    public FilterServant(Logger logger, Filter parent, String name, String TCPPort, String UDPPort) {
35 <        _logRef = logger;
36 <        _name = name;
37 <        _parent = parent;
36 <        _TCPPort = TCPPort;
37 <        _UDPPort = UDPPort;
38 <        _logRef.write(this.toString(), Logger.SYSINIT, "created");
34 >    public FilterServant(int TCPListenPort, int UDPListenPort, Queue queue) {    
35 >        _TCPListenPort = TCPListenPort;
36 >        _UDPListenPort = UDPListenPort;
37 >        _queue = queue;
38      }
39 <
39 >    
40   //---PUBLIC METHODS---
41  
42      /**
# Line 46 | Line 45 | class FilterServant extends FilterPOA {
45       * @param xml the String of XML to print out
46       */
47      public void receiveXML(String xml) {
48 <        _logRef.write(this.toString(), Logger.SYSMSG, "received XML: "+xml);
50 <        FilterThread t = new FilterThread(xml, _parent, _logRef);
51 <        t.start();
48 >        _queue.add(xml);
49      }
50      
51      /**
52       * Overrides the {@link java.lang.Object#toString() Object.toString()}
53       * method to provide clean logging (every class should have this).
54       *
55 +     * This uses the uk.ac.ukc.iscream.util.NameFormat class
56 +     * to format the toString()
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) + ")";
61 >        return FormatName.getName(
62 >            _name,
63 >            getClass().getName(),
64 >            REVISION);
65      }
66  
67   //---PRIVATE METHODS---
68  
69   //---ACCESSOR/MUTATOR METHODS---
70  
71 +    /**
72 +     * Provides information to the FilterManager
73 +     */
74      public String getUDPPort() {
75 <        return _UDPPort;
75 >        return new Integer(_UDPListenPort).toString();
76      }
77      
78 +    /**
79 +     * Provides information to the FilterManager
80 +     */
81      public String getTCPPort() {
82 <        return _TCPPort;
82 >        return new Integer(_TCPListenPort).toString();
83      }
84      
85 +    /**
86 +     * Provides information to the FilterManager
87 +     */
88      public String getHostName() {
89          try {
90              return InetAddress.getLocalHost().getHostName();
91          } catch (java.net.UnknownHostException e) {
92 <            _logRef.write(toString(), Logger.ERROR, e.getMessage());
92 >            _logger.write(toString(), Logger.ERROR, e.getMessage());
93          }
94          return null;
95      }
# Line 86 | Line 98 | class FilterServant extends FilterPOA {
98   //---ATTRIBUTES---
99  
100      /**
101 <     * Reference to a Logger
101 >     * This is the friendly identifier of the
102 >     * component this class is running in.
103 >     * eg, a Filter may be called "filter1",
104 >     * If this class does not have an owning
105 >     * component,  a name from the configuration
106 >     * can be placed here.  This name could also
107 >     * be changed to null for utility classes.
108       */
109 <    private Logger _logRef;
110 <    
109 >    private String _name = FilterMain.NAME;
110 >
111      /**
112 <     * Our name
112 >     * This holds a reference to the
113 >     * system logger that is being used.
114       */
115 <    private String _name;
115 >    private Logger _logger = ReferenceManager.getInstance().getLogger();
116  
117      /**
118 <     * Our parent filter
118 >     * Our Queue object
119       */
120 <    private Filter _parent;
120 >    private Queue _queue;
121      
122 <    private String _UDPPort;
123 <    private String _TCPPort;
122 >    /**
123 >     * The UDP port we're listening on
124 >     */
125 >    private int _UDPListenPort;
126 >    
127 >    /**
128 >     * The TCP port we're listening on
129 >     */
130 >    private int _TCPListenPort;
131      
132   //---STATIC ATTRIBUTES---
133  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines