jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1466851 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: api/Root.java core/ContentSessionImpl.java core/ImmutableRoot.java core/RootImpl.java
Date Thu, 11 Apr 2013 12:38:20 GMT
Author: mduerig
Date: Thu Apr 11 12:38:19 2013
New Revision: 1466851

URL: http://svn.apache.org/r1466851
Log:
OAK-768: Enhance Root API in order to provide information about the ContentSession
Applied slightly edited patch from Antonio: add getContentSession method to Root

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableRoot.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java?rev=1466851&r1=1466850&r2=1466851&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java Thu
Apr 11 12:38:19 2013
@@ -144,4 +144,14 @@ public interface Root {
      */
     @Nonnull
     BlobFactory getBlobFactory();
+    
+    /**
+     * Get the {@code ContentSession} from which this root was acquired
+     * 
+     * @return the associated ContentSession
+     * 
+     * @throws UnsupportedOperationException
+     */
+    @Nonnull
+    ContentSession getContentSession();
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java?rev=1466851&r1=1466850&r2=1466851&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
Thu Apr 11 12:38:19 2013
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.oak.core;
 
+import static com.google.common.base.Preconditions.checkState;
+
 import java.io.IOException;
 import java.util.Set;
 
@@ -33,8 +35,6 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static com.google.common.base.Preconditions.checkState;
-
 /**
  * {@code MicroKernel}-based implementation of the {@link ContentSession} interface.
  */
@@ -97,7 +97,12 @@ class ContentSessionImpl implements Cont
             @Override
             protected void checkLive() {
                 ContentSessionImpl.this.checkLive();
-            }
+            }            
+ 
+            @Override
+            public ContentSession getContentSession() {
+            	return ContentSessionImpl.this;
+            }            
         };
         return root;
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableRoot.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableRoot.java?rev=1466851&r1=1466850&r2=1466851&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableRoot.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableRoot.java
Thu Apr 11 12:38:19 2013
@@ -18,20 +18,21 @@
  */
 package org.apache.jackrabbit.oak.core;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static org.apache.jackrabbit.oak.commons.PathUtils.elements;
+
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import org.apache.jackrabbit.oak.api.BlobFactory;
+import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.QueryEngine;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.TreeLocation;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
-import static com.google.common.base.Preconditions.checkArgument;
-import static org.apache.jackrabbit.oak.commons.PathUtils.elements;
-
 /**
  * Simple implementation of the Root interface that only supports simple read
  * operations (excluding query) based on the {@code NodeState} (or {@code ImmutableTree})
@@ -131,4 +132,10 @@ public final class ImmutableRoot impleme
     public BlobFactory getBlobFactory() {
         throw new UnsupportedOperationException();
     }
+    
+	@Override
+	public ContentSession getContentSession() {
+		throw new UnsupportedOperationException();
+	}
+    
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java?rev=1466851&r1=1466850&r2=1466851&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
Thu Apr 11 12:38:19 2013
@@ -38,6 +38,7 @@ import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.Blob;
 import org.apache.jackrabbit.oak.api.BlobFactory;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.QueryEngine;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
@@ -184,6 +185,12 @@ public class RootImpl implements Root {
     }
 
     //---------------------------------------------------------------< Root >---
+    
+	@Override
+	public ContentSession getContentSession() {
+		throw new UnsupportedOperationException();
+	}
+    
     @Override
     public boolean move(String sourcePath, String destPath) {
         checkLive();



Mime
View raw message