Ajout des nouveaux readers et writers à protocolRepository

This commit is contained in:
Maximilien LEDOUX 2022-03-13 15:02:40 +01:00
parent a5e6b0b3e0
commit 166cf37286
7 changed files with 14 additions and 7 deletions

View File

@ -37,6 +37,9 @@ public class App {
protocolRep.addReader(new SavefileRule(protocolRep, repositoryStorage.getStoragePath())); protocolRep.addReader(new SavefileRule(protocolRep, repositoryStorage.getStoragePath()));
protocolRep.addReader(new SendOkRule(protocolRep)); protocolRep.addReader(new SendOkRule(protocolRep));
protocolRep.addReader(new GetFileRule(protocolRep)); protocolRep.addReader(new GetFileRule(protocolRep));
protocolRep.addReader(new EraseErrorRule(protocolRep));
protocolRep.addReader(new EraseOkRule(protocolRep));
protocolRep.addReader(new RemoveFileRule(protocolRep));
protocolRep.addWriter(new SignOkRule()); protocolRep.addWriter(new SignOkRule());
protocolRep.addWriter(new SignErrorRule()); protocolRep.addWriter(new SignErrorRule());
@ -45,6 +48,9 @@ public class App {
protocolRep.addWriter(new SaveFileErrorRule()); protocolRep.addWriter(new SaveFileErrorRule());
protocolRep.addWriter(new SendfileRule(repositoryStorage.getStoragePath())); protocolRep.addWriter(new SendfileRule(repositoryStorage.getStoragePath()));
protocolRep.addWriter(new GetFileErrorRule()); protocolRep.addWriter(new GetFileErrorRule());
protocolRep.addWriter(new EraseFileRule());
protocolRep.addWriter(new RemoveFileErrorRule());
protocolRep.addWriter(new RemoveFileOkRule());
FileFrontEnd ffe = new FileFrontEnd(clientRep, storeRep, protocolRep); FileFrontEnd ffe = new FileFrontEnd(clientRep, storeRep, protocolRep);
new UnicastServerListener(ffe, clientRep, protocolRep, repositoryStorage, repositoryStorage.getUnicastPort()); new UnicastServerListener(ffe, clientRep, protocolRep, repositoryStorage, repositoryStorage.getUnicastPort());

View File

@ -14,7 +14,7 @@ public class EraseErrorRule extends ProtocolReader {
private final ProtocolRepository protocolRep; private final ProtocolRepository protocolRep;
protected EraseErrorRule(ProtocolRepository protocolRep) { public EraseErrorRule(ProtocolRepository protocolRep) {
super(NAME, PATTERN); super(NAME, PATTERN);
this.protocolRep = protocolRep; this.protocolRep = protocolRep;
} }

View File

@ -13,7 +13,7 @@ public class EraseOkRule extends ProtocolReader {
private final ProtocolRepository protocolRep; private final ProtocolRepository protocolRep;
protected EraseOkRule(ProtocolRepository protocolRep) { public EraseOkRule(ProtocolRepository protocolRep) {
super(NAME, PATTERN); super(NAME, PATTERN);
this.protocolRep = protocolRep; this.protocolRep = protocolRep;
} }

View File

@ -3,6 +3,7 @@ package lightcontainer.protocol.rules.reader;
import lightcontainer.domains.client.Context; import lightcontainer.domains.client.Context;
import lightcontainer.interfaces.ProtocolRepository; import lightcontainer.interfaces.ProtocolRepository;
import lightcontainer.protocol.ProtocolReader; import lightcontainer.protocol.ProtocolReader;
import lightcontainer.protocol.rules.writer.EraseFileRule;
import lightcontainer.protocol.rules.writer.RemoveFileErrorRule; import lightcontainer.protocol.rules.writer.RemoveFileErrorRule;
public class RemoveFileRule extends ProtocolReader { public class RemoveFileRule extends ProtocolReader {
@ -16,7 +17,7 @@ public class RemoveFileRule extends ProtocolReader {
private final ProtocolRepository protocolRep; private final ProtocolRepository protocolRep;
protected RemoveFileRule(ProtocolRepository protocolRep) { public RemoveFileRule(ProtocolRepository protocolRep) {
super(NAME, PATTERN); super(NAME, PATTERN);
this.protocolRep = protocolRep; this.protocolRep = protocolRep;
} }

View File

@ -1,4 +1,4 @@
package lightcontainer.protocol.rules.reader; package lightcontainer.protocol.rules.writer;
import lightcontainer.protocol.ProtocolWriter; import lightcontainer.protocol.ProtocolWriter;
@ -9,7 +9,7 @@ public class EraseFileRule extends ProtocolWriter {
public static String NAME = "ERASEFILE"; public static String NAME = "ERASEFILE";
protected EraseFileRule() { public EraseFileRule() {
super(NAME, PATTERN); super(NAME, PATTERN);
} }
} }

View File

@ -8,7 +8,7 @@ public class RemoveFileErrorRule extends ProtocolWriter {
public static String NAME = "REMOVEFILE_ERROR"; public static String NAME = "REMOVEFILE_ERROR";
protected RemoveFileErrorRule() { public RemoveFileErrorRule() {
super(NAME, PATTERN); super(NAME, PATTERN);
} }
} }

View File

@ -7,7 +7,7 @@ public class RemoveFileOkRule extends ProtocolWriter {
private static final String PATTERN = "^REMOVEFILE_OK\r\n$"; private static final String PATTERN = "^REMOVEFILE_OK\r\n$";
public static String NAME = "REMOVEFILE_OK"; public static String NAME = "REMOVEFILE_OK";
protected RemoveFileOkRule() { public RemoveFileOkRule() {
super(NAME, PATTERN); super(NAME, PATTERN);
} }
} }