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 { |
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 { |
126 |
– |
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"); |
132 |
– |
String dbi = cp.getProperty("RootFilter", "RootFilter.dbInterfaceName"); |
133 |
– |
// finally check the CLI and DBI are alive |
169 |
|
obj = _refman.getCORBARef("iscream.ClientInterface." + cli); |
135 |
– |
obj = _refman.getCORBARef("iscream.ClientInterface." + dbi); |
170 |
|
} catch(ComponentCORBAException e) { |
171 |
|
System.err.println(toString() + ": Dependency Failure: "+e); |
172 |
|
return false; |
173 |
|
} catch(PropertyNotFoundException e) { |
174 |
< |
System.err.println(toString() + ": 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 |
|
} |