this.curator = curator;
this.sink = sink;
}
public void importObject(Reader reader) throws IOException {
Rules existingRules = curator.getRules();
Rules newRules = new Rules(StringFromReader.asString(reader));
// Only import if rules version is greater than what we currently have now:
if (VersionUtil.getRulesVersionCompatibility(existingRules.getVersion(),
newRules.getVersion())) {
log.info("Importing new rules from manifest, current version: " +
existingRules.getVersion() + " new version: " + newRules.getVersion());
curator.update(newRules);
sink.emitRulesModified(existingRules, newRules);
}
else {
log.info("Ignoring older rules in manifest, current version: " +
existingRules.getVersion() + " new version: " + newRules.getVersion());
}
}