3 import java.rmi.Naming;
4 import java.rmi.RMISecurityManager;
5 import java.rmi.Remote;
7 import businessLogic.AdminManager;
8 import businessLogic.BookingManager;
9 import businessLogic.HouseManager;
10 import businessLogic.LoginManager;
11 import businessLogic.OfferManager;
12 import businessLogic.OwnerManager;
14 public class RMILauncher {
16 public static void main(String[] args) {
17 RMILauncher.startRegistry();
18 RMILauncher.initRemoteObject();
21 private static void startRegistry() {
22 System.setProperty("java.security.policy", "java.policy");
23 System.setSecurityManager(new RMISecurityManager());
25 java.rmi.registry.LocateRegistry.createRegistry(9999);
26 } catch (Exception e) {
27 System.out.println(e.toString()
28 + "\nRMI registry was already created");
33 private static void initRemoteObject() {
34 boolean adm = runAdmin();
35 boolean bok = runBooking();
36 boolean hou = runHouse();
37 boolean off = runOffer();
38 boolean own = runOwner();
39 boolean log = runLogin();
41 System.out.println(" Admin: "+adm+
49 private static boolean runAdmin() {
51 Remote remoteObject = new AdminManager();
52 String authService = "rmi://localhost:9999//AdM";
53 Naming.rebind(authService, remoteObject);
55 } catch (Exception e) {
56 System.out.println(e.toString());
62 private static boolean runBooking() {
64 Remote remoteBooking = new BookingManager();
65 String authService = "rmi://localhost:9999//BoM";
66 Naming.rebind(authService, remoteBooking);
68 } catch (Exception e) {
69 System.out.println(e.toString());
75 private static boolean runHouse() {
77 Remote remoteHouse = new HouseManager();
78 String authService = "rmi://localhost:9999//HoM";
79 Naming.rebind(authService, remoteHouse);
81 } catch (Exception e) {
82 System.out.println(e.toString());
88 private static boolean runLogin() {
90 Remote remoteLogin = new LoginManager();
91 String authService = "rmi://localhost:9999//LoM";
92 Naming.rebind(authService, remoteLogin);
94 } catch (Exception e) {
95 System.out.println(e.toString());
101 private static boolean runOffer() {
103 Remote remoteOffer = new OfferManager();
104 String authService = "rmi://localhost:9999//OfM";
105 Naming.rebind(authService, remoteOffer);
107 } catch (Exception e) {
108 System.out.println(e.toString());
114 private static boolean runOwner() {
116 Remote remoteOwner = new OwnerManager();
117 String authService = "rmi://localhost:9999//OwM";
118 Naming.rebind(authService, remoteOwner);
120 } catch (Exception e) {
121 System.out.println(e.toString());