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.18 by tdb, Fri Jan 12 00:45:25 2001 UTC vs.
Revision 1.25 by tdb, Tue Mar 13 16:25:57 2001 UTC

# Line 4 | Line 4 | package uk.ac.ukc.iscream.filter;
4   //---IMPORTS---
5   import uk.ac.ukc.iscream.util.*;
6   import uk.ac.ukc.iscream.core.*;
7 + import uk.ac.ukc.iscream.componentmanager.*;
8   import uk.ac.ukc.iscream.filter.*;
9  
10   /**
# Line 13 | Line 14 | import uk.ac.ukc.iscream.filter.*;
14   * @author  $Author$
15   * @version $Id$
16   */
17 < public class FilterMain implements uk.ac.ukc.iscream.util.Component {
17 > public class FilterMain implements Component {
18  
19   //---FINAL ATTRIBUTES---
20  
# Line 41 | Line 42 | public class FilterMain implements uk.ac.ukc.iscream.u
42       * Starts the Filter component
43       */
44      public void start() throws ComponentStartException {
45 <              
45 >        // get references to key objects
46 >        _refman = ReferenceManager.getInstance();
47 >        _logger = ReferenceManager.getInstance().getLogger();
48 >        
49          _logger.write(toString(), Logger.SYSINIT, "coming up");
46            
47        // configuration variables we require
48        int UDPListenPort = 0;
49        int TCPListenPort = 0;
50        String parentFilterName = null;
51
52        Configuration config = _refman.getCM().getConfiguration(FilterMain.NAME);
53        if (config == null) {
54            System.err.println("CRITICAL:Unable to obtain configuration" +
55                               "\n         Advise you check the i-scream log for more information.");
56            _logger.write(toString(), Logger.FATAL, "ERROR - unable to obtain configuration");
57            System.exit(1);
58        } else {
59            try {
60                UDPListenPort = Integer.parseInt(config.getProperty("Filter.UDPListenPort"));
61                TCPListenPort = Integer.parseInt(config.getProperty("Filter.TCPListenPort"));
62                parentFilterName = config.getProperty("Filter.parentFilter");
63            } catch (org.omg.CORBA.MARSHAL e) {
64                System.err.println ("CRITICAL:Unable to obtain required configuration property" +
65                                    "\n         Advise you check the i-scream log for more information.");
66                _logger.write(toString(), Logger.FATAL, "ERROR - required configuration property not present");
67                System.exit(1);
68            }
69        }
70        _logger.write(toString(), Logger.SYSINIT, "configured");
50          
51 <        // get parent
73 <        Filter parentFilter = FilterHelper.narrow(_refman.getCORBARef("iscream.Filter." + parentFilterName));
51 >        ConfigurationProxy cp = ConfigurationProxy.getInstance();
52          
53 +        int UDPListenPort, TCPListenPort;
54 +        try {
55 +            UDPListenPort = Integer.parseInt(cp.getProperty(FilterMain.NAME, "Filter.UDPListenPort"));
56 +            TCPListenPort = Integer.parseInt(cp.getProperty(FilterMain.NAME, "Filter.TCPListenPort"));
57 +        } catch (PropertyNotFoundException e) {
58 +            throw new ComponentStartException("Unable to obtain requried configuration property for component: " + e);
59 +        }
60 +        
61          // setup a queue
62          Queue queue = new Queue();
63          
64 +        // startup a monitor on this queue
65 +        try {
66 +            // try to get the interval, if this fails, we won't start up the monitor
67 +            int queueMonitorInterval = Integer.parseInt(cp.getProperty(FilterMain.NAME, "Queue.MonitorInterval"));
68 +            String queueName = NAME + " Filter";
69 +            queue.startMonitor(queueMonitorInterval*1000, queueName);
70 +        } catch (PropertyNotFoundException e) {
71 +            _logger.write(toString(), Logger.WARNING, "failed to find queue monitor config, disabling. " + e);
72 +        }
73 +        
74          // Start a filter thread
75          _logger.write(toString(), Logger.SYSINIT, "starting Filter Thread / Queue consumer");
76 <        FilterThread filterThread = new FilterThread(queue, parentFilter);
76 >        FilterThread filterThread = new FilterThread(queue);
77          filterThread.start();
78          
79          // FilterServant start (for inbound child filter data)
80 <        _logger.write(toString(), Logger.DEBUG, "starting Filter Child -> Parent link for upstream parent - " + parentFilterName);
80 >        _logger.write(toString(), Logger.DEBUG, "starting Servant to listen for downstream filters");
81          FilterServant filterServant = new FilterServant(TCPListenPort, UDPListenPort, queue);
82          _refman.bindToOrb(filterServant, "iscream.Filter." + FilterMain.NAME);
83  
# Line 124 | Line 120 | public class FilterMain implements uk.ac.ukc.iscream.u
120       * This holds a reference to the
121       * system logger that is being used.
122       */
123 <    private Logger _logger = ReferenceManager.getInstance().getLogger();
123 >    private Logger _logger;
124  
125      /**
126       * A reference to the reference manager in use
127       */
128 <    private ReferenceManager _refman = ReferenceManager.getInstance();
128 >    private ReferenceManager _refman;
129  
130   //---STATIC ATTRIBUTES---
131  
# Line 140 | Line 136 | public class FilterMain implements uk.ac.ukc.iscream.u
136       */
137      public static String NAME;
138  
139 < }            
139 > }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines