source: xssim/trunk/src/test/local/db/loader/PropertiesReader.java @ 104

Revision 104, 1.6 KB checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package test.local.db.loader;
2
3import java.io.FileInputStream;
4import java.io.FileNotFoundException;
5import java.io.IOException;
6import java.util.MissingResourceException;
7import java.util.PropertyResourceBundle;
8import java.util.ResourceBundle;
9
10import simulator.ConfigurationOptions;
11
12/**
13 *
14 * @author Marcin Krystek
15 *
16 */
17public class PropertiesReader extends StatsReader {
18
19        protected ResourceBundle resourceBoundle;
20        protected int cnt = 3;
21       
22        public PropertiesReader(String fileName) throws FileNotFoundException, IOException{
23                super(null);
24               
25                this.resourceBoundle = new PropertyResourceBundle(new FileInputStream(fileName));       
26        }
27       
28        protected PropertiesReader(StatsParser p) {
29                super(p);
30        }
31       
32        public String getGridSchedulingPlugin(){
33                return getValue(
34                                ConfigurationOptions.GRID_SCHEDULING_PLUGIN_NAME_MODIFIER);
35        }
36
37        public String getLocalSchedulingPlugin(){
38                return getValue(
39                                ConfigurationOptions.LOCAL_ALLOC_POLICY_PLUGIN_NAME_MODIFIER);
40        }
41       
42        public String getTimeEstimationPlugin(){
43                return getValue(
44                                ConfigurationOptions.EXEC_TIME_ESTIMATION_PLUGIN_NAME_MODIFIER);
45               
46        }
47       
48        public String getUserDN(){
49                return getValue(
50                                ConfigurationOptions.USER_DN);
51        }
52       
53        public String getExperimentId(){
54                return getValue(
55                                ConfigurationOptions.EXPERIMENT_ID);
56        }
57       
58        public boolean next(){
59                /*
60                 * This simulates one read for skipping file header
61                 * and one read for reading file content
62                 */
63                cnt--;
64                return (cnt > 0);
65        }
66
67        protected String getValue(String key){
68                try {
69                        return this.resourceBoundle.getString(key);
70                } catch (MissingResourceException e){
71                        return null;
72                }
73        }
74}
Note: See TracBrowser for help on using the repository browser.