001 package railo; 002 003 import java.io.IOException; 004 005 import railo.loader.TP; 006 import railo.loader.util.Util; 007 008 /** 009 * returns th current built in version 010 */ 011 public class Version { 012 013 private static int version=-1; 014 private static long created=-1; 015 016 017 /** 018 * @return returns the current version 019 */ 020 public static int getIntVersion() { 021 init(); 022 return version; 023 } 024 025 /** 026 * return creattion time of this version 027 * @return creattion time 028 */ 029 public static long getCreateTime() { 030 init(); 031 return created; 032 } 033 034 035 private static void init() { 036 if(version!=-1) return; 037 String content="9000000:"+System.currentTimeMillis(); 038 try { 039 content= Util.getContentAsString( 040 new TP().getClass().getClassLoader().getResourceAsStream("railo/version"), 041 "UTF-8"); 042 043 044 } 045 catch (IOException e) {} 046 047 int index=content.indexOf(':'); 048 version=Integer.parseInt(content.substring(0,index)); 049 created=Long.parseLong(content.substring(index+1)); 050 051 } 052 }