Class SessionContext
- java.lang.Object
-
- org.apache.jackrabbit.oak.jcr.session.SessionContext
-
- All Implemented Interfaces:
NameMapper
,NamePathMapper
,PathMapper
public class SessionContext extends 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.).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.jackrabbit.oak.namepath.NamePathMapper
NamePathMapper.Default
-
-
Field Summary
-
Fields inherited from interface org.apache.jackrabbit.oak.namepath.NamePathMapper
DEFAULT
-
-
Constructor Summary
Constructors Constructor Description SessionContext(@NotNull Repository repository, @NotNull StatisticManager statisticManager, @NotNull SecurityProvider securityProvider, @NotNull Whiteboard whiteboard, @NotNull Map<String,Object> attributes, @NotNull SessionDelegate delegate, int observationQueueLength, CommitRateLimiter commitRateLimiter)
SessionContext(@NotNull Repository repository, @NotNull StatisticManager statisticManager, @NotNull SecurityProvider securityProvider, @NotNull Whiteboard whiteboard, @NotNull Map<String,Object> attributes, @NotNull SessionDelegate delegate, int observationQueueLength, CommitRateLimiter commitRateLimiter, MountInfoProvider mountInfoProvider, @Nullable BlobAccessProvider blobAccessProvider, @Nullable SessionQuerySettings sessionQuerySettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SessionImpl
createSession()
Factory method for creating theSession
instance for this context.protected WorkspaceImpl
createWorkspace()
Factory method for creating theWorkspace
instance for this context.@NotNull AccessControlManager
getAccessControlManager()
@NotNull AccessManager
getAccessManager()
Map<String,Object>
getAttributes()
@NotNull BlobAccessProvider
getBlobAccessProvider()
@NotNull CounterStats
getCount(RepositoryStatistics.Type type)
boolean
getFastQueryResultSize()
@NotNull String
getJcrName(@NotNull String oakName)
Returns the JCR name for the given Oak name.@NotNull String
getJcrPath(String oakPath)
Returns the JCR path for the given Oak path.@NotNull MeterStats
getMeter(RepositoryStatistics.Type type)
@Nullable MountInfoProvider
getMountInfoProvider()
@NotNull String
getOakName(@NotNull String jcrName)
Returns the Oak name for the specified JCR name.@Nullable String
getOakNameOrNull(@NotNull String jcrName)
Returns the Oak name for the given JCR name, ornull
if no such mapping exists because the given JCR name contains an unknown namespace URI or prefix, or is otherwise invalid.@Nullable String
getOakPath(String jcrPath)
Returns the Oak path for the given JCR path, ornull
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.@NotNull String
getOakPathOrThrow(String jcrPath)
Returns the Oak path for the given JCR path, or throws aRepositoryException
if the path can not be mapped.@NotNull String
getOakPathOrThrowNotFound(String jcrPath)
Returns the Oak path for the given JCR path, or throws aPathNotFoundException
if the path can not be mapped.@NotNull ObservationManager
getObservationManager()
Set<String>
getOpenScopedLocks()
@NotNull PrincipalManager
getPrincipalManager()
@NotNull PrivilegeManager
getPrivilegeManager()
@NotNull List<ProtectedItemImporter>
getProtectedItemImporters()
@NotNull Repository
getRepository()
@NotNull SecurityProvider
getSecurityProvider()
SessionImpl
getSession()
@NotNull SessionDelegate
getSessionDelegate()
@NotNull Map<String,String>
getSessionLocalMappings()
Returns the local namespace prefix mappings, or an empty map if there aren't any local mappings.Set<String>
getSessionScopedLocks()
@NotNull StatisticManager
getStatisticManager()
@NotNull TimerStats
getTimer(RepositoryStatistics.Type type)
@NotNull UserManager
getUserManager()
ValueFactory
getValueFactory()
WorkspaceImpl
getWorkspace()
boolean
hasEventListeners()
-
-
-
Constructor Detail
-
SessionContext
public SessionContext(@NotNull @NotNull Repository repository, @NotNull @NotNull StatisticManager statisticManager, @NotNull @NotNull SecurityProvider securityProvider, @NotNull @NotNull Whiteboard whiteboard, @NotNull @NotNull Map<String,Object> attributes, @NotNull @NotNull SessionDelegate delegate, int observationQueueLength, CommitRateLimiter commitRateLimiter)
-
SessionContext
public SessionContext(@NotNull @NotNull Repository repository, @NotNull @NotNull StatisticManager statisticManager, @NotNull @NotNull SecurityProvider securityProvider, @NotNull @NotNull Whiteboard whiteboard, @NotNull @NotNull Map<String,Object> attributes, @NotNull @NotNull SessionDelegate delegate, int observationQueueLength, CommitRateLimiter commitRateLimiter, MountInfoProvider mountInfoProvider, @Nullable @Nullable BlobAccessProvider blobAccessProvider, @Nullable @Nullable SessionQuerySettings sessionQuerySettings)
-
-
Method Detail
-
getSession
public final SessionImpl getSession()
-
getWorkspace
public final WorkspaceImpl getWorkspace()
-
createSession
protected SessionImpl createSession()
Factory method for creating theSession
instance for this context. Called bygetSession()
when first accessed. Can be overridden by subclasses to customize the session implementation.- Returns:
- session instance
-
createWorkspace
protected WorkspaceImpl createWorkspace()
Factory method for creating theWorkspace
instance for this context. Called bygetWorkspace()
when first accessed. Can be overridden by subclasses to customize the workspace implementation.- Returns:
- session instance
-
getStatisticManager
@NotNull public @NotNull StatisticManager getStatisticManager()
-
getMeter
@NotNull public @NotNull MeterStats getMeter(RepositoryStatistics.Type type)
-
getTimer
@NotNull public @NotNull TimerStats getTimer(RepositoryStatistics.Type type)
-
getCount
@NotNull public @NotNull CounterStats getCount(RepositoryStatistics.Type type)
-
getRepository
@NotNull public @NotNull Repository getRepository()
-
getSessionDelegate
@NotNull public @NotNull SessionDelegate getSessionDelegate()
-
getSessionLocalMappings
@NotNull public @NotNull Map<String,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 interfaceNameMapper
- Returns:
- local namespace prefix to URI mappings
-
getValueFactory
public ValueFactory getValueFactory()
-
getAccessControlManager
@NotNull public @NotNull AccessControlManager getAccessControlManager() throws RepositoryException
- Throws:
RepositoryException
-
getPrincipalManager
@NotNull public @NotNull PrincipalManager getPrincipalManager()
-
getUserManager
@NotNull public @NotNull UserManager getUserManager()
-
getPrivilegeManager
@NotNull public @NotNull PrivilegeManager getPrivilegeManager()
-
getProtectedItemImporters
@NotNull public @NotNull List<ProtectedItemImporter> getProtectedItemImporters()
-
getObservationManager
@NotNull public @NotNull ObservationManager getObservationManager() throws UnsupportedRepositoryOperationException
-
getBlobAccessProvider
@NotNull public @NotNull BlobAccessProvider getBlobAccessProvider()
-
hasEventListeners
public boolean hasEventListeners()
-
getFastQueryResultSize
public boolean getFastQueryResultSize()
-
getMountInfoProvider
@Nullable public @Nullable MountInfoProvider getMountInfoProvider()
-
getOakName
@NotNull public @NotNull String getOakName(@NotNull @NotNull String jcrName) throws RepositoryException
Description copied from interface:NameMapper
Returns the Oak name for the specified JCR name. In contrast toNameMapper.getOakNameOrNull(String)
this method will throw aRepositoryException
if the JCR name is invalid and cannot be resolved.- Specified by:
getOakName
in interfaceNameMapper
- 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 String getOakNameOrNull(@NotNull @NotNull String jcrName)
Description copied from interface:NameMapper
Returns the Oak name for the given JCR name, ornull
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 interfaceNameMapper
- Parameters:
jcrName
- JCR name- Returns:
- Oak name, or
null
-
getJcrName
@NotNull public @NotNull String getJcrName(@NotNull @NotNull 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 interfaceNameMapper
- Parameters:
oakName
- Oak name- Returns:
- JCR name
-
getOakPath
@Nullable public @Nullable String getOakPath(String jcrPath)
Description copied from interface:PathMapper
Returns the Oak path for the given JCR path, ornull
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 interfacePathMapper
- Parameters:
jcrPath
- JCR path- Returns:
- Oak path, or
null
-
getJcrPath
@NotNull public @NotNull String getJcrPath(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 interfacePathMapper
- Parameters:
oakPath
- Oak path- Returns:
- JCR path
-
getOakPathOrThrow
@NotNull public @NotNull String getOakPathOrThrow(String jcrPath) throws RepositoryException
Returns the Oak path for the given JCR path, or throws aRepositoryException
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 String getOakPathOrThrowNotFound(String jcrPath) throws PathNotFoundException
Returns the Oak path for the given JCR path, or throws aPathNotFoundException
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()
-
-