1 18 19 22 package org.apache.jmeter.util; 23 24 import java.io.FileInputStream ; 25 import java.util.Properties ; 26 27 import org.apache.jorphan.logging.LoggingManager; 28 import org.apache.log.Logger; 29 30 34 public final class NameUpdater 35 { 36 private static Properties nameMap; 37 private static Logger log = LoggingManager.getLoggerForClass(); 38 39 static { 40 nameMap = new Properties (); 41 try 42 { 43 nameMap.load( 44 new FileInputStream ( 45 JMeterUtils.getJMeterHome() 46 + JMeterUtils.getPropDefault( 47 "upgrade_properties", 48 "/bin/upgrade.properties"))); 49 } 50 catch (Exception e) 51 { 52 log.error("Bad upgrade file",e); 53 } 54 } 55 56 public static String getCurrentName(String className) 57 { 58 if (nameMap.containsKey(className)) 59 { 60 String newName= nameMap.getProperty(className); 61 log.info("Upgrading class "+className+" to "+newName); 62 return newName; 63 } 64 return className; 65 } 66 67 public static String getCurrentName(String propertyName, String className) 68 { 69 String key= className+"/"+propertyName; 70 if (nameMap.containsKey(key)) 71 { 72 String newName= nameMap.getProperty(key); 73 log.info("Upgrading property "+propertyName+" to "+newName); 74 return newName; 75 } 76 return propertyName; 77 } 78 79 public static String getCurrentName(String value, String propertyName, String className) 80 { 81 String key= className+"."+propertyName+"/"+value; 82 if (nameMap.containsKey(key)) 83 { 84 String newValue= nameMap.getProperty(key); 85 log.info("Upgrading value "+value+" to "+newValue); 86 return newValue; 87 } 88 return value; 89 } 90 91 94 private NameUpdater() 95 { 96 } 97 } 98 | Popular Tags |