1 |
|
|
2 |
|
//---PACKAGE DECLARATION--- |
3 |
< |
package uk.org.iscream.rootfilter; |
3 |
> |
package uk.org.iscream.cms.server.rootfilter; |
4 |
|
|
5 |
|
//---IMPORTS--- |
6 |
< |
import uk.org.iscream.util.*; |
7 |
< |
import uk.org.iscream.core.*; |
8 |
< |
import uk.org.iscream.componentmanager.*; |
9 |
< |
import uk.org.iscream.clientinterface.*; |
6 |
> |
import uk.org.iscream.cms.server.util.*; |
7 |
> |
import uk.org.iscream.cms.server.core.*; |
8 |
> |
import uk.org.iscream.cms.server.componentmanager.*; |
9 |
> |
import uk.org.iscream.cms.server.clientinterface.*; |
10 |
|
|
11 |
|
/** |
12 |
|
* The root filter is what all filters talk to |
56 |
|
|
57 |
|
// try and get the names of the ciReal and ciDB |
58 |
|
String realInterface, dbInterface; |
59 |
+ |
// first realtime |
60 |
|
try { |
61 |
|
realInterface = cp.getProperty(configName, "RootFilter.realtimeInterfaceName"); |
61 |
– |
dbInterface = cp.getProperty(configName, "RootFilter.dbInterfaceName"); |
62 |
|
} catch (PropertyNotFoundException e) { |
63 |
|
_logger.write(toString(), Logger.DEBUG, "Optional config not set: "+e); |
64 |
|
realInterface = null; |
65 |
+ |
} |
66 |
+ |
// next dbi |
67 |
+ |
try { |
68 |
+ |
dbInterface = cp.getProperty(configName, "RootFilter.dbInterfaceName"); |
69 |
+ |
} catch (PropertyNotFoundException e) { |
70 |
+ |
_logger.write(toString(), Logger.DEBUG, "Optional config not set: "+e); |
71 |
|
dbInterface = null; |
72 |
|
} |
73 |
|
|
89 |
|
String queueRemoveAlgorithm = cp.getProperty(configName, "Queue.RemoveAlgorithm"); |
90 |
|
int algorithm = StringUtils.getStringPos(queueRemoveAlgorithm, Queue.algorithms); |
91 |
|
if(algorithm != -1) { |
92 |
+ |
_logger.write(toString(), Logger.DEBUG, "Starting Queue with size limit of "+queueSizeLimit+", using remove algorithm "+queueRemoveAlgorithm); |
93 |
+ |
// we have valid values, so lets start it. |
94 |
|
queue = new Queue(queueSizeLimit, algorithm); |
95 |
|
} |
96 |
|
else { |
119 |
|
_logger.write(toString(), Logger.WARNING, "failed to find queue monitor config, disabling. " + e); |
120 |
|
} |
121 |
|
|
122 |
< |
if (realInterface == null) { |
122 |
> |
if (realInterface != null && dbInterface != null) { |
123 |
> |
_logger.write(toString(), Logger.DEBUG, "hooked to interfaces - " + realInterface + " & " + dbInterface); |
124 |
> |
CIWrapper c = new CIWrapper(ciReal, queue); |
125 |
> |
c.start(); |
126 |
> |
c = new CIWrapper(ciDB, queue); |
127 |
> |
c.start(); |
128 |
> |
} else if (realInterface == null) { |
129 |
|
_logger.write(toString(), Logger.DEBUG, "hooked to interfaces - " + dbInterface); |
130 |
|
CIWrapper c = new CIWrapper(ciDB, queue); |
131 |
|
c.start(); |
134 |
|
CIWrapper c = new CIWrapper(ciReal, queue); |
135 |
|
c.start(); |
136 |
|
} else { |
137 |
< |
_logger.write(toString(), Logger.DEBUG, "hooked to interfaces - " + realInterface + " & " + dbInterface); |
124 |
< |
CIWrapper c = new CIWrapper(ciReal, queue); |
125 |
< |
c.start(); |
126 |
< |
c = new CIWrapper(ciDB, queue); |
127 |
< |
c.start(); |
137 |
> |
_logger.write(toString(), Logger.WARNING, "not hooked to any client interfaces, this is probably not intentional!"); |
138 |
|
} |
139 |
|
|
140 |
|
// RootFilterServant start (for inbound child filter data) |
155 |
|
* @return a boolean value, true if the depdencies are satisfied |
156 |
|
*/ |
157 |
|
public boolean depCheck() { |
158 |
+ |
org.omg.CORBA.Object obj; |
159 |
+ |
|
160 |
+ |
// first we need to check the Configuration system is available |
161 |
|
try { |
149 |
– |
org.omg.CORBA.Object obj; |
162 |
|
// first check the ConfigurationManager is alive |
163 |
|
obj = _refman.getCORBARef("iscream.ConfigurationManager"); |
164 |
< |
// then get some info on the CLI and DBI |
165 |
< |
ConfigurationProxy cp = ConfigurationProxy.getInstance(); |
164 |
> |
} catch(ComponentCORBAException e) { |
165 |
> |
System.err.println(toString() + ": Dependency Failure: "+e); |
166 |
> |
return false; |
167 |
> |
} |
168 |
> |
|
169 |
> |
// next we need to check which client interfaces *should* |
170 |
> |
// be active, and check them. Note they do not have to |
171 |
> |
// be enabled, and we should check this. |
172 |
> |
// -- each check only forces a dependency if it's configured |
173 |
> |
ConfigurationProxy cp = ConfigurationProxy.getInstance(); |
174 |
> |
// first check the client interface |
175 |
> |
try { |
176 |
|
String cli = cp.getProperty("RootFilter", "RootFilter.realtimeInterfaceName"); |
155 |
– |
String dbi = cp.getProperty("RootFilter", "RootFilter.dbInterfaceName"); |
156 |
– |
// finally check the CLI and DBI are alive |
177 |
|
obj = _refman.getCORBARef("iscream.ClientInterface." + cli); |
158 |
– |
obj = _refman.getCORBARef("iscream.ClientInterface." + dbi); |
178 |
|
} catch(ComponentCORBAException e) { |
179 |
|
System.err.println(toString() + ": Dependency Failure: "+e); |
180 |
|
return false; |
181 |
|
} catch(PropertyNotFoundException e) { |
182 |
< |
System.err.println(toString() + ": Unable to obtain configuration: "+e); |
182 |
> |
System.err.println(toString() + ": Client interface not configured and thus not enabled."); |
183 |
> |
} |
184 |
> |
// second check the database interface |
185 |
> |
try { |
186 |
> |
String dbi = cp.getProperty("RootFilter", "RootFilter.dbInterfaceName"); |
187 |
> |
obj = _refman.getCORBARef("iscream.ClientInterface." + dbi); |
188 |
> |
} catch(ComponentCORBAException e) { |
189 |
> |
System.err.println(toString() + ": Dependency Failure: "+e); |
190 |
|
return false; |
191 |
+ |
} catch(PropertyNotFoundException e) { |
192 |
+ |
System.err.println(toString() + ": Database interface not configured and thus not enabled."); |
193 |
|
} |
194 |
+ |
|
195 |
|
// dependency check suceeded |
196 |
|
return true; |
197 |
|
} |
200 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
201 |
|
* method to provide clean logging (every class should have this). |
202 |
|
* |
203 |
< |
* This uses the uk.org.iscream.util.NameFormat class |
203 |
> |
* This uses the uk.org.iscream.cms.server.util.NameFormat class |
204 |
|
* to format the toString() |
205 |
|
* |
206 |
|
* @return the name of this class and its CVS revision |