6.1.1 Repository

The naming service lookup (or whatever mechanism is used) will return an object implementing the Repository interface.

javax.jcr.
Repository

Session

login(Credentials credentials,
String workspaceName)

Authenticates the user using the supplied credentials. If workspaceName is recognized as the name of an existing workspace in the repository and authorization to access that workspace is granted, then a new Session object is returned. The format of the string workspaceName depends upon the implementation.

If credentials is null, it is assumed that authentication is handled by a mechanism external to the repository itself (for example, through the JAAS framework) and that the repository implementation exists within a context (for example, an application server) that allows it to handle authorization of the request for access to the specified workspace. See 8.4 Access Control for more details.

If workspaceName is null, a default workspace is automatically selected by the repository implementation. This may, for example, be the “home workspace” of the user whose credentials were passed, though this is entirely up to the configuration and implementation of the repository. Alternatively, this may be a “null workspace” that serves only to provide the method Workspace.getAccessibleWorkspaceNames, allowing the client to select from among available “real” workspaces (see 6.2.2 Workspace Read Methods).

If authentication or authorization for the specified workspace fails, a LoginException is thrown.

If workspaceName is not recognized, a NoSuchWorkspaceException is thrown.

A RepositoryException is thrown if another error occurs.

Session

login(Credentials credentials)

Equivalent to login(credentials, null).

Session

login(String workspaceName)

Equivalent to login(null, workspaceName).

Session

login()

Equivalent to login(null, null).

String[]

getDescriptorKeys()

Returns a string array holding all descriptor keys available for this implementation. This set must contain at least the built-in keys defined by the string constants in this interface (see below). Used in conjunction with Repository.getDescriptor(String name) to query information about this repository implementation.

String

getDescriptor(String key)

Returns the descriptor for the specified key. Used to query information about this repository implementation. The set of available keys can be found by calling getDescriptorKeys. If the specified key is not found, null is returned.