001package edu.pdx.cs410J.rmi;
002
003import java.rmi.NotBoundException;
004import java.rmi.RemoteException;
005import java.rmi.registry.LocateRegistry;
006
007/**
008 * This program searches the remote movie database for all of the
009 * movies that a given actor has acted in.
010 */
011public class GetFilmography {
012
013  public static void main(String[] args) {
014    String host = args[0];
015    int port = Integer.parseInt(args[1]);
016    Long actor = Long.parseLong(args[2]);
017
018    try {
019      MovieDatabase db = (MovieDatabase) LocateRegistry.getRegistry(host, port).lookup(MovieDatabase.RMI_OBJECT_NAME);
020      db.getFilmography(actor).forEach(System.out::println);
021
022    } catch (RemoteException | NotBoundException ex) {
023      ex.printStackTrace(System.err);
024    }
025
026  }
027
028}