Class VersionHandler

java.lang.Object
io.openems.edge.timedata.rrd4j.version.VersionHandler

public class VersionHandler extends Object
  • Constructor Details

    • VersionHandler

      public VersionHandler()
  • Method Details

    • getVersion

      public static int getVersion(org.rrd4j.core.RrdDb db) throws IOException
      Gets the version of the given RrdDb.
      Parameters:
      db - the database to get the version from
      Returns:
      the version
      Throws:
      IOException - on I/O-Error
    • bindVersion

      protected void bindVersion(Version version)
    • unbindVersion

      protected void unbindVersion(Version version)
    • getLatestVersion

      public Version getLatestVersion()
      Gets the latest version of the found Versions.

      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

      public boolean isUpToDate(org.rrd4j.core.RrdDb db) throws IOException
      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

      public List<Version> getVersions()
      Gets all versions. Ordered by the version number ascending.
      Returns:
      a unmodifiable list of the versions