jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1329213 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel: NodeValidator.java NodeValidatorProvider.java
Date Mon, 23 Apr 2012 12:37:59 GMT
Author: jukka
Date: Mon Apr 23 12:37:59 2012
New Revision: 1329213

URL: http://svn.apache.org/viewvc?rev=1329213&view=rev
Log:
OAK-68: Extension point for commit validation

First draft of such an extension point

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidatorProvider.java

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidator.java?rev=1329213&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidator.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidator.java
Mon Apr 23 12:37:59 2012
@@ -0,0 +1,48 @@
+/*
+ * 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.kernel;
+
+import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.kernel.NodeState;
+
+/**
+ * Content change validator. An instance of this interface is used to
+ * validate changes against a specific {@link NodeState}.
+ */
+public interface NodeValidator {
+
+    void propertyAdded(PropertyState after)
+            throws CommitFailedException;
+
+    void propertyChanged(PropertyState before, PropertyState after)
+            throws CommitFailedException;
+
+    void propertyDeleted(PropertyState before)
+            throws CommitFailedException;
+
+    NodeValidator childNodeAdded(String name, NodeState after)
+            throws CommitFailedException;
+
+    NodeValidator childNodeChanged(
+            String name, NodeState before, NodeState after)
+            throws CommitFailedException;
+
+    NodeValidator childNodeDeleted(String name, NodeState before)
+            throws CommitFailedException;
+
+}

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidatorProvider.java?rev=1329213&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidatorProvider.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidatorProvider.java
Mon Apr 23 12:37:59 2012
@@ -0,0 +1,37 @@
+/*
+ * 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.kernel;
+
+import org.apache.jackrabbit.oak.kernel.NodeState;
+
+/**
+ * Extension point for plugging in different kinds of validation rules
+ * for content changes.
+ */
+public interface NodeValidatorProvider {
+
+    /**
+     * Returns a validator for checking the changes between the given
+     * two root states.
+     *
+     * @param before original root state
+     * @param after  modified root state
+     * @return validator for checking the modifications
+     */
+    NodeValidator getRootValidator(NodeState before, NodeState after);
+
+}



Mime
View raw message