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 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 own = runOwner();
40 boolean log = runLogin();
41 boolean acc = runAccount();
43 System.out.println(" Admin: "+adm+
52 private static boolean runAdmin() {
54 Remote remoteObject = new AdminManager();
55 String authService = "rmi://localhost:9999//AdM";
56 Naming.rebind(authService, remoteObject);
58 } catch (Exception e) {
59 System.out.println(e.toString());
64 private static boolean runAccount() {
66 Remote remoteObject = new AccountManager();
67 String authService = "rmi://localhost:9999//AcM";
68 Naming.rebind(authService, remoteObject);
70 } catch (Exception e) {
71 System.out.println(e.toString());
76 private static boolean runBooking() {
78 Remote remoteBooking = new BookingManager();
79 String authService = "rmi://localhost:9999//BoM";
80 Naming.rebind(authService, remoteBooking);
82 } catch (Exception e) {
83 System.out.println(e.toString());
89 private static boolean runHouse() {
91 Remote remoteHouse = new HouseManager();
92 String authService = "rmi://localhost:9999//HoM";
93 Naming.rebind(authService, remoteHouse);
95 } catch (Exception e) {
96 System.out.println(e.toString());
102 private static boolean runLogin() {
104 Remote remoteLogin = new LoginManager();
105 String authService = "rmi://localhost:9999//LoM";
106 Naming.rebind(authService, remoteLogin);
108 } catch (Exception e) {
109 System.out.println(e.toString());
115 private static boolean runOffer() {
117 Remote remoteOffer = new OfferManager();
118 String authService = "rmi://localhost:9999//OfM";
119 Naming.rebind(authService, remoteOffer);
121 } catch (Exception e) {
122 System.out.println(e.toString());
128 private static boolean runOwner() {
130 Remote remoteOwner = new OwnerManager();
131 String authService = "rmi://localhost:9999//OwM";
132 Naming.rebind(authService, remoteOwner);
134 } catch (Exception e) {
135 System.out.println(e.toString());