IndexUpdate implements Editor, PathSource { private static String getIndexPath(String path, String indexName) { if (PathUtils.denotesRoot(path)) { return "/" + INDEX_DEFINITIONS_NAME + "/" + indexName; } return path + "/" + INDEX_DEFINITIONS_NAME + "/" + indexName; } IndexUpdate(
            IndexEditorProvider provider, String async,
            NodeState root, NodeBuilder builder,
            IndexUpdateCallback updateCallback);  IndexUpdate(
            IndexEditorProvider provider, String async,
            NodeState root, NodeBuilder builder,
            IndexUpdateCallback updateCallback, CommitInfo commitInfo);  IndexUpdate(
            IndexEditorProvider provider, String async,
            NodeState root, NodeBuilder builder,
            IndexUpdateCallback updateCallback, NodeTraversalCallback traversalCallback,
            CommitInfo commitInfo, CorruptIndexHandler corruptIndexHandler); private  IndexUpdate(IndexUpdate parent, String name); @Override void enter(NodeState before, NodeState after); boolean isReindexingPerformed(); List<String> getReindexStats(); Set<String> getUpdatedIndexPaths(); void setTraversalRateEstimator(TraversalRateEstimator estimator); void setNodeCountEstimator(NodeCountEstimator nodeCountEstimator); String getIndexingStats(); void setIgnoreReindexFlags(boolean ignoreReindexFlag); @Override String getPath(); @Override void leave(NodeState before, NodeState after); @Override void propertyAdded(PropertyState after); @Override void propertyChanged(PropertyState before, PropertyState after); @Override void propertyDeleted(PropertyState before); @Override @NotNull Editor childNodeAdded(String name, NodeState after); @Override @NotNull Editor childNodeChanged(
            String name, NodeState before, NodeState after); @Override @Nullable Editor childNodeDeleted(String name, NodeState before); void commitProgress(IndexProgress indexProgress); IndexUpdate withMissingProviderStrategy(
            MissingIndexProviderStrategy missingProvider);  }
@Test public void contextAwareCallback() throws Exception{ NodeState before = builder.getNodeState(); createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME), "rootIndex", true, false, ImmutableSet.of("foo"), null); NodeState after = builder.getNodeState(); CallbackCapturingProvider provider = new CallbackCapturingProvider(); EditorHook hook = new EditorHook(new IndexUpdateProvider(provider)); CommitInfo info = new CommitInfo("foo", "bar"); NodeState indexed = hook.processCommit(before, after, info); assertNotNull(provider.callback); assertThat(provider.callback, instanceOf(ContextAwareCallback.class)); ContextAwareCallback contextualCallback = (ContextAwareCallback) provider.callback; IndexingContext context = contextualCallback.getIndexingContext(); assertNotNull(context); assertEquals("/oak:index/rootIndex", context.getIndexPath()); assertTrue(context.isReindexing()); assertFalse(context.isAsync()); assertSame(info, context.getCommitInfo()); before = indexed; builder = indexed.builder(); builder.child("a").setProperty("foo", "bar"); after = builder.getNodeState(); hook.processCommit(before, after, info); assertFalse(((ContextAwareCallback)provider.callback).getIndexingContext().isReindexing()); }