private static Logger LOG = LoggerFactory.getLogger(GraphUpdaterConfigurator.class);
public void setupGraph(Graph graph, Preferences mainConfig) {
// Create a updater manager for this graph
GraphUpdaterManager updaterManager = new GraphUpdaterManager(graph);
// Look for embedded config if it exists
Properties embeddedGraphPreferences = graph.embeddedPreferences;
Preferences embeddedConfig = null;
if (embeddedGraphPreferences != null) {
embeddedConfig = new PropertiesPreferences(embeddedGraphPreferences);
}
LOG.info("Using configurations: " + (mainConfig == null ? "" : "[main]") + " "
+ (embeddedConfig == null ? "" : "[embedded]"));
// Apply configuration
updaterManager = applyConfigurationToGraph(graph, updaterManager, Arrays.asList(mainConfig, embeddedConfig));
// Stop the updater manager if it contains nothing
if (updaterManager.size() == 0) {
updaterManager.stop();
}
// Otherwise add it to the graph
else {
graph.updaterManager = updaterManager;
}