Info.java revision 1195
0N/A/*
0N/A * CDDL HEADER START
0N/A *
0N/A * The contents of this file are subject to the terms of the
407N/A * Common Development and Distribution License (the "License").
0N/A * You may not use this file except in compliance with the License.
0N/A *
0N/A * See LICENSE.txt included in this distribution for the specific
0N/A * language governing permissions and limitations under the License.
0N/A *
0N/A * When distributing Covered Code, include this CDDL HEADER in each
0N/A * file and include the License file at LICENSE.txt.
0N/A * If applicable, add the following below this CDDL HEADER, with the
0N/A * fields enclosed by brackets "[]" replaced with your own identifying
0N/A * information: Portions Copyright [yyyy] [name of copyright owner]
0N/A *
0N/A * CDDL HEADER END
0N/A */
1220N/A
0N/A/*
1297N/A * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
1356N/A */
0N/Apackage org.opensolaris.opengrok;
0N/A
0N/Aimport java.io.IOException;
1185N/Aimport java.io.InputStream;
1185N/Aimport java.util.Properties;
1185N/Aimport org.opensolaris.opengrok.util.IOUtils;
154N/A
1185N/A/**
1185N/A * Utility class to get information of the OpenGrok version.
154N/A *
1366N/A * @author Trond Norbye
1366N/A */
1376N/A@SuppressWarnings("PMD.AvoidThrowingRawExceptionTypes")
154N/Apublic final class Info {
154N/A private static final Properties properties = new Properties();
1124N/A
1330N/A private static final String VERSION;
1384N/A private static final String REVISION;
1185N/A
434N/A static {
1219N/A InputStream in = null;
1297N/A try {
1297N/A in = Info.class.getResourceAsStream("info.properties");
1185N/A if (in != null) {
1185N/A properties.load(in);
1185N/A }
1470N/A VERSION = properties.getProperty("version", "unknown");
259N/A REVISION = properties.getProperty("changeset", "unknown");
1124N/A } catch (IOException ioe) {
1124N/A throw new RuntimeException(ioe);
1195N/A } finally {
0N/A IOUtils.close(in);
0N/A }
1185N/A }
0N/A
456N/A /**
1327N/A * get major version
1185N/A * @return major version
1185N/A */
1185N/A public static String getVersion() {
1185N/A return VERSION;
92N/A }
1469N/A
1469N/A /**
1469N/A * get full version (product vMajor revMinor)
1469N/A * @return full version
1469N/A */
92N/A public static String getFullVersion() {
1469N/A return "OpenGrok v" + VERSION + " rev " + REVISION;
1469N/A }
1469N/A
1469N/A /**
1469N/A * get minor version
1469N/A * @return minor version
1469N/A */
1469N/A public static String getRevision() {
1469N/A return REVISION;
1469N/A }
1469N/A
1469N/A private Info() {
1469N/A }
1469N/A}
1469N/A