Java Reference
In-Depth Information
JApplet
GisServer
ServerSocket
Runnable
void disconnect()
void run()
GisApplet
Socket
Socket
void init()
void destroy()
void setDataRecord()
GisService
void run()
CartographicMap
void createMap()
void saveMap()
void addLayer()
void setCurrentLayer()
DBConnector
DBValueRecord getRecord()
Figure 15.12 The class diagram of the applet-based distributed system
Figure 15.12). The main class is GisServer which listens to incoming requests
on a socket port. When a connection request is received, it instantiates an
object of class GisService in order to handle the socket communication with
the remote applet. Both the GisServer class and the GisService class imple-
ment the Runnable interface. The GisService receives from the applet the ref-
erence to a database record, i.e. the name of the database, the name of a
table, the name of the key attribute and a value of the key. It queries the
database with this information, serializes the retrieved record and sends the
resulting data stream back to the applet.
The GisApplet is basically a graphical user interface that builds on class
CartographicMap . It allows the user to load a cartographic map from a list of
available maps that is initialized when the applet is loaded on the web
browser. The XML file of the selected map is retrieved directly from the file
system on the GIS web server and parsed by the applet. When the applet is
started, a socket connection is established with the GIS server. This creates
a dedicated GIS service. The applet listens to the user's mouse events to
acquire the coordinates of the selected geographic entities. The database
references bound to these entities are serialized and sent to the GIS service
in order to retrieve the associated geographic information.
15.6.3
Implementation
Classes GisServer and GisService implement the multithreaded application
server that listens to incoming requests from the remote applet, extracts the
selected record from a thematic database and sends the associated infor-
mation back to the applet.
 
Search WWH ::




Custom Search