Defining how a recorder can record a client

All recorders cannot record all clients. The framework must be notified that a recorder can record a client. In many cases, the recorder must configure a client before recording, and then undo these configuration actions when the client is closed. In these cases, you can declare a client decorator. A client decorator is a class that configures a client so that it can be recorded by a recorder.

To declare that a recorder can record a client:

To implement a client decorator, define an implementation of the class.

The implementation has two main methods: decorate() and undecorate(). The decorate() method is called when the recorder starts running, but before the client is launched. The undecorate() method is called after the client is closed, but before the recorder is stopped.

The decorator can interact with the recorder delegate and the client delegate by setting or getting properties from them. The methods for doing so are available in the decorator context. The client and the recorder must support the properties.

Typically, you extend the BaseClientDecorator class rather than directly implementing the IClientDecorator class. The base abstract class provides a basic behavior for most methods. With that class, you can override specifically those methods that you must override.