001package edu.pdx.cs410J.rmi; 002 003import java.rmi.*; 004import java.util.*; 005 006/** 007 * This remote interface allows a client to interact with a database 008 * of {@link Movie} objects. 009 */ 010public interface MovieDatabase extends Remote { 011 012 String RMI_OBJECT_NAME = "/MovieDatabase"; 013 014 /** 015 * Creates a new <code>Movie</code> object on the server. It 016 * returns the id of the movie that was created. 017 * 018 * @param title 019 * The title of the movie 020 * @param year 021 * The year in which the movie was released 022 */ 023 long createMovie(String title, int year) 024 throws RemoteException; 025 026 /** 027 * Returns the <code>Movie</code> with the given id. 028 */ 029 Movie getMovie(long id) throws RemoteException; 030 031 /** 032 * Makes note of a character in a given movie played by a given 033 * actor. 034 * 035 * @throws IllegalArgumentException 036 * The character is already played by someone else 037 */ 038 void noteCharacter(long movieId, String character, long actorId) 039 throws RemoteException; 040 041 /** 042 * Returns the movie in which a given actor acted. The movies are 043 * sorted by release date. 044 */ 045 SortedSet<Movie> getFilmography(long actorId) 046 throws RemoteException; 047 048 /** 049 * Performs a query on the database. The movies that match the 050 * query are sorted using the given comparator. 051 */ 052 SortedSet<Movie> executeQuery(Query query, Comparator<Movie> sorter) 053 throws RemoteException; 054 055 /** 056 * Unregisters this <code>MovieDatabase</code> object with the RMI 057 * registry. Once it is unregistered, this object will no longer be 058 * accessible. 059 */ 060 void shutdown() throws RemoteException; 061 062 /** 063 * Returns all of the movies in the database 064 */ 065 Collection<Movie> getMovies() throws RemoteException; 066 067 void deleteMovie(long movieId) throws RemoteException; 068}