Skip to content

Commit f469561

Browse files
committed
Minor changes and Fix in Current and Previous DT State management in transaction
1 parent 97e9e63 commit f469561

16 files changed

Lines changed: 41 additions & 32 deletions

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* This file was generated by the Gradle 'init' task.
33
*/
44
group = "io.github.wldt"
5-
version = "0.3.0-alpha"
5+
version = "0.3.0-alpha-31012024"
66
description = "The core library to build White Label Digital Twins"
77
java.sourceCompatibility = JavaVersion.VERSION_1_8
88

@@ -14,7 +14,7 @@ plugins {
1414

1515
repositories {
1616
mavenCentral()
17-
17+
mavenLocal()
1818
}
1919

2020
dependencies {

src/main/java/it/wldt/augmentation/AugmentationFunction.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
/**
44
* @author Marco Picone, Ph.D. - picone.m@gmail.com
5-
* @project HelloJava
6-
* @created 26/10/2023 - 15:43
75
*/
86
public abstract class AugmentationFunction<T> implements Runnable {
97

src/main/java/it/wldt/augmentation/AugmentationFunctionExecutor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
/**
99
* @author Marco Picone, Ph.D. - picone.m@gmail.com
10-
* @project wldt-core
11-
* @created 26/10/2023 - 16:06
1210
*/
1311
public class AugmentationFunctionExecutor {
1412

src/main/java/it/wldt/augmentation/AugmentationFunctionListener.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
/**
44
* @author Marco Picone, Ph.D. - picone.m@gmail.com
5-
* @project wldt-core
6-
* @created 26/10/2023 - 15:54
75
*/
86
public interface AugmentationFunctionListener<T> {
97

src/main/java/it/wldt/augmentation/AverageHrAugmentationFunction.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
/**
44
* @author Marco Picone, Ph.D. - picone.m@gmail.com
5-
* @project wldt-core
6-
* @created 26/10/2023 - 15:52
75
*/
86
public class AverageHrAugmentationFunction extends AugmentationFunction<Double>{
97

src/main/java/it/wldt/augmentation/TestAugmentation.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
/**
44
* @author Marco Picone, Ph.D. - picone.m@gmail.com
5-
* @project wldt-core
6-
* @created 26/10/2023 - 16:03
75
*/
86
public class TestAugmentation {
97

src/main/java/it/wldt/core/engine/DigitalTwinEngine.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
* The DigitalTwinEngine class manages a collection of DigitalTwin instances.
1414
*
1515
* @author Marco Picone, Ph.D. - picone.m@gmail.com
16-
* @project wldt-core
17-
* @created 29/12/2023 - 15:50
1816
*/
1917
public class DigitalTwinEngine {
2018

src/main/java/it/wldt/core/event/DefaultWldtEventLogger.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,26 @@ public class DefaultWldtEventLogger implements IWldtEventLogger {
1919
@Override
2020
public void logEventPublished(String publisherId, WldtEvent<?> wldtEvent) {
2121
if(wldtEvent != null)
22-
logger.info("PUBLISHER [{}] -> PUBLISHED EVENT TYPE: {} Message: {}", publisherId, wldtEvent.getType(), wldtEvent);
22+
logger.debug("PUBLISHER [{}] -> PUBLISHED EVENT TYPE: {} Message: {}", publisherId, wldtEvent.getType(), wldtEvent);
2323
else
2424
logger.error("PUBLISHER [{}] -> NULL MESSAGE !", publisherId);
2525
}
2626

2727
@Override
2828
public void logEventForwarded(String publisherId, String subscriberId, WldtEvent<?> wldtEvent) {
2929
if(wldtEvent != null)
30-
logger.info("EVENT-BUS -> FORWARDED from PUBLISHER [{}] to SUBSCRIBER [{}] -> TOPIC: {} Message: {}", publisherId, subscriberId, wldtEvent.getType(), wldtEvent);
30+
logger.debug("EVENT-BUS -> FORWARDED from PUBLISHER [{}] to SUBSCRIBER [{}] -> TOPIC: {} Message: {}", publisherId, subscriberId, wldtEvent.getType(), wldtEvent);
3131
else
3232
logger.error("EVENT-BUS FORWARDING from PUBLISHER [{}] to SUBSCRIBER [{}] -> NULL MESSAGE ! ", publisherId, subscriberId);
3333
}
3434

3535
@Override
3636
public void logClientSubscription(String eventType, String subscriberId) {
37-
logger.info("SUBSCRIBER [{}] -> Subscribed Correctly - Event Type: {}", subscriberId, eventType);
37+
logger.debug("SUBSCRIBER [{}] -> Subscribed Correctly - Event Type: {}", subscriberId, eventType);
3838
}
3939

4040
@Override
4141
public void logClientUnSubscription(String eventType, String subscriberId) {
42-
logger.info("SUBSCRIBER [{}] -> UnSubscribed Correctly - Event Type: {}", subscriberId, eventType);
42+
logger.debug("SUBSCRIBER [{}] -> UnSubscribed Correctly - Event Type: {}", subscriberId, eventType);
4343
}
4444
}

src/main/java/it/wldt/core/event/SubscriptionDescriptor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
/**
77
* @author Marco Picone, Ph.D. - picone.m@gmail.com
8-
* @project wldt-core
9-
* @created 30/12/2023 - 19:37
108
*/
119
public class SubscriptionDescriptor extends HashMap<String, List<WldtSubscriberInfo>> {
1210
}

src/main/java/it/wldt/core/state/DigitalTwinState.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
* Manages the lifecycle and operations on these components.
1313
*
1414
* @author Marco Picone, Ph.D. - picone.m@gmail.com
15-
* @project wldt-core
16-
* @created 18/10/2023 - 15:14
1715
*/
1816
public class DigitalTwinState {
1917

@@ -58,6 +56,20 @@ public DigitalTwinState(Map<String, DigitalTwinStateProperty<?>> properties,
5856
this.evaluationInstant = Instant.now();
5957
}
6058

59+
/**
60+
* Constructor to build a new DT State from a previous one.
61+
* The evaluationInstant will be assigned to now and values are copied
62+
*
63+
* @param sourceDigitalTwinState The Source DT State to copy
64+
*/
65+
public DigitalTwinState(DigitalTwinState sourceDigitalTwinState) {
66+
this();
67+
this.properties.putAll(sourceDigitalTwinState.properties);
68+
this.actions.putAll(sourceDigitalTwinState.actions);
69+
this.events.putAll(sourceDigitalTwinState.events);
70+
this.relationships.putAll(sourceDigitalTwinState.relationships);
71+
}
72+
6173
//////////////////////////// PROPERTY MANAGEMENT //////////////////////////////////////////////////////////
6274

6375
/**

0 commit comments

Comments
 (0)