-package hotel;\r
-\r
-import java.rmi.Remote;\r
-import java.rmi.RemoteException;\r
-\r
-\r
-/**\r
- * Applications reparties\r
- * TP - Exercice\r
- * Chaine d'hotels\r
- * \r
- * Interface de la chaine d'hotel\r
- * \r
- * @author Toto\r
- * @version 1.0\r
- */\r
-public interface ChaineHotelsInterface { //TODO completer la declaration\r
-\r
- //TODO completer l'interface\r
-\r
-}\r
+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();
+
+}
-package hotel;\r
-\r
-/**\r
- * Applications reparties\r
- * TP - Exercice\r
- * Chaine d'hotels\r
- * \r
- * Exception liee a la non disponibilite\r
- * \r
- * @author Toto\r
- * @version 1.0\r
- */\r
-public class ExceptionChambresIndispo extends Exception {\r
-\r
- private static final long serialVersionUID = 5269715160970930660L;\r
-\r
- String message;\r
- \r
- public ExceptionChambresIndispo() {\r
- super();\r
- message = "Erreur: chambre(s) indisponible(s)";\r
- }\r
- \r
- public String toString() {\r
- return message;\r
- }\r
- \r
-}\r
+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;\r
-\r
-/**\r
- * Applications reparties\r
- * TP - Exercice \r
- * Chaine d'hotels\r
- * \r
- * Exception liee a un numero de reservation inexistant\r
- * \r
- * @author Toto\r
- * @version 1.0\r
- */\r
-public class ExceptionNumReservation extends Exception {\r
-\r
- private static final long serialVersionUID = -6656122783469441587L;\r
-\r
- String message;\r
- \r
- public ExceptionNumReservation() {\r
- super();\r
- message = "Erreur: numero de reservation incorrect";\r
- }\r
- \r
- public String toString() {\r
- return message;\r
- }\r
- \r
-}\r
+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;\r
-\r
-import java.io.Serializable;\r
-\r
-\r
-/**\r
- * Applications reparties\r
- * TP - Exercice \r
- * Chaine d'hotels\r
- * \r
- * Classe regroupant les informations d'une reservation\r
- * \r
- * @author Toto\r
- * @version 1.0\r
- */\r
-public class Infos implements Serializable {\r
-\r
- private static final long serialVersionUID = -6199402168457446943L;\r
-\r
- private String nomClient;\r
- private String nomHotel;\r
- private String date;\r
- private int nbchambres;\r
- \r
- public Infos() {\r
- this.nomClient = "";\r
- this.nomHotel = "";\r
- this.date = "";\r
- this.nbchambres = 0;\r
- }\r
- \r
- public Infos(String client, String hotel, String date, int nb) {\r
- this.nomClient = client;\r
- this.nomHotel = hotel;\r
- this.date = date;\r
- this.nbchambres = nb;\r
- }\r
- \r
- public String getNomClient() {\r
- return this.nomClient;\r
- }\r
- \r
- public void setNomClient(String nom) {\r
- this.nomClient = nom;\r
- }\r
- \r
- public String getNomHotel() {\r
- return this.nomHotel;\r
- }\r
- \r
- public void setNomHotel(String nom) {\r
- this.nomHotel = nom;\r
- }\r
- \r
- public String getDate() {\r
- return this.date;\r
- }\r
- \r
- public void setDate(String d) {\r
- this.date = d;\r
- }\r
- \r
- public int getNbChambres() {\r
- return this.nbchambres;\r
- }\r
- \r
- public void setNbChambres(int nb) {\r
- this.nbchambres = nb;\r
- }\r
- \r
- public String toString() {\r
- String str = "";\r
- str = str + this.nomClient + " " + this.nomHotel + " " + this.date + " " + this.nbchambres;\r
- return str;\r
- }\r
- \r
-}\r
+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;
+ }
+
+}
-\r
-\r
-# 1) Completer les classes :\r
-# ChaineHotelsInterface, ChaineHotels, ChaineHotelsServeurRMI, ChaineHotelsClientRMI\r
-\r
-\r
-\r
-\r
-# 2) Pour la compilation:\r
-\r
-#Se placer dans le dossier CONTENANT le dossier "hotel"\r
-\r
-#compilation :\r
-javac hotel/*.java\r
-\r
-#Generation des souches :\r
-rmic hotel.ChaineHotels\r
-\r
-#Creation d'un fichier texte "security.policy" contenant la politique de sécurité retenue\r
-# (ici on autorise tout... dangereux !)\r
-\r
-\r
-\r
-\r
-# 3) Execution de l'application :\r
-\r
-#On suppose que l’élève e00000 a place le dossier "hotel" dans un dossier "SR"\r
-\r
-#On suppose que le serveur tourne sur la machine 134.192.30.6\r
-# et le registre utilise le port par défaut 1099 (le registre rmi tourne aussi sur la machine 134.192.30.6)\r
-\r
-\r
-#Sur la machine "serveur" :\r
-\r
-#Lancement du registre rmi :\r
-rmiregistry\r
-\r
-#Se placer dans le dossier "SR"\r
-\r
-#Lancement du programme serveur :\r
-java -cp . -Djava.security.policy=/filer/eleves/e00000/SR/hotel/security.policy -Djava.rmi.server.codebase=file:/filer/eleves/e00000/SR/ hotel.ChaineHotelsServeurRMI\r
-\r
-\r
-#Sur la machine "client" :\r
-\r
-#Lancement du programme client :\r
-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\r
+
+
+# 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
-//\r
-// For more information see:\r
-// http://java.sun.com/docs/books/tutorial/rmi/running.html\r
-// http://java.sun.com/j2se/1.5.0/docs/guide/security/PolicyFiles.html\r
-// \r
-\r
-grant {\r
- permission java.security.AllPermission;\r
- \r
- // Other options:\r
- // permission java.net.SocketPermission "127.0.0.1:1024-", "accept, connect, listen, resolve";\r
- // permission java.net.SocketPermission "localhost:1024-", "accept, connect, listen, resolve";\r
- \r
- // From http://java.sun.com/docs/books/tutorial/rmi/running.html\r
- // Copyright 1995-2005 Sun Microsystems, Inc. Reprinted with permission \r
- \r
- // permission java.net.SocketPermission "*:1024-65535", "connect,accept";\r
- // permission java.net.SocketPermission "*:80", "connect";\r
- \r
- // permission java.net.SocketPermission "*:1024-65535", "connect,accept";\r
- // permission java.io.FilePermission "c:\\home\\ann\\public_html\\classes\\-", "read";\r
- // permission java.io.FilePermission "c:\\home\\jones\\public_html\\classes\\-", "read";\r
-};\r
+//
+// 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";
+};