6.2 Reading Repository Content

Reading repository content involves accessing nodes (either directly or by traversing the hierarchy step by step) and reading the values of properties.

The Session object returned by Repository.login encapsulates both the authorization settings of a particular user (as determined by the Credentials object) and a binding to the workspace specified by the workspaceName passed on login.

Each Session object is associated one-to-one with a Workspace object. The Workspace object represents a “view” of an actual repository workspace entity as seen through the authorization settings of its associated Session.

There is an important distinction between the Workspace object instance associated with a particular Session and the actual workspace entity in the repository. If multiple Sessions access a particular workspace each will have its own Workspace object, even though all of these Workspace objects may represent the same actual workspace entity in the repository. In other words, a Workspace object corresponds to a view of a particular workspace entity, and that view is determined by the Session associated with the Workspace object.

On the other hand, each Session object represents a separate session entity. Two or more Session instances can exist for the same Credentials and the same workspaceName but still have different states.

Since Session and Workspace instances are always associated one-to-one, combining them into a single object might seem logical. However, the distinction between the two objects comes into play in level 2 implementations, where writing to the repository can occur in two ways, either through transient storage (associated with the Session object) or directly to the persistent layer (associated with the Workspace object). It is primarily to differentiate these two modes of writing that the distinction between the two objects is maintained. See Transient Storage in the Session and 7.1 Writing Repository Content for more details.

In a level 1 repository the distinction between Session and Workspace objects does not play a significant role. It exists simply for the sake of compatibility with level 2.