// Get the properties file stream...
if(ruleSetFile.exists()) {
try {
ruleStream = new FileInputStream(ruleSetFile);
} catch (FileNotFoundException e) {
throw new MessageRouterException("Unable to open rule properties file '" + ruleSetFile.getAbsolutePath() + "'.", e);
}
lastLoaded = ruleSetFile.lastModified();
} else {
ruleStream = ClassUtil.getResourceAsStream(ruleSetConfig, AbstractPropertyRulesRouter.class);
}
if(ruleStream == null) {
throw new MessageRouterException("Unable to open rule properties file '" + ruleSetConfig + "'.");
}
// Load the rule properties...
Properties rules = new Properties();
try {
try {
rules.load(ruleStream);
} catch (IOException e) {
throw new MessageRouterException("Error reading rule properties file '" + ruleSetConfig + "'.", e);
}
} finally {
try {
ruleStream.close();
} catch (IOException e) {
throw new MessageRouterException("Error closing rule properties file '" + ruleSetConfig + "'.", e);
}
}
return rules;
}