OSID Logo
OSID Specifications
osid package
Version 3.0.0
Release Candidate Preview
Interfaceosid.OsidSession
Description

The OsidSession is the top level interface for all OSID sessions. An OsidSession is created through its corresponding OsidManager. A new OsidSession should be created for each user of a service and for each processing thread. A session maintains a single authenticated user and is not required to ensure thread-protection. A typical OSID session defines a set of service methods corresponding to some compliance level as defined by the service and is generally responsible for the management and retrieval of OsidObjects.

OsidSession defines a set of common methods used throughout all OSID sessions. An OSID session may optionally support transactions through the transaction interface.

MethodgetLocale
Description

Gets the locale indicating the localization preferences in effect for this session.

Returnosid.locale.Localethe locale
CompliancemandatoryThis method must be implemented.
MethodisAuthenticated
Description

Tests if an agent is authenticated to this session.

Returnboolean true if valid authentication credentials exist, false otherwise
CompliancemandatoryThis method must be implemented.
MethodgetAuthenticatedAgentId
Description

Gets the Id of the agent authenticated to this session. This is the agent for which credentials are used either acquired natively or via an OsidProxyManager.

Returnosid.id.Idthe authenticated agent Id
ErrorsILLEGAL_STATE isAuthenticated() is false
CompliancemandatoryThis method must be implemented.
MethodgetAuthenticatedAgent
Description

Gets the agent authenticated to this session. This is the agent for which credentials are used either acquired natively or via an OsidProxyManager.

Returnosid.authentication.Agentthe authenticated agent
ErrorsILLEGAL_STATE isAuthenticated() is false
OPERATION_FAILEDunable to complete request
CompliancemandatoryThis method must be implemented.
MethodgetEffectiveAgentId
Description

Gets the Id of the effective agent in use by this session. If isAuthenticated() is true, then the effective agent may be the same as the agent returned by getAuthenticatedAgent(). If isAuthenticated() is false, then the effective agent may be a default agent used for authorization by an unknwon or anonymous user.

Returnosid.id.Idthe effective agent
CompliancemandatoryThis method must be implemented.
MethodgetEffectiveAgent
Description

Gets the effective agent in use by this session. If isAuthenticated() is true, then the effective agent may be the same as the agent returned by getAuthenticatedAgent(). If isAuthenticated() is false, then the effective agent may be a default agent used for authorization by an unknwon or anonymous user.

Returnosid.authentication.Agentthe effective agent
ErrorsOPERATION_FAILEDunable to complete request
CompliancemandatoryThis method must be implemented.
MethodgetDate
Description

Gets the service date which may be the current date or the effective date in which this session exists.

Returntimestampthe service date
CompliancemandatoryThis method must be implemented.
MethodgetClockRate
Description

Gets the rate of the service clock.

Returndecimalthe clock rate
CompliancemandatoryThis method must be implemented.
MethodgetFormatType
Description

Gets the DisplayText format Type preference in effect for this session.

Returnosid.type.Typethe effective DisplayText format Type
CompliancemandatoryThis method must be implemented.
MethodsupportsTransactions
Description

Tests for the availability of transactions.

Returnboolean true if transaction methods are available, false otherwise
CompliancemandatoryThis method must be implemented.
MethodstartTransaction
Description

Starts a new transaction for this sesson. Transactions are a means for an OSID to provide an all-or-nothing set of operations within a session and may be used to coordinate this service from an external transaction manager. A session supports one transaction at a time. Starting a second transaction before the previous has been committed or aborted results in an ILLEGAL_STATE error.

Returnosid.transaction.Transactiona new transaction
ErrorsILLEGAL_STATEa transaction is already open
OPERATION_FAILEDunable to complete request
UNSUPPORTEDtransactions not supported
ComplianceoptionalThis method must be implemented if supportsTransactions() is true.
Provider Notes

Ideally, a provider that supports transactions should guarantee atomicity, consistency, isolation and durability in a 2 phase commit process. This is not always possible in distributed systems and a transaction provider may simply allow for a means of processing bulk updates.

To maximize interoperability, providers should honor the one-transaction-at-a-time rule.