Project

General

Profile

1
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: leinfelder $'
10
 *     '$Date: 2012-01-03 10:56:38 -0800 (Tue, 03 Jan 2012) $'
11
 * '$Revision: 6826 $'
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
public class Upgrade2_0_0 implements UpgradeUtilityInterface {
34

    
35
    public boolean upgrade() throws AdminException {
36
        boolean success = true;
37
        
38
        // empty replicated files
39
        UpgradeEmptyReplicatedDataFile emptyDataUpgrader = new UpgradeEmptyReplicatedDataFile();
40
        success = emptyDataUpgrader.upgrade();
41
        
42
        // node data datetime
43
        UpgradeNodeDataDatetime dateTimeUpgrade = new UpgradeNodeDataDatetime();
44
        success = success && dateTimeUpgrade.upgrade();
45
        
46
        // dataone system metadata generation
47
        
48
        
49
    	return success;
50
    }
51
    
52
    public static void main(String [] ags){
53

    
54
        try {
55
        	// set up the properties based on the test/deployed configuration of the workspace
56
        	SortedProperties testProperties = 
57
				new SortedProperties("test/test.properties");
58
			testProperties.load();
59
			String metacatContextDir = testProperties.getProperty("metacat.contextDir");
60
			PropertyService.getInstance(metacatContextDir + "/WEB-INF");
61
			// now run it
62
            Upgrade2_0_0 upgrader = new Upgrade2_0_0();
63
	        upgrader.upgrade();
64
	        
65
        } catch (Exception ex) {
66
            System.out.println("Exception:" + ex.getMessage());
67
            ex.printStackTrace();
68
        }
69
    }
70
}
(3-3/6)