jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1340053 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: ItemDelegate.java NodeImpl.java PropertyImpl.java SessionDelegate.java SessionImpl.java
Date Fri, 18 May 2012 09:56:59 GMT
Author: reschke
Date: Fri May 18 09:56:59 2012
New Revision: 1340053

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

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java?rev=1340053&r1=1340052&r2=1340053&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
Fri May 18 09:56:59 2012
@@ -17,6 +17,9 @@
 
 package org.apache.jackrabbit.oak.jcr;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import org.apache.jackrabbit.oak.api.Tree.Status;
 
 /**
@@ -34,18 +37,21 @@ public abstract class ItemDelegate {
      * Get the name of this item
      * @return oak name of this item
      */
+    @Nonnull
     public abstract String getName();
 
     /**
      * Get the path of this item
      * @return oak path of this item
      */
+    @Nonnull
     public abstract String getPath();
 
     /**
      * Get the parent of this item
      * @return  parent of this item or {@code null} for root
      */
+    @CheckForNull
     public abstract NodeDelegate getParent();
 
     /**
@@ -58,11 +64,13 @@ public abstract class ItemDelegate {
      * Get the status of this item
      * @return  {@link Status} of this item
      */
+    @Nonnull
     public abstract Status getStatus();
 
     /**
      * Get the session delegate with which this item is associated
      * @return  {@link SessionDelegate} to which this item belongs
      */
+    @Nonnull
     public abstract SessionDelegate getSessionDelegate();
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1340053&r1=1340052&r2=1340053&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Fri May 18 09:56:59 2012
@@ -92,6 +92,7 @@ public class NodeImpl extends ItemImpl i
      * @see javax.jcr.Item#getParent()
      */
     @Override
+    @Nonnull
     public Node getParent() throws RepositoryException {
         checkStatus();
         NodeDelegate parent = dlg.getParent();
@@ -140,12 +141,14 @@ public class NodeImpl extends ItemImpl i
      * @see Node#addNode(String)
      */
     @Override
+    @Nonnull
     public Node addNode(String relPath) throws RepositoryException {
         checkStatus();
         return addNode(relPath, null);
     }
 
     @Override
+    @Nonnull
     public Node addNode(String relPath, String primaryNodeTypeName) throws RepositoryException
{
         checkStatus();
 
@@ -189,6 +192,7 @@ public class NodeImpl extends ItemImpl i
      * @see Node#setProperty(String, javax.jcr.Value)
      */
     @Override
+    @Nonnull
     public Property setProperty(String name, Value value) throws RepositoryException {
         int type = PropertyType.UNDEFINED;
         if (value != null) {
@@ -201,6 +205,7 @@ public class NodeImpl extends ItemImpl i
      * @see Node#setProperty(String, javax.jcr.Value, int)
      */
     @Override
+    @Nonnull
     public Property setProperty(String jcrName, Value value, int type)
             throws RepositoryException {
         checkStatus();
@@ -222,6 +227,7 @@ public class NodeImpl extends ItemImpl i
      * @see Node#setProperty(String, javax.jcr.Value[])
      */
     @Override
+    @Nonnull
     public Property setProperty(String name, Value[] values) throws RepositoryException {
         int type;
         if (values == null || values.length == 0 || values[0] == null) {
@@ -233,6 +239,7 @@ public class NodeImpl extends ItemImpl i
     }
 
     @Override
+    @Nonnull
     public Property setProperty(String jcrName, Value[] values, int type) throws RepositoryException
{
         checkStatus();
 
@@ -253,6 +260,7 @@ public class NodeImpl extends ItemImpl i
      * @see Node#setProperty(String, String[])
      */
     @Override
+    @Nonnull
     public Property setProperty(String name, String[] values) throws RepositoryException
{
         return setProperty(name, values, PropertyType.UNDEFINED);
     }
@@ -261,6 +269,7 @@ public class NodeImpl extends ItemImpl i
      * @see Node#setProperty(String, String[], int)
      */
     @Override
+    @Nonnull
     public Property setProperty(String name, String[] values, int type) throws RepositoryException
{
         Value[] vs;
         if (type == PropertyType.UNDEFINED) {
@@ -275,6 +284,7 @@ public class NodeImpl extends ItemImpl i
      * @see Node#setProperty(String, String)
      */
     @Override
+    @Nonnull
     public Property setProperty(String name, String value) throws RepositoryException {
         Value v = (value == null) ? null : getValueFactory().createValue(value, PropertyType.STRING);
         return setProperty(name, v, PropertyType.UNDEFINED);
@@ -284,6 +294,7 @@ public class NodeImpl extends ItemImpl i
      * @see Node#setProperty(String, String, int)
      */
     @Override
+    @Nonnull
     public Property setProperty(String name, String value, int type) throws RepositoryException
{
         Value v = (value == null) ? null : getValueFactory().createValue(value, type);
         return setProperty(name, v, type);
@@ -294,6 +305,7 @@ public class NodeImpl extends ItemImpl i
      */
     @SuppressWarnings("deprecation")
     @Override
+    @Nonnull
     public Property setProperty(String name, InputStream value) throws RepositoryException
{
         Value v = (value == null ? null : getValueFactory().createValue(value));
         return setProperty(name, v, PropertyType.BINARY);
@@ -303,6 +315,7 @@ public class NodeImpl extends ItemImpl i
      * @see Node#setProperty(String, Binary)
      */
     @Override
+    @Nonnull
     public Property setProperty(String name, Binary value) throws RepositoryException {
         Value v = (value == null ? null : getValueFactory().createValue(value));
         return setProperty(name, v, PropertyType.BINARY);
@@ -312,15 +325,16 @@ public class NodeImpl extends ItemImpl i
      * @see Node#setProperty(String, boolean)
      */
     @Override
+    @Nonnull
     public Property setProperty(String name, boolean value) throws RepositoryException {
         return setProperty(name, getValueFactory().createValue(value), PropertyType.BOOLEAN);
-
     }
 
     /**
      * @see Node#setProperty(String, double)
      */
     @Override
+    @Nonnull
     public Property setProperty(String name, double value) throws RepositoryException {
         return setProperty(name, getValueFactory().createValue(value), PropertyType.DOUBLE);
     }
@@ -329,6 +343,7 @@ public class NodeImpl extends ItemImpl i
      * @see Node#setProperty(String, BigDecimal)
      */
     @Override
+    @Nonnull
     public Property setProperty(String name, BigDecimal value) throws RepositoryException
{
         Value v = (value == null ? null : getValueFactory().createValue(value));
         return setProperty(name, v, PropertyType.DECIMAL);
@@ -338,6 +353,7 @@ public class NodeImpl extends ItemImpl i
      * @see Node#setProperty(String, long)
      */
     @Override
+    @Nonnull
     public Property setProperty(String name, long value) throws RepositoryException {
         return setProperty(name, getValueFactory().createValue(value), PropertyType.LONG);
     }
@@ -346,6 +362,7 @@ public class NodeImpl extends ItemImpl i
      * @see Node#setProperty(String, Calendar)
      */
     @Override
+    @Nonnull
     public Property setProperty(String name, Calendar value) throws RepositoryException {
         Value v = (value == null ? null : getValueFactory().createValue(value));
         return setProperty(name, v, PropertyType.DATE);
@@ -355,12 +372,14 @@ public class NodeImpl extends ItemImpl i
      * @see Node#setProperty(String, Node)
      */
     @Override
+    @Nonnull
     public Property setProperty(String name, Node value) throws RepositoryException {
         Value v = (value == null) ? null : getValueFactory().createValue(value);
         return setProperty(name, v, PropertyType.REFERENCE);
     }
 
     @Override
+    @Nonnull
     public Node getNode(String relPath) throws RepositoryException {
         checkStatus();
 
@@ -376,6 +395,7 @@ public class NodeImpl extends ItemImpl i
     }
 
     @Override
+    @Nonnull
     public NodeIterator getNodes() throws RepositoryException {
         checkStatus();
 
@@ -384,6 +404,7 @@ public class NodeImpl extends ItemImpl i
     }
 
     @Override
+    @Nonnull
     public NodeIterator getNodes(final String namePattern)
             throws RepositoryException {
         checkStatus();
@@ -401,6 +422,7 @@ public class NodeImpl extends ItemImpl i
     }
 
     @Override
+    @Nonnull
     public NodeIterator getNodes(final String[] nameGlobs) throws RepositoryException {
         checkStatus();
 
@@ -430,6 +452,7 @@ public class NodeImpl extends ItemImpl i
     }
 
     @Override
+    @Nonnull
     public PropertyIterator getProperties() throws RepositoryException {
         checkStatus();
 
@@ -438,6 +461,7 @@ public class NodeImpl extends ItemImpl i
     }
 
     @Override
+    @Nonnull
     public PropertyIterator getProperties(final String namePattern) throws RepositoryException
{
         checkStatus();
 
@@ -454,6 +478,7 @@ public class NodeImpl extends ItemImpl i
     }
 
     @Override
+    @Nonnull
     public PropertyIterator getProperties(final String[] nameGlobs) throws RepositoryException
{
         checkStatus();
 
@@ -473,6 +498,7 @@ public class NodeImpl extends ItemImpl i
      * @see javax.jcr.Node#getPrimaryItem()
      */
     @Override
+    @Nonnull
     public Item getPrimaryItem() throws RepositoryException {
         checkStatus();
         String name = getPrimaryNodeType().getPrimaryItemName();
@@ -492,6 +518,7 @@ public class NodeImpl extends ItemImpl i
      * @see javax.jcr.Node#getUUID()
      */
     @Override
+    @Nonnull
     public String getUUID() throws RepositoryException {
         checkStatus();
 
@@ -503,6 +530,7 @@ public class NodeImpl extends ItemImpl i
     }
 
     @Override
+    @Nonnull
     public String getIdentifier() throws RepositoryException {
         checkStatus();
         return dlg.getIdentifier();
@@ -518,11 +546,13 @@ public class NodeImpl extends ItemImpl i
      * @see javax.jcr.Node#getReferences()
      */
     @Override
+    @Nonnull
     public PropertyIterator getReferences() throws RepositoryException {
         return getReferences(null);
     }
 
     @Override
+    @Nonnull
     public PropertyIterator getReferences(String name) throws RepositoryException {
         checkStatus();
         throw new UnsupportedRepositoryOperationException("TODO: Node.getReferences");
@@ -532,11 +562,13 @@ public class NodeImpl extends ItemImpl i
      * @see javax.jcr.Node#getWeakReferences()
      */
     @Override
+    @Nonnull
     public PropertyIterator getWeakReferences() throws RepositoryException {
         return getWeakReferences(null);
     }
 
     @Override
+    @Nonnull
     public PropertyIterator getWeakReferences(String name) throws RepositoryException {
         checkStatus();
         throw new UnsupportedRepositoryOperationException("TODO: Node.getWeakReferences");
@@ -576,6 +608,7 @@ public class NodeImpl extends ItemImpl i
      * @see javax.jcr.Node#getPrimaryNodeType()
      */
     @Override
+    @Nonnull
     public NodeType getPrimaryNodeType() throws RepositoryException {
         checkStatus();
 
@@ -590,6 +623,7 @@ public class NodeImpl extends ItemImpl i
      * @see javax.jcr.Node#getMixinNodeTypes()
      */
     @Override
+    @Nonnull
     public NodeType[] getMixinNodeTypes() throws RepositoryException {
         checkStatus();
 
@@ -686,6 +720,7 @@ public class NodeImpl extends ItemImpl i
     }
 
     @Override
+    @Nonnull
     public NodeDefinition getDefinition() throws RepositoryException {
         checkStatus();
 
@@ -754,6 +789,7 @@ public class NodeImpl extends ItemImpl i
 
 
     @Override
+    @Nonnull
     public String getCorrespondingNodePath(String workspaceName) throws RepositoryException
{
         checkStatus();
         throw new UnsupportedRepositoryOperationException("TODO: Node.getCorrespondingNodePath");
@@ -772,6 +808,7 @@ public class NodeImpl extends ItemImpl i
      * @see javax.jcr.Node#checkin()
      */
     @Override
+    @Nonnull
     public Version checkin() throws RepositoryException {
         return sessionDelegate.getVersionManager().checkin(getPath());
     }
@@ -804,6 +841,7 @@ public class NodeImpl extends ItemImpl i
      * @see javax.jcr.Node#merge(String, boolean)
      */
     @Override
+    @Nonnull
     public NodeIterator merge(String srcWorkspace, boolean bestEffort) throws RepositoryException
{
         return sessionDelegate.getVersionManager().merge(getPath(), srcWorkspace, bestEffort);
     }
@@ -864,6 +902,7 @@ public class NodeImpl extends ItemImpl i
      * @see javax.jcr.Node#getVersionHistory()
      */
     @Override
+    @Nonnull
     public VersionHistory getVersionHistory() throws RepositoryException {
         return sessionDelegate.getVersionManager().getVersionHistory(getPath());
     }
@@ -872,6 +911,7 @@ public class NodeImpl extends ItemImpl i
      * @see javax.jcr.Node#getBaseVersion()
      */
     @Override
+    @Nonnull
     public Version getBaseVersion() throws RepositoryException {
         return sessionDelegate.getVersionManager().getBaseVersion(getPath());
     }
@@ -880,6 +920,7 @@ public class NodeImpl extends ItemImpl i
      * @see javax.jcr.Node#lock(boolean, boolean)
      */
     @Override
+    @Nonnull
     public Lock lock(boolean isDeep, boolean isSessionScoped) throws RepositoryException
{
         return sessionDelegate.getLockManager().lock(getPath(), isDeep, isSessionScoped,
Long.MAX_VALUE, null);
     }
@@ -888,6 +929,7 @@ public class NodeImpl extends ItemImpl i
      * @see javax.jcr.Node#getLock()
      */
     @Override
+    @Nonnull
     public Lock getLock() throws RepositoryException {
         return sessionDelegate.getLockManager().getLock(getPath());
     }
@@ -923,6 +965,7 @@ public class NodeImpl extends ItemImpl i
     }
 
     @Override
+    @Nonnull
     public NodeIterator getSharedSet() throws RepositoryException {
         throw new UnsupportedRepositoryOperationException("TODO: Node.getSharedSet");
     }
@@ -949,6 +992,7 @@ public class NodeImpl extends ItemImpl i
      * @see javax.jcr.Node#getAllowedLifecycleTransistions()
      */
     @Override
+    @Nonnull
     public String[] getAllowedLifecycleTransistions() throws RepositoryException {
         throw new UnsupportedRepositoryOperationException("Lifecycle Management is not supported");
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java?rev=1340053&r1=1340052&r2=1340053&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
Fri May 18 09:56:59 2012
@@ -22,6 +22,7 @@ import org.apache.jackrabbit.value.Value
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.annotation.Nonnull;
 import javax.jcr.Binary;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.ItemVisitor;
@@ -69,6 +70,7 @@ public class PropertyImpl extends ItemIm
      * @see javax.jcr.Item#getParent()
      */
     @Override
+    @Nonnull
     public Node getParent() throws RepositoryException {
         return new NodeImpl(dlg.getParent());
     }
@@ -296,6 +298,7 @@ public class PropertyImpl extends ItemIm
     }
 
     @Override
+    @Nonnull
     public Value getValue() throws RepositoryException {
         checkStatus();
         if (isMultiple()) {
@@ -306,6 +309,7 @@ public class PropertyImpl extends ItemIm
     }
 
     @Override
+    @Nonnull
     public Value[] getValues() throws RepositoryException {
         checkStatus();
         if (!isMultiple()) {
@@ -319,6 +323,7 @@ public class PropertyImpl extends ItemIm
      * @see Property#getString()
      */
     @Override
+    @Nonnull
     public String getString() throws RepositoryException {
         return getValue().getString();
     }
@@ -328,6 +333,7 @@ public class PropertyImpl extends ItemIm
      */
     @SuppressWarnings("deprecation")
     @Override
+    @Nonnull
     public InputStream getStream() throws RepositoryException {
         return getValue().getStream();
     }
@@ -336,6 +342,7 @@ public class PropertyImpl extends ItemIm
      * @see javax.jcr.Property#getBinary()
      */
     @Override
+    @Nonnull
     public Binary getBinary() throws RepositoryException {
         return getValue().getBinary();
     }
@@ -360,6 +367,7 @@ public class PropertyImpl extends ItemIm
      * @see Property#getDecimal()
      */
     @Override
+    @Nonnull
     public BigDecimal getDecimal() throws RepositoryException {
         return getValue().getDecimal();
     }
@@ -368,6 +376,7 @@ public class PropertyImpl extends ItemIm
      * @see Property#getDate()
      */
     @Override
+    @Nonnull
     public Calendar getDate() throws RepositoryException {
         return getValue().getDate();
     }
@@ -384,6 +393,7 @@ public class PropertyImpl extends ItemIm
      * @see javax.jcr.Property#getNode()
      */
     @Override
+    @Nonnull
     public Node getNode() throws RepositoryException {
         Value value = getValue();
         switch (value.getType()) {
@@ -433,6 +443,7 @@ public class PropertyImpl extends ItemIm
      * @see javax.jcr.Property#getProperty()
      */
     @Override
+    @Nonnull
     public Property getProperty() throws RepositoryException {
         Value value = getValue();
         Value pathValue = ValueHelper.convert(value, PropertyType.PATH, getValueFactory());
@@ -456,6 +467,7 @@ public class PropertyImpl extends ItemIm
      * @see javax.jcr.Property#getLengths()
      */
     @Override
+    @Nonnull
     public long[] getLengths() throws RepositoryException {
         Value[] values = getValues();
         long[] lengths = new long[values.length];
@@ -467,6 +479,7 @@ public class PropertyImpl extends ItemIm
     }
 
     @Override
+    @Nonnull
     public PropertyDefinition getDefinition() throws RepositoryException {
         return dlg.getDefinition();
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java?rev=1340053&r1=1340052&r2=1340053&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
Fri May 18 09:56:59 2012
@@ -33,6 +33,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
 import javax.jcr.ItemExistsException;
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.PathNotFoundException;
@@ -75,6 +76,7 @@ public class SessionDelegate {
         return isAlive;
     }
 
+    @Nonnull
     public Session getSession() {
         return session;
     }
@@ -83,6 +85,7 @@ public class SessionDelegate {
         return contentSession.getAuthInfo();
     }
 
+    @Nonnull
     public Repository getRepository() {
         return repository;
     }
@@ -103,25 +106,30 @@ public class SessionDelegate {
         }
     }
 
+    @Nonnull
     public NodeDelegate getRoot() {
         return new NodeDelegate(this, getTree(""));
     }
 
+    @CheckForNull
     public NodeDelegate getNode(String path) {
         Tree tree = getTree(path);
         return tree == null ? null : new NodeDelegate(this, tree);
     }
 
+    @CheckForNull
     public NodeDelegate getNodeByIdentifier(String id) {
         // TODO: for now the OAK path is the identifier
         Tree tree = getTree(id);
         return tree == null ? null : new NodeDelegate(this, tree);
     }
 
+    @Nonnull
     public ValueFactoryImpl getValueFactory() {
         return valueFactory;
     }
 
+    @Nonnull
     public NamePathMapper getNamePathMapper() {
         return namePathMapper;
     }
@@ -154,6 +162,7 @@ public class SessionDelegate {
      * @param jcrPath JCR path
      * @return Oak path, or {@code null}
      */
+    @CheckForNull
     public String getOakPathOrNull(String jcrPath) {
         return getNamePathMapper().getOakPath(jcrPath);
     }
@@ -166,6 +175,7 @@ public class SessionDelegate {
      * @return Oak path
      * @throws PathNotFoundException if the path can not be mapped
      */
+    @CheckForNull
     public String getOakPathOrThrowNotFound(String jcrPath)
             throws PathNotFoundException {
         String oakPath = getOakPathOrNull(jcrPath);
@@ -184,6 +194,7 @@ public class SessionDelegate {
      * @return Oak path
      * @throws RepositoryException if the path can not be mapped
      */
+    @Nonnull
     public String getOakPathOrThrow(String jcrPath)
             throws RepositoryException {
         String oakPath = getOakPathOrNull(jcrPath);
@@ -196,10 +207,12 @@ public class SessionDelegate {
 
     //----------------------------------------------------------< Workspace >---
 
+    @Nonnull
     public Workspace getWorkspace() {
         return workspace;
     }
 
+    @Nonnull
     public String getWorkspaceName() {
         return contentSession.getWorkspaceName();
     }
@@ -281,26 +294,32 @@ public class SessionDelegate {
         }
     }
 
+    @Nonnull
     public LockManager getLockManager() throws RepositoryException {
         return workspace.getLockManager();
     }
 
+    @Nonnull
     public QueryEngine getQueryEngine() {
         return contentSession.getQueryEngine();
     }
 
+    @Nonnull
     public QueryManager getQueryManager() throws RepositoryException {
         return workspace.getQueryManager();
     }
 
+    @Nonnull
     public NodeTypeManager getNodeTypeManager() throws RepositoryException {
         return workspace.getNodeTypeManager();
     }
 
+    @Nonnull
     public VersionManager getVersionManager() throws RepositoryException {
         return workspace.getVersionManager();
     }
 
+    @Nonnull
     public ContentSession getContentSession() {
         return contentSession;
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1340053&r1=1340052&r2=1340053&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Fri May 18 09:56:59 2012
@@ -16,20 +16,12 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
-import org.apache.jackrabbit.api.JackrabbitSession;
-import org.apache.jackrabbit.api.security.principal.PrincipalManager;
-import org.apache.jackrabbit.api.security.user.UserManager;
-import org.apache.jackrabbit.commons.AbstractSession;
-import org.apache.jackrabbit.oak.spi.security.authentication.ImpersonationCredentials;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xml.sax.ContentHandler;
+import java.security.AccessControlException;
 
+import javax.annotation.Nonnull;
 import javax.jcr.Credentials;
-import javax.jcr.Item;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.Node;
-import javax.jcr.PathNotFoundException;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
@@ -38,7 +30,15 @@ import javax.jcr.ValueFactory;
 import javax.jcr.Workspace;
 import javax.jcr.retention.RetentionManager;
 import javax.jcr.security.AccessControlManager;
-import java.security.AccessControlException;
+
+import org.apache.jackrabbit.api.JackrabbitSession;
+import org.apache.jackrabbit.api.security.principal.PrincipalManager;
+import org.apache.jackrabbit.api.security.user.UserManager;
+import org.apache.jackrabbit.commons.AbstractSession;
+import org.apache.jackrabbit.oak.spi.security.authentication.ImpersonationCredentials;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.ContentHandler;
 
 /**
  * {@code SessionImpl}...
@@ -59,6 +59,7 @@ public class SessionImpl extends Abstrac
     //------------------------------------------------------------< Session >---
 
     @Override
+    @Nonnull
     public Repository getRepository() {
         return dlg.getRepository();
     }
@@ -79,11 +80,13 @@ public class SessionImpl extends Abstrac
     }
 
     @Override
+    @Nonnull
     public Workspace getWorkspace() {
         return dlg.getWorkspace();
     }
 
     @Override
+    @Nonnull
     public Session impersonate(Credentials credentials) throws RepositoryException {
         ensureIsAlive();
 
@@ -92,23 +95,27 @@ public class SessionImpl extends Abstrac
     }
 
     @Override
+    @Nonnull
     public ValueFactory getValueFactory() throws RepositoryException {
         ensureIsAlive();
         return dlg.getValueFactory();
     }
 
     @Override
+    @Nonnull
     public Node getRootNode() throws RepositoryException {
         ensureIsAlive();
         return new NodeImpl(dlg.getRoot());
     }
 
     @Override
+    @Nonnull
     public Node getNodeByUUID(String id) throws RepositoryException {
         return getNodeByIdentifier(id);
     }
 
     @Override
+    @Nonnull
     public Node getNodeByIdentifier(String id) throws RepositoryException {
         ensureIsAlive();
         NodeDelegate d = dlg.getNodeByIdentifier(id);
@@ -157,6 +164,7 @@ public class SessionImpl extends Abstrac
     }
 
     @Override
+    @Nonnull
     public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior)
throws RepositoryException {
         ensureIsAlive();
 
@@ -182,6 +190,7 @@ public class SessionImpl extends Abstrac
      * @see javax.jcr.Session#getLockTokens()
      */
     @Override
+    @Nonnull
     public String[] getLockTokens() {
         try {
             return dlg.getLockManager().getLockTokens();
@@ -234,6 +243,7 @@ public class SessionImpl extends Abstrac
     }
 
     @Override
+    @Nonnull
     public AccessControlManager getAccessControlManager() throws RepositoryException {
         ensureIsAlive();
         throw new UnsupportedRepositoryOperationException("TODO: Session.getAccessControlManager");
@@ -243,6 +253,7 @@ public class SessionImpl extends Abstrac
      * @see javax.jcr.Session#getRetentionManager()
      */
     @Override
+    @Nonnull
     public RetentionManager getRetentionManager() throws RepositoryException {
         throw new UnsupportedRepositoryOperationException("Retention Management is not supported.");
     }
@@ -250,12 +261,14 @@ public class SessionImpl extends Abstrac
     //--------------------------------------------------< JackrabbitSession >---
 
     @Override
+    @Nonnull
     public PrincipalManager getPrincipalManager() throws RepositoryException {
         // TODO
         throw new UnsupportedOperationException("Implementation missing");
     }
 
     @Override
+    @Nonnull
     public UserManager getUserManager() throws RepositoryException {
         // TODO
         throw new UnsupportedOperationException("Implementation missing");



Mime
View raw message