Interface ContentRepository
-
- All Known Implementing Classes:
ContentRepositoryImpl
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 thelogin(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 inRepository
.@NotNull ContentSession
login(@Nullable Credentials credentials, @Nullable 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.
-
-
-
Method Detail
-
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 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(); }
- 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 @NotNull Descriptors getDescriptors()
Returns the repository descriptors which contain all or a subset of the descriptors defined inRepository
.- Returns:
- the repository descriptors
-
-