use of com.thinkbiganalytics.KyloVersion in project kylo by Teradata.
the class AboutKyloController method getKyloVersion.
/**
* Get Kylo Version for showing in UI About Dialog Box.
*/
@GET
@Path("/version")
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation("Gets the version number of Kylo.")
@ApiResponses(@ApiResponse(code = 200, message = "Returns the version number.", response = String.class))
public Response getKyloVersion() {
final String VERSION_NOT_AVAILABLE = "Not Available";
KyloVersion kyloVersion = kyloVersionProvider.getCurrentVersion();
if (kyloVersion != null) {
return Response.ok(kyloVersion.getVersion()).build();
} else {
return Response.ok(VERSION_NOT_AVAILABLE).build();
}
}
use of com.thinkbiganalytics.KyloVersion in project kylo by Teradata.
the class KyloServerApplication method main.
public static void main(String[] args) {
SLF4JBridgeHandler.install();
KyloUpgrader upgrader = new KyloUpgrader();
if (upgrader.isUpgradeRequired()) {
KyloVersion currentVersion = upgrader.getCurrentVersion();
log.info("***** Upgrade required - this may take some time *****");
log.info("Beginning upgrade from version {} ...", currentVersion == null ? "unknown" : currentVersion);
upgrader.upgrade();
log.info("***** Upgrading complete *****");
} else {
log.info("Kylo v{} is up to date. Starting the application.", KyloVersionUtil.getBuildVersion());
}
System.setProperty(SpringApplication.BANNER_LOCATION_PROPERTY, "banner.txt");
SpringApplication.run("classpath:application-context.xml", args);
}
use of com.thinkbiganalytics.KyloVersion in project kylo by Teradata.
the class JpaKyloVersionProvider method isUpToDate.
@Override
public boolean isUpToDate() {
KyloVersion buildVer = KyloVersionUtil.getBuildVersion();
KyloVersion currentVer = getCurrentVersion();
return currentVer != null && buildVer.matches(currentVer.getMajorVersion(), currentVer.getMinorVersion(), currentVer.getPointVersion());
}
use of com.thinkbiganalytics.KyloVersion in project kylo by Teradata.
the class KyloUpgradeDatabaseVersionChecker method getDatabaseVersion.
/**
* Query the Database for the Kylo Version
*
* @return the KyloVersion from the database, or null if not found or if an error occurs
*/
public KyloVersion getDatabaseVersion() {
KyloVersion version = null;
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
try {
String user = environmentProperties.getPropertyValueAsString("spring.datasource.username");
String password = environmentProperties.getPropertyValueAsString("spring.datasource.password");
password = encryptionService.isEncrypted(password) ? encryptionService.decrypt(password) : password;
String uri = environmentProperties.getPropertyValueAsString("spring.datasource.url");
String driverClassName = environmentProperties.getPropertyValueAsString("spring.datasource.driverClassName");
boolean testOnBorrow = BooleanUtils.toBoolean(environmentProperties.getPropertyValueAsString("spring.datasource.testOnBorrow"));
String validationQuery = environmentProperties.getPropertyValueAsString("spring.datasource.validationQuery");
PoolingDataSourceService.DataSourceProperties dataSourceProperties = new PoolingDataSourceService.DataSourceProperties(user, password, uri, driverClassName, testOnBorrow, validationQuery);
DataSource dataSource = PoolingDataSourceService.getDataSource(dataSourceProperties);
connection = dataSource.getConnection();
String query = "SELECT * FROM KYLO_VERSION ORDER BY MAJOR_VERSION DESC, MINOR_VERSION DESC, POINT_VERSION DESC, TAG DESC";
statement = connection.createStatement();
rs = statement.executeQuery(query);
if (rs.next()) {
String majorVersion = rs.getString("MAJOR_VERSION");
String minorVersion = rs.getString("MINOR_VERSION");
String pointVersion = rs.getString("POINT_VERSION");
String tag = rs.getString("TAG");
version = new KyloVersionUtil.Version(majorVersion, minorVersion, pointVersion, tag);
}
} catch (SQLException e) {
// this is ok.. If an error happens assume the upgrade is needed. The method will return a null value if errors occur and the upgrade app will start.
log.error("Error has occurred so upgrade is needed", e);
} finally {
JdbcUtils.closeStatement(statement);
JdbcUtils.closeResultSet(rs);
JdbcUtils.closeConnection(connection);
}
return version;
}
use of com.thinkbiganalytics.KyloVersion in project kylo by Teradata.
the class KyloUpgradeService method main.
public static void main(String... args) {
try {
if (args.length < 2) {
throw new IllegalArgumentException("Current source directory and build version required as arguments");
}
String resourcesDir = args[0];
Resource versionsResource = new FileSystemResource(new File(resourcesDir, UPGRADE_VERSIONS_FILE));
KyloVersion projectVersion = KyloVersionUtil.parseVersion(args[1]).withoutTag();
List<KyloVersion> upgradeVersions = Stream.concat(readUpgradeVersions(versionsResource).stream(), Stream.of(projectVersion)).sorted().distinct().collect(Collectors.toList());
writeUpgradeVersions(upgradeVersions, versionsResource.getFile());
} catch (Exception e) {
throw new UpgradeException("Failed to update versions file: " + UPGRADE_VERSIONS_FILE, e);
}
}
Aggregations