001    package org.shiftone.jrat.util;
002    
003    
004    import org.shiftone.jrat.util.io.ResourceUtil;
005    import org.shiftone.jrat.util.log.Logger;
006    
007    import java.util.Properties;
008    
009    
010    public class VersionUtil {
011    
012        private static final Logger LOG = Logger.getLogger(VersionUtil.class);
013        private static VersionUtil versionUtil = null;
014        private String version;
015        private String buildOn;
016        private String builtBy;
017    
018        private VersionUtil() {
019    
020            try {
021                Properties properties = ResourceUtil.getResourceAsProperties("org/shiftone/jrat/version.properties");
022    
023                version = properties.getProperty("version");
024                buildOn = properties.getProperty("built_on");
025                builtBy = properties.getProperty("built_by");
026            }
027            catch (Exception e) {
028                version = buildOn = builtBy = "?";
029            }
030        }
031    
032    
033        private static synchronized VersionUtil getVersionUtil() {
034    
035            if (versionUtil == null) {
036                versionUtil = new VersionUtil();
037            }
038    
039            return versionUtil;
040        }
041    
042    
043        public static String getVersion() {
044            return getVersionUtil().version;
045        }
046    
047    
048        public static String getBuiltBy() {
049            return getVersionUtil().builtBy;
050        }
051    
052    
053        public static String getBuiltOn() {
054            return getVersionUtil().buildOn;
055        }
056    }