Package org.apache.jackrabbit.oak.core
Class ContentRepositoryImpl
- java.lang.Object
-
- org.apache.jackrabbit.oak.core.ContentRepositoryImpl
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ContentRepository
public class ContentRepositoryImpl extends Object implements ContentRepository, Closeable
NodeStore
-based implementation of theContentRepository
interface.
-
-
Constructor Summary
Constructors Constructor Description ContentRepositoryImpl(@NotNull NodeStore nodeStore, @NotNull CommitHook commitHook, @NotNull String defaultWorkspaceName, QueryEngineSettings queryEngineSettings, @Nullable QueryIndexProvider indexProvider, @NotNull SecurityProvider securityProvider, @Nullable Descriptors baseDescriptors, @Nullable Feature classicMove)
Creates an content repository instance based on the given, already initialized components.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected @NotNull GenericDescriptors
createDescriptors()
@NotNull Descriptors
getDescriptors()
Returns the repository descriptors which contain all or a subset of the descriptors defined inRepository
.@NotNull ContentSession
login(Credentials credentials, String workspaceName)
Authenticates a user based on the given credentials or available out-of-band information and, if successful, returns aContentSession
instance for accessing repository content inside the specified workspace as the authenticated user.
-
-
-
Constructor Detail
-
ContentRepositoryImpl
public ContentRepositoryImpl(@NotNull @NotNull NodeStore nodeStore, @NotNull @NotNull CommitHook commitHook, @NotNull @NotNull String defaultWorkspaceName, QueryEngineSettings queryEngineSettings, @Nullable @Nullable QueryIndexProvider indexProvider, @NotNull @NotNull SecurityProvider securityProvider, @Nullable @Nullable Descriptors baseDescriptors, @Nullable @Nullable Feature classicMove)
Creates an content repository instance based on the given, already initialized components.- Parameters:
nodeStore
- the node store this repository is based upon.commitHook
- the hook to use for processing commitsdefaultWorkspaceName
- the default workspace name;indexProvider
- index providersecurityProvider
- The configured security provider.baseDescriptors
- the base descriptors.classicMove
- optional feature flag to use classic move implementation.
-
-
Method Detail
-
login
@NotNull public @NotNull ContentSession login(Credentials credentials, String workspaceName) throws LoginException, NoSuchWorkspaceException
Description copied from interface:ContentRepository
Authenticates a user based on the given credentials or available out-of-band information and, if successful, returns aContentSession
instance for accessing repository content inside the specified workspace as the authenticated user.TODO clarify workspace handling once multiple workspaces are supported. See OAK-118.
The exact type of access credentials is undefined, as this method simply acts as a generic messenger between clients and pluggable login modules that take care of the actual authentication. See the documentation of relevant login modules for the kind of access credentials they expect.
The client must explicitly
Closeable.close()
the returned session once it is no longer used. The recommended access pattern is:ContentRepository repository = ...; ContentSession session = repository.login(...); try { ...; // Use the session } finally { session.close(); }
- Specified by:
login
in interfaceContentRepository
- Parameters:
credentials
- access credentials, ornull
workspaceName
- The workspace name ornull
if the default workspace should be used.- Returns:
- authenticated repository session
- Throws:
LoginException
- if authentication failedNoSuchWorkspaceException
- if the specified workspace name is invalid.
-
getDescriptors
@NotNull public @NotNull Descriptors getDescriptors()
Description copied from interface:ContentRepository
Returns the repository descriptors which contain all or a subset of the descriptors defined inRepository
.- Specified by:
getDescriptors
in interfaceContentRepository
- Returns:
- the repository descriptors
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
createDescriptors
@NotNull protected @NotNull GenericDescriptors createDescriptors()
-
-