jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1454516 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/ oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/ oak-core/src/main/java/org/apache/jackrabbi...
Date Fri, 08 Mar 2013 19:57:29 GMT
Author: jukka
Date: Fri Mar  8 19:57:28 2013
New Revision: 1454516

URL: http://svn.apache.org/r1454516
Log:
OAK-673: Unified hook processing

Use editors instead of validators where possible

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/OsgiEditorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditorProvider.java
Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/OsgiValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeValidator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/DefaultValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatingHook.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/ConflictValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/RegistrationValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlConfigurationImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionStoreValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserConfigurationImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/Validator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java Fri Mar  8 19:57:28 2013
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.oak;
 
 import java.util.List;
+
 import javax.annotation.Nonnull;
 import javax.jcr.NoSuchWorkspaceException;
 import javax.security.auth.login.LoginException;
@@ -36,11 +37,11 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.index.IndexHookProvider;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
-import org.apache.jackrabbit.oak.spi.commit.CompositeValidatorProvider;
+import org.apache.jackrabbit.oak.spi.commit.CompositeEditorProvider;
 import org.apache.jackrabbit.oak.spi.commit.ConflictHandler;
-import org.apache.jackrabbit.oak.spi.commit.ValidatingHook;
-import org.apache.jackrabbit.oak.spi.commit.Validator;
-import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
+import org.apache.jackrabbit.oak.spi.commit.Editor;
+import org.apache.jackrabbit.oak.spi.commit.EditorHook;
+import org.apache.jackrabbit.oak.spi.commit.EditorProvider;
 import org.apache.jackrabbit.oak.spi.lifecycle.CompositeInitializer;
 import org.apache.jackrabbit.oak.spi.lifecycle.OakInitializer;
 import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
@@ -50,6 +51,7 @@ import org.apache.jackrabbit.oak.spi.que
 import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
@@ -81,7 +83,7 @@ public class Oak {
 
     private final List<CommitHook> commitHooks = newArrayList();
 
-    private List<ValidatorProvider> validatorProviders = newArrayList();
+    private List<EditorProvider> editorProviders = newArrayList();
 
     // TODO: review if we really want to have the OpenSecurityProvider as default.
     private SecurityProvider securityProvider = new OpenSecurityProvider();
@@ -154,54 +156,53 @@ public class Oak {
      */
     @Nonnull
     public Oak with(@Nonnull CommitHook hook) {
-        withValidatorHook();
+        withEditorHook();
         commitHooks.add(hook);
         return this;
     }
 
     /**
-     * Turns all currently tracked validators to a validating commit hook
-     * and associates that hook with the repository to be created. This way
-     * a sequence of {@code with()} calls that alternates between validators
-     * and other commit hooks will have all the validators in the correct
+     * 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 validators iterating over the changes simultaneously.
+     * multiple editors iterating over the changes simultaneously.
      */
-    private void withValidatorHook() {
-        if (!validatorProviders.isEmpty()) {
-            commitHooks.add(new ValidatingHook(
-                    CompositeValidatorProvider.compose(validatorProviders)));
-            validatorProviders = newArrayList();
+    private void withEditorHook() {
+        if (!editorProviders.isEmpty()) {
+            commitHooks.add(new EditorHook(
+                    CompositeEditorProvider.compose(editorProviders)));
+            editorProviders = newArrayList();
         }
     }
 
     /**
-     * Associates the given validator provider with the repository to
-     * be created.
+     * Associates the given editor provider with the repository to be created.
      *
-     * @param provider validator provider
+     * @param provider editor provider
      * @return this builder
      */
     @Nonnull
-    public Oak with(@Nonnull ValidatorProvider provider) {
-        validatorProviders.add(provider);
+    public Oak with(@Nonnull EditorProvider provider) {
+        editorProviders.add(checkNotNull(provider));
         return this;
     }
 
     /**
-     * Associates the given validator with the repository to be created.
+     * Associates the given editor with the repository to be created.
      *
-     * @param validator validator
+     * @param editor editor
      * @return this builder
      */
     @Nonnull
-    public Oak with(@Nonnull final Validator validator) {
-        return with(new ValidatorProvider() {
-            @Override
-            @Nonnull
-            public Validator getRootValidator(
-                    NodeState before, NodeState after) {
-                return validator;
+    public Oak with(@Nonnull final Editor editor) {
+        checkNotNull(editor);
+        return with(new EditorProvider() {
+            @Override @Nonnull
+            public Editor getRootEditor(
+                    NodeState before, NodeState after, NodeBuilder builder) {
+                return editor;
             }
         });
     }
@@ -221,7 +222,7 @@ public class Oak {
      */
     @Nonnull
     public Oak with(@Nonnull ConflictHandler conflictHandler) {
-        withValidatorHook();
+        withEditorHook();
         commitHooks.add(new ConflictHook(conflictHandler));
         return this;
     }
@@ -230,8 +231,8 @@ public class Oak {
         IndexHookProvider indexHooks = CompositeIndexHookProvider.compose(indexHookProviders);
         OakInitializer.initialize(store, new CompositeInitializer(initializers), indexHooks);
 
+        withEditorHook();
         commitHooks.add(IndexHookManager.of(indexHooks));
-        withValidatorHook();
         CommitHook commitHook = CompositeHook.compose(commitHooks);
         QueryIndexProvider indexProvider = CompositeQueryIndexProvider.compose(queryIndexProviders);
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java Fri Mar  8 19:57:28 2013
@@ -40,8 +40,11 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.query.QueryEngineImpl;
 import org.apache.jackrabbit.oak.security.authentication.SystemSubject;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
+import org.apache.jackrabbit.oak.spi.commit.CompositeEditorProvider;
 import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
+import org.apache.jackrabbit.oak.spi.commit.EditorHook;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.observation.ChangeExtractor;
 import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
@@ -282,9 +285,10 @@ public class RootImpl implements Root {
         commitHooks.add(hook);
         List<CommitHook> securityHooks = new ArrayList<CommitHook>();
         for (SecurityConfiguration sc : securityProvider.getSecurityConfigurations()) {
-            CommitHook validators = sc.getValidators().getCommitHook(workspaceName);
-            if (validators != EmptyHook.INSTANCE) {
-                commitHooks.add(validators);
+            List<? extends ValidatorProvider> validators = sc.getValidators(workspaceName);
+            if (!validators.isEmpty()) {
+                commitHooks.add(new EditorHook(
+                        CompositeEditorProvider.compose(validators)));
             }
             CommitHook ch = sc.getSecurityHooks().getCommitHook(workspaceName);
             if (ch != EmptyHook.INSTANCE) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java Fri Mar  8 19:57:28 2013
@@ -29,8 +29,6 @@ import org.apache.jackrabbit.oak.core.Co
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.osgi.OsgiRepositoryInitializer.RepositoryInitializerObserver;
 import org.apache.jackrabbit.oak.plugins.nodetype.DefaultTypeEditor;
-import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
-import org.apache.jackrabbit.oak.spi.commit.ValidatingHook;
 import org.apache.jackrabbit.oak.spi.lifecycle.OakInitializer;
 import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
@@ -53,7 +51,7 @@ public class Activator implements Bundle
 
     private final OsgiIndexHookProvider indexHookProvider = new OsgiIndexHookProvider();
 
-    private final OsgiValidatorProvider validatorProvider = new OsgiValidatorProvider();
+    private final OsgiEditorProvider validatorProvider = new OsgiEditorProvider();
 
     private final OsgiRepositoryInitializer repositoryInitializerTracker = new OsgiRepositoryInitializer();
 
@@ -105,10 +103,9 @@ public class Activator implements Bundle
             OakInitializer.initialize(
                     store, repositoryInitializerTracker, indexHookProvider);
             Oak oak = new Oak(store)
-                .with(new CompositeHook(
-                        // TODO: DefaultTypeEditor is JCR specific and does not belong here
-                        new DefaultTypeEditor(),
-                        new ValidatingHook(validatorProvider)))
+                // TODO: DefaultTypeEditor is JCR specific and does not belong here
+                .with(new DefaultTypeEditor())
+                .with(validatorProvider)
                 .with(indexProvider)
                 .with(indexHookProvider);
             services.put(reference, context.registerService(

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/OsgiEditorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/OsgiEditorProvider.java?rev=1454516&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/OsgiEditorProvider.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/OsgiEditorProvider.java Fri Mar  8 19:57:28 2013
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.osgi;
+
+import javax.annotation.CheckForNull;
+
+import org.apache.jackrabbit.oak.spi.commit.CompositeEditorProvider;
+import org.apache.jackrabbit.oak.spi.commit.Editor;
+import org.apache.jackrabbit.oak.spi.commit.EditorProvider;
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
+
+/**
+ * This editor provider combines all editors of all available OSGi editor
+ * providers.
+ */
+public class OsgiEditorProvider
+        extends AbstractServiceTracker<EditorProvider>
+        implements EditorProvider {
+
+    public OsgiEditorProvider() {
+        super(EditorProvider.class);
+    }
+
+    //----------------------------------------------------< EditorProvider >--
+
+    @Override @CheckForNull
+    public Editor getRootEditor(
+            NodeState before, NodeState after, NodeBuilder builder) {
+        EditorProvider provider =
+                CompositeEditorProvider.compose(getServices());
+        return provider.getRootEditor(before, after, builder);
+    }
+}

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/ConflictValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/ConflictValidatorProvider.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/ConflictValidatorProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/ConflictValidatorProvider.java Fri Mar  8 19:57:28 2013
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak.plugin
 
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Service;
+import org.apache.jackrabbit.oak.spi.commit.EditorProvider;
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -26,8 +27,8 @@ import org.apache.jackrabbit.oak.spi.sta
  * TODO document
  */
 @Component
-@Service(ValidatorProvider.class)
-public class ConflictValidatorProvider implements ValidatorProvider {
+@Service(EditorProvider.class)
+public class ConflictValidatorProvider extends ValidatorProvider {
 
     @Override
     public Validator getRootValidator(NodeState before, NodeState after) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidatorProvider.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidatorProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidatorProvider.java Fri Mar  8 19:57:28 2013
@@ -19,6 +19,7 @@ package org.apache.jackrabbit.oak.plugin
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.jackrabbit.oak.core.ReadOnlyTree;
+import org.apache.jackrabbit.oak.spi.commit.EditorProvider;
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -29,8 +30,8 @@ import org.apache.jackrabbit.oak.spi.sta
  * are properly registered.
  */
 @Component
-@Service(ValidatorProvider.class)
-public class NameValidatorProvider implements ValidatorProvider {
+@Service(EditorProvider.class)
+public class NameValidatorProvider extends ValidatorProvider {
 
     @Override
     public Validator getRootValidator(NodeState before, NodeState after) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceValidatorProvider.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceValidatorProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceValidatorProvider.java Fri Mar  8 19:57:28 2013
@@ -22,6 +22,7 @@ import static org.apache.jackrabbit.oak.
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.jackrabbit.oak.core.ReadOnlyTree;
+import org.apache.jackrabbit.oak.spi.commit.EditorProvider;
 import org.apache.jackrabbit.oak.spi.commit.SubtreeValidator;
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
@@ -33,8 +34,8 @@ import org.apache.jackrabbit.oak.spi.sta
  * are properly registered.
  */
 @Component
-@Service(ValidatorProvider.class)
-public class NamespaceValidatorProvider implements ValidatorProvider {
+@Service(EditorProvider.class)
+public class NamespaceValidatorProvider extends ValidatorProvider {
 
     @Override
     public Validator getRootValidator(NodeState before, NodeState after) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/RegistrationValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/RegistrationValidatorProvider.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/RegistrationValidatorProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/RegistrationValidatorProvider.java Fri Mar  8 19:57:28 2013
@@ -31,7 +31,7 @@ import org.apache.jackrabbit.oak.spi.sta
  * is responsible for making sure that any modifications made to node type
  * definitions are valid.
  */
-public class RegistrationValidatorProvider implements ValidatorProvider {
+public class RegistrationValidatorProvider extends ValidatorProvider {
 
     @Nonnull
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeValidatorProvider.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeValidatorProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeValidatorProvider.java Fri Mar  8 19:57:28 2013
@@ -25,13 +25,14 @@ import org.apache.jackrabbit.oak.namepat
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.namepath.NamePathMapperImpl;
 import org.apache.jackrabbit.oak.plugins.name.Namespaces;
+import org.apache.jackrabbit.oak.spi.commit.EditorProvider;
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
 @Component
-@Service(ValidatorProvider.class)
-public class TypeValidatorProvider implements ValidatorProvider {
+@Service(EditorProvider.class)
+public class TypeValidatorProvider extends ValidatorProvider {
 
     @Override
     public Validator getRootValidator(NodeState before, final NodeState after) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlConfigurationImpl.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlConfigurationImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlConfigurationImpl.java Fri Mar  8 19:57:28 2013
@@ -32,7 +32,7 @@ import org.apache.jackrabbit.oak.securit
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CommitHookProvider;
 import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
-import org.apache.jackrabbit.oak.spi.commit.ValidatingHook;
+import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.lifecycle.WorkspaceInitializer;
 import org.apache.jackrabbit.oak.spi.security.Context;
 import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
@@ -42,6 +42,8 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionProvider;
 import org.apache.jackrabbit.oak.spi.xml.ProtectedItemImporter;
 
+import com.google.common.collect.ImmutableList;
+
 /**
  * {@code AccessControlConfigurationImpl} ... TODO
  */
@@ -81,17 +83,11 @@ public class AccessControlConfigurationI
     }
 
     @Override
-    public CommitHookProvider getValidators() {
-        return new CommitHookProvider() {
-            @Nonnull
-            @Override
-            public CommitHook getCommitHook(@Nonnull final String workspaceName) {
-                return new ValidatingHook(
-                        new PermissionStoreValidatorProvider(),
-                        new PermissionValidatorProvider(securityProvider, workspaceName),
-                        new AccessControlValidatorProvider(securityProvider));
-            }
-        };
+    public List<ValidatorProvider> getValidators(String workspaceName) {
+        return ImmutableList.of(
+                new PermissionStoreValidatorProvider(),
+                new PermissionValidatorProvider(securityProvider, workspaceName),
+                new AccessControlValidatorProvider(securityProvider));
     }
 
     @Nonnull

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorProvider.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorProvider.java Fri Mar  8 19:57:28 2013
@@ -45,7 +45,7 @@ import org.slf4j.LoggerFactory;
  * and removing access control policies) are valid according to the
  * constraints defined by this access control implementation.
  */
-class AccessControlValidatorProvider implements ValidatorProvider {
+class AccessControlValidatorProvider extends ValidatorProvider {
 
     private static final Logger log = LoggerFactory.getLogger(AccessControlValidatorProvider.class);
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionStoreValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionStoreValidatorProvider.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionStoreValidatorProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionStoreValidatorProvider.java Fri Mar  8 19:57:28 2013
@@ -28,7 +28,7 @@ import org.apache.jackrabbit.oak.spi.sta
 /**
  * Validator implementation that asserts that the permission store is read-only.
  */
-public class PermissionStoreValidatorProvider implements ValidatorProvider, PermissionConstants {
+public class PermissionStoreValidatorProvider extends ValidatorProvider implements PermissionConstants {
 
     @Nonnull
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionValidatorProvider.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionValidatorProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionValidatorProvider.java Fri Mar  8 19:57:28 2013
@@ -35,7 +35,7 @@ import org.apache.jackrabbit.oak.spi.sta
 /**
  * PermissionValidatorProvider... TODO
  */
-public class PermissionValidatorProvider implements ValidatorProvider {
+public class PermissionValidatorProvider extends ValidatorProvider {
 
     private final SecurityProvider securityProvider;
     private final String workspaceName;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java Fri Mar  8 19:57:28 2013
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.oak.security.privilege;
 
+import java.util.Collections;
+import java.util.List;
+
 import javax.annotation.Nonnull;
 
 import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
@@ -23,7 +26,7 @@ import org.apache.jackrabbit.oak.api.Roo
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CommitHookProvider;
-import org.apache.jackrabbit.oak.spi.commit.ValidatingHook;
+import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.security.Context;
 import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
@@ -61,14 +64,8 @@ public class PrivilegeConfigurationImpl 
 
     @Nonnull
     @Override
-    public CommitHookProvider getValidators() {
-        return new CommitHookProvider() {
-            @Nonnull
-            @Override
-            public CommitHook getCommitHook(@Nonnull String workspaceName) {
-                return new ValidatingHook(new PrivilegeValidatorProvider());
-            }
-        };
+    public List<? extends ValidatorProvider> getValidators(String workspaceName) {
+        return Collections.singletonList(new PrivilegeValidatorProvider());
     }
 
     @Nonnull

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeValidatorProvider.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeValidatorProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeValidatorProvider.java Fri Mar  8 19:57:28 2013
@@ -31,7 +31,7 @@ import static org.apache.jackrabbit.oak.
  * to make sure modifications to the /jcr:system/rep:privileges tree are compliant
  * with constraints applied for custom privileges.
  */
-class PrivilegeValidatorProvider implements ValidatorProvider {
+class PrivilegeValidatorProvider extends ValidatorProvider {
 
     @Nonnull
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserConfigurationImpl.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserConfigurationImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserConfigurationImpl.java Fri Mar  8 19:57:28 2013
@@ -23,9 +23,7 @@ import javax.annotation.Nonnull;
 import org.apache.jackrabbit.api.security.user.UserManager;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
-import org.apache.jackrabbit.oak.spi.commit.CommitHook;
-import org.apache.jackrabbit.oak.spi.commit.CommitHookProvider;
-import org.apache.jackrabbit.oak.spi.commit.ValidatingHook;
+import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.lifecycle.WorkspaceInitializer;
 import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
 import org.apache.jackrabbit.oak.spi.security.Context;
@@ -65,14 +63,9 @@ public class UserConfigurationImpl exten
 
     @Nonnull
     @Override
-    public CommitHookProvider getValidators() {
-        return new CommitHookProvider() {
-            @Nonnull
-            @Override
-            public CommitHook getCommitHook(@Nonnull String workspaceName) {
-                return new ValidatingHook(new UserValidatorProvider(getConfigurationParameters()));
-            }
-        };
+    public List<? extends ValidatorProvider> getValidators(String workspaceName) {
+        return Collections.singletonList(
+                new UserValidatorProvider(getConfigurationParameters()));
     }
 
     @Nonnull

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidatorProvider.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidatorProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidatorProvider.java Fri Mar  8 19:57:28 2013
@@ -29,7 +29,7 @@ import static com.google.common.base.Pre
 /**
  * Provides a validator for user and group management.
  */
-class UserValidatorProvider implements ValidatorProvider {
+class UserValidatorProvider extends ValidatorProvider {
 
     private final ConfigurationParameters config;
 

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditor.java?rev=1454516&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditor.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditor.java Fri Mar  8 19:57:28 2013
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.spi.commit;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static java.util.Arrays.asList;
+
+import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
+
+import com.google.common.collect.Lists;
+
+import java.util.Collection;
+import java.util.List;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
+/**
+ * Aggregation of a list of editors into a single editor.
+ */
+public class CompositeEditor implements Editor {
+
+    @CheckForNull
+    public static Editor compose(@Nonnull Collection<Editor> editors) {
+        checkNotNull(editors);
+        switch (editors.size()) {
+        case 0:
+            return null;
+        case 1:
+            return editors.iterator().next();
+        default:
+            return new CompositeEditor(editors);
+        }
+    }
+
+    private final Collection<? extends Editor> editors;
+
+    public CompositeEditor(Collection<? extends Editor> editors) {
+        this.editors = editors;
+    }
+
+    public CompositeEditor(Editor... editors) {
+        this(asList(editors));
+    }
+
+    @Override
+    public void propertyAdded(PropertyState after)
+            throws CommitFailedException {
+        for (Editor editor : editors) {
+            editor.propertyAdded(after);
+        }
+    }
+
+    @Override
+    public void propertyChanged(PropertyState before, PropertyState after)
+            throws CommitFailedException {
+        for (Editor editor : editors) {
+            editor.propertyChanged(before, after);
+        }
+    }
+
+    @Override
+    public void propertyDeleted(PropertyState before)
+            throws CommitFailedException {
+        for (Editor editor : editors) {
+            editor.propertyDeleted(before);
+        }
+    }
+
+    @Override
+    public Editor childNodeAdded(String name, NodeState after)
+            throws CommitFailedException {
+        List<Editor> list = Lists.newArrayListWithCapacity(editors.size());
+        for (Editor editor : editors) {
+            Editor child = editor.childNodeAdded(name, after);
+            if (child != null) {
+                list.add(child);
+            }
+        }
+        return compose(list);
+    }
+
+    @Override
+    public Editor childNodeChanged(
+            String name, NodeState before, NodeState after)
+            throws CommitFailedException {
+        List<Editor> list = Lists.newArrayListWithCapacity(editors.size());
+        for (Editor editor : editors) {
+            Editor child = editor.childNodeChanged(name, before, after);
+            if (child != null) {
+                list.add(child);
+            }
+        }
+        return compose(list);
+    }
+
+    @Override
+    public Editor childNodeDeleted(String name, NodeState before)
+            throws CommitFailedException {
+        List<Editor> list = Lists.newArrayListWithCapacity(editors.size());
+        for (Editor editor : editors) {
+            Editor child = editor.childNodeDeleted(name, before);
+            if (child != null) {
+                list.add(child);
+            }
+        }
+        return compose(list);
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditorProvider.java?rev=1454516&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditorProvider.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditorProvider.java Fri Mar  8 19:57:28 2013
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.spi.commit;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static java.util.Arrays.asList;
+
+import java.util.Collection;
+import java.util.List;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
+
+import com.google.common.collect.Lists;
+
+/**
+ * Aggregation of a list of editor providers into a single provider.
+ */
+public class CompositeEditorProvider implements EditorProvider {
+
+    private static final EditorProvider EMPTY_PROVIDER =
+        new EditorProvider() {
+            @Override @CheckForNull
+            public Editor getRootEditor(
+                    NodeState before, NodeState after, NodeBuilder builder) {
+                return null;
+            }
+        };
+
+    @Nonnull
+    public static EditorProvider compose(
+            @Nonnull Collection<? extends EditorProvider> providers) {
+        checkNotNull(providers);
+        switch (providers.size()) {
+        case 0:
+            return EMPTY_PROVIDER;
+        case 1:
+            return providers.iterator().next();
+        default:
+            return new CompositeEditorProvider(providers);
+        }
+    }
+
+    private final Collection<? extends EditorProvider> providers;
+
+    private CompositeEditorProvider(
+            Collection<? extends EditorProvider> providers) {
+        this.providers = providers;
+    }
+
+    public CompositeEditorProvider(EditorProvider... providers) {
+        this(asList(providers));
+    }
+
+    @Override @CheckForNull
+    public Editor getRootEditor(
+            NodeState before, NodeState after, NodeBuilder builder) {
+        List<Editor> list = Lists.newArrayListWithCapacity(providers.size());
+        for (EditorProvider provider : providers) {
+            Editor editor = provider.getRootEditor(before, after, builder);
+            if (editor != null) {
+                list.add(editor);
+            }
+        }
+        return CompositeEditor.compose(list);
+    }
+
+}

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/Validator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/Validator.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/Validator.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/Validator.java Fri Mar  8 19:57:28 2013
@@ -26,7 +26,7 @@ import javax.annotation.CheckForNull;
  * Content change validator. An instance of this interface is used to
  * validate changes against a specific {@link NodeState}.
  */
-public interface Validator {
+public interface Validator extends Editor {
 
     /**
      * Validate an added property

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatorProvider.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatorProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatorProvider.java Fri Mar  8 19:57:28 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.oak.spi.commit;
 
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
 import javax.annotation.Nonnull;
@@ -24,7 +25,7 @@ import javax.annotation.Nonnull;
  * Extension point for plugging in different kinds of validation rules
  * for content changes.
  */
-public interface ValidatorProvider {
+public abstract class ValidatorProvider implements EditorProvider {
 
     /**
      * Returns a validator for checking the changes between the given
@@ -35,6 +36,15 @@ public interface ValidatorProvider {
      * @return validator for checking the modifications
      */
     @Nonnull
-    Validator getRootValidator(NodeState before, NodeState after);
+    protected abstract Validator getRootValidator(
+            NodeState before, NodeState after);
+
+    //----------------------------------------------------< EditorProvider >--
+
+    @Override @Nonnull
+    public final Editor getRootEditor(
+            NodeState before, NodeState after, NodeBuilder builder) {
+        return getRootValidator(before, after);
+    }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java Fri Mar  8 19:57:28 2013
@@ -24,6 +24,7 @@ import org.apache.jackrabbit.oak.api.Pro
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CommitHookProvider;
+import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.lifecycle.WorkspaceInitializer;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -44,7 +45,7 @@ public interface SecurityConfiguration {
     CommitHookProvider getSecurityHooks();
 
     @Nonnull
-    CommitHookProvider getValidators();
+    List<? extends ValidatorProvider> getValidators(String workspaceName);
 
     @Nonnull
     List<ProtectedItemImporter> getProtectedItemImporters();
@@ -83,8 +84,8 @@ public interface SecurityConfiguration {
 
         @Nonnull
         @Override
-        public CommitHookProvider getValidators() {
-            return new CommitHookProvider.Empty();
+        public List<? extends ValidatorProvider> getValidators(String workspaceName) {
+            return Collections.emptyList();
         }
 
         @Nonnull

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java?rev=1454516&r1=1454515&r2=1454516&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java Fri Mar  8 19:57:28 2013
@@ -40,8 +40,8 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.security.SecurityProviderImpl;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.ConflictHandler;
-import org.apache.jackrabbit.oak.spi.commit.Validator;
-import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
+import org.apache.jackrabbit.oak.spi.commit.Editor;
+import org.apache.jackrabbit.oak.spi.commit.EditorProvider;
 import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
@@ -113,14 +113,14 @@ public class Jcr {
     }
 
     @Nonnull
-    public Jcr with(@Nonnull ValidatorProvider provider) {
+    public Jcr with(@Nonnull EditorProvider provider) {
         oak.with(checkNotNull(provider));
         return this;
     }
 
     @Nonnull
-    public Jcr with(@Nonnull Validator validator) {
-        oak.with(checkNotNull(validator));
+    public Jcr with(@Nonnull Editor editor) {
+        oak.with(checkNotNull(editor));
         return this;
     }
 



Mime
View raw message