Class SessionContext

  • All Implemented Interfaces:
    NameMapper, NamePathMapper, PathMapper

    public class SessionContext
    extends java.lang.Object
    implements NamePathMapper
    Instances of this class are passed to all JCR implementation classes (e.g. SessionImpl, NodeImpl, etc.) and provide access to the session scoped instances generally needed (e.g. NamePathMapper, ValueFactory, etc.).
    • Method Detail

      • getAttributes

        public final java.util.Map<java.lang.String,​java.lang.Object> getAttributes()
      • createSession

        protected SessionImpl createSession()
        Factory method for creating the Session instance for this context. Called by getSession() when first accessed. Can be overridden by subclasses to customize the session implementation.
        Returns:
        session instance
      • createWorkspace

        protected WorkspaceImpl createWorkspace()
        Factory method for creating the Workspace instance for this context. Called by getWorkspace() when first accessed. Can be overridden by subclasses to customize the workspace implementation.
        Returns:
        session instance
      • getStatisticManager

        @NotNull
        public @NotNull StatisticManager getStatisticManager()
      • getRepository

        @NotNull
        public @NotNull Repository getRepository()
      • getSessionDelegate

        @NotNull
        public @NotNull SessionDelegate getSessionDelegate()
      • getSessionLocalMappings

        @NotNull
        public @NotNull java.util.Map<java.lang.String,​java.lang.String> getSessionLocalMappings()
        Description copied from interface: NameMapper
        Returns the local namespace prefix mappings, or an empty map if there aren't any local mappings.
        Specified by:
        getSessionLocalMappings in interface NameMapper
        Returns:
        local namespace prefix to URI mappings
      • getPrincipalManager

        @NotNull
        public @NotNull PrincipalManager getPrincipalManager()
      • getUserManager

        @NotNull
        public @NotNull UserManager getUserManager()
      • getPrivilegeManager

        @NotNull
        public @NotNull PrivilegeManager getPrivilegeManager()
      • getProtectedItemImporters

        @NotNull
        public @NotNull java.util.List<ProtectedItemImporter> getProtectedItemImporters()
      • getBlobAccessProvider

        @NotNull
        public @NotNull BlobAccessProvider getBlobAccessProvider()
      • hasEventListeners

        public boolean hasEventListeners()
      • getOpenScopedLocks

        public java.util.Set<java.lang.String> getOpenScopedLocks()
      • getSessionScopedLocks

        public java.util.Set<java.lang.String> getSessionScopedLocks()
      • getFastQueryResultSize

        public boolean getFastQueryResultSize()
      • getMountInfoProvider

        @Nullable
        public @Nullable MountInfoProvider getMountInfoProvider()
      • getOakName

        @NotNull
        public @NotNull java.lang.String getOakName​(@NotNull
                                                    @NotNull java.lang.String jcrName)
                                             throws RepositoryException
        Description copied from interface: NameMapper
        Returns the Oak name for the specified JCR name. In contrast to NameMapper.getOakNameOrNull(String) this method will throw a RepositoryException if the JCR name is invalid and cannot be resolved.
        Specified by:
        getOakName in interface NameMapper
        Parameters:
        jcrName - The JCR name to be converted.
        Returns:
        A valid Oak name.
        Throws:
        RepositoryException - If the JCR name cannot be resolved.
      • getOakNameOrNull

        @Nullable
        public @Nullable java.lang.String getOakNameOrNull​(@NotNull
                                                           @NotNull java.lang.String jcrName)
        Description copied from interface: NameMapper
        Returns the Oak name for the given JCR name, or null if no such mapping exists because the given JCR name contains an unknown namespace URI or prefix, or is otherwise invalid.
        Specified by:
        getOakNameOrNull in interface NameMapper
        Parameters:
        jcrName - JCR name
        Returns:
        Oak name, or null
      • getJcrName

        @NotNull
        public @NotNull java.lang.String getJcrName​(@NotNull
                                                    @NotNull java.lang.String oakName)
        Description copied from interface: NameMapper
        Returns the JCR name for the given Oak name. The given name is expected to have come from a valid Oak repository that contains only valid names with proper namespace mappings. If that's not the case, either a programming error or a repository corruption has occurred and an appropriate unchecked exception gets thrown.
        Specified by:
        getJcrName in interface NameMapper
        Parameters:
        oakName - Oak name
        Returns:
        JCR name
      • getOakPath

        @Nullable
        public @Nullable java.lang.String getOakPath​(java.lang.String jcrPath)
        Description copied from interface: PathMapper
        Returns the Oak path for the given JCR path, or null if no such mapping exists because the given JCR path contains a name element with an unknown namespace URI or prefix, or is otherwise invalid.
        Specified by:
        getOakPath in interface PathMapper
        Parameters:
        jcrPath - JCR path
        Returns:
        Oak path, or null
      • getJcrPath

        @NotNull
        public @NotNull java.lang.String getJcrPath​(java.lang.String oakPath)
        Description copied from interface: PathMapper
        Returns the JCR path for the given Oak path. The given path is expected to have come from a valid Oak repository that contains only valid paths whose name elements only use proper namespace mappings. If that's not the case, either a programming error or a repository corruption has occurred and an appropriate unchecked exception gets thrown.
        Specified by:
        getJcrPath in interface PathMapper
        Parameters:
        oakPath - Oak path
        Returns:
        JCR path
      • getOakPathOrThrow

        @NotNull
        public @NotNull java.lang.String getOakPathOrThrow​(java.lang.String jcrPath)
                                                    throws RepositoryException
        Returns the Oak path for the given JCR path, or throws a RepositoryException if the path can not be mapped.
        Parameters:
        jcrPath - JCR path
        Returns:
        Oak path
        Throws:
        RepositoryException - if the path can not be mapped
      • getOakPathOrThrowNotFound

        @NotNull
        public @NotNull java.lang.String getOakPathOrThrowNotFound​(java.lang.String jcrPath)
                                                            throws PathNotFoundException
        Returns the Oak path for the given JCR path, or throws a PathNotFoundException if the path can not be mapped.
        Parameters:
        jcrPath - JCR path
        Returns:
        Oak path
        Throws:
        PathNotFoundException - if the path can not be mapped
      • getAccessManager

        @NotNull
        public @NotNull AccessManager getAccessManager()
      • getSecurityProvider

        @NotNull
        public @NotNull SecurityProvider getSecurityProvider()