jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1328289 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: NodeImpl.java SessionContext.java SessionImpl.java security/user/UserManagerImpl.java
Date Fri, 20 Apr 2012 09:55:37 GMT
Author: mduerig
Date: Fri Apr 20 09:55:36 2012
New Revision: 1328289

URL: http://svn.apache.org/viewvc?rev=1328289&view=rev
Log:
OAK-15: Clean up oak-jcr
- don't expose internals through NodeImpl

Modified:
    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/SessionContext.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java

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=1328289&r1=1328288&r2=1328289&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 Apr 20 09:55:36 2012
@@ -98,7 +98,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public String getPath() throws RepositoryException {
-        return '/' + path();
+        return path();
     }
 
     /**
@@ -852,32 +852,32 @@ public class NodeImpl extends ItemImpl i
 
     }
 
-    //--------------------------------------------------------------------------
+    //------------------------------------------------------------< package >---
+
+    String path() {
+        return '/' + getTransientNodeState().getPath();
+    }
+
+    //------------------------------------------------------------< private >---
+
     /**
      * Access to TransientNodeState to allow code in other packages to
      * access item states.
      *
      * @return The node state.
-     * FIXME this should not be public in order to avoid clients to access internals through
casting to the implementation
      */
-    public TransientNodeState getState() {
+    private TransientNodeState getState() {
         return getTransientNodeState();
     }
 
-    //------------------------------------------------------------< private >---
-
     private Branch getBranch() {
         return sessionContext.getBranch();
     }
-    
+
     private synchronized TransientNodeState getTransientNodeState() {
         return transientNodeState = getBranch().getNode(transientNodeState.getPath());
     }
 
-    private String path() {
-        return getTransientNodeState().getPath();
-    }
-
     private Iterator<Node> nodeIterator(Iterator<TransientNodeState> childNodeStates)
{
         return Iterators.map(childNodeStates, new Function1<TransientNodeState, Node>()
{
             @Override

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java?rev=1328289&r1=1328288&r2=1328289&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
Fri Apr 20 09:55:36 2012
@@ -21,6 +21,7 @@ package org.apache.jackrabbit.oak.jcr;
 
 import org.apache.jackrabbit.oak.api.Connection;
 import org.apache.jackrabbit.oak.api.Branch;
+import org.apache.jackrabbit.oak.api.TransientNodeState;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
@@ -39,4 +40,5 @@ public interface SessionContext<T extend
     NodeTypeManager getNodeTypeManager() throws RepositoryException;
     VersionManager getVersionManager() throws RepositoryException;
     Branch getBranch();
+    TransientNodeState getState(NodeImpl node);
 }

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=1328289&r1=1328288&r2=1328289&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 Apr 20 09:55:36 2012
@@ -20,6 +20,7 @@ import org.apache.jackrabbit.commons.Abs
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.Connection;
 import org.apache.jackrabbit.oak.api.Branch;
+import org.apache.jackrabbit.oak.api.TransientNodeState;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.ContentHandler;
@@ -459,5 +460,10 @@ public class SessionImpl extends Abstrac
         public Branch getBranch() {
             return branch;
         }
+
+        @Override
+        public TransientNodeState getState(NodeImpl node) {
+            return branch.getNode(node.path());
+        }
     }
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java?rev=1328289&r1=1328288&r2=1328289&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
Fri Apr 20 09:55:36 2012
@@ -322,7 +322,7 @@ public class UserManagerImpl implements 
     void setInternalProperty(NodeImpl userNode, String name, String value, int type) throws
RepositoryException {
         // TODO: check again if this really makes a transient modification with marking the
property modified/new
         Scalar scalar = ValueConverter.toScalar(value, type);
-        userNode.getState().setProperty(name, scalar);
+        sessionContext.getState(userNode).setProperty(name, scalar);
     }
 
     void setInternalProperty(NodeImpl userNode, String name, String[] values, int type) throws
RepositoryException {
@@ -331,12 +331,12 @@ public class UserManagerImpl implements 
         for (String value : values) {
             scalarList.add(ValueConverter.toScalar(value, PropertyType.STRING));
         }
-        userNode.getState().setProperty(name, scalarList);
+        sessionContext.getState(userNode).setProperty(name, scalarList);
     }
 
     void removeInternalProperty(NodeImpl userNode, String name) {
         // TODO: check again if this really makes a transient modification with marking the
property modified
-        userNode.getState().removeProperty(name);
+        sessionContext.getState(userNode).removeProperty(name);
     }
 
     private Authorizable getAuthorizable(NodeImpl node) throws RepositoryException {



Mime
View raw message