jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1456033 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: delegate/VersionManagerDelegate.java version/VersionManagerImpl.java
Date Wed, 13 Mar 2013 16:28:13 GMT
Author: mduerig
Date: Wed Mar 13 16:28:13 2013
New Revision: 1456033

URL: http://svn.apache.org/r1456033
Log:
OAK-672: Avoid JCR APIs calling other JCR APIs
- Simplify VersionManagerImpl and VersionManagerDelegate

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/VersionManagerDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/VersionManagerDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/VersionManagerDelegate.java?rev=1456033&r1=1456032&r2=1456033&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/VersionManagerDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/VersionManagerDelegate.java
Wed Mar 13 16:28:13 2013
@@ -61,10 +61,6 @@ public class VersionManagerDelegate {
         };
     }
 
-    public SessionDelegate getSessionDelegate() {
-        return sessionDelegate;
-    }
-
     @Nonnull
     public VersionDelegate checkin(@Nonnull NodeDelegate nodeDelegate)
             throws RepositoryException {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java?rev=1456033&r1=1456032&r2=1456033&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java
Wed Mar 13 16:28:13 2013
@@ -115,13 +115,17 @@ public class VersionManagerImpl implemen
         return TODO.unimplemented().returnValue(NodeIteratorAdapter.EMPTY);
     }
 
+    private String getOakPathOrThrowNotFound(String absPath) throws PathNotFoundException
{
+        return sessionContext.getOakPathOrThrowNotFound(absPath);
+    }
+
     @Override
     public boolean isCheckedOut(final String absPath) throws RepositoryException {
-        final SessionDelegate sessionDelegate = versionManagerDelegate.getSessionDelegate();
+        final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
         return sessionDelegate.perform(new SessionOperation<Boolean>() {
             @Override
             public Boolean perform() throws RepositoryException {
-                String oakPath = getOakPathOrThrowNotFound(sessionDelegate, absPath);
+                String oakPath = getOakPathOrThrowNotFound(absPath);
                 NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                 if (nodeDelegate == null) {
                     throw new PathNotFoundException(absPath);
@@ -131,19 +135,14 @@ public class VersionManagerImpl implemen
         });
     }
 
-    private String getOakPathOrThrowNotFound(SessionDelegate sessionDelegate, String absPath)
-            throws PathNotFoundException {
-        return sessionContext.getOakPathOrThrowNotFound(absPath);
-    }
-
     @Override
     public VersionHistory getVersionHistory(final String absPath)
             throws RepositoryException {
-        final SessionDelegate sessionDelegate = versionManagerDelegate.getSessionDelegate();
+        final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
         return sessionDelegate.perform(new SessionOperation<VersionHistory>() {
             @Override
             public VersionHistory perform() throws RepositoryException {
-                String oakPath = getOakPathOrThrowNotFound(sessionDelegate, absPath);
+                String oakPath = getOakPathOrThrowNotFound(absPath);
                 NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                 if (nodeDelegate == null) {
                     throw new PathNotFoundException(absPath);
@@ -156,11 +155,11 @@ public class VersionManagerImpl implemen
 
     @Override
     public Version getBaseVersion(final String absPath) throws RepositoryException {
-        final SessionDelegate sessionDelegate = versionManagerDelegate.getSessionDelegate();
+        final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
         return sessionDelegate.perform(new SessionOperation<Version>() {
             @Override
             public Version perform() throws RepositoryException {
-                String oakPath = getOakPathOrThrowNotFound(sessionDelegate, absPath);
+                String oakPath = getOakPathOrThrowNotFound(absPath);
                 NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                 if (nodeDelegate == null) {
                     throw new PathNotFoundException(absPath);
@@ -198,7 +197,7 @@ public class VersionManagerImpl implemen
     }
 
     @Nonnull
-    private LockManager getLockManager(SessionDelegate sessionDelegate) {
+    private LockManager getLockManager() {
         return sessionContext.getLockManager();
     }
 
@@ -207,16 +206,16 @@ public class VersionManagerImpl implemen
         if (true) {
             TODO.unimplemented().doNothing();
         }
-        final SessionDelegate sessionDelegate = versionManagerDelegate.getSessionDelegate();
+        final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
         sessionDelegate.perform(new SessionOperation<Void>() {
             @Override
             public Void perform() throws RepositoryException {
-                String oakPath = getOakPathOrThrowNotFound(sessionDelegate, absPath);
+                String oakPath = getOakPathOrThrowNotFound(absPath);
                 NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                 if (nodeDelegate == null) {
                     throw new PathNotFoundException(absPath);
                 }
-                if (getLockManager(sessionDelegate).isLocked(absPath)) {
+                if (getLockManager().isLocked(absPath)) {
                     throw new LockException("Node at " + absPath + " is locked");
                 }
                 versionManagerDelegate.checkout(nodeDelegate);
@@ -230,16 +229,16 @@ public class VersionManagerImpl implemen
         if (true) {
             return TODO.dummyImplementation().returnValue(getBaseVersion(absPath));
         }
-        final SessionDelegate sessionDelegate = versionManagerDelegate.getSessionDelegate();
+        final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
         return sessionDelegate.perform(new SessionOperation<Version>() {
             @Override
             public Version perform() throws RepositoryException {
-                String oakPath = getOakPathOrThrowNotFound(sessionDelegate, absPath);
+                String oakPath = getOakPathOrThrowNotFound(absPath);
                 NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                 if (nodeDelegate == null) {
                     throw new PathNotFoundException(absPath);
                 }
-                if (getLockManager(sessionDelegate).isLocked(absPath)) {
+                if (getLockManager().isLocked(absPath)) {
                     throw new LockException("Node at " + absPath + " is locked");
                 }
                 return new VersionImpl(versionManagerDelegate.checkin(nodeDelegate), sessionContext);



Mime
View raw message