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 Summary
FieldsModifier and TypeFieldDescriptionprotected final Tprotected final reactor.core.publisher.Sinks.Many<org.springframework.boot.health.contributor.Health> protected final Deque<AiidaRecord> protected final reactor.core.publisher.Sinks.Many<DataSourceRecord> -
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, tools.jackson.databind.ObjectMapper objectMapper, MqttConfiguration mqttConfiguration, UUID aiidaId) Factory method forDataSourceAdaptercreation.voidemitAiidaRecord(List<AiidaRecordValue> aiidaRecordValues) Emits a newAiidaRecordwith specified aiida record valuesorg.springframework.boot.health.contributor.Healthhealth()abstract reactor.core.publisher.Flux<DataSourceRecord> start()Starts this datasource and all records will be published on the returned Flux.<R extends DataSourceRecord>
reactor.core.publisher.Flux<R> startFiltered(Class<R> recordType) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.boot.health.contributor.HealthIndicator
health
-
Field Details
-
recordSink
-
healthSink
protected final reactor.core.publisher.Sinks.Many<org.springframework.boot.health.contributor.Health> healthSink -
dataSource
-
healthValidationMessages
-
-
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, tools.jackson.databind.ObjectMapper objectMapper, MqttConfiguration mqttConfiguration, UUID aiidaId) Factory method forDataSourceAdaptercreation.- Parameters:
dataSource- The entity of the data source.objectMapper- The object mapper to use for deserialization.mqttConfiguration- The MQTT configuration to use for connecting to the broker (if needed).aiidaId- The ID of the AIIDA instance, used for formatting the acknowledgements (if needed).- 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.
-
startFiltered
public <R extends DataSourceRecord> reactor.core.publisher.Flux<R> startFiltered(Class<R> recordType) -
emitAiidaRecord
Emits a newAiidaRecordwith specified aiida record values- Parameters:
aiidaRecordValues- Values for the new aiida record
-
health
public org.springframework.boot.health.contributor.Health health()- Specified by:
healthin interfaceorg.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 bystart().- Specified by:
closein interfaceAutoCloseable
-
dataSource
-