Revision 4105
Added by daigle about 16 years ago
src/edu/ucsb/nceas/metacat/admin/DBAdmin.java | ||
---|---|---|
39 | 39 |
import java.io.InputStreamReader; |
40 | 40 |
|
41 | 41 |
import java.util.Date; |
42 |
import java.util.HashMap; |
|
42 | 43 |
import java.util.HashSet; |
44 |
import java.util.Map; |
|
43 | 45 |
import java.util.TreeSet; |
44 | 46 |
import java.util.Vector; |
45 | 47 |
|
... | ... | |
85 | 87 |
private static DBAdmin dbAdmin = null; |
86 | 88 |
private Logger logMetacat = Logger.getLogger(DBAdmin.class); |
87 | 89 |
private HashSet<String> sqlCommandSet = new HashSet<String>(); |
88 |
// private MetaCatVersion metacatVersion = null;
|
|
90 |
private Map<String, String> scriptSuffixMap = new HashMap<String, String>();
|
|
89 | 91 |
private static DBVersion databaseVersion = null; |
90 | 92 |
|
91 | 93 |
/** |
... | ... | |
104 | 106 |
// gets all the upgrade version objects |
105 | 107 |
try { |
106 | 108 |
versionSet = DatabaseUtil.getUpgradeVersions(); |
109 |
scriptSuffixMap = DatabaseUtil.getScriptSuffixes(); |
|
107 | 110 |
} catch (PropertyNotFoundException pnfe) { |
108 | 111 |
throw new AdminException("Could not retrieve database upgrade " |
109 | 112 |
+ "versions during instantiation" + pnfe.getMessage()); |
... | ... | |
657 | 660 |
MetaCatVersion metaCatVersion = null; |
658 | 661 |
|
659 | 662 |
// get the location of sql scripts |
660 |
String sqlSuffix = ".sql"; |
|
661 | 663 |
try { |
662 | 664 |
metaCatVersion = SystemUtil.getMetacatVersion(); |
663 | 665 |
sqlFileLocation = SystemUtil.getSQLDir(); |
... | ... | |
666 | 668 |
throw new AdminException("Could not get property while trying " |
667 | 669 |
+ "to retrieve database update scripts: " + pnfe.getMessage()); |
668 | 670 |
} |
669 |
// for postgres, we only want scripts that end in -postgres.sql |
|
670 |
if (databaseType.equals("PostgreSQL")) {
|
|
671 |
sqlSuffix = "-postgres.sql";
|
|
672 |
}
|
|
673 |
|
|
671 |
|
|
672 |
// Each type of db has it's own set of scripts. For instance, Oracle
|
|
673 |
// scripts end in -oracle.sql. Postges end in -postgres.sql, etc
|
|
674 |
String sqlSuffix = "-" + scriptSuffixMap.get(databaseType);
|
|
675 |
|
|
674 | 676 |
// if either of these is null, we don't want to do anything. Just |
675 | 677 |
// return an empty list. |
676 | 678 |
if (metaCatVersion == null || databaseVersion == null) { |
Also available in: Unified diff
use metacat.properties to determine script suffixes