Interface ContentRepository
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
Modifier and TypeMethodDescription@NotNull DescriptorsReturns the repository descriptors which contain all or a subset of the descriptors defined inRepository.@NotNull ContentSessionlogin(@Nullable Credentials credentials, @Nullable String workspaceName) Authenticates a user based on the given credentials or available out-of-band information and, if successful, returns aContentSessioninstance for accessing repository content inside the specified workspace as the authenticated user.
-
Method Details
-
login
@NotNull @NotNull ContentSession login(@Nullable @Nullable Credentials credentials, @Nullable @Nullable String workspaceName) throws LoginException, NoSuchWorkspaceException Authenticates a user based on the given credentials or available out-of-band information and, if successful, returns aContentSessioninstance 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, ornullworkspaceName- The workspace name ornullif the default workspace should be used.- Returns:
- authenticated repository session
- Throws:
LoginException- if authentication failedNoSuchWorkspaceException- if the specified workspace name is invalid.
-
getDescriptors
Returns the repository descriptors which contain all or a subset of the descriptors defined inRepository.- Returns:
- the repository descriptors
-