Class OsidContext

Description

<p>

OsidContext holds contextual information that is shared by the application and the OSID implementations it uses. The osid package has some design constraints that create the need for OsidContext. They are:

  • OSIDs must work with all frameworks.
  • OSID implementations are independent of each other.

These design constraints mean that there this no obvious place to put global information. The OsidContext argument of the OsidLoader.getManager method is intended to provide access to information that is global to an application and the OSID implementations that it loads. OsidContext can hold and retrieve context. The only requirement is that the information is serializable. There are OsidContext methods to get and assign context. </p>

<p> With few exceptions OSID objects are interfaces and not classes. The use of interfaces in the definition of OSID objects has some important characteristics:

  • There is no OSID framework for storing contextual (global) information.
  • The OSID implementation developer can define OSID objects by implementing the OSID interface and extending a framework class.
  • Contextual (global) information can only be communicated when the application loads an implementation.

These characteristics of OSIDs and the need to provide sharable contextual (global) information led to the definition of OsidContext. An application is responsible for supplying a valid OsidContext instance when it loads an OSID implementation using the OsidLoader.getManager method. This approach provides all the benefits and limitations of any system of global data. </p>

<p> OsidContext uses an unambiguous String as a key to assign the serializable context information. To retrieve the contextual information from the OsidContext the getContext method is called with the key. </p>

<p> OSID Version: 2.0 </p>

<p> Licensed under the org.osid.SidImplementationLicenseMIT. </p>

Located in /harmoni/oki2/osid/OsidContext.php (line 69)

stdClass
   |
   --OsidContext
Method Summary
OsidContext OsidContext ()
void assignContext (string $key, object mixed $context)
object mixed getContext (mixed $key, string $key )
Methods
Constructor OsidContext (line 135)

Constructor

OsidContext OsidContext ()
assignContext (line 87)

Assign the context of the OsidContext. Context is associated with an unambiguous key, for example the context's fully qualified class name.

There is only one context asscociated with a particular key. If a context already exists for this key, that context is overwritten.

  • access: public
  • throws: object OsidException An exception with one of the following messages defined in org.osid.OsidException: NULL_ARGUMENT
void assignContext (string $key, object mixed $context)
  • string $key
  • object mixed $context: (original type: java.io.Serializable)
getContext (line 118)

Get the context associated with this key. If the key is unknown, null is returned.

  • return: (original type: java.io.Serializable)
  • access: public
  • throws: object OsidException An exception with one of the following messages defined in org.osid.OsidException: NULL_ARGUMENT
object mixed getContext (mixed $key, string $key )
  • string $key

Documentation generated on Wed, 19 Sep 2007 10:25:24 -0400 by phpDocumentor 1.3.0RC3