15.3. The Message
In this library system, the underlying mechanism for communication is the Message. A Message contains a header with a message identifier, and parameter values or response values corresponding to the message type. Each operation performed by a print client or a release station client is transformed into one or more Messages that are sent to the central server. The server responds to each Message with a Message back to the client. The client takes action appropriate to the operation and the response. It might display information on the GUI, report an error, or continue to send other Messages. Messages are transmitted between the two systems in text ("To Text or Not to Text"). The Message class has a well-defined interface ("Create Interface Contracts") and looks like this:
class Message ComputerID computer_id UserID user_id Timestamp timestamp abstract Integer get_message_type_id( ) abstract convert_from_text(String text) abstract String convert_to_text( ) abstract Message handle( )
computer_id identifies the source of the message. user_id identifies the user at the client. timestamp is used for logging and tracking purposes. The convert_from_text( ) and convert_to_text( ) methods convert the attributes in derived Messages to and from text. The handle( ) method processes the message. get_message_type_id( ) returns the type identifier assigned to each message type.
15.3.1. Particular Messages
Every message is derived from Message and includes the attributes for ...
Get Prefactoring now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.