76. Datum Data SourceΒΆ
The DatumDataSource
API defines the primary way for plugins to generate datum instances
from devices or services integrated with SolarNode, through a request-based API. The MultiDatumDataSource
API
is closely related, and allows a plugin to generate multiple datum when requested.
package net.solarnetwork.node.service;
import net.solarnetwork.node.domain.datum.NodeDatum;
import net.solarnetwork.service.Identifiable;
/**
* API for collecting {@link NodeDatum} objects from some device.
*/
public interface DatumDataSource extends Identifiable, DeviceInfoProvider {
/**
* Get the class supported by this DataSource.
*
* @return class
*/
Class<? extends NodeDatum> getDatumType();
/**
* Read the current value from the data source, returning as an unpersisted
* {@link NodeDatum} object.
*
* @return Datum
*/
NodeDatum readCurrentDatum();
}
package net.solarnetwork.node.service;
import java.util.Collection;
import net.solarnetwork.node.domain.datum.NodeDatum;
import net.solarnetwork.service.Identifiable;
/**
* API for collecting multiple {@link NodeDatum} objects from some device.
*/
public interface MultiDatumDataSource extends Identifiable, DeviceInfoProvider {
/**
* Get the class supported by this DataSource.
*
* @return class
*/
Class<? extends NodeDatum> getMultiDatumType();
/**
* Read multiple values from the data source, returning as a collection of
* unpersisted {@link NodeDatum} objects.
*
* @return Datum
*/
Collection<NodeDatum> readMultipleDatum();
}
The Datum Data Source Poll Job provides a way to let users schedule the polling for datum from a data source.