public interface OsidSession extends OsidSession, java.io.Closeable
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.
Modifier and Type | Method and Description |
---|---|
Agent |
getAuthenticatedAgent()
Gets the agent authenticated to this session.
|
Id |
getAuthenticatedAgentId()
Gets the
Id of the agent authenticated to this session. |
java.math.BigDecimal |
getClockRate()
Gets the rate of the service clock.
|
java.util.Date |
getDate()
Gets the service date which may be the current date or the effective
date in which this session exists.
|
Agent |
getEffectiveAgent()
Gets the effective agent in use by this session.
|
Id |
getEffectiveAgentId()
Gets the
Id of the effective agent in use by this
session. |
Type |
getFormatType()
Gets the
DisplayText format Type
preference in effect for this session. |
Locale |
getLocale()
Gets the locale indicating the localization preferences in effect for
this session.
|
boolean |
isAuthenticated()
Tests if an agent is authenticated to this session.
|
Transaction |
startTransaction()
Starts a new transaction for this sesson.
|
boolean |
supportsTransactions()
Tests for the availability of transactions.
|
close
Locale getLocale()
mandatory
- This method must be implemented. boolean isAuthenticated()
true
if valid authentication credentials exist,
false
otherwisemandatory
- This method must be implemented. Id getAuthenticatedAgentId()
Id
of the agent authenticated to this session.
This is the agent for which credentials are used either acquired
natively or via an OsidProxyManager.
Id
IllegalStateException
- isAuthenticated()
is false
mandatory
- This method must be implemented. Agent getAuthenticatedAgent() throws OperationFailedException
OsidProxyManager.
IllegalStateException
- isAuthenticated()
is false
OperationFailedException
- unable to complete requestmandatory
- This method must be implemented. Id getEffectiveAgentId()
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.mandatory
- This method must be implemented. Agent getEffectiveAgent() throws OperationFailedException
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.OperationFailedException
- unable to complete requestmandatory
- This method must be implemented. java.util.Date getDate()
mandatory
- This method must be implemented. java.math.BigDecimal getClockRate()
mandatory
- This method must be implemented. Type getFormatType()
DisplayText
format Type
preference in effect for this session. DisplayText
format Type
mandatory
- This method must be implemented. boolean supportsTransactions()
true
if transaction methods are available,
false
otherwisemandatory
- This method must be implemented. Transaction startTransaction() throws OperationFailedException
ILLEGAL_STATE
error.IllegalStateException
- a transaction is already openOperationFailedException
- unable to complete requestUnsupportedException
- transactions not supportedoptional
- This method must be implemented if
supportsTransactions()
is true. 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.