From 166cf372862deea4758ff0aec9551c59b040b190 Mon Sep 17 00:00:00 2001 From: Maximilien LEDOUX Date: Sun, 13 Mar 2022 15:02:40 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20des=20nouveaux=20readers=20et=20writers?= =?UTF-8?q?=20=C3=A0=20protocolRepository?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/lightcontainer/App.java | 6 ++++++ .../protocol/rules/reader/EraseErrorRule.java | 2 +- .../lightcontainer/protocol/rules/reader/EraseOkRule.java | 2 +- .../protocol/rules/reader/RemoveFileRule.java | 3 ++- .../protocol/rules/{reader => writer}/EraseFileRule.java | 4 ++-- .../protocol/rules/writer/RemoveFileErrorRule.java | 2 +- .../protocol/rules/writer/RemoveFileOkRule.java | 2 +- 7 files changed, 14 insertions(+), 7 deletions(-) rename app/src/main/java/lightcontainer/protocol/rules/{reader => writer}/EraseFileRule.java (77%) diff --git a/app/src/main/java/lightcontainer/App.java b/app/src/main/java/lightcontainer/App.java index ad7dd73..9c28c9f 100644 --- a/app/src/main/java/lightcontainer/App.java +++ b/app/src/main/java/lightcontainer/App.java @@ -37,6 +37,9 @@ public class App { protocolRep.addReader(new SavefileRule(protocolRep, repositoryStorage.getStoragePath())); protocolRep.addReader(new SendOkRule(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 SignErrorRule()); @@ -45,6 +48,9 @@ public class App { protocolRep.addWriter(new SaveFileErrorRule()); protocolRep.addWriter(new SendfileRule(repositoryStorage.getStoragePath())); protocolRep.addWriter(new GetFileErrorRule()); + protocolRep.addWriter(new EraseFileRule()); + protocolRep.addWriter(new RemoveFileErrorRule()); + protocolRep.addWriter(new RemoveFileOkRule()); FileFrontEnd ffe = new FileFrontEnd(clientRep, storeRep, protocolRep); new UnicastServerListener(ffe, clientRep, protocolRep, repositoryStorage, repositoryStorage.getUnicastPort()); 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 6cf945a..1ce0b0b 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/EraseErrorRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/EraseErrorRule.java @@ -14,7 +14,7 @@ public class EraseErrorRule extends ProtocolReader { private final ProtocolRepository protocolRep; - protected EraseErrorRule(ProtocolRepository protocolRep) { + public EraseErrorRule(ProtocolRepository protocolRep) { super(NAME, PATTERN); this.protocolRep = protocolRep; } 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 9ff6b44..9125c7a 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/EraseOkRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/EraseOkRule.java @@ -13,7 +13,7 @@ public class EraseOkRule extends ProtocolReader { private final ProtocolRepository protocolRep; - protected EraseOkRule(ProtocolRepository protocolRep) { + public EraseOkRule(ProtocolRepository protocolRep) { super(NAME, PATTERN); this.protocolRep = protocolRep; } 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 4b1bdaa..412c8da 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/RemoveFileRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/RemoveFileRule.java @@ -3,6 +3,7 @@ package lightcontainer.protocol.rules.reader; import lightcontainer.domains.client.Context; import lightcontainer.interfaces.ProtocolRepository; import lightcontainer.protocol.ProtocolReader; +import lightcontainer.protocol.rules.writer.EraseFileRule; import lightcontainer.protocol.rules.writer.RemoveFileErrorRule; public class RemoveFileRule extends ProtocolReader { @@ -16,7 +17,7 @@ public class RemoveFileRule extends ProtocolReader { private final ProtocolRepository protocolRep; - protected RemoveFileRule(ProtocolRepository protocolRep) { + public RemoveFileRule(ProtocolRepository protocolRep) { super(NAME, PATTERN); this.protocolRep = protocolRep; } diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/EraseFileRule.java b/app/src/main/java/lightcontainer/protocol/rules/writer/EraseFileRule.java similarity index 77% rename from app/src/main/java/lightcontainer/protocol/rules/reader/EraseFileRule.java rename to app/src/main/java/lightcontainer/protocol/rules/writer/EraseFileRule.java index 1573cf7..4fcba04 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/EraseFileRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/writer/EraseFileRule.java @@ -1,4 +1,4 @@ -package lightcontainer.protocol.rules.reader; +package lightcontainer.protocol.rules.writer; import lightcontainer.protocol.ProtocolWriter; @@ -9,7 +9,7 @@ public class EraseFileRule extends ProtocolWriter { public static String NAME = "ERASEFILE"; - protected EraseFileRule() { + public EraseFileRule() { super(NAME, PATTERN); } } 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 4f91bfc..5e7517f 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/writer/RemoveFileErrorRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/writer/RemoveFileErrorRule.java @@ -8,7 +8,7 @@ public class RemoveFileErrorRule extends ProtocolWriter { public static String NAME = "REMOVEFILE_ERROR"; - protected RemoveFileErrorRule() { + public RemoveFileErrorRule() { super(NAME, PATTERN); } } 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 964f5e6..a4ae784 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/writer/RemoveFileOkRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/writer/RemoveFileOkRule.java @@ -7,7 +7,7 @@ public class RemoveFileOkRule extends ProtocolWriter { private static final String PATTERN = "^REMOVEFILE_OK\r\n$"; public static String NAME = "REMOVEFILE_OK"; - protected RemoveFileOkRule() { + public RemoveFileOkRule() { super(NAME, PATTERN); } }