static

in tephra-core/src/main/java/org/apache/tephra/util/HBaseVersion.java [88:137]


  static {
    try {
      Class versionInfoClass = Class.forName("org.apache.hadoop.hbase.util.VersionInfo");
      Method versionMethod = versionInfoClass.getMethod("getVersion");
      versionString = (String) versionMethod.invoke(null);
      if (versionString.startsWith(HBASE_94_VERSION)) {
        currentVersion = Version.HBASE_94;
      } else if (versionString.startsWith(HBASE_96_VERSION)) {
        currentVersion = Version.HBASE_96;
      } else if (versionString.startsWith(HBASE_98_VERSION)) {
        currentVersion = Version.HBASE_98;
      } else if (versionString.startsWith(HBASE_10_VERSION)) {
        VersionNumber ver = VersionNumber.create(versionString);
        if (ver.getClassifier() != null && ver.getClassifier().startsWith(CDH_CLASSIFIER)) {
          currentVersion = Version.HBASE_10_CDH;
        } else {
          currentVersion = Version.HBASE_10;
        }
      } else if (versionString.startsWith(HBASE_11_VERSION)) {
        currentVersion = Version.HBASE_11;
      } else if (versionString.startsWith(HBASE_12_VERSION)) {
        currentVersion = Version.HBASE_12;
      } else if (versionString.startsWith(HBASE_13_VERSION)) {
        currentVersion = Version.HBASE_13;
      } else if (versionString.startsWith(HBASE_14_VERSION)) {
        currentVersion = Version.HBASE_14;
      } else if (versionString.startsWith(HBASE_15_VERSION)) {
        currentVersion = Version.HBASE_15;
      } else if (versionString.startsWith(HBASE_16_VERSION)) {
          currentVersion = Version.HBASE_16;
      } else if (versionString.startsWith(HBASE_20_VERSION)) {
          currentVersion = Version.HBASE_20;
      } else if (versionString.startsWith(HBASE_21_VERSION)) {
          currentVersion = Version.HBASE_21;
      } else if (versionString.startsWith(HBASE_22_VERSION)) {
          currentVersion = Version.HBASE_22;
      } else if (versionString.startsWith(HBASE_23_VERSION)) {
          currentVersion = Version.HBASE_23;
      } else if (versionString.startsWith(HBASE_24_VERSION)) {
        currentVersion = Version.HBASE_24;
      } else {
        currentVersion = Version.UNKNOWN;
      }
    } catch (Throwable e) {
      // must be a class loading exception, HBase is not there
      LOG.error("Unable to determine HBase version from string '{}', are HBase classes available?", versionString);
      LOG.error("Exception was: ", e);
      currentVersion = Version.UNKNOWN;
    }
  }