Interface PersistenceProvider
-
- All Known Implementing Classes:
AzureDigitalTwinsPersistenceProvider
,DynamoDbPersistenceProvider
public interface PersistenceProvider
An interface that can be used for persisting/retrieving the state of real-time digital twins.
-
-
Method Summary
Modifier and Type Method Description java.lang.String
getInstance(java.lang.String containerName, java.lang.String instanceId)
Retrieves an instance or null if it doesn't exist.java.util.concurrent.CompletableFuture<java.lang.String>
getInstanceAsync(java.lang.String containerName, java.lang.String instanceId)
Retrieves a future that when complete will return an instance or null if it doesn't exist.java.util.List<java.lang.String>
getInstanceIds(java.lang.String containerName)
Retrieves the instance IDs stored in a container, or an empty list if no instances exist.java.util.concurrent.CompletableFuture<java.util.List<java.lang.String>>
getInstanceIdsAsync(java.lang.String containerName)
Retrieves a future that when complete will return the instance IDs stored in a container, or an empty list if no instances exist.<T> T
getProperty(java.lang.String containerName, java.lang.String instanceId, java.lang.String propertyName, java.lang.Class<T> clazz)
Retrieves a property or null if the property does not exist.<T> java.util.concurrent.CompletableFuture<T>
getPropertyAsync(java.lang.String containerName, java.lang.String instanceId, java.lang.String propertyName, java.lang.Class<T> clazz)
Retrieves a future that will return a property or null if the property does not exist.java.util.Map<java.lang.String,java.lang.String>
getPropertyMap(java.lang.String containerName)
Retrieves a map of property names to property types, or an empty map.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String>>
getPropertyMapAsync(java.lang.String containerName)
Retrieves a future that will return a map of property names to property, or an empty map.PersistenceProviderType
getProviderType()
Retrieves this persistence providers type.<T> T
getRtdtProperty(java.lang.String instanceId, java.lang.String propertyName, java.lang.Class<T> clazz)
Retrieves a property for a RTDT instance or null if the property does not exist.<T> java.util.concurrent.CompletableFuture<T>
getRtdtPropertyAsync(java.lang.String instanceId, java.lang.String propertyName, java.lang.Class<T> clazz)
Retrieves a future that will return a property value for a RTDT instance or null if the property doesn't exist.boolean
isActive()
Returns true if this PersistenceProvider is active, false otherwise.void
updateProperty(java.lang.String containerName, java.lang.String instanceId, java.lang.String propertyName, java.lang.Object propertyValue)
Updates a property for the provided instance id in the provided container specified by the property name and property value.java.util.concurrent.CompletableFuture<java.lang.Void>
updatePropertyAsync(java.lang.String containerName, java.lang.String instanceId, java.lang.String propertyName, java.lang.Object propertyValue)
Retrieves a future that will complete exceptionally or return void if the instance's property was successfully updated.void
updateRtdtProperty(java.lang.String instanceId, java.lang.String propertyName, java.lang.Object propertyValue)
Updates a RTDT property for the provided instance id specified by the property name and property value.java.util.concurrent.CompletableFuture<java.lang.Void>
updateRtdtPropertyAsync(java.lang.String instanceId, java.lang.String propertyName, java.lang.Object propertyValue)
Retrieves a future that will complete exceptionally or return void if the RTDT's property was successfully updated.
-
-
-
Method Detail
-
isActive
boolean isActive()
Returns true if this PersistenceProvider is active, false otherwise.- Returns:
- true if this PersistenceProvider is active, false otherwise.
-
getProviderType
PersistenceProviderType getProviderType()
Retrieves this persistence providers type. Currently supported provider types: AzureDigitalTwins.- Returns:
- the persistence provider type.
-
getInstanceIdsAsync
java.util.concurrent.CompletableFuture<java.util.List<java.lang.String>> getInstanceIdsAsync(java.lang.String containerName)
Retrieves a future that when complete will return the instance IDs stored in a container, or an empty list if no instances exist.- Parameters:
containerName
- the container name.- Returns:
- a future that will return a list of instances.
-
getInstanceIds
java.util.List<java.lang.String> getInstanceIds(java.lang.String containerName)
Retrieves the instance IDs stored in a container, or an empty list if no instances exist.- Parameters:
containerName
- the container name.- Returns:
- a list of instances.
-
getInstanceAsync
java.util.concurrent.CompletableFuture<java.lang.String> getInstanceAsync(java.lang.String containerName, java.lang.String instanceId)
Retrieves a future that when complete will return an instance or null if it doesn't exist.- Parameters:
containerName
- the container name.instanceId
- the instance identifier.- Returns:
- a future that will return an instance or null.
-
getInstance
java.lang.String getInstance(java.lang.String containerName, java.lang.String instanceId)
Retrieves an instance or null if it doesn't exist.- Parameters:
containerName
- the container nameinstanceId
- the instance identifier- Returns:
- the instance or null.
-
getPropertyMapAsync
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String>> getPropertyMapAsync(java.lang.String containerName)
Retrieves a future that will return a map of property names to property, or an empty map.- Parameters:
containerName
- the container name.- Returns:
- a future that will return a map of property names to property types.
-
getPropertyMap
java.util.Map<java.lang.String,java.lang.String> getPropertyMap(java.lang.String containerName)
Retrieves a map of property names to property types, or an empty map.- Parameters:
containerName
- the container name.- Returns:
- a map of property names to property types.
-
updatePropertyAsync
java.util.concurrent.CompletableFuture<java.lang.Void> updatePropertyAsync(java.lang.String containerName, java.lang.String instanceId, java.lang.String propertyName, java.lang.Object propertyValue)
Retrieves a future that will complete exceptionally or return void if the instance's property was successfully updated. Updates a property for the provided instance id in the provided container specified by the property name and property value.- Parameters:
containerName
- the container name.instanceId
- the instance id.propertyName
- the property name.propertyValue
- the property value.- Returns:
- a future that will complete exceptionally or return void.
-
updateProperty
void updateProperty(java.lang.String containerName, java.lang.String instanceId, java.lang.String propertyName, java.lang.Object propertyValue)
Updates a property for the provided instance id in the provided container specified by the property name and property value.- Parameters:
containerName
- the container name.instanceId
- the instance id.propertyName
- the property name.propertyValue
- the property value.
-
getPropertyAsync
<T> java.util.concurrent.CompletableFuture<T> getPropertyAsync(java.lang.String containerName, java.lang.String instanceId, java.lang.String propertyName, java.lang.Class<T> clazz)
Retrieves a future that will return a property or null if the property does not exist.- Type Parameters:
T
- the type of the property to return- Parameters:
containerName
- the container name.instanceId
- the instance id.propertyName
- the property name.clazz
- the class representing the property.- Returns:
- the property or null if the property does not exist.
-
getProperty
<T> T getProperty(java.lang.String containerName, java.lang.String instanceId, java.lang.String propertyName, java.lang.Class<T> clazz)
Retrieves a property or null if the property does not exist.- Type Parameters:
T
- the type of the property to return.- Parameters:
containerName
- the container name.instanceId
- the instance id.propertyName
- the property nameclazz
- the class representing the property.- Returns:
- the property or null if the property does not exist.
-
updateRtdtPropertyAsync
java.util.concurrent.CompletableFuture<java.lang.Void> updateRtdtPropertyAsync(java.lang.String instanceId, java.lang.String propertyName, java.lang.Object propertyValue)
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.- Parameters:
instanceId
- the instance id.propertyName
- the property name.propertyValue
- the property value.- Returns:
- a future that will complete exceptionally or return void.
-
updateRtdtProperty
void updateRtdtProperty(java.lang.String instanceId, java.lang.String propertyName, java.lang.Object propertyValue)
Updates a RTDT property for the provided instance id specified by the property name and property value.- Parameters:
instanceId
- the instance id.propertyName
- the property name.propertyValue
- the property value.
-
getRtdtPropertyAsync
<T> java.util.concurrent.CompletableFuture<T> getRtdtPropertyAsync(java.lang.String instanceId, java.lang.String propertyName, java.lang.Class<T> clazz)
Retrieves a future that will return a property value for a RTDT instance or null if the property doesn't exist.- Type Parameters:
T
- the type of the property to return.- Parameters:
instanceId
- the instance id.propertyName
- the property name.clazz
- the class of the property type- Returns:
- a future that will return a property value for a RTDT instance.
-
getRtdtProperty
<T> T getRtdtProperty(java.lang.String instanceId, java.lang.String propertyName, java.lang.Class<T> clazz)
Retrieves a property for a RTDT instance or null if the property does not exist.- Type Parameters:
T
- the type of the property to return.- Parameters:
instanceId
- the instance id.propertyName
- the property name.clazz
- the class of the property type.- Returns:
- the property value.
-
-