Reads config data ( gate.xml files). There are three sorts of these files: The builtin file from GATE's resources - this is read first. A site-wide init file given as a command-line argument or as a gate.config property - this is read second. The user's file from
()
| 540 | * simply overwrite the previous settings. |
| 541 | */ |
| 542 | public static void initConfigData() throws GateException { |
| 543 | ConfigDataProcessor configProcessor = new ConfigDataProcessor(); |
| 544 | URL configURL; |
| 545 | |
| 546 | // parse the site configuration file |
| 547 | if (siteConfigFile != null && siteConfigFile.exists()) { |
| 548 | //TODO should we set this to something sensible when we init paths now there is no gate home? |
| 549 | |
| 550 | try { |
| 551 | configURL = siteConfigFile.toURI().toURL(); |
| 552 | } |
| 553 | catch(MalformedURLException mue) { |
| 554 | // this should never happen |
| 555 | throw new GateRuntimeException(mue); |
| 556 | } |
| 557 | try (InputStream configStream = new FileInputStream(siteConfigFile)) { |
| 558 | configProcessor.parseConfigFile(configStream, configURL); |
| 559 | } |
| 560 | catch(IOException e) { |
| 561 | throw new GateException("Couldn't open site configuration file: " |
| 562 | + configURL + " " + e); |
| 563 | } |
| 564 | } |
| 565 | |
| 566 | // parse the user configuration data if present |
| 567 | if(userConfigFile != null && userConfigFile.exists()) { |
| 568 | try { |
| 569 | configURL = userConfigFile.toURI().toURL(); |
| 570 | } |
| 571 | catch(MalformedURLException mue) { |
| 572 | // this should never happen |
| 573 | throw new GateRuntimeException(mue); |
| 574 | } |
| 575 | try (InputStream configStream = new FileInputStream(userConfigFile)) { |
| 576 | configProcessor.parseConfigFile(configStream, configURL); |
| 577 | } |
| 578 | catch(IOException e) { |
| 579 | throw new GateException("Couldn't open user configuration file: " |
| 580 | + configURL + " " + e); |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | // remember the init-time config options |
| 585 | originalUserConfig.putAll(userConfig); |
| 586 | } // initConfigData() |
| 587 | |
| 588 | private static int lastSym; |
| 589 |
no test coverage detected