Interface ContentRepository


  • public interface ContentRepository
    Oak content repository. The repository may be local or remote, or a cluster of any size. These deployment details are all hidden behind this interface.

    All access to the repository happens through authenticated ContentSession instances acquired through the login(Credentials, String) method, which is why that is the only method of this interface.

    Starting and stopping ContentRepository instances is the responsibility of each particular deployment and not covered by this interface. Repository clients should use a deployment-specific mechanism (JNDI, OSGi service, etc.) to acquire references to ContentRepository instances.

    This interface is thread-safe.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      @NotNull Descriptors getDescriptors()
      Returns the repository descriptors which contain all or a subset of the descriptors defined in Repository.
      @NotNull ContentSession login​(@Nullable Credentials credentials, @Nullable java.lang.String workspaceName)
      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.
    • Method Detail

      • login

        @NotNull
        @NotNull ContentSession login​(@Nullable
                                      @Nullable Credentials credentials,
                                      @Nullable
                                      @Nullable java.lang.String workspaceName)
                               throws javax.security.auth.login.LoginException,
                                      NoSuchWorkspaceException
        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();
         }
         
        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.
      • getDescriptors

        @NotNull
        @NotNull Descriptors getDescriptors()
        Returns the repository descriptors which contain all or a subset of the descriptors defined in Repository.
        Returns:
        the repository descriptors