These services implement the same interface as the real services, and the application refers to them using this interface (and not their class names), so that it is possible to exchange dummy services for real services by changing the entity definition files without modifying the application itself.
The com.ibm.dse.samples.comms.DummyLu0SnaSession class implements a dummy host service which acts as a real notifier that raises a host response event. This event is used by the server operation, which registers as a listener for that event.
When the operation flow wants to send the contents of the host output buffer, it registers a handler for the response event, sends the buffer contents to the dummy host service, and then waits for a semaphore to be cleared before proceeding.
For simulating a real host, the dummy host service launches a thread to simulate an asynchronous process. Optionally it may display a message box after displaying a message showing the contents of its receive buffer. During this process, a simulated host message is read from a file as if it were received from a real host. The file name and path are specified when the dummy service is defined in the Workbench (in this sample, this is defined as c:\dse\server\response.res). After reading the message, the service signals the corresponding reply event. When the handler registered by the operation gets the event and control, the operation unregisters the handler for that event and clears the internal semaphore.
When the process (the operation flow) waiting for the semaphore to be cleared regains control, it performs a receive method against the dummy host service and unformats the contents of the receive buffer into the context.
The dummy journal is implemented in the DummyJournal class. It receives a formatted record but does nothing.
The rest of this section describes the process you would follow if you were writing a new service or adapting an existing service as part of your application.