From 219431065b335fdf250394ba66da8220d9bb868f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Mon, 23 Dec 2019 19:54:24 +0100 Subject: Rename messages package --- .../cloudatlas/agent/messages/AgentMessage.java | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java new file mode 100644 index 0000000..4f5a69c --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java @@ -0,0 +1,57 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +import pl.edu.mimuw.cloudatlas.agent.Agent; + +public class AgentMessage { + + public enum AgentModule { + TIMER_SCHEDULER, + TIMER_GTP, + RMI, + UDP, + GOSSIP_IN, + GOSSIP_OUT, + STATE, + QUERY + } + + private String messageId; + private AgentModule destinationModule; + private long timestamp; + + public AgentMessage(String messageId, AgentModule destinationModule, long timestamp) { + this.messageId = messageId; + this.destinationModule = destinationModule; + this.timestamp = timestamp; + } + + public AgentMessage(String messageId, AgentModule destinationModule) { + this.messageId = messageId; + this.destinationModule = destinationModule; + this.timestamp = System.currentTimeMillis() / 1000L; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public AgentModule getDestinationModule() { + return destinationModule; + } + + public void setDestinationModule(AgentModule destinationModule) { + this.destinationModule = destinationModule; + } + + public long getTimestamp() { + return timestamp; + } + + public void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } +} -- cgit v1.2.3 From 23c86416390fdbcfc8d749e9117564d25c7ef729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Mon, 23 Dec 2019 19:56:37 +0100 Subject: Import fixes --- src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java index 4f5a69c..31fc6f8 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java @@ -1,7 +1,5 @@ package pl.edu.mimuw.cloudatlas.agent.messages; -import pl.edu.mimuw.cloudatlas.agent.Agent; - public class AgentMessage { public enum AgentModule { -- cgit v1.2.3 From 054c14ae3d1c2f02d6012c6133fa78c5a1a15c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Mon, 23 Dec 2019 23:22:57 +0100 Subject: Make scheduled task abstract --- src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java index 31fc6f8..ba15a7a 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java @@ -1,6 +1,7 @@ package pl.edu.mimuw.cloudatlas.agent.messages; public class AgentMessage { + public AgentModule correctType; public enum AgentModule { TIMER_SCHEDULER, -- cgit v1.2.3 From 6bd93c4fc80624eb83e9a1eb9b93e5781a796505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Mon, 23 Dec 2019 23:27:01 +0100 Subject: Fix agent message type checks --- .../java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java index ba15a7a..b71831f 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java @@ -1,7 +1,6 @@ package pl.edu.mimuw.cloudatlas.agent.messages; -public class AgentMessage { - public AgentModule correctType; +public abstract class AgentMessage { public enum AgentModule { TIMER_SCHEDULER, @@ -30,6 +29,8 @@ public class AgentMessage { this.timestamp = System.currentTimeMillis() / 1000L; } + public abstract AgentModule getCorrectMessageType(); + public String getMessageId() { return messageId; } -- cgit v1.2.3