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/FilterInfoServant.java
Revision: 1.3
Committed: Tue May 21 16:47:17 2002 UTC (22 years ago) by tdb
Branch: MAIN
Changes since 1.2: +3 -2 lines
Log Message:
Added URL to GPL headers.

File Contents

# User Rev Content
1 tdb 1.2 /*
2     * i-scream central monitoring system
3 tdb 1.3 * http://www.i-scream.org.uk
4 tdb 1.2 * Copyright (C) 2000-2002 i-scream
5     *
6     * This program is free software; you can redistribute it and/or
7     * modify it under the terms of the GNU General Public License
8     * as published by the Free Software Foundation; either version 2
9     * of the License, or (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19     */
20    
21 tdb 1.1 //---PACKAGE DECLARATION---
22     package uk.org.iscream.cms.server.filter;
23    
24     //---IMPORTS---
25     import uk.org.iscream.cms.server.core.*;
26     import uk.org.iscream.cms.server.componentmanager.*;
27     import uk.org.iscream.cms.server.filter.*;
28     import uk.org.iscream.cms.server.util.*;
29     import java.net.InetAddress;
30    
31     /**
32     * Provides info about Filter's to other parts of the system.
33     *
34 tdb 1.2 * @author $Author: tdb $
35 tdb 1.3 * @version $Id: FilterInfoServant.java,v 1.2 2002/05/18 18:16:01 tdb Exp $
36 tdb 1.1 */
37     class FilterInfoServant extends FilterInfoPOA {
38    
39     //---FINAL ATTRIBUTES---
40    
41     /**
42     * The current CVS revision of this class
43     */
44 tdb 1.3 public final String REVISION = "$Revision: 1.2 $";
45 tdb 1.1
46     //---STATIC METHODS---
47    
48     //---CONSTRUCTORS---
49    
50     /**
51     * Creates a new FilterServant.
52     *
53     * @param TCPListenPort the TCP port this filter is listening on
54     * @param UDPListenPort the UDP port this filter is listening on
55     */
56     public FilterInfoServant(int TCPListenPort, int UDPListenPort) {
57     _TCPListenPort = TCPListenPort;
58     _UDPListenPort = UDPListenPort;
59     _logger.write(toString(), Logger.SYSINIT, "started");
60     }
61    
62     //---PUBLIC METHODS---
63    
64     /**
65     * Overrides the {@link java.lang.Object#toString() Object.toString()}
66     * method to provide clean logging (every class should have this).
67     *
68     * This uses the uk.org.iscream.cms.server.util.NameFormat class
69     * to format the toString()
70     *
71     * @return the name of this class and its CVS revision
72     */
73     public String toString() {
74     return FormatName.getName(
75     _name,
76     getClass().getName(),
77     REVISION);
78     }
79    
80     //---PRIVATE METHODS---
81    
82     //---ACCESSOR/MUTATOR METHODS---
83    
84     /**
85     * Provides information to the FilterManager
86     */
87     public String getUDPPort() {
88     return new Integer(_UDPListenPort).toString();
89     }
90    
91     /**
92     * Provides information to the FilterManager
93     */
94     public String getTCPPort() {
95     return new Integer(_TCPListenPort).toString();
96     }
97    
98     /**
99     * Provides information to the FilterManager
100     */
101     public String getHostName() {
102     try {
103     // hacky fix for windows boxes, where getHostName() returns the NetBIOS name !
104     return InetAddress.getByName(InetAddress.getLocalHost().getHostAddress()).getHostName();
105     } catch (java.net.UnknownHostException e) {
106     _logger.write(toString(), Logger.ERROR, e.getMessage());
107     }
108     return null;
109     }
110    
111     //---ATTRIBUTES---
112    
113     /**
114     * This is the friendly identifier of the
115     * component this class is running in.
116     * eg, a Filter may be called "filter1",
117     * If this class does not have an owning
118     * component, a name from the configuration
119     * can be placed here. This name could also
120     * be changed to null for utility classes.
121     */
122     private String _name = FilterMain.NAME;
123    
124     /**
125     * This holds a reference to the
126     * system logger that is being used.
127     */
128     private Logger _logger = ReferenceManager.getInstance().getLogger();
129    
130     /**
131     * The UDP port we're listening on
132     */
133     private int _UDPListenPort;
134    
135     /**
136     * The TCP port we're listening on
137     */
138     private int _TCPListenPort;
139    
140     //---STATIC ATTRIBUTES---
141    
142     }