/** * Turns all currently tracked editors to an editor commit hook and * associates that hook with the repository to be created. This way * a sequence of {@code with()} calls that alternates between editors * and other commit hooks will have all the editors in the correct * order while still being able to leverage the performance gains of * multiple editors iterating over the changes simultaneously. */ private void withEditorHook() { if (!editorProviders.isEmpty()) { commitHooks.add(new EditorHook( CompositeEditorProvider.compose(editorProviders))); editorProviders = newArrayList(); } }
/** * Turns all currently tracked editors to an editor commit hook and * associates that hook with the repository to be created. This way * a sequence of {@code with()} calls that alternates between editors * and other commit hooks will have all the editors in the correct * order while still being able to leverage the performance gains of * multiple editors iterating over the changes simultaneously. */ private void withEditorHook() { if (!editorProviders.isEmpty()) { commitHooks.add(new EditorHook( CompositeEditorProvider.compose(editorProviders))); editorProviders = newArrayList(); } }
/** * Turns all currently tracked editors to an editor commit hook and * associates that hook with the repository to be created. This way * a sequence of {@code with()} calls that alternates between editors * and other commit hooks will have all the editors in the correct * order while still being able to leverage the performance gains of * multiple editors iterating over the changes simultaneously. */ private void withEditorHook() { if (!editorProviders.isEmpty()) { commitHooks.add(new EditorHook( CompositeEditorProvider.compose(editorProviders))); editorProviders = newArrayList(); } }
@Override @Nullable public Editor getRootEditor( NodeState before, NodeState after, NodeBuilder builder, CommitInfo info) throws CommitFailedException { EditorProvider provider = CompositeEditorProvider.compose(getServices()); return provider.getRootEditor(before, after, builder, info); }
@Override @CheckForNull public Editor getRootEditor( NodeState before, NodeState after, NodeBuilder builder, CommitInfo info) throws CommitFailedException { EditorProvider provider = CompositeEditorProvider.compose(getServices()); return provider.getRootEditor(before, after, builder, info); }
/** * Combine the globally defined commit hook(s) and the hooks and validators defined by the * various security related configurations. * * @return A commit hook combining repository global commit hook(s) with the pluggable hooks * defined with the security modules and the padded {@code hooks}. */ private CommitHook getCommitHook() { List<CommitHook> hooks = newArrayList(); hooks.add(ResetCommitAttributeHook.INSTANCE); hooks.add(hook); List<CommitHook> postValidationHooks = new ArrayList<CommitHook>(); List<ValidatorProvider> validators = new ArrayList<>(); for (SecurityConfiguration sc : securityProvider.getConfigurations()) { for (CommitHook ch : sc.getCommitHooks(workspaceName)) { if (ch instanceof PostValidationHook) { postValidationHooks.add(ch); } else if (ch != EmptyHook.INSTANCE) { hooks.add(ch); } } validators.addAll(sc.getValidators(workspaceName, subject.getPrincipals(), moveTracker)); } if (!validators.isEmpty()) { hooks.add(new EditorHook(CompositeEditorProvider.compose(validators))); } hooks.addAll(postValidationHooks); return CompositeHook.compose(hooks); }
/** * Combine the globally defined commit hook(s) and the hooks and validators defined by the * various security related configurations. * * @return A commit hook combining repository global commit hook(s) with the pluggable hooks * defined with the security modules and the padded {@code hooks}. */ private CommitHook getCommitHook() { List<CommitHook> hooks = newArrayList(); hooks.add(ResetCommitAttributeHook.INSTANCE); hooks.add(hook); List<CommitHook> postValidationHooks = new ArrayList<CommitHook>(); List<ValidatorProvider> validators = new ArrayList<>(); for (SecurityConfiguration sc : securityProvider.getConfigurations()) { for (CommitHook ch : sc.getCommitHooks(workspaceName)) { if (ch instanceof PostValidationHook) { postValidationHooks.add(ch); } else if (ch != EmptyHook.INSTANCE) { hooks.add(ch); } } validators.addAll(sc.getValidators(workspaceName, subject.getPrincipals(), moveTracker)); } if (!validators.isEmpty()) { hooks.add(new EditorHook(CompositeEditorProvider.compose(validators))); } hooks.addAll(postValidationHooks); return CompositeHook.compose(hooks); }
/** * Combine the globally defined commit hook(s) and the hooks and validators defined by the * various security related configurations. * * @return A commit hook combining repository global commit hook(s) with the pluggable hooks * defined with the security modules and the padded {@code hooks}. */ private CommitHook getCommitHook() { List<CommitHook> hooks = newArrayList(); hooks.add(ResetCommitAttributeHook.INSTANCE); hooks.add(hook); List<CommitHook> postValidationHooks = new ArrayList<CommitHook>(); List<ValidatorProvider> validators = new ArrayList<>(); for (SecurityConfiguration sc : securityProvider.getConfigurations()) { for (CommitHook ch : sc.getCommitHooks(workspaceName)) { if (ch instanceof PostValidationHook) { postValidationHooks.add(ch); } else if (ch != EmptyHook.INSTANCE) { hooks.add(ch); } } validators.addAll(sc.getValidators(workspaceName, subject.getPrincipals(), moveTracker)); } if (!validators.isEmpty()) { hooks.add(new EditorHook(CompositeEditorProvider.compose(validators))); } hooks.addAll(postValidationHooks); return CompositeHook.compose(hooks); }
private CompositeHook createCommitHook() { return new CompositeHook( ResetCommitAttributeHook.INSTANCE, new ConflictHook(new AnnotatingConflictHandler()), new EditorHook(CompositeEditorProvider.compose(singletonList(new ConflictValidatorProvider()))) ); }
private CompositeHook createCommitHook() { return new CompositeHook( ResetCommitAttributeHook.INSTANCE, new ConflictHook(new AnnotatingConflictHandler()), new EditorHook(CompositeEditorProvider.compose(singletonList(new ConflictValidatorProvider()))) ); }
ResetCommitAttributeHook.INSTANCE, ConflictHook.of(new AnnotatingConflictHandler()), new EditorHook(CompositeEditorProvider.compose(editorProviders)), concurrentUpdateCheck); try {
ResetCommitAttributeHook.INSTANCE, ConflictHook.of(new AnnotatingConflictHandler()), new EditorHook(CompositeEditorProvider.compose(editorProviders)), concurrentUpdateCheck); try {
static void mergeWithConcurrentCheck(NodeStore nodeStore, NodeBuilder builder) throws CommitFailedException { CompositeHook hooks = new CompositeHook( ResetCommitAttributeHook.INSTANCE, new ConflictHook(new AnnotatingConflictHandler()), new EditorHook(CompositeEditorProvider.compose(singletonList(new ConflictValidatorProvider()))) ); nodeStore.merge(builder, hooks, createCommitInfo()); }
ResetCommitAttributeHook.INSTANCE, ConflictHook.of(new AnnotatingConflictHandler()), new EditorHook(CompositeEditorProvider.compose(editorProviders)), concurrentUpdateCheck); try {
static void mergeWithConcurrentCheck(NodeStore nodeStore, NodeBuilder builder) throws CommitFailedException { CompositeHook hooks = new CompositeHook( ResetCommitAttributeHook.INSTANCE, new ConflictHook(new AnnotatingConflictHandler()), new EditorHook(CompositeEditorProvider.compose(singletonList(new ConflictValidatorProvider()))) ); nodeStore.merge(builder, hooks, createCommitInfo()); }
List<CommitHook> initHooks = new ArrayList<CommitHook>(commitHooks); initHooks.add(new EditorHook(CompositeEditorProvider .compose(editorProviders)));
static void mergeWithConcurrentCheck(NodeStore nodeStore, NodeBuilder builder) throws CommitFailedException { CompositeHook hooks = new CompositeHook( ResetCommitAttributeHook.INSTANCE, new ConflictHook(new AnnotatingConflictHandler()), new EditorHook(CompositeEditorProvider.compose(singletonList(new ConflictValidatorProvider()))) ); nodeStore.merge(builder, hooks, createCommitInfo()); }
static void mergeWithConcurrentCheck(NodeStore nodeStore, NodeBuilder builder, IndexEditorProvider indexEditorProvider) throws CommitFailedException { CompositeHook hooks = new CompositeHook( ResetCommitAttributeHook.INSTANCE, new EditorHook(new IndexUpdateProvider(indexEditorProvider, null, true)), new ConflictHook(new AnnotatingConflictHandler()), new EditorHook(CompositeEditorProvider.compose(singletonList(new ConflictValidatorProvider()))) ); nodeStore.merge(builder, hooks, createCommitInfo()); }
static void mergeWithConcurrentCheck(NodeStore nodeStore, NodeBuilder builder, IndexEditorProvider indexEditorProvider) throws CommitFailedException { CompositeHook hooks = new CompositeHook( ResetCommitAttributeHook.INSTANCE, new EditorHook(new IndexUpdateProvider(indexEditorProvider, null, true)), new ConflictHook(new AnnotatingConflictHandler()), new EditorHook(CompositeEditorProvider.compose(singletonList(new ConflictValidatorProvider()))) ); nodeStore.merge(builder, hooks, createCommitInfo()); }
static void mergeWithConcurrentCheck(NodeStore nodeStore, NodeBuilder builder, IndexEditorProvider indexEditorProvider) throws CommitFailedException { CompositeHook hooks = new CompositeHook( ResetCommitAttributeHook.INSTANCE, new EditorHook(new IndexUpdateProvider(indexEditorProvider, null, true)), new ConflictHook(new AnnotatingConflictHandler()), new EditorHook(CompositeEditorProvider.compose(singletonList(new ConflictValidatorProvider()))) ); nodeStore.merge(builder, hooks, createCommitInfo()); }