Interface PersistenceProvider


public interface PersistenceProvider
An interface that can be used for persisting/retrieving the state of real-time digital twins.
  • Method Details

    • 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

      CompletableFuture<List<String>> getInstanceIdsAsync(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

      List<String> getInstanceIds(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

      CompletableFuture<String> getInstanceAsync(String containerName, 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

      String getInstance(String containerName, String instanceId)
      Retrieves an instance or null if it doesn't exist.
      Parameters:
      containerName - the container name
      instanceId - the instance identifier
      Returns:
      the instance or null.
    • getPropertyMapAsync

      CompletableFuture<Map<String,String>> getPropertyMapAsync(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

      Map<String,String> getPropertyMap(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

      CompletableFuture<Void> updatePropertyAsync(String containerName, String instanceId, String propertyName, 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(String containerName, String instanceId, String propertyName, 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> CompletableFuture<T> getPropertyAsync(String containerName, String instanceId, String propertyName, 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(String containerName, String instanceId, String propertyName, 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 name
      clazz - the class representing the property.
      Returns:
      the property or null if the property does not exist.
    • updateRtdtPropertyAsync

      CompletableFuture<Void> updateRtdtPropertyAsync(String instanceId, String propertyName, 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(String instanceId, String propertyName, 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> CompletableFuture<T> getRtdtPropertyAsync(String instanceId, String propertyName, 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(String instanceId, String propertyName, 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.