summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShireesh Anjal <shireesh@gluster.com>2011-12-12 14:09:09 +0530
committerShireesh Anjal <shireesh@gluster.com>2011-12-12 14:09:09 +0530
commit5fee99642f7726955dd1721e1b90a8865e9fe050 (patch)
tree26104420f11cda6dbedc644292a5a16213809994
parent80a418fa94fc215d9d3a077650a23f5f08f9edea (diff)
parent8e2295b6b7139a0cf36d4f78c5caeb6bf7919ef0 (diff)
Merge branch 'master' of github.com:gluster/gmc
-rw-r--r--src/org.gluster.storage.management.gateway/buckminster.cspex2
-rw-r--r--src/org.gluster.storage.management.gateway/build/glustermg.ant (renamed from src/org.gluster.storage.management.gateway/build/glusterserver.ant)4
-rw-r--r--src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/InitServerTask.java17
-rw-r--r--src/org.gluster.storage.management.gateway/src/spring/gluster-server-base.xml7
4 files changed, 19 insertions, 11 deletions
diff --git a/src/org.gluster.storage.management.gateway/buckminster.cspex b/src/org.gluster.storage.management.gateway/buckminster.cspex
index 31eb9d6..4133dfc 100644
--- a/src/org.gluster.storage.management.gateway/buckminster.cspex
+++ b/src/org.gluster.storage.management.gateway/buckminster.cspex
@@ -15,7 +15,7 @@
<actions>
<public name="archive" actor="ant">
<actorProperties>
- <property key="buildFile" value="build/glusterserver.ant"/>
+ <property key="buildFile" value="build/glustermg.ant"/>
</actorProperties>
</public>
</actions>
diff --git a/src/org.gluster.storage.management.gateway/build/glusterserver.ant b/src/org.gluster.storage.management.gateway/build/glustermg.ant
index d05a5fb..ac15e1b 100644
--- a/src/org.gluster.storage.management.gateway/build/glusterserver.ant
+++ b/src/org.gluster.storage.management.gateway/build/glustermg.ant
@@ -57,7 +57,11 @@
<exclude name="**/servlet-api.jar" />
</fileset>
</copy>
+
+ <!-- Update product version in xml files -->
<replace file="${TEMP}/WEB-INF/web.xml" token="@VERSION@" value="${product.version}" />
+ <replace file="${TEMP}/WEB-INF/classes/spring/gluster-server-base.xml" token="@VERSION@" value="${product.version}" />
+
<war destfile="${OUT}/${WAR_FILE_NAME}" basedir="${TEMP}" compress="true" webxml="${TEMP}/WEB-INF/web.xml" />
<delete dir="${TEMP}" />
</target>
diff --git a/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/InitServerTask.java b/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/InitServerTask.java
index 4426683..99e8c63 100644
--- a/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/InitServerTask.java
+++ b/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/InitServerTask.java
@@ -57,7 +57,7 @@ public class InitServerTask extends JdbcDaoSupport {
private UserDetailsService userDetailsService;
@Autowired
- private String appVersion;
+ private String dataVersion;
@Autowired
private PersistenceDao<ClusterInfo> clusterDao;
@@ -104,7 +104,7 @@ public class InitServerTask extends JdbcDaoSupport {
private void initDatabase() {
logger.info("Initializing server data...");
- executeScriptsFrom(getDirFromRelativePath(SCRIPT_DIR + appVersion));
+ executeScriptsFrom(getDirFromRelativePath(SCRIPT_DIR + dataVersion));
securePasswords(); // encrypt the passwords
}
@@ -136,14 +136,13 @@ public class InitServerTask extends JdbcDaoSupport {
*/
public synchronized void initServer() {
try {
- String dbVersion = getDBVersion();
- if (!appVersion.equals(dbVersion)) {
- logger.info("App version [" + appVersion + "] differs from data version [" + dbVersion
- + "]. Trying to upgrade data...");
- upgradeData(dbVersion, appVersion);
+ String currentDataVersion = getDataVersion();
+ if (!dataVersion.equals(currentDataVersion)) {
+ logger.info("Upgrading data from [" + currentDataVersion + "] to [" + dataVersion + "]...");
+ upgradeData(currentDataVersion, dataVersion);
}
} catch (Exception ex) {
- logger.info("No cluster created yet. DB version query failed with error [" + ex.getMessage() + "]", ex);
+ logger.info("Data version query failed with error [" + ex.getMessage() + "]", ex);
// Database not created yet. Create it!
initDatabase();
}
@@ -153,7 +152,7 @@ public class InitServerTask extends JdbcDaoSupport {
executeScriptsFrom(getDirFromRelativePath(SCRIPT_DIR + fromVersion + "-" + toVersion));
}
- private String getDBVersion() {
+ private String getDataVersion() {
return (String) clusterDao.getSingleResultFromSQL("select version from version");
}
}
diff --git a/src/org.gluster.storage.management.gateway/src/spring/gluster-server-base.xml b/src/org.gluster.storage.management.gateway/src/spring/gluster-server-base.xml
index 9bce061..43a0aad 100644
--- a/src/org.gluster.storage.management.gateway/src/spring/gluster-server-base.xml
+++ b/src/org.gluster.storage.management.gateway/src/spring/gluster-server-base.xml
@@ -62,6 +62,11 @@
<!-- Gluster Management Gateway Version -->
<bean id="appVersion" class="java.lang.String">
+ <constructor-arg value="@VERSION@" />
+ </bean>
+
+ <!-- Gluster Management Gateway Data Version -->
+ <bean id="dataVersion" class="java.lang.String">
<constructor-arg value="1.0.0" />
</bean>
@@ -115,4 +120,4 @@
<bean class="org.gluster.storage.management.gateway.tasks.InitServerTask" init-method="initServer" depends-on="dataSource">
<property name="dataSource" ref="dataSource" />
</bean>
-</beans> \ No newline at end of file
+</beans>