From bfd4c421004ce35a9eac307c3ac4976caa1820ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sun, 5 Jan 2020 18:00:56 +0100 Subject: UDUP with no serialization working --- .../cloudatlas/agent/messages/UDUPMessage.java | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/UDUPMessage.java (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/UDUPMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/UDUPMessage.java new file mode 100644 index 0000000..335d6fe --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/UDUPMessage.java @@ -0,0 +1,61 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +import pl.edu.mimuw.cloudatlas.agent.modules.Module; +import pl.edu.mimuw.cloudatlas.agent.modules.ModuleType; +import pl.edu.mimuw.cloudatlas.model.ValueContact; + +public class UDUPMessage extends AgentMessage { + private ValueContact contact; + private AgentMessage content; + private int retry; + private String conversationId; + + public UDUPMessage(String messageId, long timestamp, ValueContact contact, AgentMessage content, int retry, String conversationId) { + super(messageId, ModuleType.UDP, timestamp); + this.contact = contact; + this.content = content; + this.retry = retry; + this.conversationId = conversationId; + } + + public UDUPMessage(String messageId, ValueContact contact, AgentMessage content, int retry, String conversationId) { + super(messageId, ModuleType.UDP); + this.contact = contact; + this.content = content; + this.retry = retry; + this.conversationId = conversationId; + } + + @Override + public void callMe(Module module) throws InterruptedException, Module.InvalidMessageType { + module.handleTyped(this); + } + + public AgentMessage getContent() { + return content; + } + + public void setContent(AgentMessage content) { + this.content = content; + } + + public int getRetry() { + return retry; + } + + public String getConversationId() { + return conversationId; + } + + public void setRetry(int retry) { this.retry = retry; } + + public ValueContact getContact() { return contact; } + + public void setContact(ValueContact contact) { + this.contact = contact; + } + + public void setConversationId(String conversationId) { + this.conversationId = conversationId; + } +} -- cgit v1.2.3 From f8e0f371515a825ead0bf385105b461223c55e71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Mon, 6 Jan 2020 16:17:18 +0100 Subject: Refactor UDUP message --- .../cloudatlas/agent/messages/UDUPMessage.java | 28 +++++----------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/UDUPMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/UDUPMessage.java index 335d6fe..fa8d1fa 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/UDUPMessage.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/UDUPMessage.java @@ -7,23 +7,21 @@ import pl.edu.mimuw.cloudatlas.model.ValueContact; public class UDUPMessage extends AgentMessage { private ValueContact contact; private AgentMessage content; - private int retry; - private String conversationId; - public UDUPMessage(String messageId, long timestamp, ValueContact contact, AgentMessage content, int retry, String conversationId) { + public UDUPMessage(String messageId, long timestamp, ValueContact contact, AgentMessage content) { super(messageId, ModuleType.UDP, timestamp); this.contact = contact; this.content = content; - this.retry = retry; - this.conversationId = conversationId; } - public UDUPMessage(String messageId, ValueContact contact, AgentMessage content, int retry, String conversationId) { + public UDUPMessage(String messageId, ValueContact contact, AgentMessage content) { super(messageId, ModuleType.UDP); this.contact = contact; this.content = content; - this.retry = retry; - this.conversationId = conversationId; + } + + public UDUPMessage() { + super("", ModuleType.UDP); } @Override @@ -39,23 +37,9 @@ public class UDUPMessage extends AgentMessage { this.content = content; } - public int getRetry() { - return retry; - } - - public String getConversationId() { - return conversationId; - } - - public void setRetry(int retry) { this.retry = retry; } - public ValueContact getContact() { return contact; } public void setContact(ValueContact contact) { this.contact = contact; } - - public void setConversationId(String conversationId) { - this.conversationId = conversationId; - } } -- cgit v1.2.3