Java Reference
In-Depth Information
} catch (Exception e) { e.printStackTrace(); }
}
}
19.6
Prototype 3: Web communication
The focus of this prototype is on the extension of the control module model
in order to provide support for multi-protocol communication.
19.6.1
Analysis
Client applications might use different technologies to access the services of
a remote control module. Web browsers use applets or active HTML pages,
mobile phones use midlets or WML pages, desktop applications visualize
data in complex graphical interfaces.
The MMI framework should allow the development of control modules
that support a variety of communication mechanisms and protocols such as
TCP Sockets and HTTP connections. The goal is to improve reusability and
versatility of control modules in order to avoid the need to implement
multiple versions of the same service for different types of client application.
19.6.2
Design
We basically need to find a way to implement the synchronous and
asynchronous communication paradigms using different communication
mechanisms instead of Java RMI.
Decision point
How does the control module support socket-based communication?
The new solution should not affect the way control modules implement
and execute services or synchronize with remote clients. The simplest solu-
tion requires implementing a specific activity that acts as a bridge between
the RMI mechanism used by the control modules and the Socket mechanism
used by remote clients. Figure 19.8 depicts the class diagram that describes
two new framework components: class DSocketListener , class DParserInterface ,
and class DParser . Class MyParser extends DParser
Class DSocketListener extends DActivity and is in charge of listening to
incoming service requests on a specific port. Every control module should
activate an instance of this service in order to provide clients with a socket
access to its services. When a connection request is received, the
DSocketListener object creates an instance of class DSocketActivity , which
implements method update() of the DObserver interface. It delegates a
 
Search WWH ::




Custom Search