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;
14 @SuppressWarnings("deprecation")
15 public class RMILauncher {
17 public static void main(String[] args) {
18 RMILauncher.startRegistry();
19 RMILauncher.initRemoteObject();
22 private static void startRegistry() {
23 System.setProperty("java.security.policy", "java.policy");
24 System.setSecurityManager(new RMISecurityManager());
26 java.rmi.registry.LocateRegistry.createRegistry(9999);
27 } catch (Exception e) {
28 System.out.println(e.toString()
29 + "\nRMI registry was already created");
34 private static void initRemoteObject() {
35 boolean adm = runAdmin();
36 boolean bok = runBooking();
37 boolean hou = runHouse();
38 boolean off = runOffer();
39 boolean log = runLogin();
40 boolean acc = runAccount();
42 System.out.println(" Admin: "+adm+
50 private static boolean runAdmin() {
52 Remote remoteObject = new AdminManager();
53 String authService = "rmi://localhost:9999//AdM";
54 Naming.rebind(authService, remoteObject);
56 } catch (Exception e) {
57 System.out.println(e.toString());
62 private static boolean runAccount() {
64 Remote remoteObject = new AccountManager();
65 String authService = "rmi://localhost:9999//AcM";
66 Naming.rebind(authService, remoteObject);
68 } catch (Exception e) {
69 System.out.println(e.toString());
74 private static boolean runBooking() {
76 Remote remoteBooking = new BookingManager();
77 String authService = "rmi://localhost:9999//BoM";
78 Naming.rebind(authService, remoteBooking);
80 } catch (Exception e) {
81 System.out.println(e.toString());
87 private static boolean runHouse() {
89 Remote remoteHouse = new HouseManager();
90 String authService = "rmi://localhost:9999//HoM";
91 Naming.rebind(authService, remoteHouse);
93 } catch (Exception e) {
94 System.out.println(e.toString());
100 private static boolean runLogin() {
102 Remote remoteLogin = new LoginManager();
103 String authService = "rmi://localhost:9999//LoM";
104 Naming.rebind(authService, remoteLogin);
106 } catch (Exception e) {
107 System.out.println(e.toString());
113 private static boolean runOffer() {
115 Remote remoteOffer = new OfferManager();
116 String authService = "rmi://localhost:9999//OfM";
117 Naming.rebind(authService, remoteOffer);
119 } catch (Exception e) {
120 System.out.println(e.toString());