Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard
 
d30bcc8a3c13bbf5144b03a644c1345865aed708
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
128
129
package launcher;

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

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

@SuppressWarnings("deprecation")
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 log = runLogin();
		boolean acc = runAccount();

		System.out.println("  Admin: "+adm+
							"\t Booking:  "+bok+
							"\t House:  "+hou+
							"\t Login:  "+log+
							"\t Offer:  "+off+
							"\t Account: "+acc);
	}
	
	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 runAccount() {
		try {
			Remote remoteObject = new AccountManager();
			String authService = "rmi://localhost:9999//AcM";
			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;
		}
	}

	

	
	
}

Commits for RRRRHHHH_CoderuralHouses/src/launcher/RMILauncher.java

Diff revisions: vs.
Revision Author Commited Message
d30bcc ... Diff Diff pinene picture pinene Wed 20 May, 2015 16:32:33 +0000

cleaning

25898b ... Diff Diff camjan Mon 18 May, 2015 15:26:01 +0000

Account adding and deleting fixed

578bec ... Diff Diff epinzolas001 Mon 18 May, 2015 11:44:38 +0000

New owners now can be created properly.

4f8bcc ... epinzolas001 Mon 18 May, 2015 09:49:54 +0000

Merge conflicts solutioned