Class ContentRepositoryImpl

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, ContentRepository

    public class ContentRepositoryImpl
    extends java.lang.Object
    implements ContentRepository, java.io.Closeable
    NodeStore-based implementation of the ContentRepository interface.
    • Constructor Detail

      • ContentRepositoryImpl

        public ContentRepositoryImpl​(@NotNull
                                     @NotNull NodeStore nodeStore,
                                     @NotNull
                                     @NotNull CommitHook commitHook,
                                     @NotNull
                                     @NotNull java.lang.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 commits
        defaultWorkspaceName - the default workspace name;
        indexProvider - index provider
        securityProvider - 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,
                                             java.lang.String workspaceName)
                                      throws javax.security.auth.login.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 a ContentSession 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 interface ContentRepository
        Parameters:
        credentials - access credentials, or null
        workspaceName - The workspace name or null if the default workspace should be used.
        Returns:
        authenticated repository session
        Throws:
        javax.security.auth.login.LoginException - if authentication failed
        NoSuchWorkspaceException - if the specified workspace name is invalid.
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException