Yurttas/PL/OOL/Java/F/08/01/01/00/PhoneBookRMIApplet00.java
Jump to navigation
Jump to search
1/**
2 * Copyright(C) 1999
3 * All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
4 *
5 * Permission to use, copy, modify, and distribute this
6 * software and its documentation for EDUCATIONAL purposes
7 * and without fee is hereby granted provided that this
8 * copyright notice appears in all copies.
9 *
10 * @date : July 1, 1999.
11 * @author : Salih Yurttas.
12 */
13
14
15import java.rmi.*;
16
17import java.applet.*;
18
19import java.awt.*;
20
21public class PhoneBookRMIApplet00 extends Applet {
22
23 static final int N = 256;
24
25 private static String[] name = new String[N];
26 private static String[] phone = new String[N];
27
28 private static int count = 0;
29
30 private static String servername;
31 private static PhoneBookRMIServerInterface00 server;
32 private static PhoneBookAppletInterface pBAI;
33
34 public void init() {
35 try {
36 servername = this.getParameter("server");
37
38 if(System.getSecurityManager()==null)
39 System.setSecurityManager(new RMISecurityManager());
40
41 server = (PhoneBookRMIServerInterface00)Naming.lookup("//"+
42 servername+
43 "/PhoneBookRMIServer00");
44
45 name = server.getNames();
46 phone = server.getPhones();
47 count = name.length;
48
49 pBAI = new PhoneBookAppletInterface(name,
50 phone,
51 count);
52 add(pBAI);
53 }
54 catch(Exception e) {
55 e.printStackTrace();
56 }
57 }
58
59}