Java Reference
In-Depth Information
public void setForecast(String f)
throws RemoteException {
forecast = f;
}
public String getLocation()
throws RemoteException {
if (location != null) {
return location;
}
else {
return "";
}
}
public String getForecast()
throws RemoteException {
if (forecast != null) {
return forecast;
}
else {
return "";
}
}
}
Pretty simple stuff, except for two key differences between this class and a generic
container class for data: the declaration imports
java.rmi
, and each of the accessors and
mutators can throw
java.rmi.RemoteException
. When implementing a remotable class, all
of its methods may throw
java.rmi.RemoteException
, because the class implementation
may actually be a remote stub provided by the IXC registry and may be unable to com-
municate with the actual instance of the class.
As I previously stated, the entire
java.rmi
class hierarchy is
not
available to Xlets
running atop the PBP. Instead, the PBP requires only the following RMI classes:
•
java.rmi.Remote
: Used to indicate a remotable class
•
java.rmi.AccessException
: Thrown to indicate that the caller of a remote object
does not have permission to perform the requested action
•
java.rmi.AlreadyBoundException
: Thrown if you attempt to bind an object to the
registry to a name that has already been bound to another object