Commit d0250b0a authored by Matt Tucker's avatar Matt Tucker Committed by matt

Fixed plugin database upgrades.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5311 b35dd754-fafc-0310-a699-88a17e54d16e
parent 3bc19c83
......@@ -15,7 +15,6 @@ import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.container.Plugin;
import org.jivesoftware.wildfire.container.PluginClassLoader;
import org.jivesoftware.wildfire.container.PluginManager;
import java.io.*;
......@@ -71,7 +70,8 @@ public class SchemaManager {
"resources" + File.separator + "database", resourceName);
try {
return new FileInputStream(file);
} catch (FileNotFoundException e) {
}
catch (FileNotFoundException e) {
return null;
}
}
......@@ -108,9 +108,14 @@ public class SchemaManager {
con = DbConnectionManager.getConnection();
return checkSchema(con, schemaKey, schemaVersion, new ResourceLoader() {
public InputStream loadResource(String resourceName) {
PluginClassLoader pluginClassLoader = pluginManager.getPluginClassloader(plugin);
ClassLoader classLoader = pluginClassLoader.getClassLoader();
return classLoader.getResourceAsStream(resourceName);
File file = new File(pluginManager.getPluginDirectory(plugin) +
File.separator + "database", resourceName);
try {
return new FileInputStream(file);
}
catch (FileNotFoundException e) {
return null;
}
}
});
}
......@@ -234,7 +239,7 @@ public class SchemaManager {
// Run all upgrade scripts until we're up to the latest schema.
for (int i = currentVersion + 1; i <= requiredVersion; i++) {
InputStream resource = getUpgradeResource(resourceLoader, i, schemaKey);
if(resource == null) {
if (resource == null) {
continue;
}
try {
......@@ -278,7 +283,7 @@ public class SchemaManager {
}
}
else {
String resourceName = "database/upgrade/" + upgradeVersion + "/" + schemaKey + "_" +
String resourceName = "upgrade/" + upgradeVersion + "/" + schemaKey + "_" +
DbConnectionManager.getDatabaseType() + ".sql";
resource = resourceLoader.loadResource(resourceName);
}
......
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