use of org.opennms.netmgt.config.syslogd.SyslogdConfigurationGroup in project opennms by OpenNMS.
the class SyslogdConfigFactory method parseIncludedFiles.
/**
* Parse import-file tags and add all uei-matchs and hide-messages.
*
* @throws IOException
*/
private void parseIncludedFiles() throws IOException {
final File configDir;
try {
configDir = ConfigFileConstants.getFile(ConfigFileConstants.SYSLOGD_CONFIG_FILE_NAME).getParentFile();
} catch (final Throwable t) {
LOG.warn("Error getting default syslogd configuration location. <import-file> directives will be ignored. This should really only happen in unit tests.");
return;
}
for (final String fileName : m_config.getImportFiles()) {
final File configFile = new File(configDir, fileName);
final SyslogdConfigurationGroup includeCfg = JaxbUtils.unmarshal(SyslogdConfigurationGroup.class, new FileSystemResource(configFile));
if (includeCfg.getUeiMatches() != null) {
for (final UeiMatch ueiMatch : includeCfg.getUeiMatches()) {
if (m_config.getUeiMatches() == null) {
m_config.setUeiMatches(new ArrayList<>());
}
m_config.addUeiMatch(ueiMatch);
}
}
if (includeCfg.getHideMatches() != null) {
for (final HideMatch hideMatch : includeCfg.getHideMatches()) {
if (m_config.getHideMatches() == null) {
m_config.setHideMatches(new ArrayList<>());
}
m_config.addHideMatch(hideMatch);
}
}
}
}
Aggregations