import java.rmi.*;

/**
 * The client in an example of Java's remote method invocation
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0rmi
 */
public class ClientDriver
{

    /**
     * The entry point
     *
     * @param args  The command line arguments
     */
    public static void main(String[] args)
    {
       Course           course;       
       CourseDatabase   db;
       String           host, username;
        
       System.setProperty("java.security.policy", "database.policy");        

       try 
       {
          db = (CourseDatabase)Naming.lookup("rmi://localhost:22801/CourseDatabase");
          db.add(new Course("CS",139,"Algorithm Development"));
          db.add(new Course("CS",240,"Data Structures and Algorithms"));
          db.add(new Course("CS",349,"Developing Multimedia Content"));
          db.add(new Course("CS",462,"Network Applications Development"));
          
          course = db.get("CS",462);
          System.out.println(course.getDesignation()+"\t"+
                             course.getTitle());          

       }
       catch (Exception e) 
       {
          e.printStackTrace();
       }
    }

}
