jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1344019 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: api/ core/ kernel/ plugins/name/ plugins/type/ spi/commit/ util/
Date Tue, 29 May 2012 21:45:18 GMT
Author: mduerig
Date: Tue May 29 21:45:17 2012
New Revision: 1344019

URL: http://svn.apache.org/viewvc?rev=1344019&view=rev
Log:
OAK-37: Use nullability annotation to enforce/document API contract

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/AuthInfo.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentRepository.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValue.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValueFactory.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.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/core/TreeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CommitHook.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/util/Iterators.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/AuthInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/AuthInfo.java?rev=1344019&r1=1344018&r2=1344019&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/AuthInfo.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/AuthInfo.java
Tue May 29 21:45:17 2012
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.oak.api;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 /**
  * {@code AuthInfo} instances provide access to information related
  * to authentication and authorization of a given content session.
@@ -47,6 +50,7 @@ public interface AuthInfo {
      *
      * @return the user ID such as exposed on the JCR Session object.
      */
+    @CheckForNull
     String getUserID();
 
     /**
@@ -55,6 +59,7 @@ public interface AuthInfo {
      * @return The attribute names with that instance or an empty array if
      * no attributes are present.
      */
+    @Nonnull
     String[] getAttributeNames();
 
     /**
@@ -64,5 +69,6 @@ public interface AuthInfo {
      * @param attributeName The attribute name.
      * @return The attribute or {@code null}.
      */
+    @CheckForNull
     Object getAttribute(String attributeName);
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentRepository.java?rev=1344019&r1=1344018&r2=1344019&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentRepository.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentRepository.java
Tue May 29 21:45:17 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.oak.api;
 
+import javax.annotation.Nonnull;
 import javax.jcr.Credentials;
 import javax.jcr.NoSuchWorkspaceException;
 import javax.security.auth.login.LoginException;
@@ -76,6 +77,7 @@ public interface ContentRepository {
      * @throws LoginException if authentication failed
      * @throws NoSuchWorkspaceException
      */
+    @Nonnull
     ContentSession login(Credentials credentials, String workspaceName)
             throws LoginException, NoSuchWorkspaceException;
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java?rev=1344019&r1=1344018&r2=1344019&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java
Tue May 29 21:45:17 2012
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.oak.api;
 
+import com.sun.istack.internal.NotNull;
+
+import javax.annotation.Nonnull;
 import java.io.Closeable;
 
 /**
@@ -49,9 +52,11 @@ public interface ContentSession extends 
      *
      * @return  immutable {@link AuthInfo} instance
      */
+    @Nonnull
     AuthInfo getAuthInfo();
 
     /**
+     * TODO clarify workspace handling
      * The name of the workspace this {@code ContentSession} instance has
      * been created for. If no workspace name has been specified during
      * repository login this method will return the name of the default
@@ -68,6 +73,7 @@ public interface ContentSession extends 
      *
      * @return  the current root
      */
+    @NotNull
     Root getCurrentRoot();
 
     /**
@@ -75,6 +81,7 @@ public interface ContentSession extends 
      *
      * @return the query engine
      */
+    @NotNull
     QueryEngine getQueryEngine();
 
     /**
@@ -82,6 +89,7 @@ public interface ContentSession extends 
      *
      * @return the internal value factory.
      */
+    @Nonnull
     CoreValueFactory getCoreValueFactory();
 
     // TODO : add versioning operations

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValue.java?rev=1344019&r1=1344018&r2=1344019&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValue.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValue.java
Tue May 29 21:45:17 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.oak.api;
 
+import javax.annotation.Nonnull;
 import java.io.InputStream;
 import java.math.BigDecimal;
 
@@ -58,6 +59,7 @@ public interface CoreValue extends Compa
      *
      * @return The string representation of this value.
      */
+    @Nonnull
     String getString();
 
     /**
@@ -96,6 +98,7 @@ public interface CoreValue extends Compa
      * @throws {@code NumberFormatException} If the value cannot be converted
      * a {@code BigDecimal}.
      */
+    @Nonnull
     BigDecimal getDecimal();
 
     /**
@@ -104,6 +107,7 @@ public interface CoreValue extends Compa
      * @return a new stream for this value based on an internal conversion.
      * @throws //TODO define exceptions
      */
+    @Nonnull
     InputStream getNewStream();
 
     /**

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValueFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValueFactory.java?rev=1344019&r1=1344018&r2=1344019&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValueFactory.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CoreValueFactory.java
Tue May 29 21:45:17 2012
@@ -16,12 +16,11 @@
  */
 package org.apache.jackrabbit.oak.api;
 
+import javax.annotation.Nonnull;
 import java.io.IOException;
 import java.io.InputStream;
 import java.math.BigDecimal;
 
-import javax.annotation.Nonnull;
-
 /**
  * {@code CoreValueFactory} defines methods to create new instances of
  * {@code CoreValue}.
@@ -36,6 +35,7 @@ public interface CoreValueFactory {
      * @throws IllegalArgumentException if the specified {@code String}
      * is {@code null}.
      */
+    @Nonnull
     CoreValue createValue(String value);
 
     /**
@@ -44,6 +44,7 @@ public interface CoreValueFactory {
      * @param value The {@code double} that defines the new value.
      * @return a new value instance.
      */
+    @Nonnull
     CoreValue createValue(double value);
 
     /**
@@ -52,6 +53,7 @@ public interface CoreValueFactory {
      * @param value The {@code double} that defines the new value.
      * @return a new value instance.
      */
+    @Nonnull
     CoreValue createValue(long value);
 
     /**
@@ -60,6 +62,7 @@ public interface CoreValueFactory {
      * @param value The {@code boolean} that defines the new value.
      * @return a new value instance.
      */
+    @Nonnull
     CoreValue createValue(boolean value);
 
     /**
@@ -69,6 +72,7 @@ public interface CoreValueFactory {
      * @return a new value instance.
      * @throws IllegalArgumentException if the specified {@code BigDecimal} is {@code null}.
      */
+    @Nonnull
     CoreValue createValue(BigDecimal value);
 
     /**
@@ -80,6 +84,7 @@ public interface CoreValueFactory {
      * @throws IOException If an error occurs while processing the stream.
      * @throws //TODO define exceptions (currently impl. throws MicrokernelException)
      */
+    @Nonnull
     CoreValue createValue(InputStream value) throws IOException;
 
     /**
@@ -94,5 +99,6 @@ public interface CoreValueFactory {
      * conversion to any of the number types and the conversion fails.
      * @throws //TODO define and consolidate exceptions
      */
+    @Nonnull
     CoreValue createValue(@Nonnull String value, int type);
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java?rev=1344019&r1=1344018&r2=1344019&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
Tue May 29 21:45:17 2012
@@ -44,6 +44,9 @@ class ContentSessionImpl implements Cont
 
     public ContentSessionImpl(LoginContext loginContext, String workspaceName,
                               NodeStore store, QueryEngine queryEngine) {
+
+        assert queryEngine != null;
+
         this.loginContext = loginContext;
         this.workspaceName = workspaceName;
         this.store = store;

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=1344019&r1=1344018&r2=1344019&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
Tue May 29 21:45:17 2012
@@ -32,6 +32,7 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.annotation.Nonnull;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -183,10 +184,16 @@ public class RootImpl implements Root {
      * Returns the current root node state of the workspace
      * @return root node state
      */
+    @Nonnull
     public NodeState getWorkspaceRootState() {
-        return workspaceBuilder == null
-            ? branch.getRoot().getChildNode(workspaceName)
-            : workspaceBuilder.getNodeState();
+        if (workspaceBuilder == null) {
+            NodeState workspaceRootState = branch.getRoot().getChildNode(workspaceName);
+            assert workspaceRootState != null;
+            return workspaceRootState;
+        }
+        else {
+            return workspaceBuilder.getNodeState();
+        }
     }
 
     /**
@@ -194,8 +201,11 @@ public class RootImpl implements Root {
      * the current branch was created.
      * @return base node state
      */
+    @Nonnull
     public NodeState getWorkspaceBaseState() {
-        return branch.getBase().getChildNode(workspaceName);
+        NodeState workspaceBaseState = branch.getBase().getChildNode(workspaceName);
+        assert workspaceBaseState != null;
+        return workspaceBaseState;
     }
 
     /**
@@ -206,6 +216,7 @@ public class RootImpl implements Root {
      * @param nodeState  base node state, or {@code null} for building new nodes
      * @return  builder instance
      */
+    @Nonnull
     public NodeStateBuilder getBuilder(NodeState nodeState) {
         return store.getBuilder(nodeState);
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java?rev=1344019&r1=1344018&r2=1344019&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
Tue May 29 21:45:17 2012
@@ -30,6 +30,8 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.apache.jackrabbit.oak.util.Function1;
 import org.apache.jackrabbit.oak.util.Iterators;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -64,6 +66,7 @@ public class TreeImpl implements Tree, P
         this.name = name;
     }
 
+    @Nonnull
     static TreeImpl createRoot(final RootImpl root) {
         return new TreeImpl(root, null, "") {
             @Override
@@ -346,14 +349,25 @@ public class TreeImpl implements Tree, P
 
     //------------------------------------------------------------< protected >---
 
+    @CheckForNull
     protected NodeState getBaseState() {
-        return parent.getBaseState().getChildNode(name);
+        NodeState parentBaseState = parent.getBaseState();
+        return parentBaseState == null
+            ? null
+            : parentBaseState.getChildNode(name);
     }
 
+    @Nonnull
     protected NodeState getNodeState() {
-        return nodeStateBuilder == null
-            ? parent.getNodeState().getChildNode(name)
-            : nodeStateBuilder.getNodeState();
+        if (nodeStateBuilder == null) {
+            parent.getNodeState().getChildNode(name);
+            NodeState nodeState = parent.getNodeState().getChildNode(name);
+            assert nodeState != null;
+            return nodeState;
+        }
+        else {
+            return nodeStateBuilder.getNodeState();
+        }
     }
 
     protected void updateParentState(NodeState childState) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java?rev=1344019&r1=1344018&r2=1344019&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
Tue May 29 21:45:17 2012
@@ -31,6 +31,7 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.apache.jackrabbit.oak.util.Iterators;
 import org.apache.jackrabbit.oak.util.PagedIterator;
 
+import javax.annotation.Nonnull;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -74,6 +75,11 @@ class KernelNodeState extends AbstractNo
      * @param revision
      */
     public KernelNodeState(MicroKernel kernel, CoreValueFactory valueFactory, String path,
String revision) {
+        assert kernel != null;
+        assert valueFactory != null;
+        assert path != null;
+        assert revision != null;
+
         this.kernel = kernel;
         this.valueFactory = valueFactory;
         this.path = path;
@@ -169,10 +175,12 @@ class KernelNodeState extends AbstractNo
 
     //------------------------------------------------------------< internal >---
 
+    @Nonnull
     String getRevision() {
         return revision;
     }
 
+    @Nonnull
     String getPath() {
         return path;
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java?rev=1344019&r1=1344018&r2=1344019&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
Tue May 29 21:45:17 2012
@@ -24,6 +24,8 @@ import org.apache.jackrabbit.oak.spi.com
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
 
+import javax.annotation.Nonnull;
+
 /**
  * {@code NodeStore} implementations against {@link MicroKernel}.
  */
@@ -54,6 +56,9 @@ public class KernelNodeStore extends Mem
     }
 
     public KernelNodeStore(MicroKernel kernel, CommitHook commitHook) {
+        assert kernel != null;
+        assert commitHook != null;
+
         this.kernel = kernel;
         this.commitHook = commitHook;
         this.valueFactory = new CoreValueFactoryImpl(kernel);
@@ -83,10 +88,12 @@ public class KernelNodeStore extends Mem
 
     //------------------------------------------------------------< internal >---
 
+    @Nonnull
     MicroKernel getKernel() {
         return kernel;
     }
 
+    @Nonnull
     CommitHook getCommitHook() {
         return commitHook;
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java?rev=1344019&r1=1344018&r2=1344019&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
Tue May 29 21:45:17 2012
@@ -100,7 +100,7 @@ class NameValidator implements Validator
     @Override
     public Validator childNodeDeleted(String name, NodeState before) {
         // do nothing
-        return null;
+        return this;
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java?rev=1344019&r1=1344018&r2=1344019&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
Tue May 29 21:45:17 2012
@@ -16,9 +16,6 @@
  */
 package org.apache.jackrabbit.oak.plugins.type;
 
-import java.util.Collections;
-import java.util.Set;
-
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.CoreValue;
@@ -26,6 +23,9 @@ import org.apache.jackrabbit.oak.api.Pro
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
+import java.util.Collections;
+import java.util.Set;
+
 class TypeValidator implements Validator {
 
     private final Set<String> types;
@@ -93,7 +93,7 @@ class TypeValidator implements Validator
     @Override
     public Validator childNodeDeleted(String name, NodeState before) {
         // TODO: validate removed child node
-        return null;
+        return this;
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CommitHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CommitHook.java?rev=1344019&r1=1344018&r2=1344019&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CommitHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CommitHook.java
Tue May 29 21:45:17 2012
@@ -20,6 +20,8 @@ import org.apache.jackrabbit.oak.api.Com
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
+import javax.annotation.Nonnull;
+
 /**
  * Extension point for custom functionality to be performed before and
  * after content changes are committed. The repository core will call
@@ -65,6 +67,7 @@ public interface CommitHook {
      * @return content tree to be committed
      * @throws CommitFailedException if the commit should be rejected
      */
+    @Nonnull
     NodeState beforeCommit(NodeStore store, NodeState before, NodeState after)
         throws CommitFailedException;
 

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=1344019&r1=1344018&r2=1344019&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
Tue May 29 21:45:17 2012
@@ -20,6 +20,8 @@ import org.apache.jackrabbit.oak.api.Com
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
+import javax.annotation.Nonnull;
+
 /**
  * Content change validator. An instance of this interface is used to
  * validate changes against a specific {@link NodeState}.
@@ -35,13 +37,16 @@ public interface Validator {
     void propertyDeleted(PropertyState before)
             throws CommitFailedException;
 
+    @Nonnull
     Validator childNodeAdded(String name, NodeState after)
             throws CommitFailedException;
 
+    @Nonnull
     Validator childNodeChanged(
             String name, NodeState before, NodeState after)
             throws CommitFailedException;
 
+    @Nonnull
     Validator childNodeDeleted(String name, NodeState before)
             throws CommitFailedException;
 

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=1344019&r1=1344018&r2=1344019&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
Tue May 29 21:45:17 2012
@@ -18,6 +18,8 @@ package org.apache.jackrabbit.oak.spi.co
 
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
+import javax.annotation.Nonnull;
+
 /**
  * Extension point for plugging in different kinds of validation rules
  * for content changes.
@@ -32,6 +34,7 @@ public interface ValidatorProvider {
      * @param after  modified root state
      * @return validator for checking the modifications
      */
+    @Nonnull
     Validator getRootValidator(NodeState before, NodeState after);
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/Iterators.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/Iterators.java?rev=1344019&r1=1344018&r2=1344019&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/Iterators.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/Iterators.java
Tue May 29 21:45:17 2012
@@ -23,6 +23,7 @@ import org.apache.commons.collections.it
 import org.apache.commons.collections.iterators.SingletonIterator;
 import org.apache.commons.collections.iterators.TransformIterator;
 
+import javax.annotation.Nonnull;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -46,6 +47,7 @@ public final class Iterators {
      * @return
      */
     @SuppressWarnings("unchecked")
+    @Nonnull
     public static <T> Iterator<T> singleton(T element) {
         return new SingletonIterator(element);
     }
@@ -57,6 +59,7 @@ public final class Iterators {
      * @return
      */
     @SuppressWarnings("unchecked")
+    @Nonnull
     public static <T> Iterator<T> empty() {
         return EmptyIterator.INSTANCE;
     }
@@ -71,6 +74,7 @@ public final class Iterators {
      * @return
      */
     @SuppressWarnings("unchecked")
+    @Nonnull
     public static <T> Iterator<T> chain(Iterator<? extends T> iterator1,
Iterator<? extends T> iterator2) {
         return new IteratorChain(iterator1, iterator2);
     }
@@ -83,6 +87,7 @@ public final class Iterators {
      * @return
      */
     @SuppressWarnings("unchecked")
+    @Nonnull
     public static <T> Iterator<T> chain(Iterator<? extends T>[] iterators)
{
         return new IteratorChain(iterators);
     }
@@ -95,6 +100,7 @@ public final class Iterators {
      * @return
      */
     @SuppressWarnings("unchecked")
+    @Nonnull
     public static <T> Iterator<T> chain(Collection<? extends T> iterators)
{
         return new IteratorChain(iterators);
     }
@@ -109,6 +115,7 @@ public final class Iterators {
      * @return
      */
     @SuppressWarnings("unchecked")
+    @Nonnull
     public static <T> Iterator<T> arrayIterator(T[] values, int from, int to)
{
         return new ArrayIterator(values, from, to);
     }
@@ -123,6 +130,7 @@ public final class Iterators {
      * @return
      */
     @SuppressWarnings("unchecked")
+    @Nonnull
     public static <T> Iterator<T> filter(Iterator<? extends T> iterator,
             final Predicate<? super T> predicate) {
 
@@ -146,6 +154,7 @@ public final class Iterators {
      * @return
      */
     @SuppressWarnings("unchecked")
+    @Nonnull
     public static <T, R, S extends T> Iterator<R> map(Iterator<? extends T>
iterator,
             final Function1<S, ? super R> f) {
 
@@ -163,6 +172,7 @@ public final class Iterators {
      * @param <T>
      * @return iterable containing the values from {@code iterator}
      */
+    @Nonnull
     public static <T> Iterable<T> toIterable(final Iterator<T> iterator)
{
         return new Iterable<T>() {
             private List<T> copy;
@@ -191,6 +201,7 @@ public final class Iterators {
      * @param <T>
      * @return
      */
+    @Nonnull
     public static <T> Iterator<T> flatten(final Iterator<Iterator<? extends
T>> iterators) {
         return new Iterator<T>() {
             private Iterator<? extends T> current;



Mime
View raw message