@Nullable public static Editor wrap(@Nullable Editor editor, final Logger logger, final String message) { if (editor != null && !(editor instanceof ProgressNotificationEditor)) { return new ProgressNotificationEditor(editor, "/", new Function<String, Void>() { int count; @Nullable @Override public Void apply(String path) { if (++count % 10000 == 0) { logger.info(message + " Traversed #" + count + ' ' + path); } return null; } }); } return editor; }
@Override public Editor childNodeAdded(String name, NodeState after) throws CommitFailedException { return createChildEditor(editor.childNodeAdded(name, after), name); }
@Override public Editor getRootEditor(NodeState before, NodeState after, NodeBuilder builder, CommitInfo info) throws CommitFailedException { Editor rootEditor = new TypeEditorProvider(false) .getRootEditor(before, after, builder, info); return ProgressNotificationEditor.wrap(rootEditor, logger, "Checking node types:"); }
@Override public Editor getRootEditor(NodeState before, NodeState after, NodeBuilder builder, CommitInfo info) throws CommitFailedException { Editor rootEditor = new TypeEditorProvider(false) .getRootEditor(before, after, builder, info); return ProgressNotificationEditor.wrap(rootEditor, logger, "Checking node types:"); }
@Override public Editor childNodeChanged(String name, NodeState before, NodeState after) throws CommitFailedException { return createChildEditor(editor.childNodeChanged(name, before, after), name); }
@CheckForNull public static Editor wrap(@CheckForNull Editor editor, final Logger logger, final String message) { if (editor != null && !(editor instanceof ProgressNotificationEditor)) { return new ProgressNotificationEditor(editor, "/", new Function<String, Void>() { int count; @Nullable @Override public Void apply(String path) { if (++count % 10000 == 0) { logger.info(message + " Traversed #" + count + ' ' + path); } return null; } }); } return editor; }
@Override public Editor childNodeChanged(String name, NodeState before, NodeState after) throws CommitFailedException { return createChildEditor(editor.childNodeChanged(name, before, after), name); }
private ProgressNotificationEditor createChildEditor(Editor editor, String name) { if (editor == null) { return null; } else { return new ProgressNotificationEditor(editor, concat(path, name), onProgress); } } }
@Override public Editor childNodeDeleted(String name, NodeState before) throws CommitFailedException { return createChildEditor(editor.childNodeDeleted(name, before), name); }
private ProgressNotificationEditor createChildEditor(Editor editor, String name) { if (editor == null) { return null; } else { return new ProgressNotificationEditor(editor, concat(path, name), onProgress); } } }
@Override public Editor childNodeDeleted(String name, NodeState before) throws CommitFailedException { return createChildEditor(editor.childNodeDeleted(name, before), name); }
@Override public Editor childNodeAdded(String name, NodeState after) throws CommitFailedException { return createChildEditor(editor.childNodeAdded(name, after), name); }