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/FilterMain.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/filter/FilterMain.java (file contents):
Revision 1.33 by tdb, Wed Mar 20 13:05:49 2002 UTC vs.
Revision 1.40 by tdb, Sun Aug 1 10:40:58 2004 UTC

# Line 1 | Line 1
1 + /*
2 + * i-scream central monitoring system
3 + * http://www.i-scream.org
4 + * 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   //---PACKAGE DECLARATION---
22   package uk.org.iscream.cms.server.filter;
23  
24   //---IMPORTS---
25 < import uk.org.iscream.cms.server.util.*;
25 > import uk.org.iscream.cms.util.*;
26   import uk.org.iscream.cms.server.core.*;
27   import uk.org.iscream.cms.server.componentmanager.*;
28   import uk.org.iscream.cms.server.filter.*;
# Line 51 | Line 71 | public class FilterMain implements Component {
71          
72          // which input methods do we need to activate?
73          // default to activating them
54        boolean activateTCPReader = true;
74          boolean activateUDPReader = true;
75          boolean activateCORBAReader = true;
76          
58        // check for TCP Reader
59        try {
60            int tcp = Integer.parseInt(cp.getProperty("Filter." + FilterMain.NAME, "Filter.ActivateTCPReader"));
61            activateTCPReader = (tcp == 1);
62        } catch (PropertyNotFoundException e) {
63            activateTCPReader = false;
64        } catch (NumberFormatException e) {
65            activateTCPReader = false;
66        }
77          // check for UDP Reader
78          try {
79              int udp = Integer.parseInt(cp.getProperty("Filter." + FilterMain.NAME, "Filter.ActivateUDPReader"));
# Line 88 | Line 98 | public class FilterMain implements Component {
98          
99          // there's little point starting a Queue and a FilterThread
100          // if nothing is going to be giving us any data
101 <        if(activateTCPReader || activateUDPReader || activateCORBAReader) {
101 >        if(activateUDPReader || activateCORBAReader) {
102              // see if this Queue needs a size limit
103              try {
104                  int queueSizeLimit = Integer.parseInt(cp.getProperty("Filter." + FilterMain.NAME, "Queue.SizeLimit"));
# Line 137 | Line 147 | public class FilterMain implements Component {
147          
148          // the corba listener needs these to be set, so lets
149          // make them something obviously invalid initially
140        int TCPListenPort = -1;
150          int UDPListenPort = -1;
151          
143        // TCP Reader start (for heartbeats)
144        if(activateTCPReader) {
145            try {
146                // get the port number from the configuration
147                TCPListenPort = Integer.parseInt(cp.getProperty("Filter." + FilterMain.NAME, "Filter.TCPListenPort"));
148                // start the TCPReader
149                _logger.write(toString(), Logger.SYSINIT, "starting Filter TCP listener");
150                TCPReader tcpReader = new TCPReader(TCPListenPort, queue);
151                tcpReader.start();
152            } catch (PropertyNotFoundException e) {
153                _logger.write(toString(), Logger.WARNING, "Unable to start TCPReader due to missing configuration: " + e);
154            } catch (NumberFormatException e) {
155                _logger.write(toString(), Logger.WARNING, "Unable to start TCPReader due to invalid configuration: " + e);
156            }
157        }
158        
152          // UDP Reader start (for inbound host data)
153          if(activateUDPReader) {
154              try {
# Line 176 | Line 169 | public class FilterMain implements Component {
169          if(activateCORBAReader) {
170              // start the FilterServant
171              _logger.write(toString(), Logger.SYSINIT, "starting Servant to listen for downstream filters");
172 <            FilterServant filterServant = new FilterServant(TCPListenPort, UDPListenPort, queue);
173 <            _refman.bindToOrb(filterServant, "iscream.Filter." + FilterMain.NAME);
172 >            FilterServant filterServant = new FilterServant(queue);
173 >            _refman.bindToOrb(filterServant, "iscream.Filter\\." + FilterMain.NAME);
174          }
175          
176 +        // FilterInfoServant start (to provide filter information to the server)
177 +        _logger.write(toString(), Logger.SYSINIT, "starting Servant to provide filter information");
178 +        FilterInfoServant filterInfoServant = new FilterInfoServant(UDPListenPort);
179 +        _refman.bindToOrb(filterInfoServant, "iscream.FilterInfo\\." + FilterMain.NAME);
180 +        
181          _logger.write(toString(), Logger.SYSINIT, "started");
182      }
183      
# Line 199 | Line 197 | public class FilterMain implements Component {
197              ConfigurationProxy cp = ConfigurationProxy.getInstance();
198              String parentFilterName = cp.getProperty("Filter." + FilterMain.NAME, "Filter.parentFilter");
199              // finally check the parent filter is alive
200 <            obj = _refman.getCORBARef("iscream.Filter." + parentFilterName);
200 >            obj = _refman.getCORBARef("iscream.Filter\\." + parentFilterName);
201          } catch(ComponentCORBAException e) {
202              System.err.println(toString() + ": Dependency Failure: "+e);
203              return false;
# Line 215 | Line 213 | public class FilterMain implements Component {
213       * Overrides the {@link java.lang.Object#toString() Object.toString()}
214       * method to provide clean logging (every class should have this).
215       *
216 <     * This uses the uk.org.iscream.cms.server.util.NameFormat class
216 >     * This uses the uk.org.iscream.cms.util.NameFormat class
217       * to format the toString()
218       *
219       * @return the name of this class and its CVS revision

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines