use of gate.config.ConfigDataProcessor in project gate-core by GateNLP.
the class Gate method initConfigData.
// initDataStoreRegister()
/**
* Reads config data (<TT>gate.xml</TT> files). There are three sorts of
* these files:
* <UL>
* <LI> The builtin file from GATE's resources - this is read first.
* <LI> A site-wide init file given as a command-line argument or as a
* <TT>gate.config</TT> property - this is read second.
* <LI> The user's file from their home directory - this is read last.
* </UL>
* Settings from files read after some settings have already been made will
* simply overwrite the previous settings.
*/
public static void initConfigData() throws GateException {
ConfigDataProcessor configProcessor = new ConfigDataProcessor();
URL configURL;
// parse the site configuration file
if (siteConfigFile != null && siteConfigFile.exists()) {
try {
configURL = siteConfigFile.toURI().toURL();
} catch (MalformedURLException mue) {
// this should never happen
throw new GateRuntimeException(mue);
}
try {
InputStream configStream = new FileInputStream(siteConfigFile);
configProcessor.parseConfigFile(configStream, configURL);
} catch (IOException e) {
throw new GateException("Couldn't open site configuration file: " + configURL + " " + e);
}
}
// parse the user configuration data if present
if (userConfigFile != null && userConfigFile.exists()) {
try {
configURL = userConfigFile.toURI().toURL();
} catch (MalformedURLException mue) {
// this should never happen
throw new GateRuntimeException(mue);
}
try {
InputStream configStream = new FileInputStream(userConfigFile);
configProcessor.parseConfigFile(configStream, configURL);
} catch (IOException e) {
throw new GateException("Couldn't open user configuration file: " + configURL + " " + e);
}
}
// remember the init-time config options
originalUserConfig.putAll(userConfig);
}
Aggregations