summaryrefslogtreecommitdiff
path: root/java/common
diff options
context:
space:
mode:
authorBhupendra Bhusman Bhardwaj <bhupendrab@apache.org>2006-12-21 16:47:01 +0000
committerBhupendra Bhusman Bhardwaj <bhupendrab@apache.org>2006-12-21 16:47:01 +0000
commit2032535eb650a7fddeef04d21b750dc026f43eb8 (patch)
tree6f6d96bef5cb538cf389c16ee5b73f6e0649c64b /java/common
parent73e1fc2b9f4cf126b8143714d32c964c76d9161d (diff)
downloadqpid-python-2032535eb650a7fddeef04d21b750dc026f43eb8.tar.gz
QPID-227
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@489403 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common')
-rw-r--r--java/common/src/main/java/org/apache/qpid/common/QpidProperties.java50
1 files changed, 44 insertions, 6 deletions
diff --git a/java/common/src/main/java/org/apache/qpid/common/QpidProperties.java b/java/common/src/main/java/org/apache/qpid/common/QpidProperties.java
index 3a96821e93..4b281e9f8d 100644
--- a/java/common/src/main/java/org/apache/qpid/common/QpidProperties.java
+++ b/java/common/src/main/java/org/apache/qpid/common/QpidProperties.java
@@ -20,27 +20,65 @@
*/
package org.apache.qpid.common;
+import java.util.Properties;
+import java.io.IOException;
+
public class QpidProperties
{
+ public static final String VERSION_RESOURCE = "version.properties";
+
+ public static final String PRODUCT_NAME_PROPERTY = "qpid.name";
+ public static final String RELEASE_VERSION_PROPERTY = "qpid.version";
+ public static final String BUILD_VERSION_PROPERTY = "qpid.svnversion";
+
+ private static final String DEFAULT = "unknown";
+ private static String productName = DEFAULT;
+ private static String releaseVersion = DEFAULT;
+ private static String buildVersion = DEFAULT;
+
+ /** Loads the values from the version properties file. */
static
{
- //load values from property file.
+ Properties props = new Properties();
+
+ try
+ {
+ props.load(QpidProperties.class.getClassLoader().getResourceAsStream(VERSION_RESOURCE));
+
+ productName = props.getProperty(PRODUCT_NAME_PROPERTY);
+ releaseVersion = props.getProperty(RELEASE_VERSION_PROPERTY);
+ buildVersion = props.getProperty(BUILD_VERSION_PROPERTY);
+ }
+ catch (IOException e)
+ {
+ // Log a warning about this and leave the values initialized to unknown.
+ System.err.println("Could not load version.properties resource.");
+ }
}
public static String getProductName()
{
- return "Qpid";
+ return productName;
}
- public static String getReleaseVerision()
+ public static String getReleaseVersion()
{
- return "1.0";
+ return releaseVersion;
}
+ public static String getBuildVersion()
+ {
+ return buildVersion;
+ }
+
+ public static String getVersionString()
+ {
+ return getProductName() + " - " + getReleaseVersion() + " build: " + getBuildVersion();
+ }
- public static String getBuildVerision()
+ public static void main(String[] args)
{
- return "1";
+ System.out.println(getVersionString());
}
}