Commit | Line | Data |
---|---|---|
3a8c8f19 JB |
1 | package hotel; |
2 | ||
3 | import java.net.MalformedURLException; | |
4 | import java.rmi.Naming; | |
5 | import java.rmi.RMISecurityManager; | |
6 | import java.rmi.RemoteException; | |
7 | ||
8 | /** | |
9 | * Applications reparties | |
10 | * TP - Exercice | |
11 | * Chaine d'hotels | |
12 | * | |
13 | * Programme serveur RMI | |
14 | * | |
15 | * @author Toto | |
16 | * @version 1.0 | |
17 | */ | |
18 | public class ChaineHotelsServeurRMI { | |
19 | ||
20 | ||
21 | private static int DEFAULT_REGISTRY_PORT = 1099; | |
22 | ||
23 | ||
24 | /** | |
25 | * Constructeur par defaut | |
26 | */ | |
27 | public ChaineHotelsServeurRMI() { | |
28 | } | |
29 | ||
30 | ||
31 | /** | |
32 | * Programme principal | |
33 | * args[0] Port du registre rmi | |
34 | */ | |
35 | public static void main(String[] args) { | |
36 | ChaineHotels hotels; | |
37 | int port = -1; | |
38 | ||
39 | if(args.length != 1) { | |
40 | System.out.println("Usage: java ChaineHotelServeurRMI Port"); | |
41 | System.out.println("Utilisation du port par defaut ("+DEFAULT_REGISTRY_PORT+")"); | |
42 | port = DEFAULT_REGISTRY_PORT; | |
43 | } | |
44 | else { | |
45 | try { | |
46 | port = Integer.parseInt(args[0]); | |
47 | } | |
48 | catch(NumberFormatException nfe) { | |
49 | nfe.printStackTrace(); | |
50 | System.exit(1); | |
51 | } | |
52 | } | |
53 | ||
54 | try { | |
55 | /*************************/ | |
56 | //TODO | |
57 | /*************************/ | |
58 | } | |
59 | catch (RemoteException e) { | |
60 | System.err.println("Serveur : erreur\n"+e.getMessage()); | |
61 | e.printStackTrace(); | |
62 | } | |
63 | catch (MalformedURLException e) { | |
64 | System.err.println("Serveur : erreur\n"+e.getMessage()); | |
65 | e.printStackTrace(); | |
66 | } | |
67 | } | |
68 | ||
69 | } |