package test.local.db.loader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.MissingResourceException; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; import simulator.ConfigurationOptions; /** * * @author Marcin Krystek * */ public class PropertiesReader extends StatsReader { protected ResourceBundle resourceBoundle; protected int cnt = 3; public PropertiesReader(String fileName) throws FileNotFoundException, IOException{ super(null); this.resourceBoundle = new PropertyResourceBundle(new FileInputStream(fileName)); } protected PropertiesReader(StatsParser p) { super(p); } public String getGridSchedulingPlugin(){ return getValue( ConfigurationOptions.GRID_SCHEDULING_PLUGIN_NAME_MODIFIER); } public String getLocalSchedulingPlugin(){ return getValue( ConfigurationOptions.LOCAL_ALLOC_POLICY_PLUGIN_NAME_MODIFIER); } public String getTimeEstimationPlugin(){ return getValue( ConfigurationOptions.EXEC_TIME_ESTIMATION_PLUGIN_NAME_MODIFIER); } public String getUserDN(){ return getValue( ConfigurationOptions.USER_DN); } public String getExperimentId(){ return getValue( ConfigurationOptions.EXPERIMENT_ID); } public boolean next(){ /* * This simulates one read for skipping file header * and one read for reading file content */ cnt--; return (cnt > 0); } protected String getValue(String key){ try { return this.resourceBoundle.getString(key); } catch (MissingResourceException e){ return null; } } }