1 |
6012
|
leinfelder
|
package edu.ucsb.nceas.metacat.admin.upgrade;
|
2 |
|
|
/**
|
3 |
|
|
* '$RCSfile$'
|
4 |
|
|
* Purpose: A Class for upgrading the database to version 1.5
|
5 |
|
|
* Copyright: 2000 Regents of the University of California and the
|
6 |
|
|
* National Center for Ecological Analysis and Synthesis
|
7 |
|
|
* Authors: Saurabh Garg
|
8 |
|
|
*
|
9 |
|
|
* '$Author$'
|
10 |
|
|
* '$Date$'
|
11 |
|
|
* '$Revision$'
|
12 |
|
|
*
|
13 |
|
|
* This program is free software; you can redistribute it and/or modify
|
14 |
|
|
* it under the terms of the GNU General Public License as published by
|
15 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
16 |
|
|
* (at your option) any later version.
|
17 |
|
|
*
|
18 |
|
|
* This program is distributed in the hope that it will be useful,
|
19 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
|
|
* GNU General Public License for more details.
|
22 |
|
|
*
|
23 |
|
|
* You should have received a copy of the GNU General Public License
|
24 |
|
|
* along with this program; if not, write to the Free Software
|
25 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
26 |
|
|
*/
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
import edu.ucsb.nceas.metacat.admin.AdminException;
|
30 |
|
|
import edu.ucsb.nceas.metacat.properties.PropertyService;
|
31 |
|
|
import edu.ucsb.nceas.utilities.SortedProperties;
|
32 |
|
|
|
33 |
6550
|
leinfelder
|
public class Upgrade2_0_0 implements UpgradeUtilityInterface {
|
34 |
6012
|
leinfelder
|
|
35 |
|
|
public boolean upgrade() throws AdminException {
|
36 |
6025
|
leinfelder
|
boolean success = true;
|
37 |
6097
|
leinfelder
|
|
38 |
6826
|
leinfelder
|
// empty replicated files
|
39 |
|
|
UpgradeEmptyReplicatedDataFile emptyDataUpgrader = new UpgradeEmptyReplicatedDataFile();
|
40 |
|
|
success = emptyDataUpgrader.upgrade();
|
41 |
|
|
|
42 |
6097
|
leinfelder
|
// node data datetime
|
43 |
|
|
UpgradeNodeDataDatetime dateTimeUpgrade = new UpgradeNodeDataDatetime();
|
44 |
6826
|
leinfelder
|
success = success && dateTimeUpgrade.upgrade();
|
45 |
6097
|
leinfelder
|
|
46 |
6933
|
jones
|
// Optionally upgrade GUIDs to use DOI syntax if configured
|
47 |
|
|
GenerateGlobalIdentifiers globalIDUpgrade = new GenerateGlobalIdentifiers();
|
48 |
|
|
success = success && globalIDUpgrade.upgrade();
|
49 |
|
|
|
50 |
6025
|
leinfelder
|
return success;
|
51 |
|
|
}
|
52 |
|
|
|
53 |
6012
|
leinfelder
|
public static void main(String [] ags){
|
54 |
|
|
|
55 |
|
|
try {
|
56 |
|
|
// set up the properties based on the test/deployed configuration of the workspace
|
57 |
|
|
SortedProperties testProperties =
|
58 |
|
|
new SortedProperties("test/test.properties");
|
59 |
|
|
testProperties.load();
|
60 |
|
|
String metacatContextDir = testProperties.getProperty("metacat.contextDir");
|
61 |
|
|
PropertyService.getInstance(metacatContextDir + "/WEB-INF");
|
62 |
|
|
// now run it
|
63 |
6550
|
leinfelder
|
Upgrade2_0_0 upgrader = new Upgrade2_0_0();
|
64 |
6025
|
leinfelder
|
upgrader.upgrade();
|
65 |
|
|
|
66 |
6012
|
leinfelder
|
} catch (Exception ex) {
|
67 |
|
|
System.out.println("Exception:" + ex.getMessage());
|
68 |
|
|
ex.printStackTrace();
|
69 |
|
|
}
|
70 |
|
|
}
|
71 |
|
|
}
|