From: Julio G. <ju...@us...> - 2005-03-11 18:38:51
|
Update of /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7533/smartfrog/src/org/smartfrog Modified Files: Version.java SFSystem.java SFParse.java Log Message: New Version class: reads version infromation from version.sf file. Can be reused in other packages. Index: Version.java =================================================================== RCS file: /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog/Version.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Version.java 11 Mar 2005 14:04:40 -0000 1.23 --- Version.java 11 Mar 2005 18:37:55 -0000 1.24 *************** *** 21,24 **** --- 21,30 ---- package org.smartfrog; + import org.smartfrog.sfcore.componentdescription.ComponentDescription; + import org.smartfrog.sfcore.componentdescription.ComponentDescriptionImpl; + import org.smartfrog.sfcore.logging.LogToFileImpl; + import org.smartfrog.sfcore.logging.LogSF; + import org.smartfrog.sfcore.logging.LogFactory; + /** * Version class provides version and copyright strings for SmartFrog System. *************** *** 26,44 **** public class Version { ! private final static String name= "SmartFrog"; ! private final static String majorRelease="3"; ! private final static String minorRelease="04"; ! private final static String build= "017"; // odd numbers are development versions ! private final static String status= "beta"; //alpha, beta, stable ! ! /** The version String for the SmartFrog system. */ ! public final static String versionString = ! name+" "+majorRelease+"."+minorRelease+"."+build+"_"+status; /** The copyright String for the SmartFrog system. */ ! public final static String copyright = "(C) Copyright 1998-2005 Hewlett-Packard Development Company, LP"; private Version(){ } --- 32,105 ---- public class Version { ! /** SmartFrog attribute name. Value = {@value} */ ! final static String ATR_NAME = "name"; ! /** SmartFrog attribute name. Value = {@value} */ ! final static String ATR_MAJOR_RELEASE = "majorRelease"; ! /** SmartFrog attribute name. Value = {@value} */ ! final static String ATR_MINOR_RELEASE = "minorRelease"; ! /** SmartFrog attribute name. Value = {@value} */ ! final static String ATR_BUILD = "build"; ! /** SmartFrog attribute name. Value = {@value} */ ! final static String ATR_STATUS = "status"; ! /** SmartFrog attribute name. Value = {@value} */ ! final static String COPYRIGHT = "copyright"; + // Dont' change this. MODIFY version.sf in same package!!!!!!!!!!!!!!!!!!! + private static String name= "SmartFrog"; + private static String majorRelease="3"; + private static String minorRelease="4"; + private static String build= "17"; // odd numbers are development versions + private static String status= ""; //alpha, beta, stable + // Dont' change this. MODIFY version.sf in same package!!!!!!!!!!!!!!!!!!! /** The copyright String for the SmartFrog system. */ ! private static String copyright = "(C) Copyright 1998-2005 HP Development Company, LP"; ! ! private static boolean initialized=false; private Version(){ + init(); + } + + private synchronized void init() { + if (initialized) return; + try { + //Check Class and read configuration...NOT including system.properties + ComponentDescription classComponentDescription = ComponentDescriptionImpl. + getClassComponentDescription(this, false, null); + + name = classComponentDescription.sfResolve(ATR_NAME, name , true); + majorRelease = classComponentDescription.sfResolve(ATR_MAJOR_RELEASE, majorRelease , false); + minorRelease = classComponentDescription.sfResolve(ATR_MINOR_RELEASE, minorRelease , false); + build = classComponentDescription.sfResolve(ATR_BUILD, build , false); + status = classComponentDescription.sfResolve(ATR_STATUS, status , false); + copyright = classComponentDescription.sfResolve(COPYRIGHT, copyright , false); + initialized=true; + } catch (Exception ex) { + if (sfGetProcessLog().isWarnEnabled()) + sfGetProcessLog().warn( + "Error during init of "+ this.getClass().toString()+"", + ex); + } + } + + public static String versionString(){ + //init(); + if (!initialized) new Version(); + return name+" "+majorRelease+"."+minorRelease+"."+build+"_"+status; + } + + public static String copyright(){ + //init(); + if (!initialized) new Version(); + return copyright; + } + /** + * To get the sfCore logger + * @return Logger implementing LogSF and Log + */ + private LogSF sfGetProcessLog() { + LogSF sflog = LogFactory.sfGetProcessLog(); + return sflog; } *************** *** 49,53 **** */ public static void main(String[] args) { ! System.out.print(versionString); } } --- 110,114 ---- */ public static void main(String[] args) { ! System.out.print(versionString()); } } Index: SFParse.java =================================================================== RCS file: /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog/SFParse.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SFParse.java 17 Aug 2004 13:05:49 -0000 1.9 --- SFParse.java 11 Mar 2005 18:38:10 -0000 1.10 *************** *** 309,314 **** */ private static void showVersionInfo() { ! Logger.log("\nParser - " +Version.versionString); ! Logger.log(Version.copyright); Logger.log(" "); } --- 309,314 ---- */ private static void showVersionInfo() { ! Logger.log("\nParser - " +Version.versionString()); ! Logger.log(Version.copyright()); Logger.log(" "); } Index: SFSystem.java =================================================================== RCS file: /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog/SFSystem.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** SFSystem.java 2 Mar 2005 17:38:03 -0000 1.50 --- SFSystem.java 11 Mar 2005 18:37:55 -0000 1.51 *************** *** 263,267 **** */ private static void showVersionInfo(){ ! sflog().out(Version.versionString+"\n"+Version.copyright); } --- 263,267 ---- */ private static void showVersionInfo(){ ! sflog().out(Version.versionString()+"\n"+Version.copyright()); } |