Permalink
Browse files

current release check

  • Loading branch information...
1 parent 96298f5 commit 99fdb8127fe73726d9c3a09e752d00b69bffea22 @witek witek committed Oct 10, 2010
@@ -15,18 +15,25 @@
private String build;
private String deploymentStage;
private boolean defaultAdminPassword;
+ private String currentRelease;
public ApplicationInfo(String name, String release, String build, String deploymentStage,
- boolean defaultAdminPassword) {
+ boolean defaultAdminPassword, String currentRelease) {
this.name = name;
this.release = release;
this.build = build;
this.deploymentStage = deploymentStage;
this.defaultAdminPassword = defaultAdminPassword;
+ this.currentRelease = currentRelease;
}
protected ApplicationInfo() {}
+ public boolean isNewReleaseAvailable() {
+ if (currentRelease == null) return false;
+ return !currentRelease.equals(release);
+ }
+
public boolean isDefaultAdminPassword() {
return defaultAdminPassword;
}
@@ -56,7 +63,7 @@ public boolean isDevelopmentStage() {
}
public String getVersionDescription() {
- return name + " | Release " + " | Build " + build + " | " + deploymentStage;
+ return name + " | Release " + release + " | Build " + build + " | " + deploymentStage;
}
@Override
@@ -102,9 +102,27 @@ public ScrumEntityfilePreparator getEntityfilePreparator() {
public ApplicationInfo getApplicationInfo() {
User admin = getUserDao().getUserByName("admin");
boolean defaultAdminPassword = false;
- if (admin != null && admin.matchesPassword(scrum.client.admin.User.INITIAL_PASSWORD))
+ if (admin != null && admin.matchesPassword(scrum.client.admin.User.INITIAL_PASSWORD)) {
defaultAdminPassword = true;
- return new ApplicationInfo("kunagi", getReleaseLabel(), getBuild(), getDeploymentStage(), defaultAdminPassword);
+ }
+ return new ApplicationInfo("kunagi", getReleaseLabel(), getBuild(), getDeploymentStage(), defaultAdminPassword,
+ getCurrentRelease());
+ }
+
+ private String currentRelease;
+
+ public String getCurrentRelease() {
+ if (currentRelease == null) {
+ String url = "http://kunagi.org/current-release.properties";
+ log.info("Checking current release:", url);
+ try {
+ Properties currentReleaseProperties = IO.loadPropertiesFromUrl(url, IO.UTF_8);
+ currentRelease = currentReleaseProperties.getProperty("currentRelease");
+ } catch (Throwable ex) {
+ return null;
+ }
+ }
+ return currentRelease;
}
// --- ---
@@ -0,0 +1 @@
+currentRelease=$project.currentRelease

0 comments on commit 99fdb81

Please sign in to comment.