Package org.openremote.manager.datapoint
Class AbstractDatapointService<T extends org.openremote.model.datapoint.Datapoint>
java.lang.Object
org.openremote.manager.datapoint.AbstractDatapointService<T>
- All Implemented Interfaces:
org.openremote.model.ContainerService
- Direct Known Subclasses:
AssetDatapointService,AssetPredictedDatapointService
public abstract class AbstractDatapointService<T extends org.openremote.model.datapoint.Datapoint>
extends Object
implements org.openremote.model.ContainerService
Base class for all classes that store and retrieve
Datapoint.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AssetStorageServiceprotected ScheduledFuture<?> protected intstatic final Stringprotected org.openremote.container.persistence.PersistenceServicestatic final intprotected ScheduledExecutorServiceprotected org.openremote.container.timer.TimerServiceFields inherited from interface org.openremote.model.ContainerService
DEFAULT_PRIORITY, HIGH_PRIORITY, LOW_PRIORITY, MED_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancanQueryDatapoints(String query, Map<Integer, Object> parameters, int datapointLimit) protected voidprotected List<org.openremote.model.datapoint.ValueDatapoint<?>> doQueryDatapoints(String assetId, org.openremote.model.attribute.Attribute<?> attribute, String query, Map<Integer, Object> parameters) org.openremote.model.datapoint.DatapointPeriodgetDatapointPeriod(String assetId, String attributeName) List<org.openremote.model.datapoint.ValueDatapoint> getDatapoints(org.openremote.model.attribute.AttributeRef attributeRef) longlonggetDatapointsCount(org.openremote.model.attribute.AttributeRef attributeRef) protected abstract Stringprotected longgetFirstPurgeMillis(Instant currentTime) protected abstract Loggerintprotected PreparedStatementgetUpsertPreparedStatement(Connection connection) voidinit(org.openremote.model.Container container) List<org.openremote.model.datapoint.ValueDatapoint<?>> queryDatapoints(String assetId, String attributeName, org.openremote.model.datapoint.query.AssetDatapointQuery datapointQuery) List<org.openremote.model.datapoint.ValueDatapoint<?>> queryDatapoints(String assetId, org.openremote.model.attribute.Attribute<?> attribute, @NotNull org.openremote.model.datapoint.query.AssetDatapointQuery datapointQuery) protected voidsetUpsertValues(PreparedStatement st, String assetId, String attributeName, Object value, long timestamp) voidstop(org.openremote.model.Container container) toString()voidupsertValue(String assetId, String attributeName, Object value, long timestamp) voidupsertValue(String assetId, String attributeName, Object value, LocalDateTime timestamp) voidupsertValues(String assetId, String attributeName, List<org.openremote.model.datapoint.ValueDatapoint<?>> valuesAndTimestamps) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openremote.model.ContainerService
start
-
Field Details
-
OR_DATA_POINTS_QUERY_LIMIT
- See Also:
-
PRIORITY
public static final int PRIORITY- See Also:
-
persistenceService
protected org.openremote.container.persistence.PersistenceService persistenceService -
assetStorageService
-
timerService
protected org.openremote.container.timer.TimerService timerService -
scheduledExecutorService
-
dataPointsPurgeScheduledFuture
-
maxAmountOfQueryPoints
protected int maxAmountOfQueryPoints
-
-
Constructor Details
-
AbstractDatapointService
public AbstractDatapointService()
-
-
Method Details
-
getPriority
public int getPriority()- Specified by:
getPriorityin interfaceorg.openremote.model.ContainerService
-
init
- Specified by:
initin interfaceorg.openremote.model.ContainerService- Throws:
Exception
-
stop
- Specified by:
stopin interfaceorg.openremote.model.ContainerService- Throws:
Exception
-
upsertValue
public void upsertValue(String assetId, String attributeName, Object value, LocalDateTime timestamp) throws IllegalStateException - Throws:
IllegalStateException
-
upsertValue
public void upsertValue(String assetId, String attributeName, Object value, long timestamp) throws IllegalStateException - Throws:
IllegalStateException
-
upsertValues
public void upsertValues(String assetId, String attributeName, List<org.openremote.model.datapoint.ValueDatapoint<?>> valuesAndTimestamps) throws IllegalStateException - Throws:
IllegalStateException
-
getDatapoints
public List<org.openremote.model.datapoint.ValueDatapoint> getDatapoints(org.openremote.model.attribute.AttributeRef attributeRef) -
getDatapointsCount
public long getDatapointsCount() -
getDatapointsCount
public long getDatapointsCount(org.openremote.model.attribute.AttributeRef attributeRef) -
queryDatapoints
-
queryDatapoints
-
canQueryDatapoints
-
doQueryDatapoints
-
getDatapointPeriod
-
getUpsertPreparedStatement
- Throws:
SQLException
-
setUpsertValues
protected void setUpsertValues(PreparedStatement st, String assetId, String attributeName, Object value, long timestamp) throws Exception - Throws:
Exception
-
getDatapointClass
-
getDatapointTableName
-
getLogger
-
doPurge
-
getFirstPurgeMillis
-
toString
-