diff --git a/.gitignore b/.gitignore
index 9483d7b..d62ce0a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -80,3 +80,6 @@ gradlew.bat
Development/gradle/wrapper/gradle-wrapper.properties
Core/gradle/wrapper/gradle-wrapper.jar
Core/gradle/wrapper/gradle-wrapper.jar
+/Development/target
+/Abstractions/target
+/docs/digitaltwin-core-docs/target
diff --git a/Core/.gitattributes b/Abstractions/.gitattributes
similarity index 100%
rename from Core/.gitattributes
rename to Abstractions/.gitattributes
diff --git a/Core/.gitignore b/Abstractions/.gitignore
similarity index 100%
rename from Core/.gitignore
rename to Abstractions/.gitignore
diff --git a/Core/LICENSE b/Abstractions/LICENSE
similarity index 100%
rename from Core/LICENSE
rename to Abstractions/LICENSE
diff --git a/Abstractions/README.md b/Abstractions/README.md
new file mode 100644
index 0000000..ced7955
--- /dev/null
+++ b/Abstractions/README.md
@@ -0,0 +1,10 @@
+# ScaleOut Digital Twins™ Abstractions Libraries for Java
+
+The open source (Apache 2.0 licensed) project for the digitaltwin-abstractions API:
+
+- [com.scaleoutsoftware.digitaltwin:digitaltwin-abstractions](https://mvnrepository.com/artifact/com.scaleoutsoftware.digitaltwin/digitaltwin-abstractions/3.0.0): Abstract datatypes required for building Digital Twin models.
+
+
+## Documentation
+- [Class reference](https://scaleoutsoftware.github.io/JavaDigitalTwinCore/)
+- [ScaleOut Digital Twins™ User Guide](https://static.scaleoutsoftware.com/docs/digital_twin_user_guide/index.html)
\ No newline at end of file
diff --git a/Abstractions/build.bat b/Abstractions/build.bat
new file mode 100644
index 0000000..a40786e
--- /dev/null
+++ b/Abstractions/build.bat
@@ -0,0 +1,8 @@
+rem ********************
+rem * Requirements *
+rem ********************
+rem * Java JDK 8
+rem * MVN 3.x
+SET JAVA_HOME=C:\path\to\java8
+SET MVN_HOME=C:\path\to\maven
+call mvn clean package install javadoc:jar source:jar
\ No newline at end of file
diff --git a/Abstractions/build.sh b/Abstractions/build.sh
new file mode 100644
index 0000000..83def59
--- /dev/null
+++ b/Abstractions/build.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env sh
+export JAVA_HOME="/path/to/java8"
+export MVN_HOME="/path/to/maven"
+
+export PATH="$JAVA_HOME/bin:$MVN_HOME/bin:$PATH"
+
+mvn clean package install javadoc:jar source:jar
\ No newline at end of file
diff --git a/Abstractions/pom.xml b/Abstractions/pom.xml
new file mode 100644
index 0000000..bbad931
--- /dev/null
+++ b/Abstractions/pom.xml
@@ -0,0 +1,59 @@
+
+
+ 4.0.0
+
+ com.scaleoutsoftware.digitaltwin
+ digitaltwin-abstractions
+ 3.0.0
+ 2021
+ https://scaleoutsoftware.com
+ Digital Twin Core API
+ Core API for building real-time and simulated digital twins.
+
+
+ scaleoutdev
+ ScaleOut Dev
+ dev@scaleoutsoftware.com
+ https://scaleoutsoftware.com
+ ScaleOut Software, Inc.
+ https://scaleoutsoftware.com
+
+ developer
+ engineer
+
+ America/Los_Angeles
+
+
+
+
+ Apache License 2.0
+ https://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+ Apache License 2.0
+
+
+
+ https://github.com/scaleoutsoftware/JavaDigitalTwinCore
+
+
+ UTF-8
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.11.0
+
+ none
+ true
+
+ -Xlint:all
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/AlertMessage.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/AlertMessage.java
similarity index 94%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/AlertMessage.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/AlertMessage.java
index 4383a90..df63f13 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/AlertMessage.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/AlertMessage.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2021 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
import java.util.HashMap;
@@ -26,7 +26,7 @@ public class AlertMessage {
private final String _message;
private final HashMap _optionalTwinInstanceProperties;
- private AlertMessage() {_title = _severity = _message = null; _optionalTwinInstanceProperties = null;}
+ private AlertMessage() { _title = _severity = _message = null; _optionalTwinInstanceProperties = null;}
/**
* Construct an alert message with a title, severity, and custom message.
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/PersistenceProvider.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/AzureDigitalTwinsProvider.java
similarity index 69%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/PersistenceProvider.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/AzureDigitalTwinsProvider.java
index f75ad0c..5557f62 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/PersistenceProvider.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/AzureDigitalTwinsProvider.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2021 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
import java.util.List;
import java.util.Map;
@@ -22,7 +22,7 @@
/**
* An interface that can be used for persisting/retrieving the state of real-time digital twins.
*/
-public interface PersistenceProvider {
+public interface AzureDigitalTwinsProvider {
/**
* Returns true if this PersistenceProvider is active, false otherwise.
@@ -30,12 +30,6 @@ public interface PersistenceProvider {
*/
public abstract boolean isActive();
- /**
- * Retrieves this persistence providers type. Currently supported provider types: AzureDigitalTwins.
- * @return the persistence provider type.
- */
- public PersistenceProviderType getProviderType();
-
/**
* Retrieves a future that when complete will return the instance IDs stored in a container, or an empty list if no instances exist.
* @param containerName the container name.
@@ -121,42 +115,4 @@ public interface PersistenceProvider {
* @return the property or null if the property does not exist.
*/
public T getProperty(String containerName, String instanceId, String propertyName, Class clazz);
-
- /**
- * Retrieves a future that will complete exceptionally or return void if the RTDT's property was successfully updated.
- * Updates a RTDT property for the provided instance id specified by the property name and property value.
- * @param instanceId the instance id.
- * @param propertyName the property name.
- * @param propertyValue the property value.
- * @return a future that will complete exceptionally or return void.
- */
- public CompletableFuture updateRtdtPropertyAsync(String instanceId, String propertyName, Object propertyValue);
-
- /**
- * Updates a RTDT property for the provided instance id specified by the property name and property value.
- * @param instanceId the instance id.
- * @param propertyName the property name.
- * @param propertyValue the property value.
- */
- public void updateRtdtProperty(String instanceId, String propertyName, Object propertyValue);
-
- /**
- * Retrieves a future that will return a property value for a RTDT instance or null if the property doesn't exist.
- * @param instanceId the instance id.
- * @param propertyName the property name.
- * @param clazz the class of the property type
- * @param the type of the property to return.
- * @return a future that will return a property value for a RTDT instance.
- */
- public CompletableFuture getRtdtPropertyAsync(String instanceId, String propertyName, Class clazz);
-
- /**
- * Retrieves a property for a RTDT instance or null if the property does not exist.
- * @param instanceId the instance id.
- * @param propertyName the property name.
- * @param clazz the class of the property type.
- * @param the type of the property to return.
- * @return the property value.
- */
- public T getRtdtProperty(String instanceId, String propertyName, Class clazz);
}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/CacheOperationStatus.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/CacheOperationStatus.java
similarity index 91%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/CacheOperationStatus.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/CacheOperationStatus.java
index 3498640..820ebf8 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/CacheOperationStatus.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/CacheOperationStatus.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2024 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
/**
* Status of a cache operation.
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/CacheResult.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/CacheResult.java
similarity index 91%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/CacheResult.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/CacheResult.java
index f62adf1..5a99d65 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/CacheResult.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/CacheResult.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2024 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
/**
* Represents a response from a {@link SharedData} operation.
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/MessageFactory.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/CreateResult.java
similarity index 57%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/MessageFactory.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/CreateResult.java
index 954c08f..6095592 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/MessageFactory.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/CreateResult.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2018 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,17 +13,18 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
/**
- * Message list factory retrieves message lists for a MessageProcessor
+ * Enum indicating the status of a delete operation.
*/
-public interface MessageFactory {
-
- /**
- * Returns all incoming messages
- * @param the type of incoming messages
- * @return an iterable of incoming messages
- */
- Iterable getIncomingMessages();
+public enum CreateResult {
+ /**
+ * The twin instance was successfully created.
+ */
+ Success,
+ /**
+ * The twin instance already existed and could not be created.
+ */
+ ObjectExists
}
diff --git a/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/DeleteResult.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/DeleteResult.java
new file mode 100644
index 0000000..a141807
--- /dev/null
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/DeleteResult.java
@@ -0,0 +1,30 @@
+/*
+ Copyright (c) 2026 by ScaleOut Software, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+package com.scaleoutsoftware.digitaltwin.abstractions;
+
+/**
+ * Enum indicating the status of a delete operation.
+ */
+public enum DeleteResult {
+ /**
+ * The twin instance was successfully deleted.
+ */
+ Success,
+ /**
+ * The target twin instance was not found.
+ */
+ NotFound
+}
diff --git a/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/DigitalTwinBase.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/DigitalTwinBase.java
new file mode 100644
index 0000000..5b54875
--- /dev/null
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/DigitalTwinBase.java
@@ -0,0 +1,121 @@
+/*
+ Copyright (c) 2026 by ScaleOut Software, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+package com.scaleoutsoftware.digitaltwin.abstractions;
+
+import java.util.Date;
+import java.util.HashMap;
+
+/**
+ * A real-time digital twin of a data source. The implementation of the real-time DigitalTwin should have a parameterless constructor for
+ * basic initialization.
+ */
+public abstract class DigitalTwinBase> {
+
+ /* capitalized to match .NET serialization */
+ /**
+ * The identifier for this twin instance
+ */
+ public String Id = "";
+
+ /**
+ * The model this twin instance belongs to.
+ */
+ public String Model = "";
+
+ /**
+ * DO NOT MODIFY. This property is managed by the service. Used to send messages to the instances data source.
+ */
+ public int SourceNamespaceAppId;
+
+ /**
+ * DO NOT MODIFY. This property is managed by the service. Used to store the instances next simulation time; managed by the
+ * service in case of load balancing or server failures.
+ */
+ public long NextSimulationTimeUnixMsec;
+
+ /**
+ * Default constructor.
+ */
+ public DigitalTwinBase() {}
+
+ /**
+ * The identifier of this DigitalTwin.
+ * @return the identifier of this digital twin
+ */
+ public String getId() {
+ return Id;
+ }
+
+ /**
+ * The model for this DigitalTwin.
+ * @return the model for this DigitalTwin
+ */
+ public String getModel() {
+ return Model;
+ }
+
+ /**
+ * INTERNAL: DO NOT MODIFY. This property is managed by the service.
+ *
+ * Used for sending messages back to the instances data source.
+ *
+ * @return the source App ID namespace
+ */
+ public int getSourceAppIdNamespace() {
+ return SourceNamespaceAppId;
+ }
+
+ /**
+ * INTERNAL: DO NOT MODIFY. This property is managed by the service.
+ * @param sourceAppIdNamespace assign this instance a new source app ID namespace.
+ */
+ public void setSourceAppIdNamespace(int sourceAppIdNamespace) {
+ SourceNamespaceAppId = sourceAppIdNamespace;
+ }
+
+ /**
+ * INTERNAL: DO NOT MODIFY. This property is managed by the service.
+ *
+ * Retrieve the next simulation time for this instance.
+ *
+ * @return the next simulation time for this instance.
+ */
+ public long getNextSimulationTimeUnixMsec() {
+ return NextSimulationTimeUnixMsec;
+ }
+
+ /**
+ * INTERNAL: DO NOT MODIFY. This property is managed by the service.
+ *
+ * Assign this instance the next simulation time when the instance will be run.
+ *
+ * @param nextSimulationTimeUnixMsec the next simulation time when the instance will be run.
+ */
+ public void setNextSimulationTimeUnixMsec(long nextSimulationTimeUnixMsec) {
+ NextSimulationTimeUnixMsec = nextSimulationTimeUnixMsec;
+ }
+
+ /**
+ * Initialization method to set the identifier and model for a DigitalTwin instance. Optionally use the
+ * {@link InitContext} to start a timer.
+ * @param context the initialization context.
+ * @throws IllegalStateException if init is called after initialization.
+ */
+ public void init(InitContext context) throws IllegalStateException {
+ this.Id = context.getId();
+ this.Model = context.getModel();
+ }
+}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/InitContext.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/InitContext.java
similarity index 66%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/InitContext.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/InitContext.java
index d05933e..1f7dddd 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/InitContext.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/InitContext.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2024 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
import java.time.Duration;
@@ -21,7 +21,7 @@
* The InitContext is passed as a parameter to the {@link DigitalTwinBase#init(InitContext)} method of an initializing
* digital twin.
*/
-public abstract class InitContext {
+public abstract class InitContext> {
/**
* Default constructor.
@@ -34,11 +34,23 @@ public InitContext() {}
* @param interval the timer interval
* @param timerType the timer type
* @param timerHandler the time handler callback
- * @param the type of the digital twin
+ * @param timerHandlerClass the timer handler callback class
* @return returns {@link TimerActionResult#Success} if the timer was started, {@link TimerActionResult#FailedTooManyTimers}
* if too many timers exist, or {@link TimerActionResult#FailedInternalError} if an unexpected error occurs.
*/
- public abstract TimerActionResult startTimer(String timerName, Duration interval, TimerType timerType, TimerHandler timerHandler);
+ public abstract TimerActionResult startTimer(String timerName, Duration interval, TimerType timerType, TimerHandler timerHandler, Class extends TimerHandler> timerHandlerClass);
+
+ /**
+ * Retrieve a {@link SharedData} accessor for this model's shared data.
+ * @return a {@link SharedData} instance.
+ */
+ public abstract SharedData getSharedModelData();
+
+ /**
+ * Retrieve a {@link SharedData} accessor for globally shared data.
+ * @return a {@link SharedData} instance.
+ */
+ public abstract SharedData getSharedGlobalData();
/**
* Get the model-unique Id identifier of the initializing digital twin instance.
diff --git a/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/InitSimulationContext.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/InitSimulationContext.java
new file mode 100644
index 0000000..df0d5d4
--- /dev/null
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/InitSimulationContext.java
@@ -0,0 +1,36 @@
+/*
+ Copyright (c) 2026 by ScaleOut Software, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+package com.scaleoutsoftware.digitaltwin.abstractions;
+
+import java.util.Date;
+
+/**
+ * The InitSimulationContext is passed as a parameter to the {@link SimulationProcessor#onInitSimulation(InitSimulationContext, DigitalTwinBase, Date)} method of
+ * digital twin instance when a simulation is initializing.
+ */
+public interface InitSimulationContext {
+ /**
+ * Retrieve a {@link SharedData} accessor for this model's shared data.
+ * @return a {@link SharedData} instance.
+ */
+ public abstract SharedData getSharedModelData();
+
+ /**
+ * Retrieve a {@link SharedData} accessor for globally shared data.
+ * @return a {@link SharedData} instance.
+ */
+ public abstract SharedData getSharedGlobalData();
+}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/MessageProcessor.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/MessageProcessor.java
similarity index 53%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/MessageProcessor.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/MessageProcessor.java
index c1e6a5c..1392203 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/MessageProcessor.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/MessageProcessor.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2018 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,16 +13,15 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
import java.io.Serializable;
/**
* Processes messages for a real-time digital twin.
* @param the real type of the DigitalTwinBase
- * @param the type of messages processed by the real-time digital twin
*/
-public abstract class MessageProcessor extends MessageProcessorBase implements Serializable {
+public abstract class MessageProcessor> {
/**
* Default constructor.
@@ -33,24 +32,10 @@ public MessageProcessor() {}
* Processes a set of incoming messages and determines whether to update the real-time digital twin.
* @param context optional context for processing.
* @param stateObject the state object.
- * @param incomingMessages the incoming messages.
+ * @param incomingMessage the incoming message.
* @return processing results for updating the state object.
* @throws Exception if an exception occurs during processing
*/
- public abstract ProcessingResult processMessages(ProcessingContext context, T stateObject, Iterable incomingMessages) throws Exception;
-
- /**
- * Helper method to ensure proper typing for user methods.
- * @param context the processing context.
- * @param twin the digital twin object.
- * @param factory the message list factory.
- * @return the implementing class's processing result.
- * @throws Exception if an exception occurs during processing.
- */
- @Override
- public ProcessingResult processMessages(ProcessingContext context, T twin, MessageFactory factory) throws Exception {
- Iterable incoming = factory.getIncomingMessages();
- return this.processMessages(context, twin, incoming);
- }
+ public abstract ProcessingResult processMessage(ProcessingContext context, T stateObject, byte[] incomingMessage) throws Exception;
}
diff --git a/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/ProcessingContext.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/ProcessingContext.java
new file mode 100644
index 0000000..693e2f2
--- /dev/null
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/ProcessingContext.java
@@ -0,0 +1,164 @@
+/*
+ Copyright (c) 2026 by ScaleOut Software, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+package com.scaleoutsoftware.digitaltwin.abstractions;
+
+import java.io.Serializable;
+import java.time.Duration;
+import java.util.Date;
+import java.util.concurrent.CompletableFuture;
+import java.util.logging.Level;
+
+/**
+ * Context object that allows the user to send a message to a DataSource.
+ * @param the type of the digital twin
+ */
+public abstract class ProcessingContext> implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Default constructor.
+ */
+ public ProcessingContext() {}
+
+ /**
+ *
+ * Sends a message to a data source. This will route messages through the connector back to the data source.
+ *
+ *
+ *
+ * if the datasource is simulation instance, then the message will be sent to the simulation model's implementation
+ * of the {@link MessageProcessor}.
+ *
+ *
+ * @param payload the message (as a serialized JSON string)
+ * @return the sending result
+ */
+ public abstract CompletableFuture sendToDataSource(byte[] payload);
+
+ /**
+ *
+ * This method sends a serialized JSON message to a real-time digital twin
+ *
+ *
+ *
+ * Note, the message contents must be serialized so that the registered message type
+ * of the digital twin model will be sufficient to deserialize the message.
+ *
+ * @param model the model of the digital twin
+ * @param id the id of the digital twin
+ * @param payload the serialized JSON message
+ * @return the sending result
+ */
+ public abstract CompletableFuture sendToDigitalTwin(String model, String id, byte[] payload);
+
+ /**
+ *
+ * This method sends an alert message to configured systems.
+ *
+ *
+ *
+ * If the message cannot be sent then the returned CompletableFuture will complete exceptionally.
+ *
+ * @param alert the alert message.
+ * @return the sending result.
+ */
+ public abstract CompletableFuture sendAlert(AlertMessage alert);
+
+ /**
+ * Returns an {@link AzureDigitalTwinsProvider} or null if no AzureDigitalTwinsProvider configuration can be found.
+ * @return a {@link AzureDigitalTwinsProvider} or null.
+ */
+ public abstract AzureDigitalTwinsProvider getAzureDigitalTwinsProvider();
+
+ /**
+ * Retrieve the unique Identifier for a DataSource (matches the Device/Datasource/Real-time twin ID)
+ * @return the digital twin id
+ */
+ public abstract String getDataSourceId();
+
+ /**
+ * Retrieve the model for a DigitalTwin (matches the model of a Device/Datasource/real-time twin)
+ * @return the digital twin model
+ */
+ public abstract String getDigitalTwinModel();
+
+ /**
+ * Log a message to the real-time digital twin UI.
+ *
+ * Note: the only supported severity levels are: INFO, WARN, and SEVERE
+ *
+ * @param severity the severity of the log message
+ * @param message the message to log
+ * @return A future that will complete successfully with no result or exceptionally.
+ */
+ public abstract CompletableFuture logMessage(Level severity, String message);
+
+ /**
+ * Delete the target real-time twin instance.
+ * @param targetTwinModel the model of the real-time twin instance
+ * @param targetTwinId the id of the real-time twin instance
+ * @return a completable future that will complete with a {@link DeleteResult} indicating the status of the operation, or
+ * exceptionally indicating that an error occurred.
+ */
+ public abstract CompletableFuture removeRealTimeTwin(String targetTwinModel, String targetTwinId);
+
+ /**
+ * Starts a new timer for the digital twin
+ * @param timerName the timer name
+ * @param interval the timer interval
+ * @param timerType the timer type
+ * @param timerHandler the time handler callback
+ * @param timerHandlerClass the timer handler callback class
+ * @return returns {@link TimerActionResult#Success} if the timer was started, {@link TimerActionResult#FailedTooManyTimers}
+ * if too many timers exist, or {@link TimerActionResult#FailedInternalError} if an unexpected error occurs.
+ */
+ public abstract TimerActionResult startTimer(String timerName, Duration interval, TimerType timerType, TimerHandler timerHandler, Class extends TimerHandler> timerHandlerClass);
+
+ /**
+ * Stops the specified timer.
+ * @param timerName the timer name.
+ * @return returns {@link TimerActionResult#Success} if the timer was stopped, {@link TimerActionResult#FailedNoSuchTimer}
+ * if no timer exists with that name, or {@link TimerActionResult#FailedInternalError} if an unexpected error occurs.
+ */
+ public abstract TimerActionResult stopTimer(String timerName);
+
+ /**
+ * Retrieves the current time. If the model (simulation or real-time) is running inside of a simulation then the
+ * simulation time will be returned.
+ *
+ * @return The current time (real time, or simulation if running under simulation).
+ */
+ public abstract Date getCurrentTime();
+
+ /**
+ * Retrieve the running {@link SimulationController} or null if no simulation is running.
+ * @return the {@link SimulationController} or null if no simulation is running.
+ */
+ public abstract SimulationController getSimulationController();
+
+ /**
+ * Retrieve a {@link SharedData} accessor for this model's shared data.
+ * @return a {@link SharedData} instance.
+ */
+ public abstract SharedData getSharedModelData();
+
+ /**
+ * Retrieve a {@link SharedData} accessor for globally shared data.
+ * @return a {@link SharedData} instance.
+ */
+ public abstract SharedData getSharedGlobalData();
+
+}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/ProcessingResult.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/ProcessingResult.java
similarity index 72%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/ProcessingResult.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/ProcessingResult.java
index 45b2ed6..0465ce3 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/ProcessingResult.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/ProcessingResult.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2018 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,10 +13,11 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
/**
- * The result from a message processor which indicates to update the state object or to ignore
+ * The result from a message processor which indicates to update the twin instance, not update the twin instance, or
+ * remove the twin instance.
*/
public enum ProcessingResult {
/**
@@ -26,5 +27,9 @@ public enum ProcessingResult {
/**
* Do not update the digital twin.
*/
- NoUpdate
+ NoUpdate,
+ /**
+ * The twin instance should be removed after processing.
+ */
+ Remove
}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/SendingResult.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SendingResult.java
similarity index 86%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/SendingResult.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SendingResult.java
index 94ea82f..dfd1f01 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/SendingResult.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SendingResult.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2018 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,10 +13,10 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
/**
- * Marks a message as Delivered or not Delivered
+ * Marks a message as Handled, Enqueued, or Not Handled
*/
public enum SendingResult {
/**
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/SharedData.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SharedData.java
similarity index 75%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/SharedData.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SharedData.java
index f091158..088b2f4 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/SharedData.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SharedData.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2024 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,9 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
+
+import java.util.concurrent.CompletableFuture;
/**
* SharedData is used to access a model's, or globally, shared cache.
@@ -24,7 +26,7 @@ public interface SharedData {
* @param key the key mapping to a value.
* @return A cache result.
*/
- public CacheResult get(String key);
+ public CompletableFuture get(String key);
/**
* Put a new key/value mapping into the cache.
@@ -32,18 +34,18 @@ public interface SharedData {
* @param value the value.
* @return a cache result.
*/
- public CacheResult put(String key, byte[] value);
+ public CompletableFuture put(String key, byte[] value);
/**
* Remove a key/value mapping from the cache.
* @param key the key mapping to a value.
* @return a cache result.
*/
- public CacheResult remove(String key);
+ public CompletableFuture remove(String key);
/**
* Clear the shared data cache.
* @return a cache result.
*/
- public CacheResult clear();
+ public CompletableFuture clear();
}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/SimulationController.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SimulationController.java
similarity index 58%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/SimulationController.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SimulationController.java
index f796807..5f2f103 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/SimulationController.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SimulationController.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2022 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,10 +13,11 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
import java.time.Duration;
import java.util.Date;
+import java.util.concurrent.CompletableFuture;
/**
* The SimulationController interface is used to interact with the running DigitalTwin simulation.
@@ -31,6 +32,18 @@ public interface SimulationController {
*/
Duration getSimulationTimeIncrement();
+ /**
+ *
+ */
+
+ /**
+ *
+ * Retrieves the simulation start time.
+ *
+ * @return the simulation start time.
+ */
+ Date getSimulationStartTime();
+
/**
*
* Delay simulation processing for this DigitalTwin instance for a duration of time.
@@ -60,10 +73,9 @@ public interface SimulationController {
*
*
* @param duration the duration to delay.
- * @return {@link SendingResult#Handled} if the delay was processed or {@link SendingResult#NotHandled}
* if the delay was not processed.
*/
- SendingResult delay(Duration duration);
+ void delay(Duration duration);
/**
*
@@ -74,34 +86,21 @@ public interface SimulationController {
* Simulation processing will be delayed until this instance is run with {@link SimulationController#runThisInstance()}.
*
*
- * @return {@link SendingResult#Handled} if the delay was processed or {@link SendingResult#NotHandled}
* if the delay was not processed.
*/
- SendingResult delayIndefinitely();
+ void delayIndefinitely();
/**
*
* Asynchronously send a JSON serialized message to a DigitalTwin instance that will be processed by the DigitalTwin
- * models {@link MessageProcessor#processMessages(ProcessingContext, DigitalTwinBase, Iterable)} method.
+ * models {@link MessageProcessor#processMessage(ProcessingContext, DigitalTwinBase, byte[])} method.
*
* @param modelName the model to send the messages too.
* @param telemetryMessage a blob representing a JSON serialized messages.
* @return {@link SendingResult#Handled} if the messages were processed, {@link SendingResult#Enqueued} if
* the messages are in process of being handled, or {@link SendingResult#NotHandled} if the delay was not processed.
*/
- SendingResult emitTelemetry(String modelName, byte[] telemetryMessage);
-
- /**
- *
- * Asynchronously send a JSON serializable message to a DigitalTwin instance that will be processed by the DigitalTwin
- * models {@link MessageProcessor#processMessages(ProcessingContext, DigitalTwinBase, Iterable)} method.
- *
- * @param modelName the model to send the messages too.
- * @param jsonSerializableMessage an object message that is JSON serializable.
- * @return {@link SendingResult#Handled} if the messages were processed, {@link SendingResult#Enqueued} if
- * the messages are in process of being handled, or {@link SendingResult#NotHandled} if the delay was not processed.
- */
- SendingResult emitTelemetry(String modelName, Object jsonSerializableMessage);
+ CompletableFuture emitTelemetry(String modelName, byte[] telemetryMessage);
/**
* Create a new digital twin instance for simulation processing.
@@ -112,37 +111,7 @@ public interface SimulationController {
* is in process of being created, or {@link SendingResult#NotHandled} if the instance could not be created.
* @param the type of the digital twin to create.
*/
- SendingResult createInstance(String modelName, String instanceId, T base);
-
- /**
- * Create a new digital twin instance for simulation processing from a persistence store.
- *
- * The twin instance will be loaded via model name and id from a persistence store.
- *
- * If no instance can be found, then an exception will be thrown and no instance will be created.
- *
- * @param model The model name.
- * @param id the instance id.
- * @return {@link SendingResult#Handled} if the instance was created, {@link SendingResult#Enqueued} if the instance
- * is in process of being created, or {@link SendingResult#NotHandled} if the instance could not be created.
- */
- SendingResult createInstanceFromPersistenceStore(String model, String id);
-
- /**
- * The twin instance will be loaded via model name and id from a persistence store.
- *
- * The twin instance will be loaded via model name and id from a persistence store.
- *
- * If no instance can be found, then the default parameter instance will be used.
- *
- * @param model the model name.
- * @param id the instance id.
- * @param def the default instance to create.
- * @return {@link SendingResult#Handled} if the instance was created, {@link SendingResult#Enqueued} if the instance
- * * is in process of being created, or {@link SendingResult#NotHandled} if the instance could not be created.
- * @param the type of the digital twin to create.
- */
- SendingResult createInstanceFromPersistenceStore(String model, String id, T def);
+ > CompletableFuture createInstance(String modelName, String instanceId, T base);
/**
* Delete and remove a digital twin instance from simulation processing.
@@ -151,20 +120,19 @@ public interface SimulationController {
* @return {@link SendingResult#Handled} if the instance was deleted, {@link SendingResult#Enqueued} if the instance
* is in process of being deleted, or {@link SendingResult#NotHandled} if the instance could not be deleted.
*/
- SendingResult deleteInstance(String modelName, String instanceId);
+ CompletableFuture deleteInstance(String modelName, String instanceId);
/**
* Delete and remove this digital twin instance from simulation processing.
* @return this local request will always return {@link SendingResult#Handled}.
*/
- SendingResult deleteThisInstance();
+ CompletableFuture deleteThisInstance();
/**
* Run this instance during this simulation step. The instance will be run using the models {@link SimulationProcessor#processModel(ProcessingContext, DigitalTwinBase, Date)}
* implementation.
*
- * This will cause the simulation sub-system to run this instance regardless of the instances current
- * {@link DigitalTwinBase#NextSimulationTime}.
+ * This will cause the simulation sub-system to run this instance during the current simulation step.
*/
void runThisInstance();
@@ -174,5 +142,4 @@ public interface SimulationController {
*/
SimulationStatus stopSimulation();
-
}
diff --git a/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SimulationProcessor.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SimulationProcessor.java
new file mode 100644
index 0000000..331705f
--- /dev/null
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SimulationProcessor.java
@@ -0,0 +1,65 @@
+/*
+ Copyright (c) 2026 by ScaleOut Software, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+package com.scaleoutsoftware.digitaltwin.abstractions;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Processes simulation events for a digital twin.
+ * @param the type of the digital twin.
+ */
+public abstract class SimulationProcessor> {
+ /**
+ * Default constructor.
+ */
+ public SimulationProcessor() {}
+
+ /**
+ * Processes simulation events for a real-time digital twin.
+ * @param context the processing context.
+ * @param instance the digital twin instance.
+ * @param epoch the current time of the simulation.
+ * @return {@link ProcessingResult#UpdateDigitalTwin} to update the digital twin, or
+ * {@link ProcessingResult#NoUpdate} to ignore the changes.
+ */
+ public abstract ProcessingResult processModel(ProcessingContext context, T instance, Date epoch);
+
+ /**
+ *
+ * Optional method that is called per-instance when a simulation is started. Default behavior is a no-op.
+ *
+ *
+ *
+ * onInitSimulation can be used when internal digital twin starting state is set outside the context of a digital twins init method and may be changed
+ * between simulation runs.
+ *
+ *
+ *
Set variables in global or shared data.
+ *
Run a simulation.
+ *
onInitSimulation is called (per-instance) and digital twin instances set internal state based on the values in shared data.
+ *
Complete simulation and evaluate the result.
+ *
+ *
+ * @param context The simulation init context.
+ * @param instance The digital twin instance.
+ * @param epoch the simulation start time.
+ * @return {@link ProcessingResult#UpdateDigitalTwin} or {@link ProcessingResult#NoUpdate}. Default behavior: {@link ProcessingResult#NoUpdate}.
+ */
+ public ProcessingResult onInitSimulation(InitSimulationContext context, T instance, Date epoch) {
+ return ProcessingResult.NoUpdate;
+ }
+}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/SimulationStatus.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SimulationStatus.java
similarity index 92%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/SimulationStatus.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SimulationStatus.java
index fcb0f52..11e6d0b 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/SimulationStatus.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/SimulationStatus.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2023 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
/**
* The status of a simulation.
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/TimerActionResult.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/TimerActionResult.java
similarity index 95%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/TimerActionResult.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/TimerActionResult.java
index f326046..df1f203 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/TimerActionResult.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/TimerActionResult.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2022 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
/**
* The result of a timer action.
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/TimerHandler.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/TimerHandler.java
similarity index 84%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/TimerHandler.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/TimerHandler.java
index 60b82aa..337ca61 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/TimerHandler.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/TimerHandler.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2022 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,13 +13,13 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
/**
* Callback to a handle a timer message for a {@link DigitalTwinBase}.
* @param the type of the {@link DigitalTwinBase}.
*/
-public interface TimerHandler {
+public interface TimerHandler> {
/**
* Callback to handle a timer message.
@@ -29,5 +29,5 @@ public interface TimerHandler {
* @return {@link ProcessingResult#UpdateDigitalTwin} to update the digital twin instance or
* {@link ProcessingResult#NoUpdate} to leave the instance state as is.
*/
- public ProcessingResult onTimedMessage(String timerName, T instance, ProcessingContext ctx);
+ public ProcessingResult onTimedMessage(String timerName, T instance, ProcessingContext ctx);
}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/TimerMetadata.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/TimerMetadata.java
similarity index 59%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/TimerMetadata.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/TimerMetadata.java
index dbd0758..120e09e 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/TimerMetadata.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/TimerMetadata.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2022 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,41 +13,30 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
-
-import java.lang.reflect.InvocationTargetException;
-import java.time.Duration;
+package com.scaleoutsoftware.digitaltwin.abstractions;
/**
* Metadata class for a timer.
* @param the type of the {@link DigitalTwinBase} implementation.
*/
-public class TimerMetadata {
- final String timerHandler;
- final TimerType timerType;
- final long timerIntervalMs;
- final int timerId;
+public class TimerMetadata> {
+ final TimerHandler handlerClass;
+ final TimerType timerType;
+ final long timerIntervalMs;
+ final int timerSlot;
/**
* Constructs a timer metadata.
- * @param handler the timer handler.
+ * @param handlerClass the timer handler.
* @param timerType the timer type.
* @param timerIntervalMs the timer interval.
- * @param timerIdx the timer index.
+ * @param timerSlot the timer index.
*/
- public TimerMetadata(TimerHandler handler, TimerType timerType, long timerIntervalMs, int timerIdx) {
- this.timerHandler = handler.getClass().getName();
+ public TimerMetadata(TimerHandler handlerClass, TimerType timerType, long timerIntervalMs, int timerSlot) {
+ this.handlerClass = handlerClass;
this.timerType = timerType;
this.timerIntervalMs = timerIntervalMs;
- this.timerId = timerIdx;
- }
-
- /**
- * Retrieves the timer handler class name.
- * @return the timer handler class name.
- */
- public String getTimerHandlerClass() {
- return timerHandler;
+ this.timerSlot = timerSlot;
}
/**
@@ -70,7 +59,11 @@ public long getTimerIntervalMs() {
* Retrieves the timer ID.
* @return the timer ID.
*/
- public int getTimerId() {
- return timerId;
+ public int getTimerSlot() {
+ return timerSlot;
+ }
+
+ public TimerHandler getHandler() {
+ return handlerClass;
}
}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/TimerType.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/TimerType.java
similarity index 88%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/TimerType.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/TimerType.java
index 41fee8c..e7ef13e 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/TimerType.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/TimerType.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2022 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
/**
* Enum representation of the available timer types
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/package-info.java b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/package-info.java
similarity index 85%
rename from Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/package-info.java
rename to Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/package-info.java
index ee0bf8c..956efa9 100644
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/package-info.java
+++ b/Abstractions/src/main/java/com/scaleoutsoftware/digitaltwin/abstractions/package-info.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2018 by ScaleOut Software, Inc.
+ Copyright (c) 2026 by ScaleOut Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -17,5 +17,5 @@
/**
* Digital twin model API - Create a digital twin model.
*/
-package com.scaleoutsoftware.digitaltwin.core;
+package com.scaleoutsoftware.digitaltwin.abstractions;
diff --git a/Core/README.md b/Core/README.md
deleted file mode 100644
index 5d35706..0000000
--- a/Core/README.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# ScaleOut Digital Twins™ Core Libraries for Java
-
-The open source (Apache 2.0 licensed) project for the Core API:
-
-- [com.scaleout.digitaltwin.core](https://repo.scaleoutsoftware.com/#artifact/com.scaleoutsoftware.digitaltwin/core): Core datatypes required for building Digital Twin models.
-
-
-## Documentation
-- [Class reference](https://scaleoutsoftware.github.io/JavaDigitalTwinCore/)
-- [ScaleOut Digital Twins™ User Guide](https://static.scaleoutsoftware.com/docs/digital_twin_user_guide/index.html)
\ No newline at end of file
diff --git a/Core/build.gradle b/Core/build.gradle
deleted file mode 100644
index 5d8de5b..0000000
--- a/Core/build.gradle
+++ /dev/null
@@ -1,33 +0,0 @@
-plugins {
- id 'java'
-}
-
-group 'com.scaleoutsoftware.digitaltwin'
-version '3.0.9'
-
-sourceCompatibility = JavaVersion.VERSION_12
-
-repositories {
- mavenCentral()
-}
-
-dependencies {
- testImplementation group: 'junit', name: 'junit', version: '4.12'
-}
-
-configurations {
- archives
-}
-
-task myJavadocs(type: Javadoc) {
- source = sourceSets.main.allJava
-}
-
-jar {
- manifest {
- attributes ('Implementation-Title': project.name,
- 'Implementation-Version': project.version)
- }
-}
-
-
diff --git a/Core/settings.gradle b/Core/settings.gradle
deleted file mode 100644
index 1bdee66..0000000
--- a/Core/settings.gradle
+++ /dev/null
@@ -1,2 +0,0 @@
-rootProject.name = 'digitaltwin-core'
-
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/AlertProviderConfiguration.java b/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/AlertProviderConfiguration.java
deleted file mode 100644
index 88bd238..0000000
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/AlertProviderConfiguration.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- Copyright (c) 2021 by ScaleOut Software, Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-package com.scaleoutsoftware.digitaltwin.core;
-
-import java.io.Serializable;
-
-/**
- * Configuration for an alert provider.
- */
-public class AlertProviderConfiguration implements Serializable {
- /**
- * The alert provider type.
- */
- final String alertProviderType;
- /**
- * The required url for the alert provider type.
- */
- final String url;
- /**
- * The required integration key for the alert provider type.
- */
- final String integrationKey;
- /**
- * The required routing key for the alert provider type.
- */
- final String routingKey;
- /**
- * The name of this alert provider.
- */
- final String name;
- /**
- * The entity ID of this alert provider type.
- */
- final String entityId;
-
- private AlertProviderConfiguration() {alertProviderType = url = integrationKey = routingKey = name = entityId = null;}
-
- /**
- * Construct an alert provider configuration.
- * @param alertProviderType the alert provider type.
- * @param url the alert provider URL where alerts should be posted.
- * @param integrationKey the integration key.
- * @param routingKey the routing key.
- * @param name the name of the alert provider.
- * @param entityId the entity Id.
- */
- public AlertProviderConfiguration(String alertProviderType, String url, String integrationKey, String routingKey, String name, String entityId) {
- this.alertProviderType = alertProviderType;
- this.url = url;
- this.integrationKey = integrationKey;
- this.routingKey = routingKey;
- this.name = name;
- this.entityId = entityId;
- }
-
- /**
- * Retrieve the alert provider type for this configuration.
- * @return the alert provider type.
- */
- public String getAlertProviderType() {
- return alertProviderType;
- }
-
- /**
- * Retrieve the URL for this alert provider configuration.
- * @return the URL for this alert provider configuration.
- */
- public String getURL() {
- return url;
- }
-
- /**
- * Retrieve the integration key for this alert provider configuration.
- * @return the integration key for this alert provider configuration.
- */
- public String getIntegrationKey() {
- return integrationKey;
- }
-
- /**
- * Retrieve the routing key for this alert provider configuration.
- * @return the routing key for this alert provider configuration.
- */
- public String getRoutingKey() {
- return routingKey;
- }
-
- /**
- * Retrieve the name of this alert provider configuration.
- * @return the name of this alert provider configuration.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Retrieve the entity ID for this alert provider configuration.
- * @return the entity ID for this alert provider configuration.
- */
- public String getEntityId() {
- return entityId;
- }
-
- @Override
- public String toString() {
- return "AlertProviderConfiguration{" +
- "alertProviderType=" + alertProviderType + '\'' +
- ", URL='" + url + '\'' +
- ", IntegrationKey='" + integrationKey + '\'' +
- ", RoutingKey='" + routingKey + '\'' +
- ", Name='" + name + '\'' +
- ", EntityId='" + entityId + '\'' +
- '}';
- }
-}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/DigitalTwinBase.java b/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/DigitalTwinBase.java
deleted file mode 100644
index d8082ca..0000000
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/DigitalTwinBase.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- Copyright (c) 2018 by ScaleOut Software, Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-package com.scaleoutsoftware.digitaltwin.core;
-
-import java.util.Date;
-import java.util.HashMap;
-
-/**
- * A real-time digital twin of a data source. The implementation of the real-time DigitalTwin should have a parameterless constructor for
- * basic initialization.
- */
-public abstract class DigitalTwinBase {
-
- /* capitalized to match .NET serialization */
- /**
- * The identifier for this twin instance
- */
- public String Id = "";
-
- /**
- * The model this twin instance belongs to.
- */
- public String Model = "";
-
- /**
- * The timer handlers for this twin instance.
- */
- public HashMap TimerHandlers = new HashMap<>();
-
- /**
- * Note: Simulation only. The next time in milliseconds that this Digital Twin instance will be passed to {@link SimulationProcessor#processModel(ProcessingContext, DigitalTwinBase, Date)}.
- */
- public long NextSimulationTime = 0L;
-
- /**
- * Default constructor.
- */
- public DigitalTwinBase() {}
-
- /**
- * Retrieve the next simulation time in milliseconds.
- * @return the next simulation time in milliseconds.
- */
- public long getNextSimulationTimeMs() {
- return NextSimulationTime;
- }
-
- /**
- * Set the next simulation time in milliseconds.
- * @param nextSimulationTime set the next simulation time.
- */
- public void setNextSimulationTime(long nextSimulationTime) {
- NextSimulationTime = nextSimulationTime;
- }
-
- /**
- * The identifier of this DigitalTwin.
- * @return the identifier of this digital twin
- */
- public String getId() {
- return Id;
- }
-
- /**
- * The model for this DigitalTwin.
- * @return the model for this DigitalTwin
- */
- public String getModel() {
- return Model;
- }
-
- /**
- * Initialization method to set the identifier and model for a DigitalTwin instance. Optionally use the
- * {@link InitContext} to start a timer.
- * @param context the initialization context.
- * @throws IllegalStateException if init is called after initialization.
- */
- public void init(InitContext context) throws IllegalStateException {
- this.Id = context.getId();
- this.Model = context.getModel();
- }
-}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/DigitalTwinTimerMessage.java b/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/DigitalTwinTimerMessage.java
deleted file mode 100644
index 9b591c8..0000000
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/DigitalTwinTimerMessage.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- Copyright (c) 2022 by ScaleOut Software, Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-package com.scaleoutsoftware.digitaltwin.core;
-
-/**
- * A message sent to a digital twin instance's message processor.
- */
-public class DigitalTwinTimerMessage {
-
- private String _modelName;
- private String _twinId;
- private int _timerId;
- private String _timerName;
- private TimerType _timerType;
-
- /**
- * Construct a digital twin timer message.
- * @param modelName the digital twin model name.
- * @param twinId the digital twin instance ID
- * @param timerId the timer ID
- * @param timerName the timer name
- * @param timerType the timer type
- */
- public DigitalTwinTimerMessage(String modelName, String twinId, int timerId, String timerName, TimerType timerType) {
- _modelName = modelName;
- _twinId = twinId;
- _timerId = timerId;
- _timerName = timerName;
- _timerType = timerType;
- }
-
- /**
- * Retrieve the digital twin model name.
- * @return the digital twin model name.
- */
- public String getModelName() {
- return _modelName;
- }
-
- /**
- * Retrieve the digital twin ID.
- * @return the digital twin ID.
- */
- public String getTwinId() {
- return _twinId;
- }
-
- /**
- * Retrieve the timer ID.
- * @return the timer ID.
- */
- public int getTimerId() {
- return _timerId;
- }
-
- /**
- * Retrieve the timer name.
- * @return the timer name.
- */
- public String getTimerName() {
- return _timerName;
- }
-
- /**
- * Retrieve the {@link TimerType}.
- * @return the {@link TimerType}
- */
- public TimerType getTimerType() {
- return _timerType;
- }
-}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/MessageProcessorBase.java b/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/MessageProcessorBase.java
deleted file mode 100644
index 68a49c6..0000000
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/MessageProcessorBase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- Copyright (c) 2018 by ScaleOut Software, Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-package com.scaleoutsoftware.digitaltwin.core;
-
-/**
- * Base class for the MessageProcessor to help with typing.
- * @param the type of the DigitalTwin
- */
-public abstract class MessageProcessorBase {
-
- /**
- * Default constructor.
- */
- public MessageProcessorBase() {}
-
- /**
- * Helper method to ensure proper typing for the user methods.
- * @param context the processing context
- * @param twin the real-time digital twin instance
- * @param messageListFactory the message list factory
- * @return the implementing class's processing result
- * @throws Exception if an exception occurs during processing
- */
- public abstract ProcessingResult processMessages(ProcessingContext context, T twin, MessageFactory messageListFactory) throws Exception;
-}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/ModelSchema.java b/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/ModelSchema.java
deleted file mode 100644
index a2fe2f7..0000000
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/ModelSchema.java
+++ /dev/null
@@ -1,541 +0,0 @@
-/*
- Copyright (c) 2018 by ScaleOut Software, Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-package com.scaleoutsoftware.digitaltwin.core;
-
-import java.util.List;
-
-/**
- * The ModelSchema class is used as a Java object representation of the model.json schema file used for deploying a
- * digital twin model to the real-time digital twin cloud service.
- */
-public class ModelSchema {
- private final String modelType;
- private final String messageProcessorType;
- private final String simulationProcessorType;
- private final String messageType;
- private final String assemblyName;
- private final String azureDigitalTwinModelName;
- private final String persistenceProvider;
- private final boolean enablePersistence;
- private final boolean enableSimulationSupport;
- private final boolean enableMessageRecording;
- private final List alertProviders;
-
- private ModelSchema() {
- modelType = messageProcessorType = simulationProcessorType = messageType = assemblyName = azureDigitalTwinModelName = persistenceProvider = null;
- enablePersistence = false;
- enableSimulationSupport = false;
- enableMessageRecording = false;
- alertProviders = null;
- }
-
- /**
- * Creates a model schema from a digital twin class, a message processor class, and a message class.
- * @param dtClass the digital twin class implementation.
- * @param mpClass the message processor class implementation.
- * @param msgClass a JSON serializable message class.
- */
- public ModelSchema(
- String dtClass,
- String mpClass,
- String msgClass) {
- if( (dtClass == null || dtClass.isEmpty()) ||
- (mpClass == null || mpClass.isEmpty()) ||
- (msgClass == null || msgClass.isEmpty())
- ) {
- throw new IllegalArgumentException(String.format("Expected value for dtClass, mpClass, and msgClass; actual values: %s, %s, %s",
- (dtClass == null ? "null dtClass" : dtClass),
- (mpClass == null ? "null mpClass" : mpClass),
- (msgClass == null ? "null mpClass" : msgClass)
- ));
- }
- modelType = dtClass;
- messageProcessorType = mpClass;
- simulationProcessorType = null;
- enableSimulationSupport = false;
- messageType = msgClass;
- assemblyName = "NOT_USED_BY_JAVA_MODELS";
- alertProviders = null;
- azureDigitalTwinModelName = null;
- enablePersistence = false;
- enableMessageRecording = false;
- persistenceProvider = null;
- }
-
- /**
- * Creates a model schema from a digital twin class, a message processor class, and a message class.
- * @param dtClass the digital twin class implementation.
- * @param mpClass the message processor class implementation.
- * @param msgClass a JSON serializable message class.
- * @param emr enable message recording for this model.
- */
- public ModelSchema(
- String dtClass,
- String mpClass,
- String msgClass,
- boolean emr) {
- if( (dtClass == null || dtClass.isEmpty()) ||
- (mpClass == null || mpClass.isEmpty()) ||
- (msgClass == null || msgClass.isEmpty())
- ) {
- throw new IllegalArgumentException(String.format("Expected value for dtClass, mpClass, and msgClass; actual values: %s, %s, %s",
- (dtClass == null ? "null dtClass" : dtClass),
- (mpClass == null ? "null mpClass" : mpClass),
- (msgClass == null ? "null mpClass" : msgClass)
- ));
- }
- modelType = dtClass;
- messageProcessorType = mpClass;
- simulationProcessorType = null;
- enableSimulationSupport = false;
- messageType = msgClass;
- assemblyName = "NOT_USED_BY_JAVA_MODELS";
- alertProviders = null;
- azureDigitalTwinModelName = null;
- enablePersistence = false;
- enableMessageRecording = emr;
- persistenceProvider = null;
- }
-
- /**
- * Creates a model schema from a digital twin class, a message processor class, a message class, and
- * alert provider configurations.
- * @param dtClass the digital twin class implementation.
- * @param mpClass the message processor class implementation.
- * @param msgClass a JSON serializable message class.
- * @param alertingProviders the alerting provider configurations.
- */
- public ModelSchema(
- String dtClass,
- String mpClass,
- String msgClass,
- List alertingProviders) {
- if( (dtClass == null || dtClass.isEmpty()) ||
- (mpClass == null || mpClass.isEmpty()) ||
- (msgClass == null || msgClass.isEmpty())
- ) {
- throw new IllegalArgumentException(String.format("Expected value for dtClass, mpClass, and msgClass; actual values: %s, %s, %s",
- (dtClass == null ? "null dtClass" : dtClass),
- (mpClass == null ? "null mpClass" : mpClass),
- (msgClass == null ? "null mpClass" : msgClass)
- ));
- }
- modelType = dtClass;
- messageProcessorType = mpClass;
- simulationProcessorType = null;
- enableSimulationSupport = false;
- messageType = msgClass;
- assemblyName = "NOT_USED_BY_JAVA_MODELS";
- azureDigitalTwinModelName = null;
- enablePersistence = false;
- enableMessageRecording = false;
- persistenceProvider = null;
- alertProviders = alertingProviders;
- }
-
- /**
- * Creates a model schema from a digital twin class, a message processor class, a message class, and
- * alert provider configurations.
- * @param dtClass the digital twin class implementation.
- * @param mpClass the message processor class implementation.
- * @param msgClass a JSON serializable message class.
- * @param spClass the simulation processor class implementation.
- * @param alertingProviders the alerting provider configurations.
- */
- public ModelSchema(
- String dtClass,
- String mpClass,
- String msgClass,
- String spClass,
- List alertingProviders) {
- if( (dtClass == null || dtClass.isEmpty()) ||
- (mpClass == null || mpClass.isEmpty()) ||
- (msgClass == null || msgClass.isEmpty()) ||
- (spClass == null || spClass.isEmpty())
- ) {
- throw new IllegalArgumentException(String.format("Expected value for dtClass, mpClass, and msgClass; actual values: %s, %s, %s",
- (dtClass == null ? "null dtClass" : dtClass),
- (mpClass == null ? "null mpClass" : mpClass),
- (msgClass == null ? "null mpClass" : msgClass),
- (spClass == null ? "null mpClass" : msgClass)
- ));
- }
- modelType = dtClass;
- messageProcessorType = mpClass;
- simulationProcessorType = spClass;
- enableSimulationSupport = true;
- messageType = msgClass;
- assemblyName = "NOT_USED_BY_JAVA_MODELS";
- azureDigitalTwinModelName = null;
- enablePersistence = false;
- persistenceProvider = null;
- enableMessageRecording = false;
- alertProviders = alertingProviders;
- }
-
- /**
- * Creates a model schema from a digital twin class, a message processor class, a message class, and
- * alert provider configurations.
- * @param dtClass the digital twin class implementation.
- * @param mpClass the message processor class implementation.
- * @param msgClass a JSON serializable message class.
- * @param spClass the simulation processor class implementation.
- * @param alertingProviders the alerting provider configurations.
- * @param emr enable message recording for this model.
- */
- public ModelSchema(
- String dtClass,
- String mpClass,
- String msgClass,
- String spClass,
- List alertingProviders,
- boolean emr) {
- if( (dtClass == null || dtClass.isEmpty()) ||
- (mpClass == null || mpClass.isEmpty()) ||
- (msgClass == null || msgClass.isEmpty()) ||
- (spClass == null || spClass.isEmpty())
- ) {
- throw new IllegalArgumentException(String.format("Expected value for dtClass, mpClass, and msgClass; actual values: %s, %s, %s",
- (dtClass == null ? "null dtClass" : dtClass),
- (mpClass == null ? "null mpClass" : mpClass),
- (msgClass == null ? "null mpClass" : msgClass),
- (spClass == null ? "null mpClass" : msgClass)
- ));
- }
- modelType = dtClass;
- messageProcessorType = mpClass;
- simulationProcessorType = spClass;
- enableSimulationSupport = true;
- messageType = msgClass;
- assemblyName = "NOT_USED_BY_JAVA_MODELS";
- azureDigitalTwinModelName = null;
- enablePersistence = false;
- persistenceProvider = null;
- enableMessageRecording = emr;
- alertProviders = alertingProviders;
- }
-
- /**
- * Creates a model schema from a digital twin class, a message processor class, a message class, and
- * alert provider configurations.
- * @param dtClass the digital twin class implementation.
- * @param mpClass the message processor class implementation.
- * @param msgClass a JSON serializable message class.
- * @param adtName the Azure Digital Twin model name.
- * @param persistenceType the persistence provider type.
- * @param alertingProviders the alerting provider configurations.
- */
- public ModelSchema(
- String dtClass,
- String mpClass,
- String msgClass,
- String adtName,
- PersistenceProviderType persistenceType,
- List alertingProviders) {
- if( (dtClass == null || dtClass.isEmpty()) ||
- (mpClass == null || mpClass.isEmpty()) ||
- (msgClass == null || msgClass.isEmpty())
- ) {
- throw new IllegalArgumentException(String.format("Expected value for dtClass, mpClass, and msgClass; actual values: %s, %s, %s",
- (dtClass == null ? "null dtClass" : dtClass),
- (mpClass == null ? "null mpClass" : mpClass),
- (msgClass == null ? "null mpClass" : msgClass)
- ));
- }
- modelType = dtClass;
- messageProcessorType = mpClass;
- simulationProcessorType = null;
- enableSimulationSupport = false;
- messageType = msgClass;
- enableMessageRecording = false;
- assemblyName = "NOT_USED_BY_JAVA_MODELS";
- persistenceProvider = persistenceType.name();
- switch (persistenceType) {
- case AzureDigitalTwinsService:
- azureDigitalTwinModelName = adtName;
- enablePersistence = true;
- break;
- case SQLite:
- case SQLServer:
- case DynamoDb:
- case CosmosDb:
- enablePersistence = true;
- azureDigitalTwinModelName = null;
- break;
- default:
- azureDigitalTwinModelName = null;
- enablePersistence = false;
- break;
- }
- alertProviders = alertingProviders;
- }
-
- /**
- * Creates a model schema from a digital twin class, a message processor class, a message class, and
- * alert provider configurations.
- * @param dtClass the digital twin class implementation.
- * @param mpClass the message processor class implementation.
- * @param msgClass a JSON serializable message class.
- * @param adtName the Azure Digital Twin model name.
- * @param persistenceType the persistence provider type.
- * @param alertingProviders the alerting provider configurations.
- * @param emr enable message recording for this model.
- */
- public ModelSchema(
- String dtClass,
- String mpClass,
- String msgClass,
- String adtName,
- PersistenceProviderType persistenceType,
- List alertingProviders,
- boolean emr) {
- if( (dtClass == null || dtClass.isEmpty()) ||
- (mpClass == null || mpClass.isEmpty()) ||
- (msgClass == null || msgClass.isEmpty())
- ) {
- throw new IllegalArgumentException(String.format("Expected value for dtClass, mpClass, and msgClass; actual values: %s, %s, %s",
- (dtClass == null ? "null dtClass" : dtClass),
- (mpClass == null ? "null mpClass" : mpClass),
- (msgClass == null ? "null mpClass" : msgClass)
- ));
- }
- modelType = dtClass;
- messageProcessorType = mpClass;
- simulationProcessorType = null;
- enableSimulationSupport = false;
- messageType = msgClass;
- enableMessageRecording = emr;
- assemblyName = "NOT_USED_BY_JAVA_MODELS";
- persistenceProvider = persistenceType.name();
- switch (persistenceType) {
- case AzureDigitalTwinsService:
- azureDigitalTwinModelName = adtName;
- enablePersistence = true;
- break;
- case SQLite:
- case SQLServer:
- case DynamoDb:
- enablePersistence = true;
- azureDigitalTwinModelName = null;
- break;
- default:
- azureDigitalTwinModelName = null;
- enablePersistence = false;
- break;
- }
- alertProviders = alertingProviders;
- }
-
- /**
- * Creates a model schema from a digital twin class, a message processor class, a message class,
- * a simulation processor class, an Azure Digital Twin Model name class, a persistence provider type,
- * and an alert provider configuration.
- *
- * @param dtClass the digital twin class implementation.
- * @param mpClass the message processor class implementation.
- * @param msgClass a JSON serializable message class.
- * @param simulationProcessorClass the simulation processor class implementation.
- * @param adtName the Azure Digital Twin model name.
- * @param persistenceType the persistence provider type.
- * @param alertingProviders the alerting provider configurations.
- */
- public ModelSchema(
- String dtClass,
- String mpClass,
- String msgClass,
- String simulationProcessorClass,
- String adtName,
- PersistenceProviderType persistenceType,
- List alertingProviders) {
- if( (dtClass == null || dtClass.isEmpty()) ||
- (mpClass == null || mpClass.isEmpty()) ||
- (msgClass == null || msgClass.isEmpty())
- ) {
- throw new IllegalArgumentException(String.format("Expected value for dtClass, mpClass, and msgClass; actual values: %s, %s, %s",
- (dtClass == null ? "null dtClass" : dtClass),
- (mpClass == null ? "null mpClass" : mpClass),
- (msgClass == null ? "null mpClass" : msgClass)
- ));
- }
- modelType = dtClass;
- messageProcessorType = mpClass;
- simulationProcessorType = simulationProcessorClass;
- enableSimulationSupport = true;
- enableMessageRecording = false;
- messageType = msgClass;
- assemblyName = "NOT_USED_BY_JAVA_MODELS";
- persistenceProvider = persistenceType.name();
- switch (persistenceType) {
- case AzureDigitalTwinsService:
- azureDigitalTwinModelName = adtName;
- enablePersistence = true;
- break;
- case SQLite:
- case SQLServer:
- case DynamoDb:
- enablePersistence = true;
- azureDigitalTwinModelName = null;
- break;
- default:
- azureDigitalTwinModelName = null;
- enablePersistence = false;
- break;
- }
- alertProviders = alertingProviders;
- }
-
- /**
- * Creates a model schema from a digital twin class, a message processor class, a message class,
- * a simulation processor class, an Azure Digital Twin Model name class, a persistence provider type,
- * and an alert provider configuration.
- *
- * @param dtClass the digital twin class implementation.
- * @param mpClass the message processor class implementation.
- * @param msgClass a JSON serializable message class.
- * @param simulationProcessorClass the simulation processor class implementation.
- * @param adtName the Azure Digital Twin model name.
- * @param persistenceType the persistence provider type.
- * @param alertingProviders the alerting provider configurations.
- * @param emr enable message recording for this model.
- */
- public ModelSchema(
- String dtClass,
- String mpClass,
- String msgClass,
- String simulationProcessorClass,
- String adtName,
- PersistenceProviderType persistenceType,
- List alertingProviders,
- boolean emr) {
- if( (dtClass == null || dtClass.isEmpty()) ||
- (mpClass == null || mpClass.isEmpty()) ||
- (msgClass == null || msgClass.isEmpty())
- ) {
- throw new IllegalArgumentException(String.format("Expected value for dtClass, mpClass, and msgClass; actual values: %s, %s, %s",
- (dtClass == null ? "null dtClass" : dtClass),
- (mpClass == null ? "null mpClass" : mpClass),
- (msgClass == null ? "null mpClass" : msgClass)
- ));
- }
- modelType = dtClass;
- messageProcessorType = mpClass;
- simulationProcessorType = simulationProcessorClass;
- enableSimulationSupport = true;
- enableMessageRecording = emr;
- messageType = msgClass;
- assemblyName = "NOT_USED_BY_JAVA_MODELS";
- persistenceProvider = persistenceType.name();
- switch (persistenceType) {
- case AzureDigitalTwinsService:
- azureDigitalTwinModelName = adtName;
- enablePersistence = true;
- break;
- case SQLite:
- case SQLServer:
- case DynamoDb:
- case CosmosDb:
- enablePersistence = true;
- azureDigitalTwinModelName = null;
- break;
- default:
- azureDigitalTwinModelName = null;
- enablePersistence = false;
- break;
- }
- alertProviders = alertingProviders;
- }
-
- /**
- * Retrieve the digital twin model type (a {@link DigitalTwinBase} implementation).
- * @return the model type.
- */
- public String getModelType() {
- return modelType;
- }
-
- /**
- * Retrieve the message type (JSON serializable message implementation).
- * @return the message type.
- */
- public String getMessageType() {
- return messageType;
- }
-
- /**
- * Retrieve the message processor type (a {@link MessageProcessor} implementation).
- * @return the message processor type.
- */
- public String getMessageProcessorType() {
- return messageProcessorType;
- }
-
- /**
- * Retrieve the simulation processor type (a {@link SimulationProcessor} implementation).
- * @return the simulation processor type.
- */
- public String getSimulationProcessorType() {
- return simulationProcessorType;
- }
-
- /**
- * NOT USED BY JAVA MODEL SCHEMA
- * @return NOT USED BY JAVA MODEL SCHEMA
- */
- public String getAssemblyName() {
- return assemblyName;
- }
-
- /**
- * Retrieve the alert provider configurations.
- * @return the alert provider configurations.
- */
- public List getAlertProviders() {return alertProviders; }
-
- /**
- * Retrieve the Azure Digital Twin model name.
- * @return the Azure Digital Twin model name.
- */
- public String getAzureDigitalTwinModelName() {
- return azureDigitalTwinModelName;
- }
-
- /**
- * Retrieve persistence status. True if persistence is enabled, false otherwise.
- * @return True if persistence is enabled, false otherwise.
- */
- public boolean persistenceEnabled() { return enablePersistence; }
-
- /**
- * Retrieve simulation support enabled status. True if simulation support is enabled, false otherwise.
- * @return True if simulation support is enabled, false otherwise.
- */
- public boolean simulationSupportEnabled() {return enableSimulationSupport;}
-
- /**
- * Retrieve the persistence provider type.
- * @return the persistence provider type.
- */
- public PersistenceProviderType getPersistenceProvider() { return PersistenceProviderType.fromString(persistenceProvider); }
-
- /**
- * Retrieves the message recording enabled status. True if this model should persist messages when message recording is active,
- * false otherwise.
- * @return True if message recording is enabled, false otherwise.
- */
- public boolean messageRecordingEnabled() {
- return enableMessageRecording;
- }
-}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/PersistenceProviderType.java b/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/PersistenceProviderType.java
deleted file mode 100644
index 17681a2..0000000
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/PersistenceProviderType.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- Copyright (c) 2021 by ScaleOut Software, Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-package com.scaleoutsoftware.digitaltwin.core;
-
-import java.io.Serializable;
-
-/**
- * Available {@link PersistenceProvider} types.
- */
-public enum PersistenceProviderType implements Serializable {
-
- /**
- * Enum for the Azure Digital Twin service.
- */
- AzureDigitalTwinsService("AzureDigitalTwinsService", 1),
- /**
- * Enum for CosmosDB
- */
- CosmosDb("Azure Cosmos DB", 6),
-
- /**
- * Enum for DynamoDB
- */
- DynamoDb("DynamoDB", 5),
- /**
- * Enum for SQLite
- */
- SQLite("SQLite", 4),
- /**
- * Enum for SQLServer
- */
- SQLServer("SQLServer", 3),
-
- /**
- * Enum for an unconfigured PersistenceProvider
- */
- Unconfigured("", 0);
-
- private String _name;
- private int _value;
- PersistenceProviderType(String name, int ordinal) {
- _name = name;
- _value = ordinal;
- }
-
- /**
- * Return the PersistenceProviderType from a string value. We do not rely on Java's naming
- * because the string values need to be cross-platform and the names may be different in each language.
- * @param name the enums name.
- * @return the associated PersistenceProviderType, or null if no association exists.
- */
- public static PersistenceProviderType fromString(String name) {
- if(name != null && !name.isEmpty() && !name.isBlank()) {
- switch(name) {
- case "AzureDigitalTwinsService":
- return AzureDigitalTwinsService;
- case "SQLite":
- return SQLite;
- case "SQLServer":
- return SQLServer;
- case "DynamoDB":
- return DynamoDb;
- case "Azure Cosmos DB":
- return CosmosDb;
- default:
- return null;
- }
- } else {
- return null;
- }
- }
-
- /**
- * Return the PersistenceProviderType from an ordinal value. We do not rely on Java's ordering
- * because the ordinal values need to be cross-platform, and the values may be ordered differently.
- * @param ordinal the enums ordinal value.
- * @return the associated PersistenceProviderType, or null if no association exists.
- */
- public static PersistenceProviderType fromOrdinal(int ordinal) {
- switch(ordinal) {
- case 1:
- return AzureDigitalTwinsService;
- case 3:
- return SQLServer;
- case 4:
- return SQLite;
- case 5:
- return DynamoDb;
- case 6:
- return CosmosDb;
- default:
- return null;
- }
- }
-}
diff --git a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/ProcessingContext.java b/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/ProcessingContext.java
deleted file mode 100644
index 9803b63..0000000
--- a/Core/src/main/java/com/scaleoutsoftware/digitaltwin/core/ProcessingContext.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- Copyright (c) 2018 by ScaleOut Software, Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-package com.scaleoutsoftware.digitaltwin.core;
-
-import java.io.Serializable;
-import java.time.Duration;
-import java.util.Date;
-import java.util.List;
-import java.util.logging.Level;
-
-/**
- * Context object that allows the user to send a message to a DataSource.
- */
-public abstract class ProcessingContext implements Serializable {
-
- /**
- * Default constructor.
- */
- public ProcessingContext() {}
-
- /**
- *
- * Sends a message to a data source. This will route messages through the connector back to the data source.
- *
- *
- *
- * if the datasource is simulation instance, then the message will be sent to the simulation model's implementation
- * of the {@link MessageProcessor}.
- *
- *
- * @param payload the message (as a serialized JSON string)
- * @return the sending result
- */
- public abstract SendingResult sendToDataSource(byte[] payload);
-
- /**
- *
- * Sends a message to a data source. This will route messages through the connector back to the data source.
- *
- *
- *
- * if the datasource is simulation instance, then the message will be sent to the simulation model's implementation
- * of the {@link MessageProcessor}.
- *
- *
- * @param jsonSerializableMessage a JSON serializable message.
- * @return the sending result
- */
- public abstract SendingResult sendToDataSource(Object jsonSerializableMessage);
-
- /**
- *
- * Sends a list of messages to a data source. This will route messages through the connector back to the data source.
- *
- *
- *
- * if the datasource is simulation instance, then the message will be sent to the simulation model's implementation
- * of the {@link MessageProcessor#processMessages(ProcessingContext, DigitalTwinBase, Iterable)}.
- *
- *
- * @param jsonSerializableMessages a list of JSON serializable messages.
- * @return the sending result
- */
- public abstract SendingResult sendToDataSource(List