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 Detail

      • login

        @NotNull ContentSession login​(@Nullable
                                      @Nullable Credentials credentials,
                                      @Nullable String workspaceName)
                               throws LoginException,
        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 {
        credentials - access credentials, or null
        workspaceName - The workspace name or null if the default workspace should be used.
        authenticated repository session
        LoginException - if authentication failed
        NoSuchWorkspaceException - if the specified workspace name is invalid.
      • getDescriptors

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