Runtime components : Core components : Contexts : Concept : How contexts work
  
How contexts work
The following is a description of how the system uses contexts:
1 When the application starts, it creates a runtime context tree containing upper level contexts such as the root context, branch context (for a banking application), and workstation context. The toolkit may use definitions contained in the context definition file to construct the context tree. If you use a context definition file, remember that its references are by name. The toolkit searches for the first context with a matching name in the runtime context hierarchy and adds the contexts defined in the file to this node in the tree.
2 The application can dynamically chain new contexts to these upper level contexts when needed. This builds the context tree and is the preferred method for adding lower level contexts. For example, when a user logs onto the system, the application creates a user context to contain the user's resources and chains it to one of the upper level contexts.
3 When the application creates a context for a client such as a workstation, it updates the session table to maintain the relationship between the client/server session and the specific context instance.
4 When an application needs to perform a service or process in the Business Logic layer, it starts an invoker for that service or process. The invoker obtains the data for the service or process request by searching in the context chain for the data for the service or process. The toolkit starts the search in a lower level context. For example, if a user makes a deposit request in the GUI, a deposit request context to hold the deposit data such as the amount and currency of the deposit. This context is a low level context chained to a user or workstation context. If the named resource is not in the low level context, the toolkit then searches in its parent context. The toolkit continues to search in the chain until it either finds the resource or it cannot find the resource in the chain. If this occurs, the toolkit throws a DSEObjectNotFoundException.
5 The invoker formats the data into a WSIF message. The invoker send the WSIF message to the Business Logic layer.
6 When the invoker receives the response, it unformats the response data back into the context hierarchy.
7 The application unchains contexts when appropriate. For example, when a user logs off a workstation, the application unchains the user context from its parent workstation context. (As part of the process of unchaining a context, its child contexts are removed.)
See also
Concept