Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard
 
4f8bcc7fa6ac7640915ac3aa5e115b6d37c08a86
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package launcher;

import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.Remote;

import businessLogic.AdminManager;
import businessLogic.BookingManager;
import businessLogic.HouseManager;
import businessLogic.LoginManager;
import businessLogic.OfferManager;
import businessLogic.OwnerManager;

public class RMILauncher {

	public static void main(String[] args) {
		RMILauncher.startRegistry();
		RMILauncher.initRemoteObject();
	}

	private static void startRegistry() {
		System.setProperty("java.security.policy", "java.policy");
		System.setSecurityManager(new RMISecurityManager());
		try {
			java.rmi.registry.LocateRegistry.createRegistry(9999);
		} catch (Exception e) {
			System.out.println(e.toString()
					+ "\nRMI registry was already created");
		}

	}

	private static void initRemoteObject() {
		boolean adm = runAdmin();
		boolean bok = runBooking();
		boolean hou = runHouse();
		boolean off = runOffer();
		boolean own = runOwner();
		boolean log = runLogin();

		System.out.println("  Admin: "+adm+
							"\t Booking:  "+bok+
							"\t House:  "+hou+
							"\t Login:  "+log+
							"\t Offer:  "+off+
							"\t Owner:  "+own);
	}
	
	private static boolean runAdmin() {
		try {
			Remote remoteObject = new AdminManager();
			String authService = "rmi://localhost:9999//AdM";
			Naming.rebind(authService, remoteObject);
			return true;
		} catch (Exception e) {
			System.out.println(e.toString());
			return false;
		}
	}

	
	private static boolean runBooking() {
		try {
			Remote remoteBooking = new BookingManager();
			String authService = "rmi://localhost:9999//BoM";
			Naming.rebind(authService, remoteBooking);
			return true;
		} catch (Exception e) {
			System.out.println(e.toString());
			return false;
		}
	}

	
	private static boolean runHouse() {
		try {
			Remote remoteHouse = new HouseManager();
			String authService = "rmi://localhost:9999//HoM";
			Naming.rebind(authService, remoteHouse);
			return true;
		} catch (Exception e) {
			System.out.println(e.toString());
			return false;
		}
	}

	
	private static boolean runLogin() {
		try {
			Remote remoteLogin = new LoginManager();
			String authService = "rmi://localhost:9999//LoM";
			Naming.rebind(authService, remoteLogin);
			return true;
		} catch (Exception e) {
			System.out.println(e.toString());
			return false;
		}
	}

	
	private static boolean runOffer() {
		try {
			Remote remoteOffer = new OfferManager();
			String authService = "rmi://localhost:9999//OfM";
			Naming.rebind(authService, remoteOffer);
			return true;
		} catch (Exception e) {
			System.out.println(e.toString());
			return false;
		}
	}

	
	private static boolean runOwner() {
		try {
			Remote remoteOwner = new OwnerManager();
			String authService = "rmi://localhost:9999//OwM";
			Naming.rebind(authService, remoteOwner);
			return true;
		} catch (Exception e) {
			System.out.println(e.toString());
			return false;
		}
	}
	
	
}

Commits for RRRRHHHH_CoderuralHouses/src/launcher/RMILauncher.java

Diff revisions: vs.
Revision Author Commited Message
4f8bcc ... epinzolas001 Mon 18 May, 2015 09:49:54 +0000

Merge conflicts solutioned