1
|
/**
|
2
|
* '$RCSfile$'
|
3
|
* Copyright: 2004 Regents of the University of California and the
|
4
|
* National Center for Ecological Analysis and Synthesis
|
5
|
*
|
6
|
* '$Author: cjones $'
|
7
|
* '$Date: 2011-06-07 09:53:46 -0700 (Tue, 07 Jun 2011) $'
|
8
|
* '$Revision: 6124 $'
|
9
|
*
|
10
|
* This program is free software; you can redistribute it and/or modify
|
11
|
* it under the terms of the GNU General Public License as published by
|
12
|
* the Free Software Foundation; either version 2 of the License, or
|
13
|
* (at your option) any later version.
|
14
|
*
|
15
|
* This program is distributed in the hope that it will be useful,
|
16
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
* GNU General Public License for more details.
|
19
|
*
|
20
|
* You should have received a copy of the GNU General Public License
|
21
|
* along with this program; if not, write to the Free Software
|
22
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
|
*/
|
24
|
package edu.ucsb.nceas.metacat;
|
25
|
|
26
|
import edu.ucsb.nceas.metacat.properties.PropertyService;
|
27
|
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
|
28
|
|
29
|
/**
|
30
|
* @author jones
|
31
|
*
|
32
|
* Version represents the current version information for this Metacat instance.
|
33
|
*/
|
34
|
public class MetacatVersion extends Version {
|
35
|
public MetacatVersion(String versionID) {
|
36
|
super(versionID);
|
37
|
}
|
38
|
|
39
|
/**
|
40
|
* Get the current version string for this metacat instance. It is currently
|
41
|
* stored in the metacat.properties file.
|
42
|
*
|
43
|
* @return a string indicating the version of Metacat running
|
44
|
*/
|
45
|
public static String getVersionID() throws PropertyNotFoundException {
|
46
|
String version = PropertyService.getProperty("application.metacatVersion");
|
47
|
return version;
|
48
|
}
|
49
|
|
50
|
/**
|
51
|
* Get the version number in an XML document.
|
52
|
*
|
53
|
* @return the version wrapped in an XML document
|
54
|
*/
|
55
|
public static String getVersionAsXml() throws PropertyNotFoundException {
|
56
|
StringBuffer sb = new StringBuffer();
|
57
|
sb.append("<?xml version=\"1.0\"?>");
|
58
|
sb.append("<version>");
|
59
|
sb.append(getVersionID());
|
60
|
sb.append("</version>");
|
61
|
return sb.toString();
|
62
|
}
|
63
|
}
|