From 321de3f1ad537e7f9c313326ac50c45f2b6e9b5b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 16 Mar 2018 16:36:12 +0100 Subject: [PATCH] TD3: convert to unix LF the code skeleton for hostels. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- TD3/hotel/ChaineHotelsInterface.java | 44 +++---- TD3/hotel/ExceptionChambresIndispo.java | 56 ++++----- TD3/hotel/ExceptionNumReservation.java | 56 ++++----- TD3/hotel/Infos.java | 154 ++++++++++++------------ TD3/hotel/Readme.txt | 94 +++++++-------- TD3/hotel/security.policy | 46 +++---- 6 files changed, 226 insertions(+), 224 deletions(-) diff --git a/TD3/hotel/ChaineHotelsInterface.java b/TD3/hotel/ChaineHotelsInterface.java index d4c4af0..590fb32 100644 --- a/TD3/hotel/ChaineHotelsInterface.java +++ b/TD3/hotel/ChaineHotelsInterface.java @@ -1,21 +1,23 @@ -package hotel; - -import java.rmi.Remote; -import java.rmi.RemoteException; - - -/** - * Applications reparties - * TP - Exercice - * Chaine d'hotels - * - * Interface de la chaine d'hotel - * - * @author Toto - * @version 1.0 - */ -public interface ChaineHotelsInterface { //TODO completer la declaration - - //TODO completer l'interface - -} +package hotel; + +import java.rmi.Remote; +import java.rmi.RemoteException; + + +/** + * Applications reparties + * TP - Exercice + * Chaine d'hotels + * + * Interface de la chaine d'hotel + * + * @author Toto + * @version 1.0 + */ +public interface ChaineHotelsInterface extends Remote { + + public void reserver(); + public void annuler(); + public Infos lister(); + +} diff --git a/TD3/hotel/ExceptionChambresIndispo.java b/TD3/hotel/ExceptionChambresIndispo.java index 0cf161e..748db66 100644 --- a/TD3/hotel/ExceptionChambresIndispo.java +++ b/TD3/hotel/ExceptionChambresIndispo.java @@ -1,28 +1,28 @@ -package hotel; - -/** - * Applications reparties - * TP - Exercice - * Chaine d'hotels - * - * Exception liee a la non disponibilite - * - * @author Toto - * @version 1.0 - */ -public class ExceptionChambresIndispo extends Exception { - - private static final long serialVersionUID = 5269715160970930660L; - - String message; - - public ExceptionChambresIndispo() { - super(); - message = "Erreur: chambre(s) indisponible(s)"; - } - - public String toString() { - return message; - } - -} +package hotel; + +/** + * Applications reparties + * TP - Exercice + * Chaine d'hotels + * + * Exception liee a la non disponibilite + * + * @author Toto + * @version 1.0 + */ +public class ExceptionChambresIndispo extends Exception { + + private static final long serialVersionUID = 5269715160970930660L; + + String message; + + public ExceptionChambresIndispo() { + super(); + message = "Erreur: chambre(s) indisponible(s)"; + } + + public String toString() { + return message; + } + +} diff --git a/TD3/hotel/ExceptionNumReservation.java b/TD3/hotel/ExceptionNumReservation.java index cb8dbde..7acd348 100644 --- a/TD3/hotel/ExceptionNumReservation.java +++ b/TD3/hotel/ExceptionNumReservation.java @@ -1,28 +1,28 @@ -package hotel; - -/** - * Applications reparties - * TP - Exercice - * Chaine d'hotels - * - * Exception liee a un numero de reservation inexistant - * - * @author Toto - * @version 1.0 - */ -public class ExceptionNumReservation extends Exception { - - private static final long serialVersionUID = -6656122783469441587L; - - String message; - - public ExceptionNumReservation() { - super(); - message = "Erreur: numero de reservation incorrect"; - } - - public String toString() { - return message; - } - -} +package hotel; + +/** + * Applications reparties + * TP - Exercice + * Chaine d'hotels + * + * Exception liee a un numero de reservation inexistant + * + * @author Toto + * @version 1.0 + */ +public class ExceptionNumReservation extends Exception { + + private static final long serialVersionUID = -6656122783469441587L; + + String message; + + public ExceptionNumReservation() { + super(); + message = "Erreur: numero de reservation incorrect"; + } + + public String toString() { + return message; + } + +} diff --git a/TD3/hotel/Infos.java b/TD3/hotel/Infos.java index 3c881c0..0eba859 100644 --- a/TD3/hotel/Infos.java +++ b/TD3/hotel/Infos.java @@ -1,77 +1,77 @@ -package hotel; - -import java.io.Serializable; - - -/** - * Applications reparties - * TP - Exercice - * Chaine d'hotels - * - * Classe regroupant les informations d'une reservation - * - * @author Toto - * @version 1.0 - */ -public class Infos implements Serializable { - - private static final long serialVersionUID = -6199402168457446943L; - - private String nomClient; - private String nomHotel; - private String date; - private int nbchambres; - - public Infos() { - this.nomClient = ""; - this.nomHotel = ""; - this.date = ""; - this.nbchambres = 0; - } - - public Infos(String client, String hotel, String date, int nb) { - this.nomClient = client; - this.nomHotel = hotel; - this.date = date; - this.nbchambres = nb; - } - - public String getNomClient() { - return this.nomClient; - } - - public void setNomClient(String nom) { - this.nomClient = nom; - } - - public String getNomHotel() { - return this.nomHotel; - } - - public void setNomHotel(String nom) { - this.nomHotel = nom; - } - - public String getDate() { - return this.date; - } - - public void setDate(String d) { - this.date = d; - } - - public int getNbChambres() { - return this.nbchambres; - } - - public void setNbChambres(int nb) { - this.nbchambres = nb; - } - - public String toString() { - String str = ""; - str = str + this.nomClient + " " + this.nomHotel + " " + this.date + " " + this.nbchambres; - return str; - } - -} +package hotel; + +import java.io.Serializable; + + +/** + * Applications reparties + * TP - Exercice + * Chaine d'hotels + * + * Classe regroupant les informations d'une reservation + * + * @author Toto + * @version 1.0 + */ +public class Infos implements Serializable { + + private static final long serialVersionUID = -6199402168457446943L; + + private String nomClient; + private String nomHotel; + private String date; + private int nbchambres; + + public Infos() { + this.nomClient = ""; + this.nomHotel = ""; + this.date = ""; + this.nbchambres = 0; + } + + public Infos(String client, String hotel, String date, int nb) { + this.nomClient = client; + this.nomHotel = hotel; + this.date = date; + this.nbchambres = nb; + } + + public String getNomClient() { + return this.nomClient; + } + + public void setNomClient(String nom) { + this.nomClient = nom; + } + + public String getNomHotel() { + return this.nomHotel; + } + + public void setNomHotel(String nom) { + this.nomHotel = nom; + } + + public String getDate() { + return this.date; + } + + public void setDate(String d) { + this.date = d; + } + + public int getNbChambres() { + return this.nbchambres; + } + + public void setNbChambres(int nb) { + this.nbchambres = nb; + } + + public String toString() { + String str = ""; + str = str + this.nomClient + " " + this.nomHotel + " " + this.date + " " + this.nbchambres; + return str; + } + +} diff --git a/TD3/hotel/Readme.txt b/TD3/hotel/Readme.txt index 5a52233..c7442c8 100644 --- a/TD3/hotel/Readme.txt +++ b/TD3/hotel/Readme.txt @@ -1,47 +1,47 @@ - - -# 1) Completer les classes : -# ChaineHotelsInterface, ChaineHotels, ChaineHotelsServeurRMI, ChaineHotelsClientRMI - - - - -# 2) Pour la compilation: - -#Se placer dans le dossier CONTENANT le dossier "hotel" - -#compilation : -javac hotel/*.java - -#Generation des souches : -rmic hotel.ChaineHotels - -#Creation d'un fichier texte "security.policy" contenant la politique de sécurité retenue -# (ici on autorise tout... dangereux !) - - - - -# 3) Execution de l'application : - -#On suppose que l’élève e00000 a place le dossier "hotel" dans un dossier "SR" - -#On suppose que le serveur tourne sur la machine 134.192.30.6 -# et le registre utilise le port par défaut 1099 (le registre rmi tourne aussi sur la machine 134.192.30.6) - - -#Sur la machine "serveur" : - -#Lancement du registre rmi : -rmiregistry - -#Se placer dans le dossier "SR" - -#Lancement du programme serveur : -java -cp . -Djava.security.policy=/filer/eleves/e00000/SR/hotel/security.policy -Djava.rmi.server.codebase=file:/filer/eleves/e00000/SR/ hotel.ChaineHotelsServeurRMI - - -#Sur la machine "client" : - -#Lancement du programme client : -java -cp . -Djava.security.policy=/filer/eleves/e00000/SR/hotel/security.policy -Djava.rmi.server.codebase=file:/filer/eleves/e00000/SR/ hotel.ChaineHotelsClientRMI 134.192.30.6 1099 + + +# 1) Completer les classes : +# ChaineHotelsInterface, ChaineHotels, ChaineHotelsServeurRMI, ChaineHotelsClientRMI + + + + +# 2) Pour la compilation: + +#Se placer dans le dossier CONTENANT le dossier "hotel" + +#compilation : +javac hotel/*.java + +#Generation des souches : +rmic hotel.ChaineHotels + +#Creation d'un fichier texte "security.policy" contenant la politique de sécurité retenue +# (ici on autorise tout... dangereux !) + + + + +# 3) Execution de l'application : + +#On suppose que l’élève e00000 a place le dossier "hotel" dans un dossier "SR" + +#On suppose que le serveur tourne sur la machine 134.192.30.6 +# et le registre utilise le port par défaut 1099 (le registre rmi tourne aussi sur la machine 134.192.30.6) + + +#Sur la machine "serveur" : + +#Lancement du registre rmi : +rmiregistry + +#Se placer dans le dossier "SR" + +#Lancement du programme serveur : +java -cp . -Djava.security.policy=/filer/eleves/e00000/SR/hotel/security.policy -Djava.rmi.server.codebase=file:/filer/eleves/e00000/SR/ hotel.ChaineHotelsServeurRMI + + +#Sur la machine "client" : + +#Lancement du programme client : +java -cp . -Djava.security.policy=/filer/eleves/e00000/SR/hotel/security.policy -Djava.rmi.server.codebase=file:/filer/eleves/e00000/SR/ hotel.ChaineHotelsClientRMI 134.192.30.6 1099 diff --git a/TD3/hotel/security.policy b/TD3/hotel/security.policy index 3264aac..76b58bb 100644 --- a/TD3/hotel/security.policy +++ b/TD3/hotel/security.policy @@ -1,23 +1,23 @@ -// -// For more information see: -// http://java.sun.com/docs/books/tutorial/rmi/running.html -// http://java.sun.com/j2se/1.5.0/docs/guide/security/PolicyFiles.html -// - -grant { - permission java.security.AllPermission; - - // Other options: - // permission java.net.SocketPermission "127.0.0.1:1024-", "accept, connect, listen, resolve"; - // permission java.net.SocketPermission "localhost:1024-", "accept, connect, listen, resolve"; - - // From http://java.sun.com/docs/books/tutorial/rmi/running.html - // Copyright 1995-2005 Sun Microsystems, Inc. Reprinted with permission - - // permission java.net.SocketPermission "*:1024-65535", "connect,accept"; - // permission java.net.SocketPermission "*:80", "connect"; - - // permission java.net.SocketPermission "*:1024-65535", "connect,accept"; - // permission java.io.FilePermission "c:\\home\\ann\\public_html\\classes\\-", "read"; - // permission java.io.FilePermission "c:\\home\\jones\\public_html\\classes\\-", "read"; -}; +// +// For more information see: +// http://java.sun.com/docs/books/tutorial/rmi/running.html +// http://java.sun.com/j2se/1.5.0/docs/guide/security/PolicyFiles.html +// + +grant { + permission java.security.AllPermission; + + // Other options: + // permission java.net.SocketPermission "127.0.0.1:1024-", "accept, connect, listen, resolve"; + // permission java.net.SocketPermission "localhost:1024-", "accept, connect, listen, resolve"; + + // From http://java.sun.com/docs/books/tutorial/rmi/running.html + // Copyright 1995-2005 Sun Microsystems, Inc. Reprinted with permission + + // permission java.net.SocketPermission "*:1024-65535", "connect,accept"; + // permission java.net.SocketPermission "*:80", "connect"; + + // permission java.net.SocketPermission "*:1024-65535", "connect,accept"; + // permission java.io.FilePermission "c:\\home\\ann\\public_html\\classes\\-", "read"; + // permission java.io.FilePermission "c:\\home\\jones\\public_html\\classes\\-", "read"; +}; -- 2.34.1