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
FieldsModifier and TypeFieldDescriptionprotected final Tprotected final reactor.core.publisher.Sinks.Many<org.springframework.boot.actuate.health.Health> protected final reactor.core.publisher.Sinks.Many<AiidaRecord> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDataSourceAdapter(T dataSource) Creates a newDataSourceAdapterwith the specified data source entity. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclose()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 forDataSourceAdaptercreation.voidemitAiidaRecord(AiidaAsset asset, List<AiidaRecordValue> aiidaRecordValues) Emits a newAiidaRecordwith specified aiida record valuesabstract reactor.core.publisher.Flux<AiidaRecord> start()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, waitMethods inherited from interface org.springframework.boot.actuate.health.HealthIndicator
getHealth, health
-
Field Details
-
recordSink
-
healthSink
protected final reactor.core.publisher.Sinks.Many<org.springframework.boot.actuate.health.Health> healthSink -
dataSource
-
-
Constructor Details
-
DataSourceAdapter
Creates a newDataSourceAdapterwith 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 forDataSourceAdaptercreation.- Parameters:
dataSource- The entity of the data source.objectMapper- The object mapper to use for deserialization.- Returns:
- The created
DataSourceAdapter.
-
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
Emits a newAiidaRecordwith 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 bystart().- Specified by:
closein interfaceAutoCloseable
-
dataSource
-