jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1454483 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit: DefaultEditor.java Editor.java EditorHook.java EditorProvider.java SubtreeEditor.java
Date Fri, 08 Mar 2013 18:19:06 GMT
Author: jukka
Date: Fri Mar  8 18:19:05 2013
New Revision: 1454483

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

Add DefaultEditor base class and some @since annotations

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/DefaultEditor.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/Editor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EditorHook.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EditorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/SubtreeEditor.java

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/DefaultEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/DefaultEditor.java?rev=1454483&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/DefaultEditor.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/DefaultEditor.java
Fri Mar  8 18:19:05 2013
@@ -0,0 +1,70 @@
+/*
+ * 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 org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
+
+/**
+ * Editor that does nothing by default and doesn't recurse into subtrees.
+ * Useful as a sentinel or as a base class for more complex editors.
+ *
+ * @since Oak 0.7
+ */
+public class DefaultEditor implements Editor {
+
+    public static final Editor INSTANCE = new DefaultEditor();
+
+    @Override
+    public void propertyAdded(PropertyState after)
+            throws CommitFailedException {
+        // do nothing
+    }
+
+    @Override
+    public void propertyChanged(PropertyState before, PropertyState after)
+            throws CommitFailedException {
+        // do nothing
+    }
+
+    @Override
+    public void propertyDeleted(PropertyState before)
+            throws CommitFailedException {
+        // do nothing
+    }
+
+    @Override
+    public Editor childNodeAdded(String name, NodeState after)
+            throws CommitFailedException {
+        return null;
+    }
+
+    @Override
+    public Editor childNodeChanged(
+            String name, NodeState before, NodeState after)
+            throws CommitFailedException {
+        return null;
+    }
+
+    @Override
+    public Editor childNodeDeleted(String name, NodeState before)
+            throws CommitFailedException {
+        return null;
+    }
+
+}

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/Editor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/Editor.java?rev=1454483&r1=1454482&r2=1454483&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/Editor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/Editor.java
Fri Mar  8 18:19:05 2013
@@ -31,6 +31,8 @@ import javax.annotation.CheckForNull;
  * Note that the given builder can contain updates from multiple different
  * editors, so its state might not match exactly the state of the given
  * after state.
+ *
+ * @since Oak 0.7
  */
 public interface Editor {
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EditorHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EditorHook.java?rev=1454483&r1=1454482&r2=1454483&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EditorHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EditorHook.java
Fri Mar  8 18:19:05 2013
@@ -32,6 +32,8 @@ import org.apache.jackrabbit.oak.spi.sta
  * This commit hook implementation processes changes to be committed
  * using the {@link Editor} instance provided by the {@link EditorProvider}
  * passed to the constructor.
+ *
+ * @since Oak 0.7
  */
 public class EditorHook implements CommitHook {
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EditorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EditorProvider.java?rev=1454483&r1=1454482&r2=1454483&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EditorProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EditorProvider.java
Fri Mar  8 18:19:05 2013
@@ -25,6 +25,8 @@ import javax.annotation.CheckForNull;
  * Extension point for content change editors. Used by the {@link EditorHook}
  * class to allow multiple components to process content changes during just
  * a single content diff.
+ *
+ * @since Oak 0.7
  */
 public interface EditorProvider {
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/SubtreeEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/SubtreeEditor.java?rev=1454483&r1=1454482&r2=1454483&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/SubtreeEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/SubtreeEditor.java
Fri Mar  8 18:19:05 2013
@@ -21,10 +21,9 @@ import static com.google.common.base.Pre
 
 import javax.annotation.CheckForNull;
 
-import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
-public class SubtreeEditor implements Editor {
+public class SubtreeEditor extends DefaultEditor {
 
     private final Editor editor;
 
@@ -53,18 +52,6 @@ public class SubtreeEditor implements Ed
         }
     }
 
-    @Override
-    public void propertyAdded(PropertyState after) {
-    }
-
-    @Override
-    public void propertyChanged(PropertyState before, PropertyState after) {
-    }
-
-    @Override
-    public void propertyDeleted(PropertyState before) {
-    }
-
     @Override @CheckForNull
     public Editor childNodeAdded(String name, NodeState after) {
         return descend(name);



Mime
View raw message