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-13 13:05:32 -0800 (Fri, 13 Jan 2012) $'
11
 * '$Revision: 6905 $'
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
        GenerateSystemMetadata systemMetadataUpgrade = new GenerateSystemMetadata();
48
        systemMetadataUpgrade.upgrade();
49
        
50
    	return success;
51
    }
52
    
53
    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
            Upgrade2_0_0 upgrader = new Upgrade2_0_0();
64
	        upgrader.upgrade();
65
	        
66
        } catch (Exception ex) {
67
            System.out.println("Exception:" + ex.getMessage());
68
            ex.printStackTrace();
69
        }
70
    }
71
}
(3-3/6)