001package headfirst.proxy.gumball;
002
003import java.rmi.RemoteException;
004
005public class GumballMonitor {
006        GumballMachineRemote machine;
007
008        public GumballMonitor(GumballMachineRemote machine) {
009                this.machine = machine;
010        }
011
012        public void report() {
013                try {
014                        System.out.println("Gumball Machine: " + machine.getLocation());
015                        System.out.println("Current inventory: " + machine.getCount() + " gumballs");
016                        System.out.println("Current state: " + machine.getState());
017                } catch (RemoteException e) {
018                        e.printStackTrace();
019                }
020        }
021}