Regex : anciennes utilisées car bug avec nouvelles
This commit is contained in:
parent
c0ec403ec2
commit
6f97cb6fc7
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user