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.19 by tdb, Fri Mar 22 10:43:06 2002 UTC

# Line 1 | Line 1
1   //---PACKAGE DECLARATION---
2 + package uk.org.iscream.cms.server.filter;
3  
4   //---IMPORTS---
5 < import uk.ac.ukc.iscream.core.*;
6 < import uk.ac.ukc.iscream.filter.*;
5 > import uk.org.iscream.cms.server.core.*;
6 > import uk.org.iscream.cms.server.componentmanager.*;
7 > import uk.org.iscream.cms.server.filter.*;
8 > import uk.org.iscream.cms.server.util.*;
9   import java.net.InetAddress;
10  
11   /**
12 < * A test FilterServant, just prints it out.
12 > * Passes inbound data from other Filters to a FilterThread
13   *
14   * @author  $Author$
15   * @version $Id$
# Line 25 | Line 28 | class FilterServant extends FilterPOA {
28   //---CONSTRUCTORS---
29  
30      /**
31 <     * Creates a new Filter.
31 >     * Creates a new FilterServant.
32       *
33 <     * @param logger a Logger to use
33 >     * @param queue the Queue this filter is using
34       */
35 <    public FilterServant(Logger logger, Filter parent, String name, String TCPPort, String UDPPort) {
36 <        _logRef = logger;
37 <        _name = name;
35 <        _parent = parent;
36 <        _TCPPort = TCPPort;
37 <        _UDPPort = UDPPort;
38 <        _logRef.write(this.toString(), Logger.SYSINIT, "created");
35 >    public FilterServant(Queue queue) {
36 >        _queue = queue;
37 >        _logger.write(toString(), Logger.SYSINIT, "started");
38      }
39 <
39 >    
40   //---PUBLIC METHODS---
41  
42      /**
43       * Method to receive a string over corba.
44       *
45 <     * @param xml the String of XML to print out
45 >     * @param xml the String of XML to queue
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.org.iscream.cms.server.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  
68    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
71   //---ATTRIBUTES---
72  
73      /**
74 <     * Reference to a Logger
74 >     * This is the friendly identifier of the
75 >     * component this class is running in.
76 >     * eg, a Filter may be called "filter1",
77 >     * If this class does not have an owning
78 >     * component,  a name from the configuration
79 >     * can be placed here.  This name could also
80 >     * be changed to null for utility classes.
81       */
82 <    private Logger _logRef;
83 <    
82 >    private String _name = FilterMain.NAME;
83 >
84      /**
85 <     * Our name
85 >     * This holds a reference to the
86 >     * system logger that is being used.
87       */
88 <    private String _name;
88 >    private Logger _logger = ReferenceManager.getInstance().getLogger();
89  
90      /**
91 <     * Our parent filter
91 >     * Our Queue object
92       */
93 <    private Filter _parent;
102 <    
103 <    private String _UDPPort;
104 <    private String _TCPPort;
93 >    private Queue _queue;
94      
95   //---STATIC ATTRIBUTES---
96  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines