diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/EraseErrorRule.java b/app/src/main/java/lightcontainer/protocol/rules/reader/EraseErrorRule.java index e9dd3b2..1ce0b0b 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/EraseErrorRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/EraseErrorRule.java @@ -5,11 +5,9 @@ import lightcontainer.interfaces.ProtocolRepository; import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.rules.writer.RemoveFileErrorRule; -import static lightcontainer.protocol.StandardizedDefinitions.SBE_ERASE_RESULT_ERROR; - public class EraseErrorRule extends ProtocolReader { - private static final String PATTERN = SBE_ERASE_RESULT_ERROR; + private static final String PATTERN = "^ERASE_ERROR\r\n$"; private static final String NAME = "ERASE_ERROR"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/EraseOkRule.java b/app/src/main/java/lightcontainer/protocol/rules/reader/EraseOkRule.java index 04c9ab7..9125c7a 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/EraseOkRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/EraseOkRule.java @@ -5,11 +5,9 @@ import lightcontainer.interfaces.ProtocolRepository; import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.rules.writer.RemoveFileOkRule; -import static lightcontainer.protocol.StandardizedDefinitions.SBE_ERASE_RESULT_OK; - public class EraseOkRule extends ProtocolReader { - private static final String PATTERN = SBE_ERASE_RESULT_OK; + private static final String PATTERN = "^ERASE_OK\r\n$"; private static final String NAME = "ERASE_OK"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/FilelistRule.java b/app/src/main/java/lightcontainer/protocol/rules/reader/FilelistRule.java index 2974746..18bfeea 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/FilelistRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/FilelistRule.java @@ -7,14 +7,12 @@ import lightcontainer.protocol.rules.writer.FilesRule; import java.util.List; -import static lightcontainer.protocol.StandardizedDefinitions.CLIENT_FILE_LIST; - /** * Règle permettant de récupérer la liste des fichiers d'un utilisateur */ public class FilelistRule extends ProtocolReader { // Constants - private static final String PATTERN = CLIENT_FILE_LIST; + private static final String PATTERN = "^FILELIST\r\n$"; private static final String NAME = "FILELIST"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/GetFileRule.java b/app/src/main/java/lightcontainer/protocol/rules/reader/GetFileRule.java index 1f75281..116fb6d 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/GetFileRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/GetFileRule.java @@ -9,11 +9,9 @@ import lightcontainer.storage.ReadOnlyFile; import java.util.Iterator; -import static lightcontainer.protocol.StandardizedDefinitions.CLIENT_GET_FILE; - public class GetFileRule extends ProtocolReader { // Constants - private static final String PATTERN = CLIENT_GET_FILE; + private static final String PATTERN = "^GETFILE ([^ !]{1,20})\r\n$"; private static final String NAME = "GETFILE"; // -- arguments private static final int FILE_NAME = 0; // Index file name. diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/HelloRule.java b/app/src/main/java/lightcontainer/protocol/rules/reader/HelloRule.java index 9fa53a1..4c0aa4b 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/HelloRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/HelloRule.java @@ -3,14 +3,12 @@ package lightcontainer.protocol.rules.reader; import lightcontainer.domains.client.Context; import lightcontainer.protocol.ProtocolReader; -import static lightcontainer.protocol.StandardizedDefinitions.SBE_HELLO; - /** * Règle permettant d'être alerter de l'annoncement d'un SBE */ public class HelloRule extends ProtocolReader { - private static final String PATTERN = SBE_HELLO; + private static final String PATTERN = "^HELLO ([A-Za-z0-9.]{5,20}) ([\\d]{0,5})\r\n$"; private static final String NAME = "HELLO"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/RemoveFileRule.java b/app/src/main/java/lightcontainer/protocol/rules/reader/RemoveFileRule.java index efe5768..7024478 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/RemoveFileRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/RemoveFileRule.java @@ -9,11 +9,9 @@ import lightcontainer.storage.ReadOnlyFile; import java.util.Iterator; -import static lightcontainer.protocol.StandardizedDefinitions.CLIENT_REMOVE_FILE; - public class RemoveFileRule extends ProtocolReader { - private static final String PATTERN = CLIENT_REMOVE_FILE; + private static final String PATTERN = "^REMOVEFILE ([^ !]{1,20})\r\n$"; private static final String NAME = "REMOVEFILE"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/RetrieveErrorRule.java b/app/src/main/java/lightcontainer/protocol/rules/reader/RetrieveErrorRule.java index 6b3a425..9bb8339 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/RetrieveErrorRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/RetrieveErrorRule.java @@ -5,11 +5,9 @@ import lightcontainer.interfaces.ProtocolRepository; import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.rules.writer.GetFileErrorRule; -import static lightcontainer.protocol.StandardizedDefinitions.SBE_RETRIEVE_RESULT_ERROR; - public class RetrieveErrorRule extends ProtocolReader { // Constants - private static final String PATTERN = SBE_RETRIEVE_RESULT_ERROR; + private static final String PATTERN = "^RETRIEVE_ERROR\r\n$"; private static final String NAME = "RETRIEVE_ERROR"; // Variables diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/RetrieveOkRule.java b/app/src/main/java/lightcontainer/protocol/rules/reader/RetrieveOkRule.java index af326ab..76be719 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/RetrieveOkRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/RetrieveOkRule.java @@ -9,11 +9,9 @@ import lightcontainer.utils.FileReceiver; import java.io.InputStream; -import static lightcontainer.protocol.StandardizedDefinitions.SBE_RETRIEVE_RESULT_OK; - public class RetrieveOkRule extends ProtocolReader { // Constants - private static final String PATTERN = SBE_RETRIEVE_RESULT_OK; + private static final String PATTERN = "^RETRIEVE_OK ([A-Za-z0-9.]{50,200} [0-9]{1,10} [A-Za-z0-9.]{50,200})\r\n$"; private static final String NAME = "RETRIEVE_OK"; // -- arguments private static final int HASHED_FILE_NAME = 0; // Index hashed filename diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/SendErrorRule.java b/app/src/main/java/lightcontainer/protocol/rules/reader/SendErrorRule.java index b0f940f..520fa19 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/SendErrorRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/SendErrorRule.java @@ -5,14 +5,12 @@ import lightcontainer.interfaces.ProtocolRepository; import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.rules.writer.SaveFileErrorRule; -import static lightcontainer.protocol.StandardizedDefinitions.SBE_SEND_RESULT_ERROR; - /** * Règle permettant de de confirmer la sauvegrade d'un fichier. */ public class SendErrorRule extends ProtocolReader { // Constants - private static final String PATTERN = SBE_SEND_RESULT_ERROR; + private static final String PATTERN = "^SEND_ERROR\r\n$"; private static final String NAME = "SEND_ERROR"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/SendOkRule.java b/app/src/main/java/lightcontainer/protocol/rules/reader/SendOkRule.java index 2827deb..d7fb36d 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/SendOkRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/SendOkRule.java @@ -5,15 +5,13 @@ import lightcontainer.interfaces.ProtocolRepository; import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.rules.writer.SaveFileOkRule; -import static lightcontainer.protocol.StandardizedDefinitions.SBE_SEND_RESULT_OK; - /** * Règle permettant de de confirmer la sauvegrade d'un fichier. */ public class SendOkRule extends ProtocolReader { // Constants - private static final String PATTERN = SBE_SEND_RESULT_OK; + private static final String PATTERN = "^SEND_OK\r\n$"; private static final String NAME = "SEND_OK"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/SigninRule.java b/app/src/main/java/lightcontainer/protocol/rules/reader/SigninRule.java index 22605f7..6f697b5 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/SigninRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/SigninRule.java @@ -6,14 +6,12 @@ import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.rules.writer.SignErrorRule; import lightcontainer.protocol.rules.writer.SignOkRule; -import static lightcontainer.protocol.StandardizedDefinitions.CLIENT_SIGN_IN; - /** * Règle permettant de gérer la connection d'un utilisateur */ public class SigninRule extends ProtocolReader { // Constants - private static final String PATTERN = CLIENT_SIGN_IN; + private static final String PATTERN = "^SIGNIN ([A-Za-z0-9]{5,20}) ([^ !]{5,50})\r\n$"; private static final String NAME = "SIGNIN"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/SignoutRule.java b/app/src/main/java/lightcontainer/protocol/rules/reader/SignoutRule.java index 9bad94d..2b7a39f 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/SignoutRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/SignoutRule.java @@ -3,14 +3,12 @@ package lightcontainer.protocol.rules.reader; import lightcontainer.domains.client.Context; import lightcontainer.protocol.ProtocolReader; -import static lightcontainer.protocol.StandardizedDefinitions.CLIENT_SIGN_OUT; - /** * Règle demandant la déconnexion du client */ public class SignoutRule extends ProtocolReader { - private static final String PATTERN = CLIENT_SIGN_OUT; + private static final String PATTERN = "^SIGNOUT\r\n$"; public static final String NAME = "SIGNOUT"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/SignupRule.java b/app/src/main/java/lightcontainer/protocol/rules/reader/SignupRule.java index db6703c..fbb56ed 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/SignupRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/SignupRule.java @@ -6,14 +6,12 @@ import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.rules.writer.SignErrorRule; import lightcontainer.protocol.rules.writer.SignOkRule; -import static lightcontainer.protocol.StandardizedDefinitions.CLIENT_SIGN_UP; - /** * Règle permettant de gérer la création d'un utilisateur */ public class SignupRule extends ProtocolReader { // Constants - private static final String PATTERN = CLIENT_SIGN_UP; + private static final String PATTERN = "^SIGNUP ([A-Za-z0-9]{5,20}) ([^ !]{5,50})\r\n$"; private static final String NAME = "SIGNUP"; private static final int LOGIN = 0; private static final int PASSWORD = 1; diff --git a/app/src/main/java/lightcontainer/protocol/rules/writer/EraseFileRule.java b/app/src/main/java/lightcontainer/protocol/rules/writer/EraseFileRule.java index 9de71f0..f0d9794 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/writer/EraseFileRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/writer/EraseFileRule.java @@ -2,12 +2,10 @@ package lightcontainer.protocol.rules.writer; import lightcontainer.protocol.ProtocolWriter; -import static lightcontainer.protocol.StandardizedDefinitions.FFE_ERASE_FILE; - public class EraseFileRule extends ProtocolWriter { //"^ERASEFILE ([A-Za-z0-9]{50,200})\r\n$" - private static final String PATTERN = FFE_ERASE_FILE; + private static final String PATTERN = "^ERASEFILE ([A-Za-z0-9.]{50,200})\r\n$"; public static String NAME = "ERASEFILE"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/writer/FilesRule.java b/app/src/main/java/lightcontainer/protocol/rules/writer/FilesRule.java index 5dde723..457f978 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/writer/FilesRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/writer/FilesRule.java @@ -2,14 +2,12 @@ package lightcontainer.protocol.rules.writer; import lightcontainer.protocol.ProtocolWriter; -import static lightcontainer.protocol.StandardizedDefinitions.FFE_FILE_LIST_RESULT; - /** * Règle permettant de construire une commande contenant la liste des fichiers d'un utilisateur */ public class FilesRule extends ProtocolWriter { //"^FILES( ([^ !]{1,20})!([0-9]{1,10})){0,50}\r\n$" - private static final String PATTERN = FFE_FILE_LIST_RESULT; + private static final String PATTERN = "^FILES( ([^ !]{1,20})!([0-9]{1,10})){0,50}\r\n$"; public static final String NAME = "FILES"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/writer/GetFileErrorRule.java b/app/src/main/java/lightcontainer/protocol/rules/writer/GetFileErrorRule.java index f76597b..e43ec21 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/writer/GetFileErrorRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/writer/GetFileErrorRule.java @@ -2,8 +2,6 @@ package lightcontainer.protocol.rules.writer; import lightcontainer.protocol.ProtocolWriter; -import static lightcontainer.protocol.StandardizedDefinitions.FFE_GET_FILE_RESULT_ERROR; - /** * Règle utilisé dans le cas ou une erreur survient lors * de la demande de récupération d'un fichier. @@ -11,7 +9,7 @@ import static lightcontainer.protocol.StandardizedDefinitions.FFE_GET_FILE_RESUL public class GetFileErrorRule extends ProtocolWriter { // Constants //"^GETFILE_ERROR\r\n$" - private static final String PATTERN = FFE_GET_FILE_RESULT_ERROR; + private static final String PATTERN = "^GETFILE_ERROR\r\n$"; public static final String NAME = "GETFILE_ERROR"; // Constructors diff --git a/app/src/main/java/lightcontainer/protocol/rules/writer/GetFileOkRule.java b/app/src/main/java/lightcontainer/protocol/rules/writer/GetFileOkRule.java index 486dd71..83d355e 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/writer/GetFileOkRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/writer/GetFileOkRule.java @@ -6,12 +6,10 @@ import lightcontainer.utils.FileSender; import java.io.OutputStream; -import static lightcontainer.protocol.StandardizedDefinitions.FFE_GET_FILE_RESULT_OK; - public class GetFileOkRule extends ProtocolWriter { // Constants //"^GETFILE_OK ([^ !]{1,20}) ([0-9]{1,10})\r\n$" - private static final String PATTERN = FFE_GET_FILE_RESULT_OK; + private static final String PATTERN = "^GETFILE_OK ([^ !]{1,20}) ([0-9]{1,10})\r\n$"; public static final String NAME = "GETFILE_OK"; // -- params private static final int FILE_NAME = 0; // Index file name hashed diff --git a/app/src/main/java/lightcontainer/protocol/rules/writer/RemoveFileErrorRule.java b/app/src/main/java/lightcontainer/protocol/rules/writer/RemoveFileErrorRule.java index 5fc60f1..c071683 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/writer/RemoveFileErrorRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/writer/RemoveFileErrorRule.java @@ -2,12 +2,10 @@ package lightcontainer.protocol.rules.writer; import lightcontainer.protocol.ProtocolWriter; -import static lightcontainer.protocol.StandardizedDefinitions.FFE_REMOVE_ERROR; - public class RemoveFileErrorRule extends ProtocolWriter { //"^REMOVEFILE_ERROR\r\n$" - private static final String PATTERN = FFE_REMOVE_ERROR; + private static final String PATTERN = "^REMOVEFILE_ERROR\r\n$"; public static String NAME = "REMOVEFILE_ERROR"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/writer/RemoveFileOkRule.java b/app/src/main/java/lightcontainer/protocol/rules/writer/RemoveFileOkRule.java index 6e5ab3e..bc9fc39 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/writer/RemoveFileOkRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/writer/RemoveFileOkRule.java @@ -2,11 +2,9 @@ package lightcontainer.protocol.rules.writer; import lightcontainer.protocol.ProtocolWriter; -import static lightcontainer.protocol.StandardizedDefinitions.FFE_REMOVE_OK; - public class RemoveFileOkRule extends ProtocolWriter { //"^REMOVEFILE_OK\r\n$" - private static final String PATTERN = FFE_REMOVE_OK; + private static final String PATTERN = "^REMOVEFILE_OK\r\n$"; public static String NAME = "REMOVEFILE_OK"; public RemoveFileOkRule() { diff --git a/app/src/main/java/lightcontainer/protocol/rules/writer/RetrieveFileRule.java b/app/src/main/java/lightcontainer/protocol/rules/writer/RetrieveFileRule.java index 951f92d..b64d1bb 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/writer/RetrieveFileRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/writer/RetrieveFileRule.java @@ -2,12 +2,10 @@ package lightcontainer.protocol.rules.writer; import lightcontainer.protocol.ProtocolWriter; -import static lightcontainer.protocol.StandardizedDefinitions.FFE_RETRIEVE_FILE; - public class RetrieveFileRule extends ProtocolWriter { // Constants //"^RETRIEVEFILE ([A-Za-z0-9]{50,200})\r\n$" - private static final String PATTERN = FFE_RETRIEVE_FILE; + private static final String PATTERN = "^RETRIEVEFILE ([A-Za-z0-9]{50,200})\r\n$"; public static final String NAME = "RETRIEVEFILE"; // Constructor diff --git a/app/src/main/java/lightcontainer/protocol/rules/writer/SaveFileErrorRule.java b/app/src/main/java/lightcontainer/protocol/rules/writer/SaveFileErrorRule.java index d85feaa..abf15f1 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/writer/SaveFileErrorRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/writer/SaveFileErrorRule.java @@ -8,14 +8,12 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import static lightcontainer.protocol.StandardizedDefinitions.FFE_SAVE_FILE_ERROR; - /** * Règle signifiant que la sauvegarde d'un fichier a échoué */ public class SaveFileErrorRule extends ProtocolWriter { //"^SAVEFILE_ERROR\r\n$" - private static final String PATTERN = FFE_SAVE_FILE_ERROR; + private static final String PATTERN = "^SAVEFILE_ERROR\r\n$"; public static final String NAME = "SAVEFILE_ERROR"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/writer/SaveFileOkRule.java b/app/src/main/java/lightcontainer/protocol/rules/writer/SaveFileOkRule.java index be28e09..5a01eec 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/writer/SaveFileOkRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/writer/SaveFileOkRule.java @@ -7,14 +7,12 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import static lightcontainer.protocol.StandardizedDefinitions.FFE_SAVE_FILE_OK; - /** * Règle signifiant que la sauvegarde d'un fichier fût un succès */ public class SaveFileOkRule extends ProtocolWriter { //"^SAVEFILE_OK\r\n$" - private static final String PATTERN = FFE_SAVE_FILE_OK; + private static final String PATTERN = "^SAVEFILE_OK\r\n$"; public static final String NAME = "SAVEFILE_OK"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/writer/SignErrorRule.java b/app/src/main/java/lightcontainer/protocol/rules/writer/SignErrorRule.java index 34dfba6..ca02cc6 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/writer/SignErrorRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/writer/SignErrorRule.java @@ -2,14 +2,12 @@ package lightcontainer.protocol.rules.writer; import lightcontainer.protocol.ProtocolWriter; -import static lightcontainer.protocol.StandardizedDefinitions.FFE_SIGN_ERROR; - /** * Règle renvoyée au client lorsque l'authentification a échoué. */ public class SignErrorRule extends ProtocolWriter { //"^SIGN_ERROR\r\n$" - private static final String PATTERN = FFE_SIGN_ERROR; + private static final String PATTERN = "^SIGN_ERROR\r\n$"; public static final String NAME = "SIGN_ERROR"; diff --git a/app/src/main/java/lightcontainer/protocol/rules/writer/SignOkRule.java b/app/src/main/java/lightcontainer/protocol/rules/writer/SignOkRule.java index 63b5019..05e0295 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/writer/SignOkRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/writer/SignOkRule.java @@ -2,14 +2,12 @@ package lightcontainer.protocol.rules.writer; import lightcontainer.protocol.ProtocolWriter; -import static lightcontainer.protocol.StandardizedDefinitions.FFE_SIGN_OK; - /** * Règle renvoyée au client lorsque l'authentification a réusie. */ public class SignOkRule extends ProtocolWriter { //"^SIGN_OK\r\n$" - private static final String PATTERN = FFE_SIGN_OK; + private static final String PATTERN = "^SIGN_OK\r\n$"; public static final String NAME = "SIGN_OK";