ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/rootfilter/RootFilter.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/rootfilter/RootFilter.java (file contents):
Revision 1.13 by ajm, Wed Dec 13 12:58:26 2000 UTC vs.
Revision 1.27 by ajm, Mon Feb 26 02:15:11 2001 UTC

# Line 1 | Line 1
1 +
2   //---PACKAGE DECLARATION---
3   package uk.ac.ukc.iscream.rootfilter;
4  
5   //---IMPORTS---
6   import uk.ac.ukc.iscream.util.*;
7   import uk.ac.ukc.iscream.core.*;
8 + import uk.ac.ukc.iscream.componentmanager.*;
9   import uk.ac.ukc.iscream.clientinterface.*;
10  
11   /**
# Line 17 | Line 19 | import uk.ac.ukc.iscream.clientinterface.*;
19   * @author  $Author$
20   * @version $Id$
21   */
22 < public class RootFilter implements uk.ac.ukc.iscream.util.Component {
22 > public class RootFilter implements Component {
23  
24   //---FINAL ATTRIBUTES---
25  
# Line 36 | Line 38 | public class RootFilter implements uk.ac.ukc.iscream.u
38       * This starts the Root Filter for the system
39       */
40      public void start() throws ComponentStartException {
41 <
41 >        // get references to key objects
42 >        _refman = ReferenceManager.getInstance();
43 >        _logger = ReferenceManager.getInstance().getLogger();
44 >        
45          _logger.write(toString(), Logger.SYSINIT, "coming up");
46              
47          // configuration variables we require
48          String ourName = null;
49          String realInterface = null;
50          String dbInterface = null;
51 +        int queueMonitorInterval = 0;
52          
53          Configuration config = _refman.getCM().getConfiguration("RootFilter");
54          if (config == null) {
55 <            System.err.println("CRITICAL:Unable to obtain configuration" +
56 <                               "\n         Advise you check the i-scream log for more information.");
57 <            _logger.write(toString(), Logger.FATAL, "ERROR - unable to obtain configuration");
52 <            System.exit(1);
53 <        } else {
55 >            throw new ComponentStartException("Unable to obtain configuration for component");
56 >        }
57 >        else {
58              try {
59 +                // get the configuration properties we need
60                  ourName = config.getProperty("RootFilter.name");
61 +            
62 +                queueMonitorInterval = Integer.parseInt(config.getProperty("Queue.MonitorInterval"));
63 +            } catch (org.omg.CORBA.MARSHAL e) {
64 +                throw new ComponentStartException("Unable to obtain requried configuration property for component");
65 +            }
66 +            try {
67 +                // get the optional configuration properties
68                  realInterface = config.getProperty("RootFilter.realtimeInterfaceName");
69                  dbInterface = config.getProperty("RootFilter.dbInterfaceName");
70              } catch (org.omg.CORBA.MARSHAL e) {
71 <                System.err.println ("CRITICAL:Unable to obtain required configuration property" +
60 <                                    "\n         Advise you check the i-scream log for more information.");
61 <                _logger.write(toString(), Logger.FATAL, "ERROR - required configuration property not present");
62 <                System.exit(1);
71 >                // we can ignore that fact
72              }
73          }
74 +        
75          // now we have the name of the Root Filter we set it
76          NAME = ourName;
77          
# Line 76 | Line 86 | public class RootFilter implements uk.ac.ukc.iscream.u
86          if (dbInterface != null) {
87              ciDB = ClientInterfaceHelper.narrow(_refman.getCORBARef("iscream.ClientInterface." + dbInterface));
88          }
89 <
90 <        ClientInterface[] clientInterfaces;
89 >        
90 >        Queue queue = new Queue();
91 >        // startup a monitor on this queue, every minute
92 >        String queueName = NAME + " RootFilter";
93 >        queue.startMonitor(queueMonitorInterval*1000, queueName);
94 >        
95          if (realInterface == null) {        
96              _logger.write(toString(), Logger.DEBUG, "hooked to interfaces - " + dbInterface);
97 <            clientInterfaces = new ClientInterface[] {ciDB};
97 >            CIWrapper c = new CIWrapper(ciDB, queue);
98 >            c.start();
99          } else if (dbInterface == null) {
100              _logger.write(toString(), Logger.DEBUG, "hooked to interfaces - " + realInterface);
101 <            clientInterfaces = new ClientInterface[] {ciReal};
101 >            CIWrapper c = new CIWrapper(ciReal, queue);
102 >            c.start();
103          } else {
104              _logger.write(toString(), Logger.DEBUG, "hooked to interfaces - " + realInterface + " & " + dbInterface);
105 <            clientInterfaces = new ClientInterface[] {ciReal, ciDB};
105 >            CIWrapper c = new CIWrapper(ciReal, queue);
106 >            c.start();
107 >            c = new CIWrapper(ciDB, queue);
108 >            c.start();
109          }
110 <        
110 >                
111          // RootFilterServant start (for inbound child filter data)
112          _logger.write(toString(), Logger.DEBUG, "starting Root Filter");
113 <        RootFilterServant filterServant = new RootFilterServant(clientInterfaces);
113 >        RootFilterServant filterServant = new RootFilterServant(queue);
114          // bind to the naming service as a filter
115 <        _refman.bindToOrb(filterServant, "iscream.Filter." + _name);
115 >        _refman.bindToOrb(filterServant, "iscream.Filter." + RootFilter.NAME);
116          
117          _logger.write(toString(), Logger.SYSINIT, "started");
118 +        
119      }
120      
121      /**
# Line 109 | Line 129 | public class RootFilter implements uk.ac.ukc.iscream.u
129       */
130      public String toString() {
131          return FormatName.getName(
132 <            _name,
132 >            NAME,
133              getClass().getName(),
134              REVISION);
135      }
# Line 121 | Line 141 | public class RootFilter implements uk.ac.ukc.iscream.u
141   //---ATTRIBUTES---
142  
143      /**
124     * This is the friendly identifier of the
125     * component this class is running in.
126     * eg, a Filter may be called "filter1",
127     * If this class does not have an owning
128     * component,  a name from the configuration
129     * can be placed here.  This name could also
130     * be changed to null for utility classes.
131     */
132    private String _name = RootFilter.NAME;
133
134    /**
144       * This holds a reference to the
145       * system logger that is being used.
146       */
147 <    private Logger _logger = ReferenceManager.getInstance().getLogger();
147 >    private Logger _logger;
148  
149      /**
150       * A reference to the reference manager in use
151       */
152 <    private ReferenceManager _refman = ReferenceManager.getInstance();
152 >    private ReferenceManager _refman;
153  
154   //---STATIC ATTRIBUTES---
155  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines