public UpdateCheckService() { ProductInfo productInfo = getProductInfoInstance(); productName = productInfo.getTitle().replaceAll("\\s+", ""); try { String version = productInfo.getMajor() +"."+ productInfo.getMinor() +"."+ productInfo.getPatch(); currentVersion = parseGatewayVersion(version); } catch (Exception e) { throw new RuntimeException("Could not locate a product version associated with the jars on the classpath", e); } final String productEdition = productInfo.getEdition().replaceAll("\\s+", ""); versionServiceUrl = (productEdition.toLowerCase().contains("enterprise")) ? "https://version.kaazing.com" : "https://version.kaazing.org"; }
@Override public void startingGateway(GatewayContext gatewayContext) { Map<String, Object> injectables = gatewayContext.getInjectables(); Properties properties = (Properties) injectables.get("configuration"); if (!InternalSystemProperty.UPDATE_CHECK.getBooleanProperty(properties)) { return; } ProductInfo productInfo = getProductInfoInstance(); productName = productInfo.getTitle().replaceAll("\\s+", ""); String version = productInfo.getMajor() +"."+ productInfo.getMinor() +"."+ productInfo.getPatch(); currentVersion = parseGatewayVersion(version); String serviceUrl = InternalSystemProperty.UPDATE_CHECK_SERVICE_URL.getProperty(properties); if (serviceUrl != null) { versionServiceUrl = serviceUrl; } else { versionServiceUrl = productInfo.getEdition().toLowerCase().contains("enterprise") ? ENTERPRISE_URL : COMMUNITY_URL; } SchedulerProvider provider = (SchedulerProvider) injectables.get("schedulerProvider"); ScheduledExecutorService scheduler = provider.getScheduler("update_check", false); UpdateCheckTask updateCheckTask = new UpdateCheckTask(this, versionServiceUrl, productName); scheduler.scheduleAtFixedRate(updateCheckTask, 0, 7, DAYS); } }