X-Git-Url: https://git.piment-noir.org/?p=TD_SR.git;a=blobdiff_plain;f=TD3%2Fhotel%2FChaineHotelsServeurRMI.java;fp=TD3%2Fhotel%2FChaineHotelsServeurRMI.java;h=eb93ba3a167e70cebeb00ab8d855c71fdd2f075a;hp=0000000000000000000000000000000000000000;hb=3a8c8f1926734c79be64af8debbc807ee2eabb5e;hpb=ae09e645684a4f53aad5566f811ab7e99d6b68ac diff --git a/TD3/hotel/ChaineHotelsServeurRMI.java b/TD3/hotel/ChaineHotelsServeurRMI.java new file mode 100644 index 0000000..eb93ba3 --- /dev/null +++ b/TD3/hotel/ChaineHotelsServeurRMI.java @@ -0,0 +1,69 @@ +package hotel; + +import java.net.MalformedURLException; +import java.rmi.Naming; +import java.rmi.RMISecurityManager; +import java.rmi.RemoteException; + +/** + * Applications reparties + * TP - Exercice + * Chaine d'hotels + * + * Programme serveur RMI + * + * @author Toto + * @version 1.0 + */ +public class ChaineHotelsServeurRMI { + + + private static int DEFAULT_REGISTRY_PORT = 1099; + + + /** + * Constructeur par defaut + */ + public ChaineHotelsServeurRMI() { + } + + + /** + * Programme principal + * args[0] Port du registre rmi + */ + public static void main(String[] args) { + ChaineHotels hotels; + int port = -1; + + if(args.length != 1) { + System.out.println("Usage: java ChaineHotelServeurRMI Port"); + System.out.println("Utilisation du port par defaut ("+DEFAULT_REGISTRY_PORT+")"); + port = DEFAULT_REGISTRY_PORT; + } + else { + try { + port = Integer.parseInt(args[0]); + } + catch(NumberFormatException nfe) { + nfe.printStackTrace(); + System.exit(1); + } + } + + try { + /*************************/ + //TODO + /*************************/ + } + catch (RemoteException e) { + System.err.println("Serveur : erreur\n"+e.getMessage()); + e.printStackTrace(); + } + catch (MalformedURLException e) { + System.err.println("Serveur : erreur\n"+e.getMessage()); + e.printStackTrace(); + } + } + +}