diff --git a/app/src/main/java/lightcontainer/domains/Task.java b/app/src/main/java/lightcontainer/domains/Task.java index 6cd8fc0..45494c8 100644 --- a/app/src/main/java/lightcontainer/domains/Task.java +++ b/app/src/main/java/lightcontainer/domains/Task.java @@ -9,7 +9,7 @@ public class Task { private TaskStatus status; private String command; private String client; - private String store; + private String storeDomain; public Task() { diff --git a/app/src/main/java/lightcontainer/interfaces/StoreProcessorFFE.java b/app/src/main/java/lightcontainer/interfaces/StoreProcessorFFE.java index e6fde95..7a5ffb6 100644 --- a/app/src/main/java/lightcontainer/interfaces/StoreProcessorFFE.java +++ b/app/src/main/java/lightcontainer/interfaces/StoreProcessorFFE.java @@ -1,4 +1,13 @@ package lightcontainer.interfaces; +import lightcontainer.domains.StoreProcessor; + public interface StoreProcessorFFE { + + /** + * Permet à un {@link StoreProcessor} d'avertir le FFE qu'il est disponible + * @param store + */ + void onStoreAvailable(StoreProcessor store); + } diff --git a/app/src/main/java/lightcontainer/repository/FileFrontEnd.java b/app/src/main/java/lightcontainer/repository/FileFrontEnd.java index b4db479..d7dfde2 100644 --- a/app/src/main/java/lightcontainer/repository/FileFrontEnd.java +++ b/app/src/main/java/lightcontainer/repository/FileFrontEnd.java @@ -1,20 +1,43 @@ package lightcontainer.repository; +import lightcontainer.domains.ClientHandler; +import lightcontainer.domains.StoreProcessor; import lightcontainer.domains.Task; import lightcontainer.interfaces.ClientHandlerFFE; import lightcontainer.interfaces.StoreProcessorFFE; +import java.util.Collections; import java.util.Deque; import java.util.LinkedList; +import java.util.concurrent.ConcurrentLinkedDeque; public class FileFrontEnd implements ClientHandlerFFE, StoreProcessorFFE { // Variables - private Deque tasks = new LinkedList<>(); + private Deque tasks = new ConcurrentLinkedDeque<>(); private ClientHandlerRepository clientRepository; // TODO -> pourquoi pas une interface ? end private StoreProcessorRepository storeRepository; // TODO -> pourquoi pas une interface ? end // Constructor - public FileFrontEnd() { + public FileFrontEnd(ClientHandlerRepository clientRepo, StoreProcessorRepository storeRepo) { + this.clientRepository = clientRepo; + this.storeRepository = storeRepo; + } + + /** + * Appelé quand nouvelle tâche + */ + public void alertStoreProcessors(Task task) { + // On avertit les stor processors d'une nouvelle tâche + + } + + /** + * Permet à un {@link StoreProcessor} d'avertir le FFE qu'il est disponible + * + * @param store + */ + @Override + public void onStoreAvailable(StoreProcessor store) { } }