use of com.thinkbiganalytics.KyloVersion in project kylo by Teradata.
the class KyloUpgradeService method getNextVersion.
private KyloVersion getNextVersion() {
init();
KyloVersion current = versionProvider.getCurrentVersion();
// If there are no recorded versions then this is a fresh install so the next version is the actual build version.
if (current == null) {
return this.buildVersion;
} else {
int idx = IntStream.range(0, upgradeSequence.size()).filter(i -> upgradeSequence.get(i).matches(current.getMajorVersion(), current.getMinorVersion(), current.getPointVersion()) || upgradeSequence.get(i).compareTo(current) > 0).findFirst().orElseThrow(() -> new IllegalStateException("The current Kylo version is unrecognized: " + current));
// If the current version is not the last one in the upgrade sequence then return it, otherwise return null.
if (upgradeSequence.get(idx).compareTo(current) > 0) {
return upgradeSequence.get(idx);
} else if (idx < upgradeSequence.size() - 1) {
return upgradeSequence.get(idx + 1);
} else {
return null;
}
}
}
use of com.thinkbiganalytics.KyloVersion in project kylo by Teradata.
the class KyloUpgrader method getCurrentVersion.
/**
* Return the database version for Kylo.
*
* @return the version of Kylo stored in the database
*/
public KyloVersion getCurrentVersion() {
String profiles = System.getProperty("spring.profiles.active", "");
if (!profiles.contains("native")) {
profiles = StringUtils.isEmpty(profiles) ? "native" : profiles + ",native";
System.setProperty("spring.profiles.active", profiles);
}
// Spring is needed to load the Spring Cloud context so we can decrypt the passwords for the database connection
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("kylo-upgrade-check-application-context.xml");
loadProfileProperties(ctx);
ctx.refresh();
KyloUpgradeDatabaseVersionChecker upgradeDatabaseVersionChecker = (KyloUpgradeDatabaseVersionChecker) ctx.getBean("kyloUpgradeDatabaseVersionChecker");
KyloVersion kyloVersion = upgradeDatabaseVersionChecker.getDatabaseVersion();
ctx.close();
return kyloVersion;
}
Aggregations