Package edu.pdx.cs410J.rmi
Class MovieDatabaseImpl
java.lang.Object
edu.pdx.cs410J.rmi.MovieDatabaseImpl
- All Implemented Interfaces:
MovieDatabase,Remote
This class provides an implementation of the remote
MovieDatabase interface. Note that this class does not extened
UnicastRemoteObject. Therefore, we have to invoke UnicastRemoteObject.exportObject(java.rmi.Remote) in the constructor.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classA comparator that sorts movies based on the year in which they were released. -
Field Summary
Fields inherited from interface edu.pdx.cs410J.rmi.MovieDatabase
RMI_OBJECT_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongcreateMovie(String title, int year) Creates a newMovieobject on the server.voiddeleteMovie(long movieId) executeQuery(Query query, Comparator<Movie> sorter) Performs a query on the database.getFilmography(long actorId) Returns the movie in which a given actor acted.getMovie(long id) Returns theMoviewith the given id.Returns all of the movies in the databasestatic voidThis main program registers an instance of MovieDatabaseImpl in an RMI registry.voidnoteCharacter(long movieId, String character, long actorId) Makes note of a character in a given movie played by a given actor.voidshutdown()Unregisters thisMovieDatabaseImplwith the RMI registry.
-
Constructor Details
-
MovieDatabaseImpl
public MovieDatabaseImpl()Creates a newMovieDatabaseImpl.
-
-
Method Details
-
createMovie
Creates a newMovieobject on the server. It returns the id of the movie that was created.- Specified by:
createMoviein interfaceMovieDatabase- Parameters:
title- The title of the movieyear- The year in which the movie was released
-
getMovie
Returns theMoviewith the given id.- Specified by:
getMoviein interfaceMovieDatabase
-
noteCharacter
Makes note of a character in a given movie played by a given actor.- Specified by:
noteCharacterin interfaceMovieDatabase- Throws:
IllegalArgumentException- There is no movie withmovieIdor the character is already played by someone else
-
getFilmography
Returns the movie in which a given actor acted. The movies are sorted by release date.- Specified by:
getFilmographyin interfaceMovieDatabase
-
executeQuery
Performs a query on the database. The movies that match the query are sorted using the given comparator.- Specified by:
executeQueryin interfaceMovieDatabase
-
shutdown
Unregisters thisMovieDatabaseImplwith the RMI registry.- Specified by:
shutdownin interfaceMovieDatabase- Throws:
RemoteException
-
getMovies
Description copied from interface:MovieDatabaseReturns all of the movies in the database- Specified by:
getMoviesin interfaceMovieDatabase
-
deleteMovie
- Specified by:
deleteMoviein interfaceMovieDatabase
-
main
This main program registers an instance of MovieDatabaseImpl in an RMI registry.
-