4.1 API Basics

The repository as a whole is represented by a Repository object1. A client connects to the repository by calling Repository.login optionally specifying a workspace name and a Credentials object2. The client then receives a Session object tied to the specified workspace.

How the Repository object is actually acquired is beyond the scope of this specification. However, one possibility, as shown below, is to use JNDI, though this depends entirely on the implementation. Similarly, the specifics of acquiring the Credentials object are also not specified. Below we show one possibility: using the class SimpleCredentials included in the specification. Implementations may provide their own Credentials classes as well.

// Get the Repository object

InitialContext ctx = ...

Repository repository = (Repository)ctx.lookup("myrepo");


// Get a Credentials object

Credentials credentials =
new SimpleCredentials("MyName",
"MyPassword".toCharArray());

// Get a Session

Session mySession =
repository.login(credentials, "MyWorkspace");



Through the Session object the client can access any node or property in that tree of the workspace to which the Session is tied. The API provides methods for both traversing the tree step by step and for directly accessing a particular item.