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

      public void bindVersion(Version version)
      Binds a Version to this current handler.
      Parameters:
      version - the Version to bind
    • unbindVersion

      public void unbindVersion(Version version)
      Unbinds a Version from this current handler.
      Parameters:
      version - the Version to unbind
    • 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