Commit 4eb05b84 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Removed db scripts from .jar file. JM-790

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@4850 b35dd754-fafc-0310-a699-88a17e54d16e
parent a8e8166d
......@@ -313,8 +313,6 @@
excludes="org/jivesoftware/wildfire/starter/ServerStarter*.class,org/jivesoftware/wildfire/launcher/*.class"/>
<fileset dir="${src.i18n.dir}" includes="*.properties"/>
<fileset dir="${target.i18n.dir}" includes="*.properties"/>
<fileset dir="${src.dir}" includes="database/*.sql"/>
<fileset dir="${src.dir}" includes="database/upgrade/**/*.sql"/>
<fileset dir="${resources.dir}/jar" includes="**"/>
<zipgroupfileset dir="${lib.merge.dir}" includes="*.jar"/>
<manifest>
......
......@@ -10,6 +10,7 @@
package org.jivesoftware.database;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.XMPPServer;
......@@ -17,10 +18,7 @@ import org.jivesoftware.wildfire.container.Plugin;
import org.jivesoftware.wildfire.container.PluginClassLoader;
import org.jivesoftware.wildfire.container.PluginManager;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.*;
import java.sql.*;
import java.util.Arrays;
......@@ -69,7 +67,13 @@ public class SchemaManager {
return checkSchema(con, "wildfire", DATABASE_VERSION,
new ResourceLoader() {
public InputStream loadResource(String resourceName) {
return SchemaManager.class.getResourceAsStream("/database/" + resourceName);
File file = new File(JiveGlobals.getHomeDirectory() + File.separator +
"resources" + File.separator + "database", resourceName);
try {
return new FileInputStream(file);
} catch (FileNotFoundException e) {
return null;
}
}
});
}
......@@ -233,12 +237,17 @@ public class SchemaManager {
}
// Run all upgrade scripts until we're up to the latest schema.
for (int i=currentVersion+1; i <= DATABASE_VERSION; i++) {
for (int i = currentVersion + 1; i <= DATABASE_VERSION; i++) {
// Resource will be like "/database/upgrade/6/wildfire_hsqldb.sql"
String resourceName = "upgrade/" + i + "/" + schemaKey + "_" +
DbConnectionManager.getDatabaseType() + ".sql";
InputStream resource = resourceLoader.loadResource(resourceName);
if (resource == null) {
InputStream resource;
String path = JiveGlobals.getHomeDirectory() + File.separator + "resources" +
File.separator + "database" + File.separator + "upgrade" + File.separator +
i;
String filename = schemaKey + "_" + DbConnectionManager.getDatabaseType() + ".sql";
File file = new File(path, filename);
try {
resource = new FileInputStream(file);
} catch (FileNotFoundException e) {
// If the resource is null, the specific upgrade number is not available.
continue;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment