How the CHA works

Applications use static methods to manipulate context data on the server side. The static methods are factories that return a Context instance to the caller. For example, when a service or business process needs to create a remote context, the following happens:
  1. The constructor for client side context creates the CHASession EJB for the server side.
  2. The constructor calls the CHASession to get the server side context.
  3. The CHASession calls the CHAMetaData to read the external definition of the server side context.
  4. The CHASession uses the definition to create the CHAInstance EJB. The CHAInstance wraps the server side context.
  5. The CHAInstance adds its information to the database of CHAInstances.
  6. The CHASession receives the instance ID of the newly created context and passes it back to the client side context.

The following sequence diagram shows this process:

The CHA workflow

Once the client side context has the CHAInstance remote interface, the service or business process can manipulate the context information on the server side using Context instance methods. From the service or business process' point of view, the remote context is indistinguishable from a local context. For example, when a service or business process sets a value in a remote context, the following happens:

  1. The application calls the setValueAt instance method in the context and passes the new value.
  2. The context passes the new value to the remote interface of the CHAInstance EJB. This EJB contains the server side of the context.
  3. If the corresponding CHAInstance is not active, the remote interface will activate it, which then retrieves the CHAInstance (and server side context) from the CHA database.
  4. The home interface updates the specified value in the server side context.