Regex : anciennes utilisées car bug avec nouvelles

This commit is contained in:
Maximilien LEDOUX 2022-03-15 19:49:06 +01:00
parent c0ec403ec2
commit 6f97cb6fc7
24 changed files with 24 additions and 72 deletions

View File

@ -5,11 +5,9 @@ import lightcontainer.interfaces.ProtocolRepository;
import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.ProtocolReader;
import lightcontainer.protocol.rules.writer.RemoveFileErrorRule; import lightcontainer.protocol.rules.writer.RemoveFileErrorRule;
import static lightcontainer.protocol.StandardizedDefinitions.SBE_ERASE_RESULT_ERROR;
public class EraseErrorRule extends ProtocolReader { 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"; private static final String NAME = "ERASE_ERROR";

View File

@ -5,11 +5,9 @@ import lightcontainer.interfaces.ProtocolRepository;
import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.ProtocolReader;
import lightcontainer.protocol.rules.writer.RemoveFileOkRule; import lightcontainer.protocol.rules.writer.RemoveFileOkRule;
import static lightcontainer.protocol.StandardizedDefinitions.SBE_ERASE_RESULT_OK;
public class EraseOkRule extends ProtocolReader { 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"; private static final String NAME = "ERASE_OK";

View File

@ -7,14 +7,12 @@ import lightcontainer.protocol.rules.writer.FilesRule;
import java.util.List; 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 * Règle permettant de récupérer la liste des fichiers d'un utilisateur
*/ */
public class FilelistRule extends ProtocolReader { public class FilelistRule extends ProtocolReader {
// Constants // Constants
private static final String PATTERN = CLIENT_FILE_LIST; private static final String PATTERN = "^FILELIST\r\n$";
private static final String NAME = "FILELIST"; private static final String NAME = "FILELIST";

View File

@ -9,11 +9,9 @@ import lightcontainer.storage.ReadOnlyFile;
import java.util.Iterator; import java.util.Iterator;
import static lightcontainer.protocol.StandardizedDefinitions.CLIENT_GET_FILE;
public class GetFileRule extends ProtocolReader { public class GetFileRule extends ProtocolReader {
// Constants // 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"; private static final String NAME = "GETFILE";
// -- arguments // -- arguments
private static final int FILE_NAME = 0; // Index file name. private static final int FILE_NAME = 0; // Index file name.

View File

@ -3,14 +3,12 @@ package lightcontainer.protocol.rules.reader;
import lightcontainer.domains.client.Context; import lightcontainer.domains.client.Context;
import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.ProtocolReader;
import static lightcontainer.protocol.StandardizedDefinitions.SBE_HELLO;
/** /**
* Règle permettant d'être alerter de l'annoncement d'un SBE * Règle permettant d'être alerter de l'annoncement d'un SBE
*/ */
public class HelloRule extends ProtocolReader { 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"; private static final String NAME = "HELLO";

View File

@ -9,11 +9,9 @@ import lightcontainer.storage.ReadOnlyFile;
import java.util.Iterator; import java.util.Iterator;
import static lightcontainer.protocol.StandardizedDefinitions.CLIENT_REMOVE_FILE;
public class RemoveFileRule extends ProtocolReader { 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"; private static final String NAME = "REMOVEFILE";

View File

@ -5,11 +5,9 @@ import lightcontainer.interfaces.ProtocolRepository;
import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.ProtocolReader;
import lightcontainer.protocol.rules.writer.GetFileErrorRule; import lightcontainer.protocol.rules.writer.GetFileErrorRule;
import static lightcontainer.protocol.StandardizedDefinitions.SBE_RETRIEVE_RESULT_ERROR;
public class RetrieveErrorRule extends ProtocolReader { public class RetrieveErrorRule extends ProtocolReader {
// Constants // 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"; private static final String NAME = "RETRIEVE_ERROR";
// Variables // Variables

View File

@ -9,11 +9,9 @@ import lightcontainer.utils.FileReceiver;
import java.io.InputStream; import java.io.InputStream;
import static lightcontainer.protocol.StandardizedDefinitions.SBE_RETRIEVE_RESULT_OK;
public class RetrieveOkRule extends ProtocolReader { public class RetrieveOkRule extends ProtocolReader {
// Constants // 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"; private static final String NAME = "RETRIEVE_OK";
// -- arguments // -- arguments
private static final int HASHED_FILE_NAME = 0; // Index hashed filename private static final int HASHED_FILE_NAME = 0; // Index hashed filename

View File

@ -5,14 +5,12 @@ import lightcontainer.interfaces.ProtocolRepository;
import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.ProtocolReader;
import lightcontainer.protocol.rules.writer.SaveFileErrorRule; 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. * Règle permettant de de confirmer la sauvegrade d'un fichier.
*/ */
public class SendErrorRule extends ProtocolReader { public class SendErrorRule extends ProtocolReader {
// Constants // 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"; private static final String NAME = "SEND_ERROR";

View File

@ -5,15 +5,13 @@ import lightcontainer.interfaces.ProtocolRepository;
import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.ProtocolReader;
import lightcontainer.protocol.rules.writer.SaveFileOkRule; 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. * Règle permettant de de confirmer la sauvegrade d'un fichier.
*/ */
public class SendOkRule extends ProtocolReader { public class SendOkRule extends ProtocolReader {
// Constants // 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"; private static final String NAME = "SEND_OK";

View File

@ -6,14 +6,12 @@ import lightcontainer.protocol.ProtocolReader;
import lightcontainer.protocol.rules.writer.SignErrorRule; import lightcontainer.protocol.rules.writer.SignErrorRule;
import lightcontainer.protocol.rules.writer.SignOkRule; 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 * Règle permettant de gérer la connection d'un utilisateur
*/ */
public class SigninRule extends ProtocolReader { public class SigninRule extends ProtocolReader {
// Constants // 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"; private static final String NAME = "SIGNIN";

View File

@ -3,14 +3,12 @@ package lightcontainer.protocol.rules.reader;
import lightcontainer.domains.client.Context; import lightcontainer.domains.client.Context;
import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.ProtocolReader;
import static lightcontainer.protocol.StandardizedDefinitions.CLIENT_SIGN_OUT;
/** /**
* Règle demandant la déconnexion du client * Règle demandant la déconnexion du client
*/ */
public class SignoutRule extends ProtocolReader { 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"; public static final String NAME = "SIGNOUT";

View File

@ -6,14 +6,12 @@ import lightcontainer.protocol.ProtocolReader;
import lightcontainer.protocol.rules.writer.SignErrorRule; import lightcontainer.protocol.rules.writer.SignErrorRule;
import lightcontainer.protocol.rules.writer.SignOkRule; 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 * Règle permettant de gérer la création d'un utilisateur
*/ */
public class SignupRule extends ProtocolReader { public class SignupRule extends ProtocolReader {
// Constants // 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 String NAME = "SIGNUP";
private static final int LOGIN = 0; private static final int LOGIN = 0;
private static final int PASSWORD = 1; private static final int PASSWORD = 1;

View File

@ -2,12 +2,10 @@ package lightcontainer.protocol.rules.writer;
import lightcontainer.protocol.ProtocolWriter; import lightcontainer.protocol.ProtocolWriter;
import static lightcontainer.protocol.StandardizedDefinitions.FFE_ERASE_FILE;
public class EraseFileRule extends ProtocolWriter { public class EraseFileRule extends ProtocolWriter {
//"^ERASEFILE ([A-Za-z0-9]{50,200})\r\n$" //"^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"; public static String NAME = "ERASEFILE";

View File

@ -2,14 +2,12 @@ package lightcontainer.protocol.rules.writer;
import lightcontainer.protocol.ProtocolWriter; 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 * Règle permettant de construire une commande contenant la liste des fichiers d'un utilisateur
*/ */
public class FilesRule extends ProtocolWriter { public class FilesRule extends ProtocolWriter {
//"^FILES( ([^ !]{1,20})!([0-9]{1,10})){0,50}\r\n$" //"^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"; public static final String NAME = "FILES";

View File

@ -2,8 +2,6 @@ package lightcontainer.protocol.rules.writer;
import lightcontainer.protocol.ProtocolWriter; 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 * Règle utilisé dans le cas ou une erreur survient lors
* de la demande de récupération d'un fichier. * 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 { public class GetFileErrorRule extends ProtocolWriter {
// Constants // Constants
//"^GETFILE_ERROR\r\n$" //"^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"; public static final String NAME = "GETFILE_ERROR";
// Constructors // Constructors

View File

@ -6,12 +6,10 @@ import lightcontainer.utils.FileSender;
import java.io.OutputStream; import java.io.OutputStream;
import static lightcontainer.protocol.StandardizedDefinitions.FFE_GET_FILE_RESULT_OK;
public class GetFileOkRule extends ProtocolWriter { public class GetFileOkRule extends ProtocolWriter {
// Constants // Constants
//"^GETFILE_OK ([^ !]{1,20}) ([0-9]{1,10})\r\n$" //"^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"; public static final String NAME = "GETFILE_OK";
// -- params // -- params
private static final int FILE_NAME = 0; // Index file name hashed private static final int FILE_NAME = 0; // Index file name hashed

View File

@ -2,12 +2,10 @@ package lightcontainer.protocol.rules.writer;
import lightcontainer.protocol.ProtocolWriter; import lightcontainer.protocol.ProtocolWriter;
import static lightcontainer.protocol.StandardizedDefinitions.FFE_REMOVE_ERROR;
public class RemoveFileErrorRule extends ProtocolWriter { public class RemoveFileErrorRule extends ProtocolWriter {
//"^REMOVEFILE_ERROR\r\n$" //"^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"; public static String NAME = "REMOVEFILE_ERROR";

View File

@ -2,11 +2,9 @@ package lightcontainer.protocol.rules.writer;
import lightcontainer.protocol.ProtocolWriter; import lightcontainer.protocol.ProtocolWriter;
import static lightcontainer.protocol.StandardizedDefinitions.FFE_REMOVE_OK;
public class RemoveFileOkRule extends ProtocolWriter { public class RemoveFileOkRule extends ProtocolWriter {
//"^REMOVEFILE_OK\r\n$" //"^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 static String NAME = "REMOVEFILE_OK";
public RemoveFileOkRule() { public RemoveFileOkRule() {

View File

@ -2,12 +2,10 @@ package lightcontainer.protocol.rules.writer;
import lightcontainer.protocol.ProtocolWriter; import lightcontainer.protocol.ProtocolWriter;
import static lightcontainer.protocol.StandardizedDefinitions.FFE_RETRIEVE_FILE;
public class RetrieveFileRule extends ProtocolWriter { public class RetrieveFileRule extends ProtocolWriter {
// Constants // Constants
//"^RETRIEVEFILE ([A-Za-z0-9]{50,200})\r\n$" //"^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"; public static final String NAME = "RETRIEVEFILE";
// Constructor // Constructor

View File

@ -8,14 +8,12 @@ import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; 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é * Règle signifiant que la sauvegarde d'un fichier a échoué
*/ */
public class SaveFileErrorRule extends ProtocolWriter { public class SaveFileErrorRule extends ProtocolWriter {
//"^SAVEFILE_ERROR\r\n$" //"^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"; public static final String NAME = "SAVEFILE_ERROR";

View File

@ -7,14 +7,12 @@ import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; 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 * Règle signifiant que la sauvegarde d'un fichier fût un succès
*/ */
public class SaveFileOkRule extends ProtocolWriter { public class SaveFileOkRule extends ProtocolWriter {
//"^SAVEFILE_OK\r\n$" //"^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"; public static final String NAME = "SAVEFILE_OK";

View File

@ -2,14 +2,12 @@ package lightcontainer.protocol.rules.writer;
import lightcontainer.protocol.ProtocolWriter; import lightcontainer.protocol.ProtocolWriter;
import static lightcontainer.protocol.StandardizedDefinitions.FFE_SIGN_ERROR;
/** /**
* Règle renvoyée au client lorsque l'authentification a échoué. * Règle renvoyée au client lorsque l'authentification a échoué.
*/ */
public class SignErrorRule extends ProtocolWriter { public class SignErrorRule extends ProtocolWriter {
//"^SIGN_ERROR\r\n$" //"^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"; public static final String NAME = "SIGN_ERROR";

View File

@ -2,14 +2,12 @@ package lightcontainer.protocol.rules.writer;
import lightcontainer.protocol.ProtocolWriter; import lightcontainer.protocol.ProtocolWriter;
import static lightcontainer.protocol.StandardizedDefinitions.FFE_SIGN_OK;
/** /**
* Règle renvoyée au client lorsque l'authentification a réusie. * Règle renvoyée au client lorsque l'authentification a réusie.
*/ */
public class SignOkRule extends ProtocolWriter { public class SignOkRule extends ProtocolWriter {
//"^SIGN_OK\r\n$" //"^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"; public static final String NAME = "SIGN_OK";