jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1508055 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SystemRoot.java
Date Mon, 29 Jul 2013 13:32:59 GMT
Author: mduerig
Date: Mon Jul 29 13:32:59 2013
New Revision: 1508055

URL: http://svn.apache.org/r1508055
Log:
OAK-932: RootImpl to AbstractRoot
avoid extra instance creation

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SystemRoot.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SystemRoot.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SystemRoot.java?rev=1508055&r1=1508054&r2=1508055&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SystemRoot.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SystemRoot.java
Mon Jul 29 13:32:59 2013
@@ -36,6 +36,29 @@ import org.apache.jackrabbit.oak.spi.sta
  *  when an usage of the system internal subject is needed.
  */
 public class SystemRoot extends RootImpl {
+    private final ContentSession contentSession = new ContentSession() {
+        private final AuthInfoImpl authInfo = new AuthInfoImpl(
+                null, null, SystemSubject.INSTANCE.getPrincipals());
+
+        @Override
+        public void close() {
+        }
+
+        @Override
+        public String getWorkspaceName() {
+            return SystemRoot.this.getWorkspaceName();
+        }
+
+        @Override
+        public Root getLatestRoot() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public AuthInfo getAuthInfo() {
+            return authInfo;
+        }
+    };
 
     public SystemRoot(NodeStore store, CommitHook hook, String workspaceName,
             SecurityProvider securityProvider, QueryIndexProvider indexProvider) {
@@ -56,27 +79,7 @@ public class SystemRoot extends RootImpl
 
     @Override
     public ContentSession getContentSession() {
-        return new ContentSession() {
-
-            @Override
-            public void close() {
-            }
-
-            @Override
-            public String getWorkspaceName() {
-                return SystemRoot.this.getWorkspaceName();
-            }
-
-            @Override
-            public Root getLatestRoot() {
-                throw new UnsupportedOperationException();
-            }
-
-            @Override
-            public AuthInfo getAuthInfo() {
-               return new AuthInfoImpl(null, null, SystemSubject.INSTANCE.getPrincipals());
  
-            }
-        };
+        return contentSession;
     }
 
 }



Mime
View raw message