
Structure of the EMail Client
The eMail client realizes its user interface from markup describing its main
view hierarchy in eNode UI Markup Language.
It invokes a web service using a controller defined as a simple JavaBean™ class.
To minimize the number of object interconnections, the controller object does
not directly deal with the presentation components in the view. Instead, it defers
that task to a mediator defined by another JavaBean class. (See
Mediator Pattern in Gamma, et al.)
The controller activates a SOAP-based web service by sending a message to a
service endpoint through a simple wrapper object for
the operation. This is illustrated in the following figure:

As usual, we first present the markup, followed by the code for the JavaBean classes.
Markup for the EMail Client
The markup for the email client starts with a
reserve element that contains an
object element describing the controller class
com.enode.xalt.services.EMailer, followed by standard edit actions,
and the main menu bar for the email client. The
reserve element is followed by a
frame element that constitutes the root of the
view hierarchy.
The emailer object is configured with two
bean properties. The
mediator property describes the object that manages
presentation components in the view, and the operation property
describes various attributes of messages that the controller sends to the
service endpoint. The values for these message attributes are obtained from the
WSDL Document for the EMail Service.
The Controller Class
The controller com.enode.xalt.services.EMailer is a JavaBean class that extends
javax.swing.AbstractAction.
Its actionPerformed() method activates the email web service.
The controller class also has setter and getter methods for the two bean properties, namely
mediator and operation, as indicated in the markup above.
Finally, we decided to consolidate the eMail client application by putting its
main() method directly in the controller class. You may choose to
define a separate class for the client application, if you wish. The full listing for the controller
class is shown below:
To keep the controller class simple, we have suppressed most error handling code. See how the
translation example handles errors by
displaying easily localizable user-friendly messages.
The Mediator Class
The mediator com.enode.xalt.services.EMailMediator is a simple JavaBean class
with setter and getter methods for its properties, which consist of the user interface components for the client.
It also has methods that can extract data from the user interface components.
The code for the mediator class is self-explanatory. Its full listing is shown below:
The Message Class
Finally, com.enode.xalt.services.EMail is a JavaBean class that extends
com.enode.Message, where most of the mundane message properties are set.
The code for the message class is self-explanatory. Its full listing is shown below: