package edu.gac.max.movies.dummy; import java.rmi.RemoteException; import java.rmi.UnexpectedException; import java.rmi.server.UnicastRemoteObject; import java.sql.Connection; import java.net.URLEncoder; import edu.gac.max.movies.Store; import edu.gac.max.movies.Movie; public class StoreImpl extends UnicastRemoteObject implements Store { private String name; // probably other state, e.g. a prepared statement public StoreImpl(Connection con, String name, int id) throws RemoteException { this.name = name; // other initialization } public String getName() throws RemoteException { return name; } public Movie[] getMoviesInStockContaining(String actor) throws RemoteException { java.util.Vector v = new java.util.Vector(); // a real version would get titles, years from database String title = "Casablanca"; int year = 1942; String url = "http://us.imdb.com/Title?" + URLEncoder.encode(title + " (" + year + ")"); v.addElement(new Movie(title, url)); Movie[] array = new Movie[v.size()]; v.copyInto(array); return array; } }