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.2
Committed: Sat May 18 18:16:01 2002 UTC (22 years ago) by tdb
Branch: MAIN
Changes since 1.1: +21 -2 lines
Log Message:
i-scream is now licensed under the GPL. I've added the GPL headers to every
source file, and put a full copy of the license in the appropriate places.
I think I've covered everything. This is going to be a mad commit ;)

File Contents

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