jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1456032 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: ./ delegate/ lock/ query/ query/qom/ version/
Date Wed, 13 Mar 2013 16:27:44 GMT
Author: mduerig
Date: Wed Mar 13 16:27:43 2013
New Revision: 1456032

URL: http://svn.apache.org/r1456032
Log:
OAK-672: Avoid JCR APIs calling other JCR APIs
- Pass SessionContext instead of SessionDelegate into JCR instance implementations

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.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/WorkspaceImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/ItemDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/lock/LockManagerImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/QueryObjectModelFactoryImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionImpl.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/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java?rev=1456032&r1=1456031&r2=1456032&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
Wed Mar 13 16:27:43 2013
@@ -49,8 +49,8 @@ abstract class ItemImpl<T extends ItemDe
             Boolean.getBoolean("OAK-652");
 
     protected final SessionContext sessionContext;
-    protected final SessionDelegate sessionDelegate;
     protected final T dlg;
+    protected final SessionDelegate sessionDelegate;
 
     /**
      * logger instance
@@ -59,8 +59,8 @@ abstract class ItemImpl<T extends ItemDe
 
     protected ItemImpl(T itemDelegate, SessionContext sessionContext) {
         this.sessionContext = sessionContext;
-        this.sessionDelegate = itemDelegate.getSessionDelegate();
         this.dlg = itemDelegate;
+        this.sessionDelegate = sessionContext.getSessionDelegate();
     }
 
     protected <X> X perform(SessionOperation<X> operation)

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=1456032&r1=1456031&r2=1456032&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
Wed Mar 13 16:27:43 2013
@@ -69,8 +69,8 @@ public abstract class SessionContext {
         ValueFactoryImpl valueFactory = new ValueFactoryImpl(root.getBlobFactory(), namePathMapper);
 
         return new SessionContext(checkNotNull(repository), delegate, namePathMapper, valueFactory){
-            private final SessionImpl session = new SessionImpl(delegate, this, namespaces);
-            private final WorkspaceImpl workspace = new WorkspaceImpl(delegate, this);
+            private final SessionImpl session = new SessionImpl(this, namespaces);
+            private final WorkspaceImpl workspace = new WorkspaceImpl(this);
 
             @Override
             public SessionImpl getSession() {

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=1456032&r1=1456031&r2=1456032&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
Wed Mar 13 16:27:43 2013
@@ -72,9 +72,8 @@ public class SessionImpl extends Abstrac
      */
     private static final Logger log = LoggerFactory.getLogger(SessionImpl.class);
 
-    private final SessionDelegate dlg;
-
     private SessionContext sessionContext;
+    private final SessionDelegate dlg;
 
     /**
      * Local namespace remappings. Prefixes as keys and namespace URIs as values.
@@ -84,9 +83,9 @@ public class SessionImpl extends Abstrac
      */
     private final Map<String, String> namespaces;
 
-    SessionImpl(SessionDelegate dlg, SessionContext sessionContext, Map<String, String>
namespaces) {
-        this.dlg = dlg;
+    SessionImpl(SessionContext sessionContext, Map<String, String> namespaces) {
         this.sessionContext = sessionContext;
+        this.dlg = sessionContext.getSessionDelegate();
         this.namespaces = namespaces;
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java?rev=1456032&r1=1456031&r2=1456032&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
Wed Mar 13 16:27:43 2013
@@ -55,19 +55,19 @@ import static org.apache.jackrabbit.oak.
  */
 public class WorkspaceImpl implements JackrabbitWorkspace {
 
-    private final SessionDelegate sessionDelegate;
     private final SessionContext sessionContext;
+    private final SessionDelegate sessionDelegate;
     private final QueryManagerImpl queryManager;
     private final LockManager lockManager;
     private final VersionManagerImpl versionManager;
     private final ReadWriteNodeTypeManager nodeTypeManager;
 
-    public WorkspaceImpl(final SessionDelegate sessionDelegate, final SessionContext sessionContext)
{
-        this.sessionDelegate = sessionDelegate;
+    public WorkspaceImpl(final SessionContext sessionContext) {
         this.sessionContext = sessionContext;
-        this.queryManager = new QueryManagerImpl(sessionDelegate, sessionContext);
-        this.lockManager = new LockManagerImpl(sessionDelegate, sessionContext);
-        this.versionManager = new VersionManagerImpl(sessionDelegate, sessionContext);
+        this.sessionDelegate = sessionContext.getSessionDelegate();
+        this.queryManager = new QueryManagerImpl(sessionContext);
+        this.lockManager = new LockManagerImpl(sessionContext);
+        this.versionManager = new VersionManagerImpl(sessionContext);
         this.nodeTypeManager = new ReadWriteNodeTypeManager() {
             @Override
             protected void refresh() throws RepositoryException {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/ItemDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/ItemDelegate.java?rev=1456032&r1=1456031&r2=1456032&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/ItemDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/ItemDelegate.java
Wed Mar 13 16:27:43 2013
@@ -101,15 +101,6 @@ public abstract class ItemDelegate {
     }
 
     /**
-     * Get the session delegate with which this item is associated
-     * @return  {@link SessionDelegate} to which this item belongs
-     */
-    @Nonnull
-    public final SessionDelegate getSessionDelegate() {
-        return sessionDelegate;
-    }
-
-    /**
      * The underlying {@link org.apache.jackrabbit.oak.api.TreeLocation} of this item.
      * @return  tree location of the underlying item
      * @throws InvalidItemStateException if the location points to a stale item

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/lock/LockManagerImpl.java?rev=1456032&r1=1456031&r2=1456032&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/lock/LockManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/lock/LockManagerImpl.java
Wed Mar 13 16:27:43 2013
@@ -29,7 +29,6 @@ import javax.jcr.lock.LockException;
 import javax.jcr.lock.LockManager;
 
 import org.apache.jackrabbit.oak.jcr.SessionContext;
-import org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate;
 
 /**
  * Simple lock manager implementation that just keeps track of a set of lock
@@ -38,12 +37,10 @@ import org.apache.jackrabbit.oak.jcr.del
  */
 public class LockManagerImpl implements LockManager {
 
-    private final SessionDelegate sessionDelegate;
     private final SessionContext sessionContext;
     private final Set<String> tokens = new HashSet<String>();
 
-    public LockManagerImpl(SessionDelegate sessionDelegate, SessionContext sessionContext)
{
-        this.sessionDelegate = sessionDelegate;
+    public LockManagerImpl(SessionContext sessionContext) {
         this.sessionContext = sessionContext;
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java?rev=1456032&r1=1456031&r2=1456032&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java
Wed Mar 13 16:27:43 2013
@@ -37,7 +37,6 @@ import org.apache.jackrabbit.oak.commons
 import org.apache.jackrabbit.oak.jcr.NodeImpl;
 import org.apache.jackrabbit.oak.jcr.SessionContext;
 import org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate;
-import org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate;
 
 /**
  * The implementation of the corresponding JCR interface.
@@ -135,10 +134,9 @@ public class QueryImpl implements Query 
     @Override
     public Node storeAsNode(String absPath) throws RepositoryException {
         manager.ensureIsAlive();
-        SessionDelegate sessionDelegate = manager.getSessionDelegate();
         String oakPath = sessionContext.getOakPath(absPath);
         String parent = PathUtils.getParentPath(oakPath);
-        NodeDelegate parentDelegate = sessionDelegate.getNode(parent);
+        NodeDelegate parentDelegate = sessionContext.getSessionDelegate().getNode(parent);
         if (parentDelegate == null) {
             throw new PathNotFoundException("The specified path does not exist: " + parent);
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java?rev=1456032&r1=1456031&r2=1456032&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java
Wed Mar 13 16:27:43 2013
@@ -57,10 +57,10 @@ public class QueryManagerImpl implements
     private final QueryEngine queryEngine;
     private final HashSet<String> supportedQueryLanguages = new HashSet<String>();
 
-    public QueryManagerImpl(SessionDelegate sessionDelegate, SessionContext sessionContext)
{
-        this.sessionDelegate = sessionDelegate;
+    public QueryManagerImpl(SessionContext sessionContext) {
+        this.sessionDelegate = sessionContext.getSessionDelegate();
         this.sessionContext = sessionContext;
-        qomFactory = new QueryObjectModelFactoryImpl(this, sessionDelegate, sessionContext);
+        qomFactory = new QueryObjectModelFactoryImpl(this, sessionContext);
         queryEngine = sessionDelegate.getQueryEngine();
         supportedQueryLanguages.addAll(queryEngine.getSupportedQueryLanguages());
     }
@@ -122,7 +122,7 @@ public class QueryManagerImpl implements
             NamePathMapper namePathMapper = sessionContext.getNamePathMapper();
             Result r = queryEngine.executeQuery(statement, language, limit, offset,
                     bindMap, namePathMapper);
-            return new QueryResultImpl(sessionDelegate, r, sessionContext);
+            return new QueryResultImpl(sessionContext, r);
         } catch (IllegalArgumentException e) {
             throw new InvalidQueryException(e);
         } catch (ParseException e) {
@@ -141,10 +141,6 @@ public class QueryManagerImpl implements
         return map;
     }
 
-    public SessionDelegate getSessionDelegate() {
-        return sessionDelegate;
-    }
-
     void ensureIsAlive() throws RepositoryException {
         // check session status
         if (!sessionDelegate.isAlive()) {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java?rev=1456032&r1=1456031&r2=1456032&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
Wed Mar 13 16:27:43 2013
@@ -64,9 +64,9 @@ public class QueryResultImpl implements 
     final Result result;
     final String pathFilter;
 
-    public QueryResultImpl(SessionDelegate sessionDelegate, Result result, SessionContext
sessionContext) {
+    public QueryResultImpl(SessionContext sessionContext, Result result) {
         this.sessionContext = sessionContext;
-        this.sessionDelegate = sessionDelegate;
+        this.sessionDelegate = sessionContext.getSessionDelegate();
         this.result = result;
 
         // TODO the path currently contains the workspace name

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/QueryObjectModelFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/QueryObjectModelFactoryImpl.java?rev=1456032&r1=1456031&r2=1456032&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/QueryObjectModelFactoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/qom/QueryObjectModelFactoryImpl.java
Wed Mar 13 16:27:43 2013
@@ -48,7 +48,6 @@ import javax.jcr.query.qom.StaticOperand
 import javax.jcr.query.qom.UpperCase;
 
 import org.apache.jackrabbit.oak.jcr.SessionContext;
-import org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate;
 import org.apache.jackrabbit.oak.jcr.query.QueryManagerImpl;
 
 /**
@@ -56,14 +55,12 @@ import org.apache.jackrabbit.oak.jcr.que
  */
 public class QueryObjectModelFactoryImpl implements QueryObjectModelFactory {
 
-    private final QueryManagerImpl queryManager;
-    private final SessionDelegate sessionDelegate;
     private final SessionContext sessionContext;
+    private final QueryManagerImpl queryManager;
 
-    public QueryObjectModelFactoryImpl(QueryManagerImpl queryManager, SessionDelegate sessionDelegate,
SessionContext sessionContext) {
-        this.queryManager = queryManager;
-        this.sessionDelegate = sessionDelegate;
+    public QueryObjectModelFactoryImpl(QueryManagerImpl queryManager, SessionContext sessionContext)
{
         this.sessionContext = sessionContext;
+        this.queryManager = queryManager;
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionImpl.java?rev=1456032&r1=1456031&r2=1456032&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionImpl.java
Wed Mar 13 16:27:43 2013
@@ -112,7 +112,7 @@ class VersionImpl extends NodeImpl<Versi
 
     @Nonnull
     private VersionManagerDelegate getVersionManagerDelegate() {
-        return VersionManagerDelegate.create(dlg.getSessionDelegate());
+        return VersionManagerDelegate.create(sessionContext.getSessionDelegate());
     }
 
     @Nonnull

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=1456032&r1=1456031&r2=1456032&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:27:43 2013
@@ -44,9 +44,9 @@ public class VersionManagerImpl implemen
     private final SessionContext sessionContext;
     private final VersionManagerDelegate versionManagerDelegate;
 
-    public VersionManagerImpl(SessionDelegate sessionDelegate, SessionContext sessionContext)
{
+    public VersionManagerImpl(SessionContext sessionContext) {
         this.sessionContext = sessionContext;
-        this.versionManagerDelegate = VersionManagerDelegate.create(sessionDelegate);
+        this.versionManagerDelegate = VersionManagerDelegate.create(sessionContext.getSessionDelegate());
     }
 
     @Override



Mime
View raw message