Java Reference
In-Depth Information
While this sounds like a lot of work, it frees you from many of the low-level details of
developing a remote application. Steps 1 and 2 are writing Java code—something you
already know how to do. The Java SE comes with the rmic compiler to perform step 3.
Step 4 is simply writing a small Java application, and step 5 you have to do anyway—your
client application is what it's all about. Step 6 can be a small task or a big task, depending
on the nature of your application and service.
Let's walk through these steps one at a time using the weather example we've visited
throughout the topic. Our WeatherApplet example for the CDC needs a source for
weather data, presumably sourced from a commercial or governmental service. In the
sections that follow, I walk you through building a remotable Location class suitable for
communicating location and weather data using RMI OP.
To implement the remotable Location object, you need to define the relationship
between the various interfaces and implementations necessary. Figure 11-3 shows the
relationship between the Location interface, the RMI OP hierarchy, and the implementa-
tion of Location , LocationImpl .
Figure 11-3. The remotable Location interface and its implementation
The Location interface—which I first introduced as a class for representing spatial
locations and weather reports for specific locations in Chapter 6—has two String proper-
ties exported as properties via the four methods getLocation , setLocation , getForecast ,
 
Search WWH ::




Custom Search