next Implementation and other Engineering Considerations
up Design Patterns
previous The Singleton
  Contents
PDF version   PostScript version

The Template Method

Figure 4.2: The Template Method pattern
 
The Message class encapsulates the data (e.g. DOM tree) and the necessary operations to build a generic SOAP message. Its subclasses ReqMsg and RespMsg extend both its knowledge and behaviour to reflect the singular aspects of both request and response message types.
Because the doContent() abstract method of the base class does not as such provide any default implementation, both subclasses must implement it, providing the behaviour necessary to build the actual content of the message. This behaviour is specific to a message type.
The build method of the base class is invoked to create the SOAP header and part of the SOAP body. It then calls the relevant implementation of doContent() to complete the message.

next Implementation and other Engineering Considerations
up Design Patterns
previous The Singleton
  Contents

Copyright © 2001 Jean-Marc Rosengard