From c99dd57bc5db3c0770b9c3b44709db4e0825f744 Mon Sep 17 00:00:00 2001 From: AllanCapistrano Date: Mon, 9 Oct 2023 12:24:05 -0300 Subject: [PATCH 1/6] refactor: using soft-iot-dlt-client-tangle-hornet --- pom.xml | 19 +++++++++++++-- .../iot/soft/models/conducts/Honest.java | 12 ++++++---- .../iot/soft/models/conducts/Malicious.java | 12 ++++++---- .../soft/models/tangle/LedgerConnector.java | 23 +++++++++++-------- .../OSGI-INF/blueprint/blueprint.xml | 4 ++-- 5 files changed, 49 insertions(+), 21 deletions(-) diff --git a/pom.xml b/pom.xml index ab8d9f6..a1ec1e1 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,9 @@ org.eclipse.paho.client.mqttv3, + jeromq, + jnacl, + soft.iot.dlt.client.tangle.hornet, gson; scope=compile|runtime; inline=false @@ -60,8 +63,8 @@ provided - io.github.larsid - SOFT-IoT-DLT-Client-Tangle + br.uefs.larsid.iot.soft + soft-iot-dlt-client-tangle-hornet 1.0-SNAPSHOT provided @@ -76,5 +79,17 @@ gson 2.9.0 + + + org.zeromq + jeromq + 0.5.2 + jar + + + eu.neilalexander + jnacl + 1.0.0 + \ No newline at end of file diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java b/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java index 135f544..3cc51ea 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java +++ b/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java @@ -2,9 +2,13 @@ import br.uefs.larsid.iot.soft.enums.ConductType; import br.uefs.larsid.iot.soft.models.tangle.LedgerConnector; -import dlt.client.tangle.enums.TransactionType; -import dlt.client.tangle.model.transactions.Evaluation; -import dlt.client.tangle.model.transactions.Transaction; +import dlt.client.tangle.hornet.enums.TransactionType; +import dlt.client.tangle.hornet.model.transactions.Evaluation; +import dlt.client.tangle.hornet.model.transactions.Transaction; + +// import dlt.client.tangle.enums.TransactionType; +// import dlt.client.tangle.model.transactions.Evaluation; +// import dlt.client.tangle.model.transactions.Transaction; import java.util.logging.Logger; public class Honest extends Conduct { @@ -61,6 +65,6 @@ public void evaluateDevice(String deviceId, int value) ); // Adicionando avaliação na Tangle. - this.getLedgerConnector().put(transactionEvaluation); + this.getLedgerConnector().put(transactionEvaluation); // TODO: Ver o motivo de não está escrevendo corretamente a transação } } diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java b/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java index c25b9c4..e0fa1a3 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java +++ b/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java @@ -2,9 +2,13 @@ import br.uefs.larsid.iot.soft.enums.ConductType; import br.uefs.larsid.iot.soft.models.tangle.LedgerConnector; -import dlt.client.tangle.enums.TransactionType; -import dlt.client.tangle.model.transactions.Evaluation; -import dlt.client.tangle.model.transactions.Transaction; +import dlt.client.tangle.hornet.enums.TransactionType; +import dlt.client.tangle.hornet.model.transactions.Evaluation; +import dlt.client.tangle.hornet.model.transactions.Transaction; + +// import dlt.client.tangle.enums.TransactionType; +// import dlt.client.tangle.model.transactions.Evaluation; +// import dlt.client.tangle.model.transactions.Transaction; import java.util.Random; import java.util.logging.Logger; @@ -99,7 +103,7 @@ public void evaluateDevice(String deviceId, int value) ); // Adicionando avaliação na Tangle. - this.getLedgerConnector().put(transactionEvaluation); + this.getLedgerConnector().put(transactionEvaluation); // TODO: Ver o motivo de não está escrevendo corretamente a transação } public float getHonestyRate() { diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java b/src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java index 728a1c2..f51a9c3 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java +++ b/src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java @@ -1,9 +1,14 @@ package br.uefs.larsid.iot.soft.models.tangle; -import dlt.client.tangle.model.transactions.Transaction; -import dlt.client.tangle.services.ILedgerReader; -import dlt.client.tangle.services.ILedgerSubscriber; -import dlt.client.tangle.services.ILedgerWriter; +import dlt.client.tangle.hornet.model.transactions.Transaction; +import dlt.client.tangle.hornet.services.ILedgerReader; +import dlt.client.tangle.hornet.services.ILedgerSubscriber; +import dlt.client.tangle.hornet.services.ILedgerWriter; + +// import dlt.client.tangle.model.transactions.Transaction; +// import dlt.client.tangle.services.ILedgerReader; +// import dlt.client.tangle.services.ILedgerSubscriber; +// import dlt.client.tangle.services.ILedgerWriter; /** * @author Allan Capistrano @@ -40,17 +45,17 @@ public void unsubscribe(String topic, ILedgerSubscriber iLedgerSubscriber) { * @throws InterruptedException */ public void put(Transaction transaction) throws InterruptedException { - this.ledgerWriter.put(transaction); + this.ledgerWriter.put(transaction); // TODO: Ver o motivo de não está escrevendo corretamente a transação } /** - * Obtém uma transação a partir do hash da mesma. + * Obtém uma transação a partir do ID da mesma. * - * @param hash String - Hash da transação. + * @param id String - ID da transação. * @return Transaction. */ - public Transaction getTransactionByHash(String hash) { - return this.ledgerWriter.getTransactionByHash(hash); + public Transaction getTransactionById(String id) { + return this.ledgerReader.getTransactionById(id); } public ILedgerWriter getLedgerWriter() { diff --git a/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/src/main/resources/OSGI-INF/blueprint/blueprint.xml index 9366414..73c4c67 100644 --- a/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -8,8 +8,8 @@ - - + + Date: Mon, 9 Oct 2023 12:28:56 -0300 Subject: [PATCH 2/6] chore: removing unnecessary imports --- .../larsid/iot/soft/models/conducts/Honest.java | 6 +----- .../larsid/iot/soft/models/conducts/Malicious.java | 6 +----- .../iot/soft/models/tangle/LedgerConnector.java | 13 ++++--------- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java b/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java index 3cc51ea..1a5d593 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java +++ b/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java @@ -5,10 +5,6 @@ import dlt.client.tangle.hornet.enums.TransactionType; import dlt.client.tangle.hornet.model.transactions.Evaluation; import dlt.client.tangle.hornet.model.transactions.Transaction; - -// import dlt.client.tangle.enums.TransactionType; -// import dlt.client.tangle.model.transactions.Evaluation; -// import dlt.client.tangle.model.transactions.Transaction; import java.util.logging.Logger; public class Honest extends Conduct { @@ -17,7 +13,7 @@ public class Honest extends Conduct { /** * Método construtor. - * + * * @param ledgerConnector LedgerConnector - Conector para comunicação com a Tangle. * @param id String - Identificador único do nó. */ diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java b/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java index e0fa1a3..5bc5195 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java +++ b/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java @@ -5,10 +5,6 @@ import dlt.client.tangle.hornet.enums.TransactionType; import dlt.client.tangle.hornet.model.transactions.Evaluation; import dlt.client.tangle.hornet.model.transactions.Transaction; - -// import dlt.client.tangle.enums.TransactionType; -// import dlt.client.tangle.model.transactions.Evaluation; -// import dlt.client.tangle.model.transactions.Transaction; import java.util.Random; import java.util.logging.Logger; @@ -21,7 +17,7 @@ public class Malicious extends Conduct { /** * Método construtor. - * + * * @param ledgerConnector LedgerConnector - Conector para comunicação com a Tangle. * @param id String - Identificador único do nó. * @param honestyRate float - Taxa de honestidade do nó malicioso. diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java b/src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java index f51a9c3..dbc9b5d 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java +++ b/src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java @@ -5,11 +5,6 @@ import dlt.client.tangle.hornet.services.ILedgerSubscriber; import dlt.client.tangle.hornet.services.ILedgerWriter; -// import dlt.client.tangle.model.transactions.Transaction; -// import dlt.client.tangle.services.ILedgerReader; -// import dlt.client.tangle.services.ILedgerSubscriber; -// import dlt.client.tangle.services.ILedgerWriter; - /** * @author Allan Capistrano */ @@ -20,7 +15,7 @@ public class LedgerConnector { /** * Inscreve em um tópico para escutar as transações que são realizadas. - * + * * @param topic String - Tópico. * @param iLedgerSubscriber ILedgerSubscriber - Objeto para inscrição. */ @@ -30,7 +25,7 @@ public void subscribe(String topic, ILedgerSubscriber iLedgerSubscriber) { /** * Se desinscreve de um tópico. - * + * * @param topic String - Tópico. * @param iLedgerSubscriber ILedgerSubscriber - Objeto para inscrição. */ @@ -40,7 +35,7 @@ public void unsubscribe(String topic, ILedgerSubscriber iLedgerSubscriber) { /** * Põe uma transação para ser publicada na Tangle. - * + * * @param transaction Transaction - Transação que será publicada. * @throws InterruptedException */ @@ -50,7 +45,7 @@ public void put(Transaction transaction) throws InterruptedException { /** * Obtém uma transação a partir do ID da mesma. - * + * * @param id String - ID da transação. * @return Transaction. */ From 04150a305b06fd790d9e73c7ad7bf724b9405206 Mon Sep 17 00:00:00 2001 From: AllanCapistrano Date: Mon, 9 Oct 2023 12:29:19 -0300 Subject: [PATCH 3/6] feat: add TODO --- .../java/br/uefs/larsid/iot/soft/models/conducts/Honest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java b/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java index 1a5d593..0f86bd3 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java +++ b/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java @@ -1,4 +1,5 @@ package br.uefs.larsid.iot.soft.models.conducts; +// TODO: Corrigir package em todas as classes. import br.uefs.larsid.iot.soft.enums.ConductType; import br.uefs.larsid.iot.soft.models.tangle.LedgerConnector; From b3fd9cc270d671d6f64d41da343f24d3fe9fb2d0 Mon Sep 17 00:00:00 2001 From: AllanCapistrano Date: Mon, 9 Oct 2023 13:34:48 -0300 Subject: [PATCH 4/6] chore: removing TODOs --- .../java/br/uefs/larsid/iot/soft/models/conducts/Honest.java | 2 +- .../java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java | 2 +- .../br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java b/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java index 0f86bd3..a44df21 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java +++ b/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java @@ -62,6 +62,6 @@ public void evaluateDevice(String deviceId, int value) ); // Adicionando avaliação na Tangle. - this.getLedgerConnector().put(transactionEvaluation); // TODO: Ver o motivo de não está escrevendo corretamente a transação + this.getLedgerConnector().put(transactionEvaluation); } } diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java b/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java index 5bc5195..0831f64 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java +++ b/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java @@ -99,7 +99,7 @@ public void evaluateDevice(String deviceId, int value) ); // Adicionando avaliação na Tangle. - this.getLedgerConnector().put(transactionEvaluation); // TODO: Ver o motivo de não está escrevendo corretamente a transação + this.getLedgerConnector().put(transactionEvaluation); } public float getHonestyRate() { diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java b/src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java index dbc9b5d..b1ea1d2 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java +++ b/src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java @@ -40,7 +40,7 @@ public void unsubscribe(String topic, ILedgerSubscriber iLedgerSubscriber) { * @throws InterruptedException */ public void put(Transaction transaction) throws InterruptedException { - this.ledgerWriter.put(transaction); // TODO: Ver o motivo de não está escrevendo corretamente a transação + this.ledgerWriter.put(transaction); } /** From 2546f992fdf0cc560f8d5f273941f3e7023fe7ba Mon Sep 17 00:00:00 2001 From: AllanCapistrano Date: Mon, 9 Oct 2023 13:43:17 -0300 Subject: [PATCH 5/6] chore: removing unnecessary dependencies --- pom.xml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/pom.xml b/pom.xml index a1ec1e1..6a8c6f4 100644 --- a/pom.xml +++ b/pom.xml @@ -23,9 +23,6 @@ org.eclipse.paho.client.mqttv3, - jeromq, - jnacl, - soft.iot.dlt.client.tangle.hornet, gson; scope=compile|runtime; inline=false @@ -79,17 +76,5 @@ gson 2.9.0 - - - org.zeromq - jeromq - 0.5.2 - jar - - - eu.neilalexander - jnacl - 1.0.0 - \ No newline at end of file From 30a25bdbf03e1bba1f1bc769364cb7691c626837 Mon Sep 17 00:00:00 2001 From: AllanCapistrano Date: Mon, 9 Oct 2023 13:50:47 -0300 Subject: [PATCH 6/6] refactor: classes and interfaces packages --- .../iot/soft/services/NodeTypeService.java | 5 ---- .../soft => node/type}/enums/ConductType.java | 2 +- .../soft => node/type}/models/NodeType.java | 23 ++++++++++--------- .../type}/models/conducts/Conduct.java | 6 ++--- .../type}/models/conducts/Honest.java | 7 +++--- .../type}/models/conducts/Malicious.java | 7 +++--- .../type}/models/tangle/LedgerConnector.java | 2 +- .../type}/mqtt/ListenerDevices.java | 7 +++--- .../node/type/services/NodeTypeService.java | 5 ++++ .../type}/tasks/CheckDevicesTask.java | 5 ++-- .../type}/tasks/RequestDataTask.java | 5 ++-- .../type}/tasks/WaitDeviceResponseTask.java | 5 ++-- .../soft => node/type}/utils/MQTTClient.java | 2 +- .../OSGI-INF/blueprint/blueprint.xml | 6 ++--- 14 files changed, 47 insertions(+), 40 deletions(-) delete mode 100644 src/main/java/br/uefs/larsid/iot/soft/services/NodeTypeService.java rename src/main/java/{br/uefs/larsid/iot/soft => node/type}/enums/ConductType.java (66%) rename src/main/java/{br/uefs/larsid/iot/soft => node/type}/models/NodeType.java (91%) rename src/main/java/{br/uefs/larsid/iot/soft => node/type}/models/conducts/Conduct.java (88%) rename src/main/java/{br/uefs/larsid/iot/soft => node/type}/models/conducts/Honest.java (91%) rename src/main/java/{br/uefs/larsid/iot/soft => node/type}/models/conducts/Malicious.java (94%) rename src/main/java/{br/uefs/larsid/iot/soft => node/type}/models/tangle/LedgerConnector.java (97%) rename src/main/java/{br/uefs/larsid/iot/soft => node/type}/mqtt/ListenerDevices.java (94%) create mode 100644 src/main/java/node/type/services/NodeTypeService.java rename src/main/java/{br/uefs/larsid/iot/soft => node/type}/tasks/CheckDevicesTask.java (90%) rename src/main/java/{br/uefs/larsid/iot/soft => node/type}/tasks/RequestDataTask.java (89%) rename src/main/java/{br/uefs/larsid/iot/soft => node/type}/tasks/WaitDeviceResponseTask.java (94%) rename src/main/java/{br/uefs/larsid/iot/soft => node/type}/utils/MQTTClient.java (99%) diff --git a/src/main/java/br/uefs/larsid/iot/soft/services/NodeTypeService.java b/src/main/java/br/uefs/larsid/iot/soft/services/NodeTypeService.java deleted file mode 100644 index 686760c..0000000 --- a/src/main/java/br/uefs/larsid/iot/soft/services/NodeTypeService.java +++ /dev/null @@ -1,5 +0,0 @@ -package br.uefs.larsid.iot.soft.services; - -public interface NodeTypeService { - -} diff --git a/src/main/java/br/uefs/larsid/iot/soft/enums/ConductType.java b/src/main/java/node/type/enums/ConductType.java similarity index 66% rename from src/main/java/br/uefs/larsid/iot/soft/enums/ConductType.java rename to src/main/java/node/type/enums/ConductType.java index c8c5afc..69f7176 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/enums/ConductType.java +++ b/src/main/java/node/type/enums/ConductType.java @@ -1,4 +1,4 @@ -package br.uefs.larsid.iot.soft.enums; +package node.type.enums; public enum ConductType { HONEST, MALICIOUS, SELFISH, CORRUPT, DISTURBING diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/NodeType.java b/src/main/java/node/type/models/NodeType.java similarity index 91% rename from src/main/java/br/uefs/larsid/iot/soft/models/NodeType.java rename to src/main/java/node/type/models/NodeType.java index 89fe9b2..531d2d5 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/NodeType.java +++ b/src/main/java/node/type/models/NodeType.java @@ -1,19 +1,20 @@ -package br.uefs.larsid.iot.soft.models; +package node.type.models; import br.uefs.larsid.extended.mapping.devices.services.IDevicePropertiesManager; -import br.uefs.larsid.iot.soft.models.conducts.Conduct; -import br.uefs.larsid.iot.soft.models.conducts.Honest; -import br.uefs.larsid.iot.soft.models.conducts.Malicious; -import br.uefs.larsid.iot.soft.models.tangle.LedgerConnector; -import br.uefs.larsid.iot.soft.mqtt.ListenerDevices; -import br.uefs.larsid.iot.soft.services.NodeTypeService; -import br.uefs.larsid.iot.soft.tasks.CheckDevicesTask; -import br.uefs.larsid.iot.soft.tasks.RequestDataTask; -import br.uefs.larsid.iot.soft.tasks.WaitDeviceResponseTask; -import br.uefs.larsid.iot.soft.utils.MQTTClient; import br.ufba.dcc.wiser.soft_iot.entities.Device; import br.ufba.dcc.wiser.soft_iot.entities.Sensor; import dlt.id.manager.services.IIDManagerService; +import node.type.models.conducts.Conduct; +import node.type.models.conducts.Honest; +import node.type.models.conducts.Malicious; +import node.type.models.tangle.LedgerConnector; +import node.type.mqtt.ListenerDevices; +import node.type.services.NodeTypeService; +import node.type.tasks.CheckDevicesTask; +import node.type.tasks.RequestDataTask; +import node.type.tasks.WaitDeviceResponseTask; +import node.type.utils.MQTTClient; + import java.io.IOException; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Conduct.java b/src/main/java/node/type/models/conducts/Conduct.java similarity index 88% rename from src/main/java/br/uefs/larsid/iot/soft/models/conducts/Conduct.java rename to src/main/java/node/type/models/conducts/Conduct.java index f4698c2..65b6118 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Conduct.java +++ b/src/main/java/node/type/models/conducts/Conduct.java @@ -1,7 +1,7 @@ -package br.uefs.larsid.iot.soft.models.conducts; +package node.type.models.conducts; -import br.uefs.larsid.iot.soft.enums.ConductType; -import br.uefs.larsid.iot.soft.models.tangle.LedgerConnector; +import node.type.enums.ConductType; +import node.type.models.tangle.LedgerConnector; public abstract class Conduct { diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java b/src/main/java/node/type/models/conducts/Honest.java similarity index 91% rename from src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java rename to src/main/java/node/type/models/conducts/Honest.java index a44df21..2b94d25 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Honest.java +++ b/src/main/java/node/type/models/conducts/Honest.java @@ -1,11 +1,12 @@ -package br.uefs.larsid.iot.soft.models.conducts; +package node.type.models.conducts; // TODO: Corrigir package em todas as classes. -import br.uefs.larsid.iot.soft.enums.ConductType; -import br.uefs.larsid.iot.soft.models.tangle.LedgerConnector; import dlt.client.tangle.hornet.enums.TransactionType; import dlt.client.tangle.hornet.model.transactions.Evaluation; import dlt.client.tangle.hornet.model.transactions.Transaction; +import node.type.enums.ConductType; +import node.type.models.tangle.LedgerConnector; + import java.util.logging.Logger; public class Honest extends Conduct { diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java b/src/main/java/node/type/models/conducts/Malicious.java similarity index 94% rename from src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java rename to src/main/java/node/type/models/conducts/Malicious.java index 0831f64..436e56f 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/conducts/Malicious.java +++ b/src/main/java/node/type/models/conducts/Malicious.java @@ -1,10 +1,11 @@ -package br.uefs.larsid.iot.soft.models.conducts; +package node.type.models.conducts; -import br.uefs.larsid.iot.soft.enums.ConductType; -import br.uefs.larsid.iot.soft.models.tangle.LedgerConnector; import dlt.client.tangle.hornet.enums.TransactionType; import dlt.client.tangle.hornet.model.transactions.Evaluation; import dlt.client.tangle.hornet.model.transactions.Transaction; +import node.type.enums.ConductType; +import node.type.models.tangle.LedgerConnector; + import java.util.Random; import java.util.logging.Logger; diff --git a/src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java b/src/main/java/node/type/models/tangle/LedgerConnector.java similarity index 97% rename from src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java rename to src/main/java/node/type/models/tangle/LedgerConnector.java index b1ea1d2..3151fe0 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/models/tangle/LedgerConnector.java +++ b/src/main/java/node/type/models/tangle/LedgerConnector.java @@ -1,4 +1,4 @@ -package br.uefs.larsid.iot.soft.models.tangle; +package node.type.models.tangle; import dlt.client.tangle.hornet.model.transactions.Transaction; import dlt.client.tangle.hornet.services.ILedgerReader; diff --git a/src/main/java/br/uefs/larsid/iot/soft/mqtt/ListenerDevices.java b/src/main/java/node/type/mqtt/ListenerDevices.java similarity index 94% rename from src/main/java/br/uefs/larsid/iot/soft/mqtt/ListenerDevices.java rename to src/main/java/node/type/mqtt/ListenerDevices.java index d9cbbe4..d1f5f38 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/mqtt/ListenerDevices.java +++ b/src/main/java/node/type/mqtt/ListenerDevices.java @@ -1,7 +1,8 @@ -package br.uefs.larsid.iot.soft.mqtt; +package node.type.mqtt; + +import node.type.models.NodeType; +import node.type.utils.MQTTClient; -import br.uefs.larsid.iot.soft.models.NodeType; -import br.uefs.larsid.iot.soft.utils.MQTTClient; import com.google.gson.Gson; import com.google.gson.JsonObject; import java.util.logging.Logger; diff --git a/src/main/java/node/type/services/NodeTypeService.java b/src/main/java/node/type/services/NodeTypeService.java new file mode 100644 index 0000000..c7f8310 --- /dev/null +++ b/src/main/java/node/type/services/NodeTypeService.java @@ -0,0 +1,5 @@ +package node.type.services; + +public interface NodeTypeService { + +} diff --git a/src/main/java/br/uefs/larsid/iot/soft/tasks/CheckDevicesTask.java b/src/main/java/node/type/tasks/CheckDevicesTask.java similarity index 90% rename from src/main/java/br/uefs/larsid/iot/soft/tasks/CheckDevicesTask.java rename to src/main/java/node/type/tasks/CheckDevicesTask.java index 52a2dc2..c7ccff3 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/tasks/CheckDevicesTask.java +++ b/src/main/java/node/type/tasks/CheckDevicesTask.java @@ -1,10 +1,11 @@ -package br.uefs.larsid.iot.soft.tasks; +package node.type.tasks; -import br.uefs.larsid.iot.soft.models.NodeType; import java.io.IOException; import java.util.TimerTask; import java.util.logging.Logger; +import node.type.models.NodeType; + /** * Classe responsável pela tarefa de atualizar a lista de dispositivos * conectados ao nó. diff --git a/src/main/java/br/uefs/larsid/iot/soft/tasks/RequestDataTask.java b/src/main/java/node/type/tasks/RequestDataTask.java similarity index 89% rename from src/main/java/br/uefs/larsid/iot/soft/tasks/RequestDataTask.java rename to src/main/java/node/type/tasks/RequestDataTask.java index 4e4c2e8..8817805 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/tasks/RequestDataTask.java +++ b/src/main/java/node/type/tasks/RequestDataTask.java @@ -1,9 +1,10 @@ -package br.uefs.larsid.iot.soft.tasks; +package node.type.tasks; -import br.uefs.larsid.iot.soft.models.NodeType; import java.util.TimerTask; import java.util.logging.Logger; +import node.type.models.NodeType; + /** * Classe responsável pela tarefa de requisitar dados de um dos sensores de um * dispositivo aleatório que estão conectado ao nó. diff --git a/src/main/java/br/uefs/larsid/iot/soft/tasks/WaitDeviceResponseTask.java b/src/main/java/node/type/tasks/WaitDeviceResponseTask.java similarity index 94% rename from src/main/java/br/uefs/larsid/iot/soft/tasks/WaitDeviceResponseTask.java rename to src/main/java/node/type/tasks/WaitDeviceResponseTask.java index c4e3f68..33007fe 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/tasks/WaitDeviceResponseTask.java +++ b/src/main/java/node/type/tasks/WaitDeviceResponseTask.java @@ -1,9 +1,10 @@ -package br.uefs.larsid.iot.soft.tasks; +package node.type.tasks; -import br.uefs.larsid.iot.soft.models.NodeType; import java.util.TimerTask; import java.util.logging.Logger; +import node.type.models.NodeType; + /** * Classe responsável por verificar se houve resposta do dispositivo à * requisição feita pelo nó. diff --git a/src/main/java/br/uefs/larsid/iot/soft/utils/MQTTClient.java b/src/main/java/node/type/utils/MQTTClient.java similarity index 99% rename from src/main/java/br/uefs/larsid/iot/soft/utils/MQTTClient.java rename to src/main/java/node/type/utils/MQTTClient.java index a9d3be4..2197a37 100644 --- a/src/main/java/br/uefs/larsid/iot/soft/utils/MQTTClient.java +++ b/src/main/java/node/type/utils/MQTTClient.java @@ -1,4 +1,4 @@ -package br.uefs.larsid.iot.soft.utils; +package node.type.utils; import java.util.Arrays; import java.util.logging.Logger; diff --git a/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/src/main/resources/OSGI-INF/blueprint/blueprint.xml index 73c4c67..b47ccac 100644 --- a/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -12,7 +12,7 @@ - @@ -21,12 +21,12 @@ - + -