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.29 by tdb, Wed Mar 14 01:34:34 2001 UTC vs.
Revision 1.35 by tdb, Fri Mar 23 04:57:09 2001 UTC

# Line 1 | Line 1
1  
2   //---PACKAGE DECLARATION---
3 < package uk.ac.ukc.iscream.rootfilter;
3 > package uk.org.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.*;
6 > import uk.org.iscream.util.*;
7 > import uk.org.iscream.core.*;
8 > import uk.org.iscream.componentmanager.*;
9 > import uk.org.iscream.clientinterface.*;
10  
11   /**
12   * The root filter is what all filters talk to
# Line 39 | Line 39 | public class RootFilter implements Component {
39       */
40      public void start() throws ComponentStartException {
41          // get references to key objects
42 <        _refman = ReferenceManager.getInstance();
43 <        _logger = ReferenceManager.getInstance().getLogger();
42 >        _logger = _refman.getLogger();
43          
44          _logger.write(toString(), Logger.SYSINIT, "coming up");
45          
# Line 75 | Line 74 | public class RootFilter implements Component {
74          if (dbInterface != null) {
75              ciDB = ClientInterfaceHelper.narrow(_refman.getCORBARef("iscream.ClientInterface." + dbInterface));
76          }
77 <
77 >        
78          // setup a queue
79 <        Queue queue = new Queue();
79 >        Queue queue;
80 >        // see if this Queue needs a size limit
81 >        try {
82 >            int queueSizeLimit = Integer.parseInt(cp.getProperty(configName, "Queue.SizeLimit"));
83 >            String queueRemoveAlgorithm = cp.getProperty(configName, "Queue.RemoveAlgorithm");
84 >            int algorithm = StringUtils.getStringPos(queueRemoveAlgorithm, Queue.algorithms);
85 >            if(algorithm != -1) {
86 >                _logger.write(toString(), Logger.DEBUG, "Starting Queue with size limit of "+queueSizeLimit+", using remove algorithm "+queueRemoveAlgorithm);
87 >                // we have valid values, so lets start it.
88 >                queue = new Queue(queueSizeLimit, algorithm);
89 >            }
90 >            else {
91 >                _logger.write(toString(), Logger.WARNING, "Bad Queue Algorithm configuration, not known: "+queueRemoveAlgorithm);
92 >                // just don't activate a limit
93 >                queue = new Queue();
94 >            }
95 >            
96 >        } catch (PropertyNotFoundException e) {
97 >            _logger.write(toString(), Logger.DEBUG, "Optional config not set: "+e);
98 >            // just don't activate a limit
99 >            queue = new Queue();
100 >        } catch (NumberFormatException e) {
101 >            _logger.write(toString(), Logger.WARNING, "Bad Queue SizeLimit configuration: "+e);
102 >            // just don't activate a limit
103 >            queue = new Queue();
104 >        }
105          
106          // startup a monitor on this queue
107          try {
# Line 123 | Line 147 | public class RootFilter implements Component {
147       * @return a boolean value, true if the depdencies are satisfied
148       */
149      public boolean depCheck() {
150 +        org.omg.CORBA.Object obj;
151 +        
152 +        // first we need to check the Configuration system is available
153          try {
127            org.omg.CORBA.Object obj;
154              // first check the ConfigurationManager is alive
155              obj = _refman.getCORBARef("iscream.ConfigurationManager");
156 <            // then get some info on the CLI and DBI
157 <            ConfigurationProxy cp = ConfigurationProxy.getInstance();
156 >        } catch(ComponentCORBAException e) {
157 >            System.err.println(toString() + ": Dependency Failure: "+e);
158 >            return false;
159 >        }
160 >        
161 >        // next we need to check which client interfaces *should*
162 >        // be active, and check them. Note they do not have to
163 >        // be enabled, and we should check this.
164 >        // -- each check only forces a dependency if it's configured
165 >        ConfigurationProxy cp = ConfigurationProxy.getInstance();
166 >        // first check the client interface
167 >        try {
168              String cli = cp.getProperty("RootFilter", "RootFilter.realtimeInterfaceName");
133            String dbi = cp.getProperty("RootFilter", "RootFilter.dbInterfaceName");
134            // finally check the CLI and DBI are alive
169              obj = _refman.getCORBARef("iscream.ClientInterface." + cli);
136            obj = _refman.getCORBARef("iscream.ClientInterface." + dbi);
170          } catch(ComponentCORBAException e) {
171 <            _logger.write(toString(), Logger.WARNING, "Dependency Failure: "+e);
171 >            System.err.println(toString() + ": Dependency Failure: "+e);
172              return false;
173          } catch(PropertyNotFoundException e) {
174 <            _logger.write(toString(), Logger.WARNING, "Unable to obtain configuration: "+e);
174 >            System.err.println(toString() + ": Client interface not configured and thus not enabled.");
175 >        }
176 >        // second check the database interface
177 >        try {
178 >            String dbi = cp.getProperty("RootFilter", "RootFilter.dbInterfaceName");
179 >            obj = _refman.getCORBARef("iscream.ClientInterface." + dbi);
180 >        } catch(ComponentCORBAException e) {
181 >            System.err.println(toString() + ": Dependency Failure: "+e);
182              return false;
183 +        } catch(PropertyNotFoundException e) {
184 +            System.err.println(toString() + ": Database interface not configured and thus not enabled.");
185          }
186 +        
187          // dependency check suceeded
188          return true;
189      }
# Line 149 | Line 192 | public class RootFilter implements Component {
192       * Overrides the {@link java.lang.Object#toString() Object.toString()}
193       * method to provide clean logging (every class should have this).
194       *
195 <     * This uses the uk.ac.ukc.iscream.util.NameFormat class
195 >     * This uses the uk.org.iscream.util.NameFormat class
196       * to format the toString()
197       *
198       * @return the name of this class and its CVS revision
# Line 176 | Line 219 | public class RootFilter implements Component {
219      /**
220       * A reference to the reference manager in use
221       */
222 <    private ReferenceManager _refman;
222 >    private ReferenceManager _refman = ReferenceManager.getInstance();
223  
224   //---STATIC ATTRIBUTES---
225  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines