From ca2f1ab4a37f0d590d5c116cd1fa7c341c77fad3 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Mon, 30 Dec 2019 22:16:46 +0100 Subject: Implement modular getZoneSet --- .../cloudatlas/agent/messages/RMIMessage.java | 14 ------------ .../cloudatlas/agent/messages/RemikMessage.java | 25 ++++++++++++++++++++++ .../agent/messages/RequestStateMessage.java | 16 ++++++++++++++ 3 files changed, 41 insertions(+), 14 deletions(-) delete mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RMIMessage.java create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RemikMessage.java create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RequestStateMessage.java (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RMIMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RMIMessage.java deleted file mode 100644 index a8e3afb..0000000 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RMIMessage.java +++ /dev/null @@ -1,14 +0,0 @@ -package pl.edu.mimuw.cloudatlas.agent.messages; - -import pl.edu.mimuw.cloudatlas.agent.modules.Module; -import pl.edu.mimuw.cloudatlas.agent.modules.ModuleType; - -public class RMIMessage extends AgentMessage { - public RMIMessage(String messageId, long timestamp) { - super(messageId, ModuleType.RMI, timestamp); - } - - public void callMe(Module module) throws InterruptedException, Module.InvalidMessageType { - module.handleTyped(this); - } -} diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RemikMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RemikMessage.java new file mode 100644 index 0000000..b0300cb --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RemikMessage.java @@ -0,0 +1,25 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +import pl.edu.mimuw.cloudatlas.agent.modules.Module; +import pl.edu.mimuw.cloudatlas.agent.modules.ModuleType; + +public abstract class RemikMessage extends AgentMessage { + public enum Type { + REQUEST_STATE + } + + private Type type; + + public RemikMessage(String messageId, long timestamp, Type type) { + super(messageId, ModuleType.RMI, timestamp); + this.type = type; + } + + public Type getType() { + return type; + } + + public void callMe(Module module) throws InterruptedException, Module.InvalidMessageType { + module.handleTyped(this); + } +} diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RequestStateMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RequestStateMessage.java new file mode 100644 index 0000000..698aac7 --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RequestStateMessage.java @@ -0,0 +1,16 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +import java.util.concurrent.CompletableFuture; + +public class RequestStateMessage extends RemikMessage { + CompletableFuture responseFuture; + + public RequestStateMessage(String messageId, long timestamp, CompletableFuture responseFuture) { + super(messageId, timestamp, Type.REQUEST_STATE); + this.responseFuture = responseFuture; + } + + public CompletableFuture getFuture() { + return responseFuture; + } +} -- cgit v1.2.3 From eb7fbbd08bb003a47d9788a9f6476695ab46b271 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Tue, 31 Dec 2019 17:31:38 +0100 Subject: Add message to set a single attribute --- .../agent/messages/SetAttributeMessage.java | 37 ++++++++++++++++++++++ .../cloudatlas/agent/messages/StanikMessage.java | 1 + 2 files changed, 38 insertions(+) create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/SetAttributeMessage.java (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/SetAttributeMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/SetAttributeMessage.java new file mode 100644 index 0000000..4888484 --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/SetAttributeMessage.java @@ -0,0 +1,37 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +import pl.edu.mimuw.cloudatlas.agent.modules.ModuleType; +import pl.edu.mimuw.cloudatlas.model.Attribute; +import pl.edu.mimuw.cloudatlas.model.Value; +import pl.edu.mimuw.cloudatlas.model.ValueTime; + +public class SetAttributeMessage extends StanikMessage { + private String pathName; + private Attribute attribute; + private Value value; + private ValueTime updateTimestamp; + + public SetAttributeMessage(String messageId, long timestamp, String pathName, Attribute attribute, Value value, ValueTime updateTimestamp) { + super(messageId, timestamp, Type.SET_ATTRIBUTE); + this.pathName = pathName; + this.attribute = attribute; + this.value = value; + this.updateTimestamp = updateTimestamp; + } + + public String getPathName() { + return pathName; + } + + public Attribute getAttribute() { + return attribute; + } + + public Value getValue() { + return value; + } + + public ValueTime getUpdateTimestamp() { + return updateTimestamp; + } +} diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/StanikMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/StanikMessage.java index d86de4a..844f31c 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/StanikMessage.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/StanikMessage.java @@ -7,6 +7,7 @@ public abstract class StanikMessage extends AgentMessage { public enum Type { GET_STATE, REMOVE_ZMI, + SET_ATTRIBUTE, UPDATE_ATTRIBUTES, UPDATE_QUERIES } -- cgit v1.2.3