java.lang.Object
io.openems.backend.timedata.timescaledb.internal.Schema

public class Schema extends Object
  • Method Details

    • initialize

      public static Schema initialize(com.zaxxer.hikari.HikariDataSource dataSource) throws SQLException
      Initialize the database Schema and the Channels Cache.
      Parameters:
      dataSource - a HikariDataSource
      Returns:
      the Schema
      Throws:
      SQLException - on error
    • getChannel

      public Schema.ChannelRecord getChannel(Connection con, String edgeId, String channelAddress, com.google.gson.JsonElement value) throws SQLException
      Gets the Channel for the given Point. Adds it if it was not existing before.
      Parameters:
      con - a database Connection, in case the entry needs to be added
      edgeId - the Edge-ID
      channelAddress - the Channel-Address
      value - the JsonElement value
      Returns:
      the Schema.ChannelRecord; or null if not in Cache and type cannot be detected
      Throws:
      SQLException - on error while adding
    • getChannelFromCache

      public Schema.ChannelRecord getChannelFromCache(String edgeId, String channelAddress)
      Gets the Schema.ChannelRecord from local Cache.
      Parameters:
      edgeId - the Edge-ID
      channelAddress - the Channel-Address
      Returns:
      the Schema.ChannelRecord with a database ID for table 'channel', null if there is no entry yet