jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1306988 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: SessionContext.java SessionImpl.java state/TransientNodeState.java state/TransientSpace.java
Date Thu, 29 Mar 2012 16:59:53 GMT
Author: mduerig
Date: Thu Mar 29 16:59:52 2012
New Revision: 1306988

URL: http://svn.apache.org/viewvc?rev=1306988&view=rev
Log:
OAK-15: Clean up oak-jcr
- reduce explicit tracking of revision

Modified:
    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/state/TransientNodeState.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/state/TransientSpace.java

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=1306988&r1=1306987&r2=1306988&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
Thu Mar 29 16:59:52 2012
@@ -31,8 +31,7 @@ public interface SessionContext<T extend
     GlobalContext getGlobalContext();
     String getWorkspaceName();
     Connection getConnection();
-    MicroKernel getMicrokernel();
-    String getRevision(); // TODO: this should be superfluous if SessionInfo is used for
communication
+    MicroKernel getMicrokernel(); // TODO: this should be superfluous when Connection is
used for communication
     ValueFactory getValueFactory();
     NodeStateProvider getNodeStateProvider();
 }

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=1306988&r1=1306987&r2=1306988&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
Thu Mar 29 16:59:52 2012
@@ -65,7 +65,6 @@ public class SessionImpl extends Abstrac
     private final TransientSpace transientSpace;
     private final NodeStateProvider nodeStateProvider;
 
-    private String revision; // TODO: revision should be kept with sessionINFO and adjusted
upon calls on oak-core API
     private boolean isAlive = true;
 
     private final SessionContext<SessionImpl> sessionContext = new Context();
@@ -74,13 +73,12 @@ public class SessionImpl extends Abstrac
 
         this.globalContext = globalContext;
         this.connection = connection;
-        this.revision = globalContext.getInstance(MicroKernel.class).getHeadRevision(); 
// fixme: this is a hack and creates a race. however we will get rid of tracking the revision
here anyway
 
         valueFactory = new ValueFactoryImpl();
         repository = new RepositoryAdaptor(globalContext.getInstance(Repository.class), valueFactory);
         workspace = new WorkspaceImpl(sessionContext);
 
-        transientSpace = new TransientSpace(sessionContext.getWorkspaceName(), sessionContext.getMicrokernel(),
revision);
+        transientSpace = new TransientSpace(sessionContext.getWorkspaceName(), sessionContext.getMicrokernel());
         nodeStateProvider = new NodeStateProvider(sessionContext, transientSpace);
     }
 
@@ -214,8 +212,8 @@ public class SessionImpl extends Abstrac
     public void save() throws RepositoryException {
         checkIsAlive();
         try {
-            revision = transientSpace.save();
-            connection.commit(connection.getCurrentRoot());  // todo: need a way to update
a connection to head
+            transientSpace.save();
+            connection.commit(connection.getCurrentRoot());  // todo: need a better way to
update a connection to head
             nodeStateProvider.clear();
         }
         catch (CommitFailedException e) {
@@ -227,8 +225,8 @@ public class SessionImpl extends Abstrac
     public void refresh(boolean keepChanges) throws RepositoryException {
         checkIsAlive();
         try {
-            revision = transientSpace.refresh(keepChanges);
-            connection.commit(connection.getCurrentRoot());  // todo: need a way to update
a connection to head
+            transientSpace.refresh(keepChanges);
+            connection.commit(connection.getCurrentRoot());  // todo: need a better way to
update a connection to head
             nodeStateProvider.clear();
         }
         catch (CommitFailedException e) {
@@ -502,11 +500,6 @@ public class SessionImpl extends Abstrac
         }
 
         @Override
-        public String getRevision() {
-            return revision;
-        }
-
-        @Override
         public ValueFactory getValueFactory() {
             return valueFactory;
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/state/TransientNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/state/TransientNodeState.java?rev=1306988&r1=1306987&r2=1306988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/state/TransientNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/state/TransientNodeState.java
Thu Mar 29 16:59:52 2012
@@ -53,8 +53,6 @@ public class TransientNodeState {
 
     private final SessionContext<SessionImpl> sessionContext;
 
-    private String revision;
-    private NodeState persistentNodeState;
     private NodeDelta nodeDelta;
 
     TransientNodeState(SessionContext<SessionImpl> sessionContext, NodeDelta nodeDelta)
{
@@ -325,17 +323,10 @@ public class TransientNodeState {
 
     private synchronized NodeState getPersistentNodeState() {
         Path path = getNodeDelta().getPersistentPath();
-        String baseRevision = sessionContext.getRevision();
-        if (persistentNodeState == null || !revision.equals(baseRevision)) {
-            revision = baseRevision;
-            if (path == null) {
-                persistentNodeState = EmptyNodeState.INSTANCE;
-            } else {
-                persistentNodeState = getPersistentNodeState(sessionContext.getConnection(),
path);
-            }
-        }
 
-        return persistentNodeState;
+        return path == null
+            ? EmptyNodeState.INSTANCE
+            : getPersistentNodeState(sessionContext.getConnection(), path);
     }
 
     private NodeDelta getNodeDelta() {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/state/TransientSpace.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/state/TransientSpace.java?rev=1306988&r1=1306987&r2=1306988&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/state/TransientSpace.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/state/TransientSpace.java
Thu Mar 29 16:59:52 2012
@@ -75,12 +75,11 @@ public class TransientSpace {
      * and {@code revision}.
      * @param workspace
      * @param microkernel
-     * @param revision
      */
-    public TransientSpace(final String workspace, final MicroKernel microkernel, final String
revision) {
+    public TransientSpace(String workspace, MicroKernel microkernel) {
         this.microkernel = microkernel;
         this.workspace = workspace;
-        this.revision = revision;
+        this.revision = microkernel.getHeadRevision();
 
         changeTree = createChangeTree(workspace, changeTreeListener);
     }



Mime
View raw message