Java Reference
In-Depth Information
Implementing the Service Using Java SE
The service itself is the
LocationImpl
class, which provides a concrete implementation of
the
Location
interface with help from the
UnicastRemoteObject
, as shown in Listing 11-2.
Listing 11-2.
The LocationImpl Class
public class LocationImpl
extends
java.rmi.server.UnicastRemoteObject
implements
Location {
private String location;
private String forecast;
public LocationImpl()
throws java.rmi.RemoteException {
super();
}
public String getLocation()
throws java.rmi.RemoteException {
if (location != null) {
return location;
} else {
return "";
}
}
public void setLocation(String l)
throws java.rmi.RemoteException {
location = l;
}
public String getForecast()
throws java.rmi.RemoteException {
if (forecast != null) {
return forecast;
} else {
return "";
}
}