Class DataSourceAdapter<T extends DataSource>

java.lang.Object
energy.eddie.aiida.adapters.datasource.DataSourceAdapter<T>
All Implemented Interfaces:
AutoCloseable, org.springframework.boot.actuate.health.HealthContributor, org.springframework.boot.actuate.health.HealthIndicator
Direct Known Subclasses:
ModbusTcpDataSourceAdapter, MqttDataSourceAdapter, SimulationAdapter

public abstract class DataSourceAdapter<T extends DataSource> extends Object implements AutoCloseable, org.springframework.boot.actuate.health.HealthIndicator
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final T
     
    protected final reactor.core.publisher.Sinks.Many<org.springframework.boot.actuate.health.Health>
     
    protected final reactor.core.publisher.Sinks.Many<AiidaRecord>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    DataSourceAdapter(T dataSource)
    Creates a new DataSourceAdapter with the specified data source entity.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    Closes any open connections and frees resources used by this datasource.
    static DataSourceAdapter<? extends DataSource>
    create(DataSource dataSource, com.fasterxml.jackson.databind.ObjectMapper objectMapper, MqttConfiguration mqttConfiguration)
    Factory method for DataSourceAdapter creation.
     
    void
    emitAiidaRecord(AiidaAsset asset, List<AiidaRecordValue> aiidaRecordValues)
    Emits a new AiidaRecord with specified aiida record values
    abstract reactor.core.publisher.Flux<AiidaRecord>
    Starts this datasource and all records will be published on the returned Flux.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.boot.actuate.health.HealthIndicator

    getHealth, health
  • Field Details

    • recordSink

      protected final reactor.core.publisher.Sinks.Many<AiidaRecord> recordSink
    • healthSink

      protected final reactor.core.publisher.Sinks.Many<org.springframework.boot.actuate.health.Health> healthSink
    • dataSource

      protected final T extends DataSource dataSource
  • Constructor Details

    • DataSourceAdapter

      protected DataSourceAdapter(T dataSource)
      Creates a new DataSourceAdapter with the specified data source entity.
      Parameters:
      dataSource - The entity of the data source.
  • Method Details

    • create

      public static DataSourceAdapter<? extends DataSource> create(DataSource dataSource, com.fasterxml.jackson.databind.ObjectMapper objectMapper, MqttConfiguration mqttConfiguration)
      Factory method for DataSourceAdapter creation.
      Parameters:
      dataSource - The entity of the data source.
      objectMapper - The object mapper to use for deserialization.
      Returns:
      The created DataSourceAdapter.
    • start

      public abstract reactor.core.publisher.Flux<AiidaRecord> start()
      Starts this datasource and all records will be published on the returned Flux.
      Returns:
      Flux on which all data from this datasource will be published.
    • emitAiidaRecord

      public void emitAiidaRecord(AiidaAsset asset, List<AiidaRecordValue> aiidaRecordValues)
      Emits a new AiidaRecord with specified aiida record values
      Parameters:
      aiidaRecordValues - Values for the new aiida record
    • close

      public abstract void close()
      Closes any open connections and frees resources used by this datasource. Also emits a complete signal on the Flux returned by start().
      Specified by:
      close in interface AutoCloseable
    • dataSource

      public T dataSource()