| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
package org.apache.commons.configuration; |
| 18 | |
|
| 19 | |
import java.math.BigDecimal; |
| 20 | |
import java.math.BigInteger; |
| 21 | |
import java.util.ArrayList; |
| 22 | |
import java.util.Collection; |
| 23 | |
import java.util.HashMap; |
| 24 | |
import java.util.Iterator; |
| 25 | |
import java.util.List; |
| 26 | |
import java.util.Map; |
| 27 | |
import java.util.Properties; |
| 28 | |
import java.util.Set; |
| 29 | |
|
| 30 | |
import org.apache.commons.configuration.event.ConfigurationErrorListener; |
| 31 | |
import org.apache.commons.configuration.event.ConfigurationListener; |
| 32 | |
import org.apache.commons.configuration.tree.ConfigurationNode; |
| 33 | |
import org.apache.commons.configuration.tree.ExpressionEngine; |
| 34 | |
import org.apache.commons.configuration.tree.NodeCombiner; |
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
public class DynamicCombinedConfiguration extends CombinedConfiguration |
| 47 | |
{ |
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | 1 | private static ThreadLocal recursive = new ThreadLocal() |
| 52 | |
{ |
| 53 | 1 | protected synchronized Object initialValue() |
| 54 | |
{ |
| 55 | 0 | return Boolean.FALSE; |
| 56 | |
} |
| 57 | |
}; |
| 58 | |
|
| 59 | |
|
| 60 | 1 | private Map configs = new HashMap(); |
| 61 | |
|
| 62 | |
|
| 63 | 1 | private List configurations = new ArrayList(); |
| 64 | |
|
| 65 | |
|
| 66 | 1 | private Map namedConfigurations = new HashMap(); |
| 67 | |
|
| 68 | |
|
| 69 | |
private String keyPattern; |
| 70 | |
|
| 71 | |
|
| 72 | |
private NodeCombiner nodeCombiner; |
| 73 | |
|
| 74 | |
|
| 75 | |
|
| 76 | |
|
| 77 | |
|
| 78 | |
|
| 79 | |
|
| 80 | |
|
| 81 | |
public DynamicCombinedConfiguration(NodeCombiner comb) |
| 82 | |
{ |
| 83 | 0 | super(); |
| 84 | 0 | setNodeCombiner(comb); |
| 85 | 0 | } |
| 86 | |
|
| 87 | |
|
| 88 | |
|
| 89 | |
|
| 90 | |
|
| 91 | |
|
| 92 | |
|
| 93 | |
public DynamicCombinedConfiguration() |
| 94 | |
{ |
| 95 | 1 | super(); |
| 96 | 1 | } |
| 97 | |
|
| 98 | |
public void setKeyPattern(String pattern) |
| 99 | |
{ |
| 100 | 1 | this.keyPattern = pattern; |
| 101 | 1 | } |
| 102 | |
|
| 103 | |
public String getKeyPattern() |
| 104 | |
{ |
| 105 | 0 | return this.keyPattern; |
| 106 | |
} |
| 107 | |
|
| 108 | |
|
| 109 | |
|
| 110 | |
|
| 111 | |
|
| 112 | |
|
| 113 | |
|
| 114 | |
public NodeCombiner getNodeCombiner() |
| 115 | |
{ |
| 116 | 8 | return nodeCombiner; |
| 117 | |
} |
| 118 | |
|
| 119 | |
|
| 120 | |
|
| 121 | |
|
| 122 | |
|
| 123 | |
|
| 124 | |
|
| 125 | |
|
| 126 | |
|
| 127 | |
|
| 128 | |
public void setNodeCombiner(NodeCombiner nodeCombiner) |
| 129 | |
{ |
| 130 | 1 | if (nodeCombiner == null) |
| 131 | |
{ |
| 132 | 0 | throw new IllegalArgumentException( |
| 133 | |
"Node combiner must not be null!"); |
| 134 | |
} |
| 135 | 1 | this.nodeCombiner = nodeCombiner; |
| 136 | 1 | invalidateAll(); |
| 137 | 1 | } |
| 138 | |
|
| 139 | |
|
| 140 | |
|
| 141 | |
|
| 142 | |
|
| 143 | |
|
| 144 | |
|
| 145 | |
|
| 146 | |
|
| 147 | |
|
| 148 | |
|
| 149 | |
|
| 150 | |
|
| 151 | |
|
| 152 | |
|
| 153 | |
|
| 154 | |
public void addConfiguration(AbstractConfiguration config, String name, |
| 155 | |
String at) |
| 156 | |
{ |
| 157 | 2 | ConfigData cd = new ConfigData(config, name, at); |
| 158 | 2 | configurations.add(cd); |
| 159 | 2 | if (name != null) |
| 160 | |
{ |
| 161 | 2 | namedConfigurations.put(name, config); |
| 162 | |
} |
| 163 | 2 | } |
| 164 | |
|
| 165 | |
|
| 166 | |
|
| 167 | |
|
| 168 | |
|
| 169 | |
|
| 170 | |
public int getNumberOfConfigurations() |
| 171 | |
{ |
| 172 | 0 | return configurations.size(); |
| 173 | |
} |
| 174 | |
|
| 175 | |
|
| 176 | |
|
| 177 | |
|
| 178 | |
|
| 179 | |
|
| 180 | |
|
| 181 | |
|
| 182 | |
|
| 183 | |
public Configuration getConfiguration(int index) |
| 184 | |
{ |
| 185 | 0 | ConfigData cd = (ConfigData) configurations.get(index); |
| 186 | 0 | return cd.getConfiguration(); |
| 187 | |
} |
| 188 | |
|
| 189 | |
|
| 190 | |
|
| 191 | |
|
| 192 | |
|
| 193 | |
|
| 194 | |
|
| 195 | |
|
| 196 | |
public Configuration getConfiguration(String name) |
| 197 | |
{ |
| 198 | 0 | return (Configuration) namedConfigurations.get(name); |
| 199 | |
} |
| 200 | |
|
| 201 | |
|
| 202 | |
|
| 203 | |
|
| 204 | |
|
| 205 | |
|
| 206 | |
|
| 207 | |
|
| 208 | |
|
| 209 | |
public Set getConfigurationNames() |
| 210 | |
{ |
| 211 | 0 | return namedConfigurations.keySet(); |
| 212 | |
} |
| 213 | |
|
| 214 | |
|
| 215 | |
|
| 216 | |
|
| 217 | |
|
| 218 | |
|
| 219 | |
|
| 220 | |
|
| 221 | |
public Configuration removeConfiguration(String name) |
| 222 | |
{ |
| 223 | 0 | Configuration conf = getConfiguration(name); |
| 224 | 0 | if (conf != null) |
| 225 | |
{ |
| 226 | 0 | removeConfiguration(conf); |
| 227 | |
} |
| 228 | 0 | return conf; |
| 229 | |
} |
| 230 | |
|
| 231 | |
|
| 232 | |
|
| 233 | |
|
| 234 | |
|
| 235 | |
|
| 236 | |
|
| 237 | |
public boolean removeConfiguration(Configuration config) |
| 238 | |
{ |
| 239 | 0 | for (int index = 0; index < getNumberOfConfigurations(); index++) |
| 240 | |
{ |
| 241 | 0 | if (((ConfigData) configurations.get(index)).getConfiguration() == config) |
| 242 | |
{ |
| 243 | 0 | removeConfigurationAt(index); |
| 244 | |
|
| 245 | |
} |
| 246 | |
} |
| 247 | |
|
| 248 | 0 | return super.removeConfiguration(config); |
| 249 | |
} |
| 250 | |
|
| 251 | |
|
| 252 | |
|
| 253 | |
|
| 254 | |
|
| 255 | |
|
| 256 | |
|
| 257 | |
public Configuration removeConfigurationAt(int index) |
| 258 | |
{ |
| 259 | 0 | ConfigData cd = (ConfigData) configurations.remove(index); |
| 260 | 0 | if (cd.getName() != null) |
| 261 | |
{ |
| 262 | 0 | namedConfigurations.remove(cd.getName()); |
| 263 | |
} |
| 264 | 0 | return super.removeConfigurationAt(index); |
| 265 | |
} |
| 266 | |
|
| 267 | |
|
| 268 | |
|
| 269 | |
|
| 270 | |
|
| 271 | |
|
| 272 | |
|
| 273 | |
public ConfigurationNode getRootNode() |
| 274 | |
{ |
| 275 | 0 | return getCurrentConfig().getRootNode(); |
| 276 | |
} |
| 277 | |
|
| 278 | |
public void setRootNode(ConfigurationNode rootNode) |
| 279 | |
{ |
| 280 | 1 | if (configs != null) |
| 281 | |
{ |
| 282 | 0 | this.getCurrentConfig().setRootNode(rootNode); |
| 283 | |
} |
| 284 | |
else |
| 285 | |
{ |
| 286 | 1 | super.setRootNode(rootNode); |
| 287 | |
} |
| 288 | 1 | } |
| 289 | |
|
| 290 | |
public void addProperty(String key, Object value) |
| 291 | |
{ |
| 292 | 0 | this.getCurrentConfig().addProperty(key, value); |
| 293 | 0 | } |
| 294 | |
|
| 295 | |
public void clear() |
| 296 | |
{ |
| 297 | 1 | if (configs != null) |
| 298 | |
{ |
| 299 | 0 | this.getCurrentConfig().clear(); |
| 300 | |
} |
| 301 | 1 | } |
| 302 | |
|
| 303 | |
public void clearProperty(String key) |
| 304 | |
{ |
| 305 | 0 | this.getCurrentConfig().clearProperty(key); |
| 306 | 0 | } |
| 307 | |
|
| 308 | |
public boolean containsKey(String key) |
| 309 | |
{ |
| 310 | 0 | return this.getCurrentConfig().containsKey(key); |
| 311 | |
} |
| 312 | |
|
| 313 | |
public BigDecimal getBigDecimal(String key, BigDecimal defaultValue) |
| 314 | |
{ |
| 315 | 0 | return this.getCurrentConfig().getBigDecimal(key, defaultValue); |
| 316 | |
} |
| 317 | |
|
| 318 | |
public BigDecimal getBigDecimal(String key) |
| 319 | |
{ |
| 320 | 0 | return this.getCurrentConfig().getBigDecimal(key); |
| 321 | |
} |
| 322 | |
|
| 323 | |
public BigInteger getBigInteger(String key, BigInteger defaultValue) |
| 324 | |
{ |
| 325 | 0 | return this.getCurrentConfig().getBigInteger(key, defaultValue); |
| 326 | |
} |
| 327 | |
|
| 328 | |
public BigInteger getBigInteger(String key) |
| 329 | |
{ |
| 330 | 0 | return this.getCurrentConfig().getBigInteger(key); |
| 331 | |
} |
| 332 | |
|
| 333 | |
public boolean getBoolean(String key, boolean defaultValue) |
| 334 | |
{ |
| 335 | 0 | return this.getCurrentConfig().getBoolean(key, defaultValue); |
| 336 | |
} |
| 337 | |
|
| 338 | |
public Boolean getBoolean(String key, Boolean defaultValue) |
| 339 | |
{ |
| 340 | 0 | return this.getCurrentConfig().getBoolean(key, defaultValue); |
| 341 | |
} |
| 342 | |
|
| 343 | |
public boolean getBoolean(String key) |
| 344 | |
{ |
| 345 | 0 | return this.getCurrentConfig().getBoolean(key); |
| 346 | |
} |
| 347 | |
|
| 348 | |
public byte getByte(String key, byte defaultValue) |
| 349 | |
{ |
| 350 | 0 | return this.getCurrentConfig().getByte(key, defaultValue); |
| 351 | |
} |
| 352 | |
|
| 353 | |
public Byte getByte(String key, Byte defaultValue) |
| 354 | |
{ |
| 355 | 0 | return this.getCurrentConfig().getByte(key, defaultValue); |
| 356 | |
} |
| 357 | |
|
| 358 | |
public byte getByte(String key) |
| 359 | |
{ |
| 360 | 0 | return this.getCurrentConfig().getByte(key); |
| 361 | |
} |
| 362 | |
|
| 363 | |
public double getDouble(String key, double defaultValue) |
| 364 | |
{ |
| 365 | 0 | return this.getCurrentConfig().getDouble(key, defaultValue); |
| 366 | |
} |
| 367 | |
|
| 368 | |
public Double getDouble(String key, Double defaultValue) |
| 369 | |
{ |
| 370 | 0 | return this.getCurrentConfig().getDouble(key, defaultValue); |
| 371 | |
} |
| 372 | |
|
| 373 | |
public double getDouble(String key) |
| 374 | |
{ |
| 375 | 0 | return this.getCurrentConfig().getDouble(key); |
| 376 | |
} |
| 377 | |
|
| 378 | |
public float getFloat(String key, float defaultValue) |
| 379 | |
{ |
| 380 | 0 | return this.getCurrentConfig().getFloat(key, defaultValue); |
| 381 | |
} |
| 382 | |
|
| 383 | |
public Float getFloat(String key, Float defaultValue) |
| 384 | |
{ |
| 385 | 0 | return this.getCurrentConfig().getFloat(key, defaultValue); |
| 386 | |
} |
| 387 | |
|
| 388 | |
public float getFloat(String key) |
| 389 | |
{ |
| 390 | 0 | return this.getCurrentConfig().getFloat(key); |
| 391 | |
} |
| 392 | |
|
| 393 | |
public int getInt(String key, int defaultValue) |
| 394 | |
{ |
| 395 | 0 | return this.getCurrentConfig().getInt(key, defaultValue); |
| 396 | |
} |
| 397 | |
|
| 398 | |
public int getInt(String key) |
| 399 | |
{ |
| 400 | 4 | return this.getCurrentConfig().getInt(key); |
| 401 | |
} |
| 402 | |
|
| 403 | |
public Integer getInteger(String key, Integer defaultValue) |
| 404 | |
{ |
| 405 | 0 | return this.getCurrentConfig().getInteger(key, defaultValue); |
| 406 | |
} |
| 407 | |
|
| 408 | |
public Iterator getKeys() |
| 409 | |
{ |
| 410 | 0 | return this.getCurrentConfig().getKeys(); |
| 411 | |
} |
| 412 | |
|
| 413 | |
public Iterator getKeys(String prefix) |
| 414 | |
{ |
| 415 | 0 | return this.getCurrentConfig().getKeys(prefix); |
| 416 | |
} |
| 417 | |
|
| 418 | |
public List getList(String key, List defaultValue) |
| 419 | |
{ |
| 420 | 0 | return this.getCurrentConfig().getList(key, defaultValue); |
| 421 | |
} |
| 422 | |
|
| 423 | |
public List getList(String key) |
| 424 | |
{ |
| 425 | 0 | return this.getCurrentConfig().getList(key); |
| 426 | |
} |
| 427 | |
|
| 428 | |
public long getLong(String key, long defaultValue) |
| 429 | |
{ |
| 430 | 0 | return this.getCurrentConfig().getLong(key, defaultValue); |
| 431 | |
} |
| 432 | |
|
| 433 | |
public Long getLong(String key, Long defaultValue) |
| 434 | |
{ |
| 435 | 0 | return this.getCurrentConfig().getLong(key, defaultValue); |
| 436 | |
} |
| 437 | |
|
| 438 | |
public long getLong(String key) |
| 439 | |
{ |
| 440 | 0 | return this.getCurrentConfig().getLong(key); |
| 441 | |
} |
| 442 | |
|
| 443 | |
public Properties getProperties(String key) |
| 444 | |
{ |
| 445 | 0 | return this.getCurrentConfig().getProperties(key); |
| 446 | |
} |
| 447 | |
|
| 448 | |
public Object getProperty(String key) |
| 449 | |
{ |
| 450 | 0 | return this.getCurrentConfig().getProperty(key); |
| 451 | |
} |
| 452 | |
|
| 453 | |
public short getShort(String key, short defaultValue) |
| 454 | |
{ |
| 455 | 0 | return this.getCurrentConfig().getShort(key, defaultValue); |
| 456 | |
} |
| 457 | |
|
| 458 | |
public Short getShort(String key, Short defaultValue) |
| 459 | |
{ |
| 460 | 0 | return this.getCurrentConfig().getShort(key, defaultValue); |
| 461 | |
} |
| 462 | |
|
| 463 | |
public short getShort(String key) |
| 464 | |
{ |
| 465 | 0 | return this.getCurrentConfig().getShort(key); |
| 466 | |
} |
| 467 | |
|
| 468 | |
public String getString(String key, String defaultValue) |
| 469 | |
{ |
| 470 | 0 | return this.getCurrentConfig().getString(key, defaultValue); |
| 471 | |
} |
| 472 | |
|
| 473 | |
public String getString(String key) |
| 474 | |
{ |
| 475 | 0 | return this.getCurrentConfig().getString(key); |
| 476 | |
} |
| 477 | |
|
| 478 | |
public String[] getStringArray(String key) |
| 479 | |
{ |
| 480 | 0 | return this.getCurrentConfig().getStringArray(key); |
| 481 | |
} |
| 482 | |
|
| 483 | |
public boolean isEmpty() |
| 484 | |
{ |
| 485 | 0 | return this.getCurrentConfig().isEmpty(); |
| 486 | |
} |
| 487 | |
|
| 488 | |
public void setProperty(String key, Object value) |
| 489 | |
{ |
| 490 | 0 | if (configs != null) |
| 491 | |
{ |
| 492 | 0 | this.getCurrentConfig().setProperty(key, value); |
| 493 | |
} |
| 494 | 0 | } |
| 495 | |
|
| 496 | |
public Configuration subset(String prefix) |
| 497 | |
{ |
| 498 | 0 | return this.getCurrentConfig().subset(prefix); |
| 499 | |
} |
| 500 | |
|
| 501 | |
public Node getRoot() |
| 502 | |
{ |
| 503 | 0 | return this.getCurrentConfig().getRoot(); |
| 504 | |
} |
| 505 | |
|
| 506 | |
public void setRoot(Node node) |
| 507 | |
{ |
| 508 | 0 | if (configs != null) |
| 509 | |
{ |
| 510 | 0 | this.getCurrentConfig().setRoot(node); |
| 511 | |
} |
| 512 | |
else |
| 513 | |
{ |
| 514 | 0 | super.setRoot(node); |
| 515 | |
} |
| 516 | 0 | } |
| 517 | |
|
| 518 | |
public ExpressionEngine getExpressionEngine() |
| 519 | |
{ |
| 520 | 4 | return super.getExpressionEngine(); |
| 521 | |
} |
| 522 | |
|
| 523 | |
public void setExpressionEngine(ExpressionEngine expressionEngine) |
| 524 | |
{ |
| 525 | 0 | super.setExpressionEngine(expressionEngine); |
| 526 | 0 | } |
| 527 | |
|
| 528 | |
public void addNodes(String key, Collection nodes) |
| 529 | |
{ |
| 530 | 0 | this.getCurrentConfig().addNodes(key, nodes); |
| 531 | 0 | } |
| 532 | |
|
| 533 | |
public SubnodeConfiguration configurationAt(String key, boolean supportUpdates) |
| 534 | |
{ |
| 535 | 0 | return this.getCurrentConfig().configurationAt(key, supportUpdates); |
| 536 | |
} |
| 537 | |
|
| 538 | |
public SubnodeConfiguration configurationAt(String key) |
| 539 | |
{ |
| 540 | 0 | return this.getCurrentConfig().configurationAt(key); |
| 541 | |
} |
| 542 | |
|
| 543 | |
public List configurationsAt(String key) |
| 544 | |
{ |
| 545 | 0 | return this.getCurrentConfig().configurationsAt(key); |
| 546 | |
} |
| 547 | |
|
| 548 | |
public void clearTree(String key) |
| 549 | |
{ |
| 550 | 0 | this.getCurrentConfig().clearTree(key); |
| 551 | 0 | } |
| 552 | |
|
| 553 | |
public int getMaxIndex(String key) |
| 554 | |
{ |
| 555 | 0 | return this.getCurrentConfig().getMaxIndex(key); |
| 556 | |
} |
| 557 | |
|
| 558 | |
public Configuration interpolatedConfiguration() |
| 559 | |
{ |
| 560 | 0 | return this.getCurrentConfig().interpolatedConfiguration(); |
| 561 | |
} |
| 562 | |
|
| 563 | |
|
| 564 | |
|
| 565 | |
|
| 566 | |
|
| 567 | |
|
| 568 | |
|
| 569 | |
|
| 570 | |
|
| 571 | |
|
| 572 | |
|
| 573 | |
|
| 574 | |
|
| 575 | |
|
| 576 | |
|
| 577 | |
|
| 578 | |
|
| 579 | |
|
| 580 | |
|
| 581 | |
|
| 582 | |
|
| 583 | |
|
| 584 | |
|
| 585 | |
|
| 586 | |
public Configuration getSource(String key) |
| 587 | |
{ |
| 588 | 0 | if (key == null) |
| 589 | |
{ |
| 590 | 0 | throw new IllegalArgumentException("Key must not be null!"); |
| 591 | |
} |
| 592 | 0 | return getCurrentConfig().getSource(key); |
| 593 | |
} |
| 594 | |
|
| 595 | |
public void addConfigurationListener(ConfigurationListener l) |
| 596 | |
{ |
| 597 | 0 | super.addConfigurationListener(l); |
| 598 | |
|
| 599 | 0 | Iterator iter = configs.values().iterator(); |
| 600 | 0 | while (iter.hasNext()) |
| 601 | |
{ |
| 602 | 0 | CombinedConfiguration config = (CombinedConfiguration) iter.next(); |
| 603 | 0 | config.addConfigurationListener(l); |
| 604 | |
} |
| 605 | 0 | } |
| 606 | |
|
| 607 | |
public boolean removeConfigurationListener(ConfigurationListener l) |
| 608 | |
{ |
| 609 | 0 | Iterator iter = configs.values().iterator(); |
| 610 | 0 | while (iter.hasNext()) |
| 611 | |
{ |
| 612 | 0 | CombinedConfiguration config = (CombinedConfiguration) iter.next(); |
| 613 | 0 | config.removeConfigurationListener(l); |
| 614 | |
} |
| 615 | 0 | return super.removeConfigurationListener(l); |
| 616 | |
} |
| 617 | |
|
| 618 | |
public Collection getConfigurationListeners() |
| 619 | |
{ |
| 620 | 0 | return super.getConfigurationListeners(); |
| 621 | |
} |
| 622 | |
|
| 623 | |
public void clearConfigurationListeners() |
| 624 | |
{ |
| 625 | 0 | Iterator iter = configs.values().iterator(); |
| 626 | 0 | while (iter.hasNext()) |
| 627 | |
{ |
| 628 | 0 | CombinedConfiguration config = (CombinedConfiguration) iter.next(); |
| 629 | 0 | config.clearConfigurationListeners(); |
| 630 | |
} |
| 631 | 0 | super.clearConfigurationListeners(); |
| 632 | 0 | } |
| 633 | |
|
| 634 | |
public void addErrorListener(ConfigurationErrorListener l) |
| 635 | |
{ |
| 636 | 0 | Iterator iter = configs.values().iterator(); |
| 637 | 0 | while (iter.hasNext()) |
| 638 | |
{ |
| 639 | 0 | CombinedConfiguration config = (CombinedConfiguration) iter.next(); |
| 640 | 0 | config.addErrorListener(l); |
| 641 | |
} |
| 642 | 0 | super.addErrorListener(l); |
| 643 | 0 | } |
| 644 | |
|
| 645 | |
public boolean removeErrorListener(ConfigurationErrorListener l) |
| 646 | |
{ |
| 647 | 0 | Iterator iter = configs.values().iterator(); |
| 648 | 0 | while (iter.hasNext()) |
| 649 | |
{ |
| 650 | 0 | CombinedConfiguration config = (CombinedConfiguration) iter.next(); |
| 651 | 0 | config.removeErrorListener(l); |
| 652 | |
} |
| 653 | 0 | return super.removeErrorListener(l); |
| 654 | |
} |
| 655 | |
|
| 656 | |
public void clearErrorListeners() |
| 657 | |
{ |
| 658 | 0 | Iterator iter = configs.values().iterator(); |
| 659 | 0 | while (iter.hasNext()) |
| 660 | |
{ |
| 661 | 0 | CombinedConfiguration config = (CombinedConfiguration) iter.next(); |
| 662 | 0 | config.clearErrorListeners(); |
| 663 | |
} |
| 664 | 0 | super.clearErrorListeners(); |
| 665 | 0 | } |
| 666 | |
|
| 667 | |
public Collection getErrorListeners() |
| 668 | |
{ |
| 669 | 0 | return super.getErrorListeners(); |
| 670 | |
} |
| 671 | |
|
| 672 | |
|
| 673 | |
|
| 674 | |
|
| 675 | |
|
| 676 | |
|
| 677 | |
|
| 678 | |
|
| 679 | |
|
| 680 | |
|
| 681 | |
|
| 682 | |
|
| 683 | |
public Object clone() |
| 684 | |
{ |
| 685 | 0 | return super.clone(); |
| 686 | |
} |
| 687 | |
|
| 688 | |
|
| 689 | |
|
| 690 | |
|
| 691 | |
|
| 692 | |
|
| 693 | |
|
| 694 | |
|
| 695 | |
|
| 696 | |
|
| 697 | |
|
| 698 | |
public void invalidate() |
| 699 | |
{ |
| 700 | 0 | getCurrentConfig().invalidate(); |
| 701 | 0 | } |
| 702 | |
|
| 703 | |
public void invalidateAll() |
| 704 | |
{ |
| 705 | 1 | if (configs == null) |
| 706 | |
{ |
| 707 | 1 | return; |
| 708 | |
} |
| 709 | 0 | Iterator iter = configs.values().iterator(); |
| 710 | 0 | while (iter.hasNext()) |
| 711 | |
{ |
| 712 | 0 | CombinedConfiguration config = (CombinedConfiguration) iter.next(); |
| 713 | 0 | config.invalidate(); |
| 714 | |
} |
| 715 | 0 | } |
| 716 | |
|
| 717 | |
|
| 718 | |
|
| 719 | |
|
| 720 | |
|
| 721 | |
|
| 722 | |
protected Object resolveContainerStore(String key) |
| 723 | |
{ |
| 724 | 0 | if (((Boolean) recursive.get()).booleanValue()) |
| 725 | |
{ |
| 726 | 0 | return null; |
| 727 | |
} |
| 728 | 0 | recursive.set(Boolean.TRUE); |
| 729 | |
try |
| 730 | |
{ |
| 731 | 0 | return super.resolveContainerStore(key); |
| 732 | |
} |
| 733 | |
finally |
| 734 | |
{ |
| 735 | 0 | recursive.set(Boolean.FALSE); |
| 736 | |
} |
| 737 | |
} |
| 738 | |
|
| 739 | |
private CombinedConfiguration getCurrentConfig() |
| 740 | |
{ |
| 741 | 4 | String key = getSubstitutor().replace(keyPattern); |
| 742 | |
CombinedConfiguration config; |
| 743 | 4 | synchronized (getNodeCombiner()) |
| 744 | |
{ |
| 745 | 4 | config = (CombinedConfiguration) configs.get(key); |
| 746 | 4 | if (config == null) |
| 747 | |
{ |
| 748 | 4 | config = new CombinedConfiguration(getNodeCombiner()); |
| 749 | 4 | config.setExpressionEngine(this.getExpressionEngine()); |
| 750 | 4 | Iterator iter = config.getErrorListeners().iterator(); |
| 751 | 4 | while (iter.hasNext()) |
| 752 | |
{ |
| 753 | 0 | ConfigurationErrorListener listener = (ConfigurationErrorListener) iter.next(); |
| 754 | 0 | config.addErrorListener(listener); |
| 755 | |
} |
| 756 | 4 | iter = config.getConfigurationListeners().iterator(); |
| 757 | 4 | while (iter.hasNext()) |
| 758 | |
{ |
| 759 | 0 | ConfigurationListener listener = (ConfigurationListener) iter.next(); |
| 760 | 0 | config.addConfigurationListener(listener); |
| 761 | |
} |
| 762 | 4 | config.setForceReloadCheck(isForceReloadCheck()); |
| 763 | 4 | iter = configurations.iterator(); |
| 764 | 12 | while (iter.hasNext()) |
| 765 | |
{ |
| 766 | 8 | ConfigData data = (ConfigData) iter.next(); |
| 767 | 8 | config.addConfiguration(data.getConfiguration(), data.getName(), |
| 768 | |
data.getAt()); |
| 769 | |
} |
| 770 | 4 | configs.put(key, config); |
| 771 | |
} |
| 772 | 4 | } |
| 773 | 4 | return config; |
| 774 | |
} |
| 775 | |
|
| 776 | |
|
| 777 | |
|
| 778 | |
|
| 779 | |
static class ConfigData |
| 780 | |
{ |
| 781 | |
|
| 782 | |
private AbstractConfiguration configuration; |
| 783 | |
|
| 784 | |
|
| 785 | |
private String name; |
| 786 | |
|
| 787 | |
|
| 788 | |
private String at; |
| 789 | |
|
| 790 | |
|
| 791 | |
|
| 792 | |
|
| 793 | |
|
| 794 | |
|
| 795 | |
|
| 796 | |
|
| 797 | |
|
| 798 | |
public ConfigData(AbstractConfiguration config, String n, String at) |
| 799 | 2 | { |
| 800 | 2 | configuration = config; |
| 801 | 2 | name = n; |
| 802 | 2 | this.at = at; |
| 803 | 2 | } |
| 804 | |
|
| 805 | |
|
| 806 | |
|
| 807 | |
|
| 808 | |
|
| 809 | |
|
| 810 | |
public AbstractConfiguration getConfiguration() |
| 811 | |
{ |
| 812 | 8 | return configuration; |
| 813 | |
} |
| 814 | |
|
| 815 | |
|
| 816 | |
|
| 817 | |
|
| 818 | |
|
| 819 | |
|
| 820 | |
public String getName() |
| 821 | |
{ |
| 822 | 8 | return name; |
| 823 | |
} |
| 824 | |
|
| 825 | |
|
| 826 | |
|
| 827 | |
|
| 828 | |
|
| 829 | |
|
| 830 | |
public String getAt() |
| 831 | |
{ |
| 832 | 8 | return at; |
| 833 | |
} |
| 834 | |
|
| 835 | |
} |
| 836 | |
} |