jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1456028 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: SessionContext.java SessionContextProvider.java SessionImpl.java
Date Wed, 13 Mar 2013 16:25:56 GMT
Author: mduerig
Date: Wed Mar 13 16:25:55 2013
New Revision: 1456028

URL: http://svn.apache.org/r1456028
Log:
OAK-672: Avoid JCR APIs calling other JCR APIs
- Promote SessionContext to top level class

Added:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
  (with props)
Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContextProvider.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java

Added: 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=1456028&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
(added)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
Wed Mar 13 16:25:55 2013
@@ -0,0 +1,294 @@
+package org.apache.jackrabbit.oak.jcr;
+
+import java.util.Map;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.LockManager;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.observation.ObservationManager;
+import javax.jcr.security.AccessControlManager;
+import javax.jcr.version.VersionManager;
+
+import com.google.common.collect.Maps;
+import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
+import org.apache.jackrabbit.api.security.principal.PrincipalManager;
+import org.apache.jackrabbit.api.security.user.UserManager;
+import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate;
+import org.apache.jackrabbit.oak.namepath.LocalNameMapper;
+import org.apache.jackrabbit.oak.namepath.NamePathMapperImpl;
+import org.apache.jackrabbit.oak.plugins.name.Namespaces;
+import org.apache.jackrabbit.oak.plugins.nodetype.DefinitionProvider;
+import org.apache.jackrabbit.oak.plugins.nodetype.EffectiveNodeTypeProvider;
+import org.apache.jackrabbit.oak.plugins.observation.ObservationManagerImpl;
+import org.apache.jackrabbit.oak.plugins.value.ValueFactoryImpl;
+import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
+import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlConfiguration;
+import org.apache.jackrabbit.oak.spi.security.authorization.PermissionProvider;
+import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+public abstract class SessionContext {
+    private final RepositoryImpl repository;
+    private final WorkspaceImpl workspace;
+    private final NamePathMapperImpl namePathMapper;
+    private final ValueFactoryImpl valueFactory;
+
+    private AccessControlManager accessControlManager;
+    private PrincipalManager principalManager;
+    private UserManager userManager;
+    private PrivilegeManager privilegeManager;
+    private UserConfiguration userConfiguration;
+    private AccessControlConfiguration accessControlConfiguration;
+    private ObservationManagerImpl observationManager;
+
+    private SessionContext(RepositoryImpl repository, WorkspaceImpl workspace,
+            NamePathMapperImpl namePathMapper, ValueFactoryImpl valueFactory) {
+        this.repository = repository;
+        this.workspace = workspace;
+        this.namePathMapper = namePathMapper;
+        this.valueFactory = valueFactory;
+    }
+
+    public static SessionContext create(final SessionDelegate delegate, RepositoryImpl repository)
{
+        final Map<String, String> namespaces = Maps.newHashMap();
+        final Root root = checkNotNull(delegate).getRoot();
+
+        LocalNameMapper nameMapper = new LocalNameMapper(namespaces) {
+            @Override
+            protected Map<String, String> getNamespaceMap() {
+                return Namespaces.getNamespaceMap(root.getTree("/"));
+            }
+        };
+
+        WorkspaceImpl workspace = new WorkspaceImpl(delegate);
+        NamePathMapperImpl namePathMapper = new NamePathMapperImpl(nameMapper, delegate.getIdManager());
+        ValueFactoryImpl valueFactory = new ValueFactoryImpl(root.getBlobFactory(), namePathMapper);
+
+        return new SessionContext(checkNotNull(repository), workspace, namePathMapper, valueFactory){
+            SessionImpl session = new SessionImpl(delegate, this, namespaces);
+            @Override
+            public SessionImpl getSession() {
+                return session;
+            }
+        };
+    }
+
+    public RepositoryImpl getRepository() {
+        return repository;
+    }
+
+    public abstract SessionImpl getSession();
+
+    public WorkspaceImpl getWorkspace() {
+        return workspace;
+    }
+
+    public LockManager getLockManager() {
+        return workspace.getLockManager();
+    }
+
+    public NodeTypeManager getNodeTypeManager() {
+        return workspace.getNodeTypeManager();
+    }
+
+    public VersionManager getVersionManager() throws RepositoryException {
+        return workspace.getVersionManager();
+    }
+
+    public EffectiveNodeTypeProvider getEffectiveNodeTypeProvider() {
+        return workspace.getReadWriteNodeTypeManager();
+    }
+
+    public DefinitionProvider getDefinitionProvider() {
+        return workspace.getReadWriteNodeTypeManager();
+    }
+
+    public NamePathMapperImpl getNamePathMapper() {
+        return namePathMapper;
+    }
+
+    public ValueFactoryImpl getValueFactory() {
+        return valueFactory;
+    }
+
+    /**
+     * Returns the Oak name for the given JCR name, or throws a
+     * {@link javax.jcr.RepositoryException} if the name is invalid or can
+     * otherwise not be mapped.
+     *
+     * @param jcrName JCR name
+     * @return Oak name
+     * @throws javax.jcr.RepositoryException if the name is invalid
+     */
+    @Nonnull
+    public String getOakName(String jcrName) throws RepositoryException {
+        return namePathMapper.getOakName(jcrName);
+    }
+
+    /**
+     * Returns the Oak path for the given JCR path, or throws a
+     * {@link javax.jcr.RepositoryException} if the path can not be mapped.
+     *
+     * @param jcrPath JCR path
+     * @return Oak path
+     * @throws javax.jcr.RepositoryException if the path can not be mapped
+     */
+    @Nonnull
+    public String getOakPath(String jcrPath) throws RepositoryException {
+        String oakPath = getOakPathOrNull(jcrPath);
+        if (oakPath != null) {
+            return oakPath;
+        } else {
+            throw new RepositoryException("Invalid name or path: " + jcrPath);
+        }
+    }
+
+    /**
+     * Shortcut for {@code SessionDelegate.getNamePathMapper().getOakPath(jcrPath)}.
+     *
+     * @param jcrPath JCR path
+     * @return Oak path, or {@code null}
+     */
+    @CheckForNull
+    public String getOakPathOrNull(String jcrPath) {
+        return namePathMapper.getOakPath(jcrPath);
+    }
+
+    /**
+     * Returns the Oak path for the given JCR path, or throws a
+     * {@link javax.jcr.PathNotFoundException} if the path can not be mapped.
+     *
+     * @param jcrPath JCR path
+     * @return Oak path
+     * @throws javax.jcr.PathNotFoundException if the path can not be mapped
+     */
+    @Nonnull
+    public String getOakPathOrThrowNotFound(String jcrPath) throws PathNotFoundException
{
+        String oakPath = getOakPathOrNull(jcrPath);
+        if (oakPath != null) {
+            return oakPath;
+        } else {
+            throw new PathNotFoundException(jcrPath);
+        }
+    }
+
+    /**
+     * Shortcut for {@code SessionDelegate.getOakPathKeepIndex(jcrPath)}.
+     *
+     * @param jcrPath JCR path
+     * @return Oak path, or {@code null}, with indexes left intact
+     * @throws javax.jcr.PathNotFoundException
+     */
+    @Nonnull
+    public String getOakPathKeepIndex(String jcrPath) throws PathNotFoundException {
+        return namePathMapper.getOakPathKeepIndex(jcrPath);
+    }
+
+    /**
+     * Shortcut for {@code SessionDelegate.getOakPathKeepIndex(jcrPath)}.
+     *
+     * @param jcrPath JCR path
+     * @return Oak path, or {@code null}, with indexes left intact
+     * @throws javax.jcr.PathNotFoundException
+     */
+    @Nonnull
+    public String getOakPathKeepIndexOrThrowNotFound(String jcrPath) throws PathNotFoundException
{
+        String oakPath = namePathMapper.getOakPathKeepIndex(jcrPath);
+        if (oakPath != null) {
+            return oakPath;
+        } else {
+            throw new PathNotFoundException(jcrPath);
+        }
+    }
+
+    @Nonnull
+    public AccessControlManager getAccessControlManager(SessionDelegate delegate) {
+        if (accessControlManager == null) {
+            SecurityProvider securityProvider = repository.getSecurityProvider();
+            accessControlManager = securityProvider.getAccessControlConfiguration()
+                    .getAccessControlManager(delegate.getRoot(), namePathMapper);
+        }
+        return accessControlManager;
+    }
+
+    @Nonnull
+    public PermissionProvider getPermissionProvider(SessionDelegate delegate) {
+        SecurityProvider securityProvider = repository.getSecurityProvider();
+
+        // TODO
+        return securityProvider.getAccessControlConfiguration()
+                .getPermissionProvider(delegate.getRoot(), delegate.getAuthInfo().getPrincipals());
+    }
+
+    @Nonnull
+    public PrincipalManager getPrincipalManager(SessionDelegate delegate) {
+        if (principalManager == null) {
+            SecurityProvider securityProvider = repository.getSecurityProvider();
+            principalManager = securityProvider.getPrincipalConfiguration()
+                    .getPrincipalManager(delegate.getRoot(), namePathMapper);
+        }
+        return principalManager;
+    }
+
+    @Nonnull
+    public UserManager getUserManager(SessionDelegate delegate) {
+        if (userManager == null) {
+            SecurityProvider securityProvider = repository.getSecurityProvider();
+            userManager = securityProvider.getUserConfiguration().getUserManager(delegate.getRoot(),
namePathMapper);
+        }
+        return userManager;
+    }
+
+    @Nonnull
+    public PrivilegeManager getPrivilegeManager(SessionDelegate delegate) {
+        if (privilegeManager == null) {
+            SecurityProvider securityProvider = repository.getSecurityProvider();
+            privilegeManager = securityProvider.getPrivilegeConfiguration().getPrivilegeManager(delegate.getRoot(),
namePathMapper);
+        }
+        return privilegeManager;
+    }
+
+    @Nonnull
+    public UserConfiguration getUserConfiguration() {
+        if (userConfiguration == null) {
+            SecurityProvider securityProvider = repository.getSecurityProvider();
+            userConfiguration = securityProvider.getUserConfiguration();
+        }
+        return userConfiguration;
+    }
+
+    @Nonnull
+    public AccessControlConfiguration getAccessControlConfiguration() {
+        if (accessControlConfiguration == null) {
+            SecurityProvider securityProvider = repository.getSecurityProvider();
+            accessControlConfiguration = securityProvider.getAccessControlConfiguration();
+        }
+        return accessControlConfiguration;
+    }
+
+    @Nonnull
+    public ObservationManager getObservationManager(SessionDelegate delegate) {
+        if (observationManager == null) {
+            observationManager = new ObservationManagerImpl(
+                    delegate.getRoot(), namePathMapper, repository.getObservationExecutor());
+        }
+        return observationManager;
+    }
+
+    public boolean hasPendingEvents() {
+        return observationManager != null && observationManager.hasEvents();
+    }
+
+    //------------------------------------------------------------< internal >---
+
+    void dispose() {
+        if (observationManager != null) {
+            observationManager.dispose();
+        }
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContextProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContextProvider.java?rev=1456028&r1=1456027&r2=1456028&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContextProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContextProvider.java
Wed Mar 13 16:25:55 2013
@@ -17,16 +17,11 @@ import com.google.common.collect.Maps;
 import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
 import org.apache.jackrabbit.api.security.principal.PrincipalManager;
 import org.apache.jackrabbit.api.security.user.UserManager;
-import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate;
-import org.apache.jackrabbit.oak.namepath.LocalNameMapper;
 import org.apache.jackrabbit.oak.namepath.NamePathMapperImpl;
-import org.apache.jackrabbit.oak.plugins.name.Namespaces;
 import org.apache.jackrabbit.oak.plugins.nodetype.DefinitionProvider;
 import org.apache.jackrabbit.oak.plugins.nodetype.EffectiveNodeTypeProvider;
-import org.apache.jackrabbit.oak.plugins.observation.ObservationManagerImpl;
 import org.apache.jackrabbit.oak.plugins.value.ValueFactoryImpl;
-import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlConfiguration;
 import org.apache.jackrabbit.oak.spi.security.authorization.PermissionProvider;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
@@ -40,22 +35,9 @@ public final class SessionContextProvide
 
     @Nonnull
     public static Session newSession(@Nonnull SessionDelegate delegate, @Nonnull RepositoryImpl
repository) {
-        Map<String, String> namespaces = Maps.newHashMap();
-        final Root root = delegate.getRoot();
-
-        NamePathMapperImpl namePathMapper = new NamePathMapperImpl(new LocalNameMapper(namespaces)
{
-            @Override
-            protected Map<String, String> getNamespaceMap() {
-                return Namespaces.getNamespaceMap(root.getTree("/"));
-            }
-        }, delegate.getIdManager());
-        ValueFactoryImpl valueFactory = new ValueFactoryImpl(root.getBlobFactory(), namePathMapper);
-        SessionImpl session = new SessionImpl(checkNotNull(delegate), namespaces);
-        WorkspaceImpl workspace = new WorkspaceImpl(delegate);
-
-        CONTEXTS.put(delegate, new SessionContext(
-                checkNotNull(repository), session, workspace, namePathMapper, valueFactory));
-        return session;
+        SessionContext context = SessionContext.create(delegate, repository);
+        CONTEXTS.put(delegate, context);
+        return context.getSession();
     }
 
     public static void remove(SessionDelegate delegate) {
@@ -68,53 +50,53 @@ public final class SessionContextProvide
 
     @Nonnull
     public static SessionImpl getSession(@Nonnull SessionDelegate delegate) {
-        return getSessionContext(delegate).session;
+        return getSessionContext(delegate).getSession();
     }
 
     @Nonnull
     public static RepositoryImpl getRepository(@Nonnull SessionDelegate delegate) {
-        return getSessionContext(delegate).repository;
+        return getSessionContext(delegate).getRepository();
     }
 
     @Nonnull
     public static WorkspaceImpl getWorkspace(@Nonnull SessionDelegate delegate) {
-        return getSessionContext(delegate).workspace;
+        return getSessionContext(delegate).getWorkspace();
     }
 
     @Nonnull
     public static LockManager getLockManager(@Nonnull SessionDelegate delegate) {
-        return getWorkspace(delegate).getLockManager();
+        return getSessionContext(delegate).getLockManager();
     }
 
     @Nonnull
     public static NodeTypeManager getNodeTypeManager(@Nonnull SessionDelegate delegate) {
-        return getWorkspace(delegate).getNodeTypeManager();
+        return getSessionContext(delegate).getNodeTypeManager();
     }
 
     @Nonnull
     public static VersionManager getVersionManager(@Nonnull SessionDelegate delegate)
             throws RepositoryException {
-        return getWorkspace(delegate).getVersionManager();
+        return getSessionContext(delegate).getVersionManager();
     }
 
     @Nonnull
     public static EffectiveNodeTypeProvider getEffectiveNodeTypeProvider(@Nonnull SessionDelegate
delegate) {
-        return getWorkspace(delegate).getReadWriteNodeTypeManager();
+        return getSessionContext(delegate).getEffectiveNodeTypeProvider();
     }
 
     @Nonnull
     public static DefinitionProvider getDefinitionProvider(@Nonnull SessionDelegate delegate)
{
-        return getWorkspace(delegate).getReadWriteNodeTypeManager();
+        return getSessionContext(delegate).getDefinitionProvider();
     }
 
     @Nonnull
     public static NamePathMapperImpl getNamePathMapper(@Nonnull SessionDelegate delegate)
{
-        return getSessionContext(delegate).namePathMapper;
+        return getSessionContext(delegate).getNamePathMapper();
     }
 
     @Nonnull
     public static ValueFactoryImpl getValueFactory(@Nonnull SessionDelegate delegate) {
-        return getSessionContext(delegate).valueFactory;
+        return getSessionContext(delegate).getValueFactory();
     }
 
     @Nonnull
@@ -147,64 +129,47 @@ public final class SessionContextProvide
     }
 
     @Nonnull
-    public static SecurityProvider getSecurityProvider(SessionDelegate delegate) {
-        return getRepository(delegate).getSecurityProvider();
-    }
-
-    @Nonnull
     public static AccessControlManager getAccessControlManager(SessionDelegate delegate)
{
-        SessionContext context = getSessionContext(delegate);
-        return context.getAccessControlManager(delegate);
+        return getSessionContext(delegate).getAccessControlManager(delegate);
     }
 
     @Nonnull
     public static PermissionProvider getPermissionProvider(SessionDelegate delegate) {
-        SecurityProvider securityProvider = getSecurityProvider(delegate);
-
-        // TODO
-        return securityProvider.getAccessControlConfiguration()
-                .getPermissionProvider(delegate.getRoot(), delegate.getAuthInfo().getPrincipals());
+        return getSessionContext(delegate).getPermissionProvider(delegate);
     }
 
     @Nonnull
     public static PrincipalManager getPrincipalManager(SessionDelegate delegate) {
-        SessionContext context = getSessionContext(delegate);
-        return context.getPrincipalManager(delegate);
+        return getSessionContext(delegate).getPrincipalManager(delegate);
     }
 
     @Nonnull
     public static UserManager getUserManager(SessionDelegate delegate) {
-        SessionContext context = getSessionContext(delegate);
-        return context.getUserManager(delegate);
+        return getSessionContext(delegate).getUserManager(delegate);
     }
 
     @Nonnull
     public static PrivilegeManager getPrivilegeManager(SessionDelegate delegate) {
-        SessionContext context = getSessionContext(delegate);
-        return context.getPrivilegeManager(delegate);
+        return getSessionContext(delegate).getPrivilegeManager(delegate);
     }
 
     @Nonnull
     public static UserConfiguration getUserConfiguration(SessionDelegate delegate) {
-        SessionContext context = getSessionContext(delegate);
-        return context.getUserConfiguration();
+        return getSessionContext(delegate).getUserConfiguration();
     }
 
     @Nonnull
     public static AccessControlConfiguration getAccessControlConfiguration(SessionDelegate
delegate) {
-        SessionContext context = getSessionContext(delegate);
-        return context.getAccessControlConfiguration();
+        return getSessionContext(delegate).getAccessControlConfiguration();
     }
 
     @Nonnull
     public static ObservationManager getObservationManager(SessionDelegate delegate) {
-        SessionContext context = getSessionContext(delegate);
-        return context.getObservationManager(delegate);
+        return getSessionContext(delegate).getObservationManager(delegate);
     }
 
     public static boolean hasPendingEvents(SessionDelegate delegate) {
-        SessionContext context = getSessionContext(delegate);
-        return context.hasPendingEvents();
+        return getSessionContext(delegate).hasPendingEvents();
     }
 
     //------------------------------------------------------------< private >---
@@ -218,181 +183,4 @@ public final class SessionContextProvide
         return context;
     }
 
-    private static class SessionContext {
-        final RepositoryImpl repository;
-        final SessionImpl session;
-        final WorkspaceImpl workspace;
-        final NamePathMapperImpl namePathMapper;
-        final ValueFactoryImpl valueFactory;
-
-        private AccessControlManager accessControlManager;
-        private PrincipalManager principalManager;
-        private UserManager userManager;
-        private PrivilegeManager privilegeManager;
-        private UserConfiguration userConfiguration;
-        private AccessControlConfiguration accessControlConfiguration;
-        private ObservationManagerImpl observationManager;
-
-        SessionContext(RepositoryImpl repository, SessionImpl session, WorkspaceImpl workspace,
-                NamePathMapperImpl namePathMapper, ValueFactoryImpl valueFactory) {
-            this.repository = repository;
-            this.session = session;
-            this.workspace = workspace;
-            this.namePathMapper = namePathMapper;
-            this.valueFactory = valueFactory;
-        }
-
-        /**
-         * Returns the Oak name for the given JCR name, or throws a
-         * {@link RepositoryException} if the name is invalid or can
-         * otherwise not be mapped.
-         *
-         * @param jcrName JCR name
-         * @return Oak name
-         * @throws RepositoryException if the name is invalid
-         */
-        @Nonnull
-        String getOakName(String jcrName) throws RepositoryException {
-            return namePathMapper.getOakName(jcrName);
-        }
-
-        /**
-         * Shortcut for {@code SessionDelegate.getNamePathMapper().getOakPath(jcrPath)}.
-         *
-         * @param jcrPath JCR path
-         * @return Oak path, or {@code null}
-         */
-        @CheckForNull
-        String getOakPathOrNull(String jcrPath) {
-            return namePathMapper.getOakPath(jcrPath);
-        }
-
-        /**
-         * Shortcut for {@code SessionDelegate.getOakPathKeepIndex(jcrPath)}.
-         *
-         * @param jcrPath JCR path
-         * @return Oak path, or {@code null}, with indexes left intact
-         * @throws javax.jcr.PathNotFoundException
-         */
-        @Nonnull
-        String getOakPathKeepIndexOrThrowNotFound(String jcrPath) throws PathNotFoundException
{
-            String oakPath = namePathMapper.getOakPathKeepIndex(jcrPath);
-            if (oakPath != null) {
-                return oakPath;
-            } else {
-                throw new PathNotFoundException(jcrPath);
-            }
-        }
-
-        /**
-         * Returns the Oak path for the given JCR path, or throws a
-         * {@link PathNotFoundException} if the path can not be mapped.
-         *
-         * @param jcrPath JCR path
-         * @return Oak path
-         * @throws PathNotFoundException if the path can not be mapped
-         */
-        @Nonnull
-        String getOakPathOrThrowNotFound(String jcrPath) throws PathNotFoundException {
-            String oakPath = getOakPathOrNull(jcrPath);
-            if (oakPath != null) {
-                return oakPath;
-            } else {
-                throw new PathNotFoundException(jcrPath);
-            }
-        }
-
-        /**
-         * Returns the Oak path for the given JCR path, or throws a
-         * {@link RepositoryException} if the path can not be mapped.
-         *
-         * @param jcrPath JCR path
-         * @return Oak path
-         * @throws RepositoryException if the path can not be mapped
-         */
-        @Nonnull
-        String getOakPath(String jcrPath) throws RepositoryException {
-            String oakPath = getOakPathOrNull(jcrPath);
-            if (oakPath != null) {
-                return oakPath;
-            } else {
-                throw new RepositoryException("Invalid name or path: " + jcrPath);
-            }
-        }
-
-        @Nonnull
-        AccessControlManager getAccessControlManager(SessionDelegate delegate) {
-            if (accessControlManager == null) {
-                SecurityProvider securityProvider = repository.getSecurityProvider();
-                accessControlManager = securityProvider.getAccessControlConfiguration()
-                        .getAccessControlManager(delegate.getRoot(), namePathMapper);
-            }
-            return accessControlManager;
-        }
-
-        @Nonnull
-        PrincipalManager getPrincipalManager(SessionDelegate delegate) {
-            if (principalManager == null) {
-                SecurityProvider securityProvider = repository.getSecurityProvider();
-                principalManager = securityProvider.getPrincipalConfiguration()
-                        .getPrincipalManager(delegate.getRoot(), namePathMapper);
-            }
-            return principalManager;
-        }
-
-        @Nonnull
-        UserManager getUserManager(SessionDelegate delegate) {
-            if (userManager == null) {
-                SecurityProvider securityProvider = repository.getSecurityProvider();
-                userManager = securityProvider.getUserConfiguration().getUserManager(delegate.getRoot(),
namePathMapper);
-            }
-            return userManager;
-        }
-
-        @Nonnull
-        PrivilegeManager getPrivilegeManager(SessionDelegate delegate) {
-            if (privilegeManager == null) {
-                SecurityProvider securityProvider = repository.getSecurityProvider();
-                privilegeManager = securityProvider.getPrivilegeConfiguration().getPrivilegeManager(delegate.getRoot(),
namePathMapper);
-            }
-            return privilegeManager;
-        }
-
-        @Nonnull
-        UserConfiguration getUserConfiguration() {
-            if (userConfiguration == null) {
-                SecurityProvider securityProvider = repository.getSecurityProvider();
-                userConfiguration = securityProvider.getUserConfiguration();
-            }
-            return userConfiguration;
-        }
-
-        @Nonnull
-        AccessControlConfiguration getAccessControlConfiguration() {
-            if (accessControlConfiguration == null) {
-                SecurityProvider securityProvider = repository.getSecurityProvider();
-                accessControlConfiguration = securityProvider.getAccessControlConfiguration();
-            }
-            return accessControlConfiguration;
-        }
-
-        @Nonnull
-        ObservationManager getObservationManager(SessionDelegate delegate) {
-            if (observationManager == null) {
-                observationManager = new ObservationManagerImpl(
-                        delegate.getRoot(), namePathMapper, repository.getObservationExecutor());
-            }
-            return observationManager;
-        }
-
-        void dispose() {
-            if (observationManager != null) {
-                observationManager.dispose();
-            }
-        }
-
-        public boolean hasPendingEvents() {
-            return observationManager != null && observationManager.hasEvents();
-        }
-    }
 }

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=1456028&r1=1456027&r2=1456028&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:25:55 2013
@@ -85,7 +85,7 @@ public class SessionImpl extends Abstrac
      */
     private final Map<String, String> namespaces;
 
-    public SessionImpl(SessionDelegate dlg, Map<String, String> namespaces) {
+    SessionImpl(SessionDelegate dlg, SessionContext sessionContext, Map<String, String>
namespaces) {
         this.dlg = dlg;
         this.namespaces = namespaces;
     }



Mime
View raw message