Java Reference
In-Depth Information
53. System.out.println("(Note: If the CalendarImpl object does not have a file containing
Appointments,");
54. System.out.println(" this call will produce an error message. This will not affect
the example.)");
55. CalendarImpl remoteObject = new CalendarImpl();
56.
57. System.out.println();
58. System.out.println("Creating the CalendarHOPP object, which provides client-side
functionality.");
59. CalendarHOPP localObject = new CalendarHOPP();
60.
61. System.out.println();
62. System.out.println("Getting the hostname. The CalendarHOPP will handle this method
locally.");
63. System.out.println("Hostname is " + localObject.getHost());
64. System.out.println();
65.
66. System.out.println("Creating and adding appointments. The CalendarHOPP will
forward");
67. System.out.println(" these calls to the CalendarImpl object.");
68. Contact attendee = new ContactImpl("Jenny", "Yip", "Chief Java Expert", "MuchoJava
LTD");
69. ArrayList contacts = new ArrayList();
70. contacts.add(attendee);
71. Location place = new LocationImpl("Albuquerque, NM");
72. localObject.addAppointment(new Appointment("Opening speeches at annual Java Guru's
dinner",
73. contacts, place, createDate(2001, 4, 1, 16, 0),
74. createDate(2001, 4, 1, 18, 0)), createDate(2001, 4, 1, 0, 0));
75. localObject.addAppointment(new Appointment("Java Guru post-dinner Cafe time",
76. contacts, place, createDate(2001, 4, 1, 19, 30),
77. createDate(2001, 4, 1, 21, 45)), createDate(2001, 4, 1, 0, 0));
78. System.out.println("Appointments added.");
79. System.out.println();
80.
81. System.out.println("Getting the Appointments for a date. The CalendarHOPP will
forward");
82. System.out.println(" this call to the CalendarImpl object.");
83. System.out.println(localObject.getAppointments(createDate(2001, 4, 1, 0, 0)));
84. }
85.
86. public static Date createDate(int year, int month, int day, int hour, int minute){
87. dateCreator.set(year, month, day, hour, minute);
88. return dateCreator.getTime();
89. }
90. }
 
Search WWH ::




Custom Search