Class Schema
- java.lang.Object
-
- io.openems.backend.timedata.timescaledb.internal.Schema
-
public class Schema extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Schema.ChannelRecord
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Schema.ChannelRecord
getChannel(java.sql.Connection con, java.lang.String edgeId, java.lang.String channelAddress, com.google.gson.JsonElement value)
Gets the Channel for the givenPoint
.Schema.ChannelRecord
getChannelFromCache(java.lang.String edgeId, java.lang.String channelAddress)
Gets theSchema.ChannelRecord
from local Cache.static Schema
initialize(com.zaxxer.hikari.HikariDataSource dataSource)
Initialize the database Schema and the Channels Cache.
-
-
-
Method Detail
-
initialize
public static Schema initialize(com.zaxxer.hikari.HikariDataSource dataSource) throws java.sql.SQLException
Initialize the database Schema and the Channels Cache.- Parameters:
dataSource
- aHikariDataSource
- Returns:
- the
Schema
- Throws:
java.sql.SQLException
- on error
-
getChannel
public Schema.ChannelRecord getChannel(java.sql.Connection con, java.lang.String edgeId, java.lang.String channelAddress, com.google.gson.JsonElement value) throws java.sql.SQLException
Gets the Channel for the givenPoint
. Adds it if it was not existing before.- Parameters:
con
- a databaseConnection
, in case the entry needs to be addededgeId
- the Edge-IDchannelAddress
- the Channel-Addressvalue
- theJsonElement
value- Returns:
- the
Schema.ChannelRecord
; or null if not in Cache and type cannot be detected - Throws:
java.sql.SQLException
- on error while adding
-
getChannelFromCache
public Schema.ChannelRecord getChannelFromCache(java.lang.String edgeId, java.lang.String channelAddress)
Gets theSchema.ChannelRecord
from local Cache.- Parameters:
edgeId
- the Edge-IDchannelAddress
- the Channel-Address- Returns:
- the
Schema.ChannelRecord
with a database ID for table 'channel', null if there is no entry yet
-
-