3 import java.rmi.Naming;
4 import java.rmi.RMISecurityManager;
5 import java.rmi.Remote;
7 import businessLogic.AccountManager;
8 import businessLogic.AdminManager;
9 import businessLogic.BookingManager;
10 import businessLogic.HouseManager;
11 import businessLogic.LoginManager;
12 import businessLogic.OfferManager;
13 import businessLogic.OwnerManager;
15 @SuppressWarnings("deprecation")
16 public class RMILauncher {
18 public static void main(String[] args) {
19 RMILauncher.startRegistry();
20 RMILauncher.initRemoteObject();
23 private static void startRegistry() {
24 System.setProperty("java.security.policy", "java.policy");
25 System.setSecurityManager(new RMISecurityManager());
27 java.rmi.registry.LocateRegistry.createRegistry(9999);
28 } catch (Exception e) {
29 System.out.println(e.toString()
30 + "\nRMI registry was already created");
35 private static void initRemoteObject() {
36 boolean adm = runAdmin();
37 boolean bok = runBooking();
38 boolean hou = runHouse();
39 boolean off = runOffer();
40 boolean own = runOwner();
41 boolean log = runLogin();
42 boolean acc = runAccount();
44 System.out.println(" Admin: "+adm+
53 private static boolean runAdmin() {
55 Remote remoteObject = new AdminManager();
56 String authService = "rmi://localhost:9999//AdM";
57 Naming.rebind(authService, remoteObject);
59 } catch (Exception e) {
60 System.out.println(e.toString());
65 private static boolean runAccount() {
67 Remote remoteObject = new AccountManager();
68 String authService = "rmi://localhost:9999//AcM";
69 Naming.rebind(authService, remoteObject);
71 } catch (Exception e) {
72 System.out.println(e.toString());
77 private static boolean runBooking() {
79 Remote remoteBooking = new BookingManager();
80 String authService = "rmi://localhost:9999//BoM";
81 Naming.rebind(authService, remoteBooking);
83 } catch (Exception e) {
84 System.out.println(e.toString());
90 private static boolean runHouse() {
92 Remote remoteHouse = new HouseManager();
93 String authService = "rmi://localhost:9999//HoM";
94 Naming.rebind(authService, remoteHouse);
96 } catch (Exception e) {
97 System.out.println(e.toString());
103 private static boolean runLogin() {
105 Remote remoteLogin = new LoginManager();
106 String authService = "rmi://localhost:9999//LoM";
107 Naming.rebind(authService, remoteLogin);
109 } catch (Exception e) {
110 System.out.println(e.toString());
116 private static boolean runOffer() {
118 Remote remoteOffer = new OfferManager();
119 String authService = "rmi://localhost:9999//OfM";
120 Naming.rebind(authService, remoteOffer);
122 } catch (Exception e) {
123 System.out.println(e.toString());
129 private static boolean runOwner() {
131 Remote remoteOwner = new OwnerManager();
132 String authService = "rmi://localhost:9999//OwM";
133 Naming.rebind(authService, remoteOwner);
135 } catch (Exception e) {
136 System.out.println(e.toString());