The Java Program: IdentityRemoteObject.java

  1 import Identifiable;
  2 import java.net.InetAddress;
  3 import java.net.UnknownHostException;
  4 import java.rmi.server.UnicastRemoteObject;
  5 import java.rmi.RemoteException;
  6 import java.util.Date;
  7 
  8 public class IdentityRemoteObject extends UnicastRemoteObject
  9    implements Identifiable {
 10 
 11    protected String user;
 12    protected String host;
 13    public IdentityRemoteObject () throws RemoteException {
 14       user = System.getProperty ("user.name");
 15       try {
 16          host = InetAddress.getLocalHost().getHostName();
 17       } catch (UnknownHostException e) {
 18          host = "(unknown)";
 19       }
 20    }
 21 
 22    public String getUser () throws RemoteException { return user; }
 23    public String getHost () throws RemoteException { return host; }
 24    public Date   getDate () throws RemoteException { return new Date(); }
 25 
 26 }