Class VersionHandler
java.lang.Object
io.openems.edge.timedata.rrd4j.version.VersionHandler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
bindVersion
(Version version) Binds aVersion
to this current handler.Gets the latest version of the foundVersions
.int
Gets the latest version number.static int
getVersion
(org.rrd4j.core.RrdDb db) Gets the version of the givenRrdDb
.Gets all versions.boolean
isUpToDate
(org.rrd4j.core.RrdDb db) Checks if the database matches the current version.void
unbindVersion
(Version version) Unbinds aVersion
from this current handler.
-
Constructor Details
-
VersionHandler
public VersionHandler()
-
-
Method Details
-
getVersion
Gets the version of the givenRrdDb
.- Parameters:
db
- the database to get the version from- Returns:
- the version
- Throws:
IOException
- on I/O-Error
-
bindVersion
Binds aVersion
to this current handler.- Parameters:
version
- theVersion
to bind
-
unbindVersion
Unbinds aVersion
from this current handler.- Parameters:
version
- theVersion
to unbind
-
getLatestVersion
Gets the latest version of the foundVersions
.Note: In order to automatically add a version, the
Version
needs to have the annotation:@Component(// scope = ServiceScope.SINGLETON, // property = { "version:Integer=(version number)" }, // immediate = true // )
- Returns:
- the latest version
-
getLatestVersionNumber
public int getLatestVersionNumber()Gets the latest version number.- Returns:
- the number of the latest version
- See Also:
-
isUpToDate
Checks if the database matches the current version.- Parameters:
db
- the database to check- Returns:
- true if the database is on the latest version
- Throws:
IOException
- on I/O-Error
-
getVersions
Gets all versions. Ordered by the version number ascending.- Returns:
- a unmodifiable list of the versions
-