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 Details

    • OR_DATA_POINTS_QUERY_LIMIT

      public static final String OR_DATA_POINTS_QUERY_LIMIT
      See Also:
    • PRIORITY

      public static final int PRIORITY
      See Also:
    • persistenceService

      protected org.openremote.container.persistence.PersistenceService persistenceService
    • assetStorageService

      protected AssetStorageService assetStorageService
    • timerService

      protected org.openremote.container.timer.TimerService timerService
    • scheduledExecutorService

      protected ScheduledExecutorService scheduledExecutorService
    • dataPointsPurgeScheduledFuture

      protected ScheduledFuture<?> dataPointsPurgeScheduledFuture
    • maxAmountOfQueryPoints

      protected int maxAmountOfQueryPoints
  • Constructor Details

    • AbstractDatapointService

      public AbstractDatapointService()
  • Method Details

    • getPriority

      public int getPriority()
      Specified by:
      getPriority in interface org.openremote.model.ContainerService
    • init

      public void init(org.openremote.model.Container container) throws Exception
      Specified by:
      init in interface org.openremote.model.ContainerService
      Throws:
      Exception
    • stop

      public void stop(org.openremote.model.Container container) throws Exception
      Specified by:
      stop in interface org.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

      public List<org.openremote.model.datapoint.ValueDatapoint<?>> queryDatapoints(String assetId, String attributeName, org.openremote.model.datapoint.query.AssetDatapointQuery datapointQuery)
    • queryDatapoints

      public List<org.openremote.model.datapoint.ValueDatapoint<?>> queryDatapoints(String assetId, org.openremote.model.attribute.Attribute<?> attribute, @NotNull @NotNull org.openremote.model.datapoint.query.AssetDatapointQuery datapointQuery)
    • canQueryDatapoints

      protected boolean canQueryDatapoints(String query, Map<Integer,Object> parameters, int datapointLimit)
    • doQueryDatapoints

      protected List<org.openremote.model.datapoint.ValueDatapoint<?>> doQueryDatapoints(String assetId, org.openremote.model.attribute.Attribute<?> attribute, String query, Map<Integer,Object> parameters)
    • getDatapointPeriod

      public org.openremote.model.datapoint.DatapointPeriod getDatapointPeriod(String assetId, String attributeName)
    • getUpsertPreparedStatement

      protected PreparedStatement getUpsertPreparedStatement(Connection connection) throws SQLException
      Throws:
      SQLException
    • setUpsertValues

      protected void setUpsertValues(PreparedStatement st, String assetId, String attributeName, Object value, long timestamp) throws Exception
      Throws:
      Exception
    • getDatapointClass

      protected abstract Class<T> getDatapointClass()
    • getDatapointTableName

      protected abstract String getDatapointTableName()
    • getLogger

      protected abstract Logger getLogger()
    • doPurge

      protected void doPurge(String whereClause, Date date)
    • getFirstPurgeMillis

      protected long getFirstPurgeMillis(Instant currentTime)
    • toString

      public String toString()
      Overrides:
      toString in class Object