Class DataSourceAdapter<T extends DataSource>

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

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

    • recordSink

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

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

      protected final T extends DataSource dataSource
    • healthValidationMessages

      protected final Deque<AiidaRecord> healthValidationMessages
  • 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, tools.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(List<AiidaRecordValue> aiidaRecordValues)
      Emits a new AiidaRecord with specified aiida record values
      Parameters:
      aiidaRecordValues - Values for the new aiida record
    • health

      public org.springframework.boot.health.contributor.Health health()
      Specified by:
      health in interface org.springframework.boot.health.contributor.HealthIndicator
    • 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()