[104] | 1 | package simulator; |
---|
| 2 | |
---|
| 3 | import java.io.File; |
---|
| 4 | import java.io.FileInputStream; |
---|
| 5 | import java.io.FileNotFoundException; |
---|
| 6 | import java.io.IOException; |
---|
| 7 | import java.util.MissingResourceException; |
---|
| 8 | import java.util.PropertyResourceBundle; |
---|
| 9 | import java.util.ResourceBundle; |
---|
| 10 | import java.util.logging.FileHandler; |
---|
| 11 | |
---|
| 12 | /** |
---|
| 13 | * This aim of this class is to store all the configuration options passed to |
---|
| 14 | * the program to steer its functionality. <br> |
---|
| 15 | * As a general contract of this class, all fields, that store a path name to a |
---|
| 16 | * folder will always be terminated with {@link File#separator} string. |
---|
| 17 | * |
---|
| 18 | * @author Stanislaw Szczepanowski |
---|
| 19 | * |
---|
| 20 | */ |
---|
| 21 | public class ConfigurationOptions { |
---|
| 22 | |
---|
| 23 | /* |
---|
| 24 | * ============================================================================================= |
---|
| 25 | * Constants describing the contents of the resource bundle file |
---|
| 26 | * ============================================================================================= |
---|
| 27 | */ |
---|
| 28 | /** Grid scheduler's plugin path */ |
---|
| 29 | public static final String GRID_SCHEDULING_PLUGIN_NAME_MODIFIER = "gridschedulingpluginname"; |
---|
| 30 | /** Forecast finish time plugin path */ |
---|
| 31 | public static final String EXEC_TIME_ESTIMATION_PLUGIN_NAME_MODIFIER = "exectimeestimationpluginname"; |
---|
| 32 | /** Local allocation policy plugin path */ |
---|
| 33 | public static final String LOCAL_ALLOC_POLICY_PLUGIN_NAME_MODIFIER = "localallocpolicypluginname"; |
---|
| 34 | /** The path to the resource description file */ |
---|
| 35 | public static final String RESOURCE_DESC_MODIFIER = "resdesc"; |
---|
| 36 | |
---|
| 37 | /** The create scenario mode of the simulation */ |
---|
| 38 | public static final String CREATE_SCENARIO_MODIFIER = "createscenario"; |
---|
| 39 | /** The path to the file with the tasks description */ |
---|
| 40 | public static final String CREATE_SCENARIO_TASK_DESC = CREATE_SCENARIO_MODIFIER |
---|
| 41 | + ".tasksdesc"; |
---|
| 42 | /** The path to the output folder for generated tasks */ |
---|
| 43 | public static final String CREATE_SCENARIO_OUTPUT_FOLDER = CREATE_SCENARIO_MODIFIER |
---|
| 44 | + ".outputfolder"; |
---|
| 45 | /** The name of the workload file */ |
---|
| 46 | public static final String CREATE_SCENARIO_WORKLOAD_FILE = CREATE_SCENARIO_MODIFIER |
---|
| 47 | + ".workloadfilename"; |
---|
| 48 | /** |
---|
| 49 | * Shall the files in the output directory be overwritten, if the folder is |
---|
| 50 | * not empty |
---|
| 51 | */ |
---|
| 52 | public static final String CREATE_SCENARIO_OVERWRITE_FILES_MODIFIER = CREATE_SCENARIO_MODIFIER |
---|
| 53 | + ".overwrite_files"; |
---|
| 54 | |
---|
| 55 | /** The read scenario mode of the simulation */ |
---|
| 56 | public static final String READ_SCENARIO_MODIFIER = "readscenario"; |
---|
| 57 | /** The input folder with generated tasks */ |
---|
| 58 | public static final String READ_SCENARIO_INPUT_FOLDER = READ_SCENARIO_MODIFIER |
---|
| 59 | + ".inputfolder"; |
---|
| 60 | public static final String READ_SCENARIO_INPUT_TAR = READ_SCENARIO_MODIFIER+ ".tar"; |
---|
| 61 | |
---|
| 62 | /** The name of the workload file */ |
---|
| 63 | public static final String READ_SCENARIO_WORKLOAD_FILE = READ_SCENARIO_MODIFIER |
---|
| 64 | + ".workloadfilename"; |
---|
| 65 | |
---|
| 66 | /** Shall a detailed history be printed */ |
---|
| 67 | public static final String PRINT_HISTORY_MODIFIER = "printhistory"; |
---|
| 68 | |
---|
| 69 | /** The default name of a workload file */ |
---|
| 70 | public static final String DEFAULT_WORKLOAD_FILE_NAME = "workload.swf"; |
---|
| 71 | |
---|
| 72 | public static final String CREATE_XML_SUPPLEMENT_FILES = "createXMLSupplement"; |
---|
| 73 | |
---|
| 74 | public static final String PROVIDER_LIST_FILE = "in/provider.list"; |
---|
| 75 | |
---|
| 76 | /** Network topology file path */ |
---|
| 77 | public static final String NETWORK_TOPOLOGY_FILE_MODIFIER = "networktopologyfilename"; |
---|
| 78 | |
---|
| 79 | public static final String CREATEDIAGRAMS = "creatediagrams"; |
---|
| 80 | public static final String CREATEDIAGRAMS_PROCESSORS = CREATEDIAGRAMS +".processors"; |
---|
| 81 | public static final String CREATEDIAGRAMS_RESERVATIONS = CREATEDIAGRAMS + ".reservations"; |
---|
| 82 | public static final String CREATEDIAGRAMS_RESOURCES = CREATEDIAGRAMS + ".resources"; |
---|
| 83 | public static final String CREATEDIAGRAMS_ENERGYUSAGE = CREATEDIAGRAMS + ".energyusage"; |
---|
| 84 | public static final String CREATEDIAGRAMS_RESOURCES_SCALE = CREATEDIAGRAMS_RESOURCES + ".scale"; |
---|
| 85 | public static final String CREATEDIAGRAMS_TASKS = CREATEDIAGRAMS + ".tasks"; |
---|
| 86 | public static final String CREATEDIAGRAMS_TASKSWAITINGTIME = CREATEDIAGRAMS + ".taskswaitingtime"; |
---|
| 87 | |
---|
| 88 | public static final String CREATESTATISTICS = "createstatistics"; |
---|
| 89 | public static final String ACCUMULATED_RESOURCES_STATISTICS = CREATESTATISTICS + ".accumulatedresources"; |
---|
| 90 | public static final String EXTENDED_TASKS_STATISTICS = CREATESTATISTICS + ".extendedtasks"; |
---|
| 91 | public static final String GRIDLET_HISTORY_STATISTICS = CREATESTATISTICS + ".gridlethistory"; |
---|
| 92 | public static final String JOBS_STATISTICS = CREATESTATISTICS + ".jobs"; |
---|
| 93 | public static final String SIMULATION_STATISTICS = CREATESTATISTICS + ".simulation"; |
---|
| 94 | public static final String FORMAT_STATISTICS_OUTPUT = CREATESTATISTICS + ".formatoutput"; |
---|
| 95 | |
---|
| 96 | /** |
---|
| 97 | * The main output folders base name |
---|
| 98 | */ |
---|
| 99 | public static final String STATS_OUTPUT_SUBFOLDER_NAME = "stats.outputfolder"; |
---|
| 100 | |
---|
| 101 | public static final String USER_DN = "user.dn"; |
---|
| 102 | public static final String EXPERIMENT_ID = "experiment.id"; |
---|
| 103 | |
---|
| 104 | public static final String NUMBER_OF_SIMULATIONS = "numberofsimulations"; |
---|
| 105 | |
---|
| 106 | /** |
---|
| 107 | * Suffix for create scenario output folder |
---|
| 108 | */ |
---|
| 109 | public String statsOutputSubfolderNameCreate = null; |
---|
| 110 | |
---|
| 111 | /** |
---|
| 112 | * Suffix for read scenario output folder |
---|
| 113 | */ |
---|
| 114 | public String statsOutputSubfolderNameRerad = null; |
---|
| 115 | |
---|
| 116 | /* =============================================================================================== */ |
---|
| 117 | |
---|
| 118 | public String providerListFile = null; |
---|
| 119 | |
---|
| 120 | /** |
---|
| 121 | * the full grid scheduling plugin name with package prefix, e.g. |
---|
| 122 | * simulator.plugin.gridscheduling.raPlugin.RAPlugin (the plugin is loaded |
---|
| 123 | * using {@link Class#forName(java.lang.String)} and |
---|
| 124 | * {@link Class#newInstance()} methods) |
---|
| 125 | */ |
---|
| 126 | public String gridSchedulingPluginName = null; |
---|
| 127 | |
---|
| 128 | /** |
---|
| 129 | * the full forecast finish time plugin name with package prefix, e.g. |
---|
| 130 | * simulator.plugin.gridscheduling.raPlugin.RAPlugin (the plugin is loaded |
---|
| 131 | * using {@link Class#forName(java.lang.String)} and |
---|
| 132 | * {@link Class#newInstance()} methods) |
---|
| 133 | */ |
---|
| 134 | public String exectimeestimationplugin = null; |
---|
| 135 | |
---|
| 136 | /** |
---|
| 137 | * the full local allocation policy plugin name with package prefix, e.g. |
---|
| 138 | * simulator.plugin.gridscheduling.raPlugin.RAPlugin (the plugin is loaded |
---|
| 139 | * using {@link Class#forName(java.lang.String)} and |
---|
| 140 | * {@link Class#newInstance()} methods) |
---|
| 141 | */ |
---|
| 142 | public String localAllocPolicyPluginName = null; |
---|
| 143 | |
---|
| 144 | /** |
---|
| 145 | * the xml file name with resource description (according to the |
---|
| 146 | * HostParamSchema.xsd), e.g. simulator/schemas/ResourceDescription.xml |
---|
| 147 | */ |
---|
| 148 | public String resdescFileName = null; |
---|
| 149 | |
---|
| 150 | /** |
---|
| 151 | * a xml file name (according to the simulator.schemas.WorkloadSchema.xsd) |
---|
| 152 | * with the description of jobs and tasks to be generated |
---|
| 153 | */ |
---|
| 154 | public String workloadDescFileName = null; |
---|
| 155 | |
---|
| 156 | /** |
---|
| 157 | * the path to the folder, to which the generated xml job descriptions are |
---|
| 158 | * to be stored |
---|
| 159 | */ |
---|
| 160 | public String outputFolder = null; |
---|
| 161 | |
---|
| 162 | /** |
---|
| 163 | * the name of the .swf simulator.workload file into which the |
---|
| 164 | * simulator.workload is to be written (it will be stored in the |
---|
| 165 | * outputFolder folder) |
---|
| 166 | */ |
---|
| 167 | public String outputWorkloadFileName = DEFAULT_WORKLOAD_FILE_NAME; |
---|
| 168 | |
---|
| 169 | /** |
---|
| 170 | * the path to the folder where previously generated xml jobs descriptions |
---|
| 171 | * are stored |
---|
| 172 | */ |
---|
| 173 | public String inputFolder = null; |
---|
| 174 | |
---|
| 175 | public String inputTar = null; |
---|
| 176 | |
---|
| 177 | /** |
---|
| 178 | * the name of the .swf simulator.workload file in the inputFolder folder |
---|
| 179 | */ |
---|
| 180 | public String inputWorkloadFileName = DEFAULT_WORKLOAD_FILE_NAME; |
---|
| 181 | |
---|
| 182 | /** |
---|
| 183 | * a txt file name with topology description |
---|
| 184 | */ |
---|
| 185 | public String networkTopologyFileName = null; |
---|
| 186 | |
---|
| 187 | /** |
---|
| 188 | * Shows the mode of the simulator: true if it is the create scenario, false |
---|
| 189 | * if it is the read scenario mode |
---|
| 190 | */ |
---|
| 191 | public boolean createScenario = false; |
---|
| 192 | |
---|
| 193 | public boolean createXMLSupplement = false; |
---|
| 194 | |
---|
| 195 | /** |
---|
| 196 | * true if the outputFolder is not empty and shall be overwritten, false |
---|
| 197 | * otherwise |
---|
| 198 | */ |
---|
| 199 | public boolean overwriteFiles = false; |
---|
| 200 | |
---|
| 201 | /** |
---|
| 202 | * true if the history files are to be generated (makes the simulation |
---|
| 203 | * slower) |
---|
| 204 | */ |
---|
| 205 | public boolean printHistory = false; |
---|
| 206 | |
---|
| 207 | /** |
---|
| 208 | * The number of simulation runs that is to be performed. Default value is <code>1</code>. |
---|
| 209 | */ |
---|
| 210 | public int numberOfSimulations = 1; //default value |
---|
| 211 | |
---|
| 212 | public boolean creatediagrams_processors = true; |
---|
| 213 | public boolean creatediagrams_reservations = true; |
---|
| 214 | public boolean creatediagrams_resources = true; |
---|
| 215 | public boolean creatediagrams_energyusage = true; |
---|
| 216 | public boolean creatediagrams_tasks = true; |
---|
| 217 | public boolean creatediagrams_taskswaitingtime = true; |
---|
| 218 | public double creatediagrams_resources_scale = 1; |
---|
| 219 | |
---|
| 220 | public boolean createaccumulatedresourcesstatistics = true; |
---|
| 221 | public boolean createextendedtasksstatistics = true; |
---|
| 222 | public boolean creategridlethistorystatistics = true; |
---|
| 223 | public boolean createjobsstatistics = true; |
---|
| 224 | public boolean createsimulationstatistics = true; |
---|
| 225 | public boolean formatstatisticsoutput = false; |
---|
| 226 | |
---|
| 227 | public static final String ENV_DESC_MODIFIER = "envdesc"; |
---|
| 228 | public String envDescFileName = null; |
---|
| 229 | /** |
---|
| 230 | * An empty constructor. |
---|
| 231 | */ |
---|
| 232 | protected ConfigurationOptions() { |
---|
| 233 | } |
---|
| 234 | |
---|
| 235 | /** |
---|
| 236 | * A static method used to read a resource bundle file and set all the |
---|
| 237 | * fields in this class according to the contents of the file |
---|
| 238 | * |
---|
| 239 | * @param resBundleFileName |
---|
| 240 | * the path to the resource bundle file that stores the |
---|
| 241 | * configuration |
---|
| 242 | * @return a ConfigurationOptions object with information set according to |
---|
| 243 | * the properties file, <code>null</code> if any exception occurs |
---|
| 244 | */ |
---|
| 245 | public static ConfigurationOptions getConfiguration(String resBundleFileName) { |
---|
| 246 | |
---|
| 247 | ConfigurationOptions co = new ConfigurationOptions(); |
---|
| 248 | File resBundleFile = new File(resBundleFileName); |
---|
| 249 | ResourceBundle bundle = null; |
---|
| 250 | try { |
---|
| 251 | bundle = new PropertyResourceBundle(new FileInputStream(resBundleFile)); |
---|
| 252 | } catch (FileNotFoundException e) { |
---|
| 253 | e.printStackTrace(); |
---|
| 254 | return null; |
---|
| 255 | } catch (IOException e) { |
---|
| 256 | e.printStackTrace(); |
---|
| 257 | return null; |
---|
| 258 | } |
---|
| 259 | |
---|
| 260 | try { |
---|
| 261 | co.gridSchedulingPluginName = bundle |
---|
| 262 | .getString(GRID_SCHEDULING_PLUGIN_NAME_MODIFIER); |
---|
| 263 | } catch(MissingResourceException e){ |
---|
| 264 | co.gridSchedulingPluginName = null; |
---|
| 265 | } |
---|
| 266 | |
---|
| 267 | try { |
---|
| 268 | co.exectimeestimationplugin = bundle |
---|
| 269 | .getString(EXEC_TIME_ESTIMATION_PLUGIN_NAME_MODIFIER); |
---|
| 270 | } catch(MissingResourceException e){ |
---|
| 271 | co.exectimeestimationplugin = null; |
---|
| 272 | } |
---|
| 273 | |
---|
| 274 | try { |
---|
| 275 | co.localAllocPolicyPluginName = bundle |
---|
| 276 | .getString(LOCAL_ALLOC_POLICY_PLUGIN_NAME_MODIFIER); |
---|
| 277 | } catch(MissingResourceException e){ |
---|
| 278 | co.localAllocPolicyPluginName = null; |
---|
| 279 | } |
---|
| 280 | |
---|
| 281 | |
---|
| 282 | co.resdescFileName = bundle.getString(RESOURCE_DESC_MODIFIER); |
---|
| 283 | |
---|
| 284 | try { |
---|
| 285 | co.envDescFileName = bundle.getString(ENV_DESC_MODIFIER); |
---|
| 286 | } catch(MissingResourceException e){ |
---|
| 287 | co.envDescFileName = null; |
---|
| 288 | } |
---|
| 289 | |
---|
| 290 | try { |
---|
| 291 | co.workloadDescFileName = bundle.getString(CREATE_SCENARIO_TASK_DESC); |
---|
| 292 | co.outputFolder = getSeparatorTerminatedPath(bundle |
---|
| 293 | .getString(CREATE_SCENARIO_OUTPUT_FOLDER)); |
---|
| 294 | File f = new File(co.outputFolder); |
---|
| 295 | String parent = f.getParent(); |
---|
| 296 | // output folder will have the same parent as the task description |
---|
| 297 | // file |
---|
| 298 | if (parent == null) { |
---|
| 299 | f = new File(co.workloadDescFileName); |
---|
| 300 | parent = f.getParent(); |
---|
| 301 | co.outputFolder = new File(parent, co.outputFolder) |
---|
| 302 | .getAbsolutePath(); |
---|
| 303 | co.outputFolder = getSeparatorTerminatedPath(co.outputFolder); |
---|
| 304 | } |
---|
| 305 | co.outputWorkloadFileName = bundle |
---|
| 306 | .getString(CREATE_SCENARIO_WORKLOAD_FILE); |
---|
| 307 | co.overwriteFiles = Boolean.valueOf( |
---|
| 308 | bundle.getString(CREATE_SCENARIO_OVERWRITE_FILES_MODIFIER)) |
---|
| 309 | .booleanValue(); |
---|
| 310 | co.createScenario = true; // success |
---|
| 311 | |
---|
| 312 | } catch (MissingResourceException e) { |
---|
| 313 | co.createScenario = false; // do not create scenario |
---|
| 314 | } |
---|
| 315 | |
---|
| 316 | |
---|
| 317 | try { |
---|
| 318 | co.networkTopologyFileName = bundle |
---|
| 319 | .getString(NETWORK_TOPOLOGY_FILE_MODIFIER); |
---|
| 320 | } catch(MissingResourceException e){ |
---|
| 321 | co.networkTopologyFileName = null; |
---|
| 322 | } |
---|
| 323 | |
---|
| 324 | if (co.createScenario == false) { |
---|
| 325 | // read scenario |
---|
| 326 | try { |
---|
| 327 | co.inputFolder = getSeparatorTerminatedPath(bundle |
---|
| 328 | .getString(READ_SCENARIO_INPUT_FOLDER)); |
---|
| 329 | } catch (MissingResourceException e) { |
---|
| 330 | co.inputFolder = null; |
---|
| 331 | } |
---|
| 332 | |
---|
| 333 | try { |
---|
| 334 | co.inputTar = getSeparatorTerminatedPath(bundle |
---|
| 335 | .getString(READ_SCENARIO_INPUT_TAR)); |
---|
| 336 | } catch (MissingResourceException e) { |
---|
| 337 | co.inputTar = null; |
---|
| 338 | } |
---|
| 339 | |
---|
| 340 | try { |
---|
| 341 | co.inputWorkloadFileName = bundle |
---|
| 342 | .getString(READ_SCENARIO_WORKLOAD_FILE); |
---|
| 343 | } catch (MissingResourceException e){ |
---|
| 344 | co.inputWorkloadFileName = null; |
---|
| 345 | } |
---|
| 346 | } |
---|
| 347 | |
---|
| 348 | try { |
---|
| 349 | |
---|
| 350 | if(Boolean.parseBoolean( |
---|
| 351 | bundle.getString(CREATE_XML_SUPPLEMENT_FILES))) |
---|
| 352 | co.createXMLSupplement = true; |
---|
| 353 | else |
---|
| 354 | co.createXMLSupplement = false; |
---|
| 355 | |
---|
| 356 | } catch (MissingResourceException e){ |
---|
| 357 | co.createXMLSupplement = false; |
---|
| 358 | } |
---|
| 359 | |
---|
| 360 | try { |
---|
| 361 | co.printHistory = Boolean.valueOf( |
---|
| 362 | bundle.getString(PRINT_HISTORY_MODIFIER)).booleanValue(); |
---|
| 363 | } catch(MissingResourceException e){ |
---|
| 364 | co.printHistory = false; |
---|
| 365 | } |
---|
| 366 | |
---|
| 367 | // create diagrams |
---|
| 368 | |
---|
| 369 | boolean createDiagrams = true; |
---|
| 370 | try { |
---|
| 371 | createDiagrams = Boolean.valueOf( |
---|
| 372 | bundle.getString(CREATEDIAGRAMS)).booleanValue(); |
---|
| 373 | } catch(MissingResourceException e){ |
---|
| 374 | createDiagrams = true; |
---|
| 375 | } |
---|
| 376 | try { |
---|
| 377 | co.creatediagrams_processors = Boolean.valueOf( |
---|
| 378 | bundle.getString(CREATEDIAGRAMS_PROCESSORS)).booleanValue() && createDiagrams; |
---|
| 379 | } catch(MissingResourceException e){ |
---|
| 380 | co.creatediagrams_processors = createDiagrams; |
---|
| 381 | } |
---|
| 382 | try { |
---|
| 383 | co.creatediagrams_reservations = Boolean.valueOf( |
---|
| 384 | bundle.getString(CREATEDIAGRAMS_RESERVATIONS)).booleanValue() && createDiagrams; |
---|
| 385 | } catch(MissingResourceException e){ |
---|
| 386 | co.creatediagrams_reservations = createDiagrams; |
---|
| 387 | } |
---|
| 388 | try { |
---|
| 389 | co.creatediagrams_resources = Boolean.valueOf( |
---|
| 390 | bundle.getString(CREATEDIAGRAMS_RESOURCES)).booleanValue() && createDiagrams; |
---|
| 391 | } catch(MissingResourceException e){ |
---|
| 392 | co.creatediagrams_resources = createDiagrams; |
---|
| 393 | } |
---|
| 394 | try { |
---|
| 395 | co.creatediagrams_resources_scale = Double.valueOf( |
---|
| 396 | bundle.getString(CREATEDIAGRAMS_RESOURCES_SCALE)).doubleValue(); |
---|
| 397 | } catch(MissingResourceException e){ |
---|
| 398 | co.creatediagrams_resources_scale = -1; |
---|
| 399 | } |
---|
| 400 | try { |
---|
| 401 | co.creatediagrams_energyusage = Boolean.valueOf( |
---|
| 402 | bundle.getString(CREATEDIAGRAMS_ENERGYUSAGE)).booleanValue() && createDiagrams; |
---|
| 403 | } catch(MissingResourceException e){ |
---|
| 404 | co.creatediagrams_energyusage = createDiagrams; |
---|
| 405 | } |
---|
| 406 | try { |
---|
| 407 | co.creatediagrams_tasks = Boolean.valueOf( |
---|
| 408 | bundle.getString(CREATEDIAGRAMS_TASKS)).booleanValue() && createDiagrams; |
---|
| 409 | } catch(MissingResourceException e){ |
---|
| 410 | co.creatediagrams_tasks = createDiagrams; |
---|
| 411 | } |
---|
| 412 | try { |
---|
| 413 | co.creatediagrams_taskswaitingtime = Boolean.valueOf( |
---|
| 414 | bundle.getString(CREATEDIAGRAMS_TASKSWAITINGTIME)).booleanValue() && createDiagrams; |
---|
| 415 | } catch(MissingResourceException e){ |
---|
| 416 | co.creatediagrams_taskswaitingtime = createDiagrams; |
---|
| 417 | } |
---|
| 418 | |
---|
| 419 | |
---|
| 420 | try { |
---|
| 421 | co.statsOutputSubfolderNameCreate = bundle.getString(STATS_OUTPUT_SUBFOLDER_NAME); |
---|
| 422 | co.statsOutputSubfolderNameRerad = co.statsOutputSubfolderNameCreate; |
---|
| 423 | } catch(MissingResourceException e){ |
---|
| 424 | co.statsOutputSubfolderNameCreate = "stats_create"; |
---|
| 425 | co.statsOutputSubfolderNameRerad = "stats_read"; |
---|
| 426 | } |
---|
| 427 | |
---|
| 428 | try { |
---|
| 429 | co.createaccumulatedresourcesstatistics = Boolean.valueOf( |
---|
| 430 | bundle.getString(ACCUMULATED_RESOURCES_STATISTICS)).booleanValue(); |
---|
| 431 | } catch(MissingResourceException e){ |
---|
| 432 | co.createaccumulatedresourcesstatistics = true; |
---|
| 433 | } |
---|
| 434 | try { |
---|
| 435 | co.createextendedtasksstatistics = Boolean.valueOf( |
---|
| 436 | bundle.getString(EXTENDED_TASKS_STATISTICS)).booleanValue(); |
---|
| 437 | } catch(MissingResourceException e){ |
---|
| 438 | co.createextendedtasksstatistics = true; |
---|
| 439 | } |
---|
| 440 | try { |
---|
| 441 | co.creategridlethistorystatistics = Boolean.valueOf( |
---|
| 442 | bundle.getString(GRIDLET_HISTORY_STATISTICS)).booleanValue(); |
---|
| 443 | } catch(MissingResourceException e){ |
---|
| 444 | co.creategridlethistorystatistics = true; |
---|
| 445 | } |
---|
| 446 | try { |
---|
| 447 | co.createjobsstatistics = Boolean.valueOf( |
---|
| 448 | bundle.getString(JOBS_STATISTICS)).booleanValue(); |
---|
| 449 | } catch(MissingResourceException e){ |
---|
| 450 | co.createjobsstatistics = true; |
---|
| 451 | } |
---|
| 452 | try { |
---|
| 453 | co.createsimulationstatistics = Boolean.valueOf( |
---|
| 454 | bundle.getString(SIMULATION_STATISTICS)).booleanValue(); |
---|
| 455 | } catch(MissingResourceException e){ |
---|
| 456 | co.createsimulationstatistics = true; |
---|
| 457 | } |
---|
| 458 | try { |
---|
| 459 | co.formatstatisticsoutput = Boolean.valueOf( |
---|
| 460 | bundle.getString(FORMAT_STATISTICS_OUTPUT)).booleanValue(); |
---|
| 461 | } catch(MissingResourceException e){ |
---|
| 462 | co.formatstatisticsoutput = false; |
---|
| 463 | } |
---|
| 464 | |
---|
| 465 | try { |
---|
| 466 | co.numberOfSimulations = Integer.valueOf(bundle.getString(NUMBER_OF_SIMULATIONS)).intValue(); |
---|
| 467 | } catch(MissingResourceException e){ |
---|
| 468 | co.numberOfSimulations = 1; |
---|
| 469 | } |
---|
| 470 | return co; |
---|
| 471 | } |
---|
| 472 | |
---|
| 473 | /** |
---|
| 474 | * Creates a new configuration object in the CREATE_SCENARIO mode. |
---|
| 475 | * |
---|
| 476 | * @param gridSchedulingPluginName |
---|
| 477 | * @param forecastFinishTimePluginName |
---|
| 478 | * @param localAllocPolicyPluginName |
---|
| 479 | * @param resdescFileName |
---|
| 480 | * @param taskParamFileName |
---|
| 481 | * @param outputFolder |
---|
| 482 | * @param outputWorkloadFileName |
---|
| 483 | * @param overwriteFiles |
---|
| 484 | * @param printHistory |
---|
| 485 | */ |
---|
| 486 | public ConfigurationOptions(String gridSchedulingPluginName, |
---|
| 487 | String exectimeestimationplugin, |
---|
| 488 | String localAllocPolicyPluginName, String resdescFileName, |
---|
| 489 | String taskParamFileName, String outputFolder, |
---|
| 490 | String outputWorkloadFileName, boolean overwriteFiles, |
---|
| 491 | boolean printHistory) { |
---|
| 492 | super(); |
---|
| 493 | this.gridSchedulingPluginName = gridSchedulingPluginName; |
---|
| 494 | this.exectimeestimationplugin = exectimeestimationplugin; |
---|
| 495 | this.localAllocPolicyPluginName = localAllocPolicyPluginName; |
---|
| 496 | this.resdescFileName = resdescFileName; |
---|
| 497 | this.workloadDescFileName = taskParamFileName; |
---|
| 498 | this.outputFolder = getSeparatorTerminatedPath(outputFolder); |
---|
| 499 | this.outputWorkloadFileName = outputWorkloadFileName; |
---|
| 500 | this.overwriteFiles = overwriteFiles; |
---|
| 501 | this.printHistory = printHistory; |
---|
| 502 | |
---|
| 503 | // the create mode |
---|
| 504 | this.createScenario = true; |
---|
| 505 | } |
---|
| 506 | |
---|
| 507 | /** |
---|
| 508 | * Creates a new configuration object in the READ_SCENARIO mode. |
---|
| 509 | * |
---|
| 510 | * @param gridSchedulingPluginName |
---|
| 511 | * @param forecastFinishTimePluginName |
---|
| 512 | * @param localAllocPolicyPluginName |
---|
| 513 | * @param resdescFileName |
---|
| 514 | * @param inputFolder |
---|
| 515 | * @param inputWorkloadFileName |
---|
| 516 | * @param overwriteFiles |
---|
| 517 | * @param printHistory |
---|
| 518 | */ |
---|
| 519 | public ConfigurationOptions(String gridSchedulingPluginName, |
---|
| 520 | String exectimeestimationplugin, |
---|
| 521 | String localAllocPolicyPluginName, String resdescFileName, |
---|
| 522 | String inputFolder, String inputWorkloadFileName, |
---|
| 523 | boolean overwriteFiles, boolean printHistory) { |
---|
| 524 | super(); |
---|
| 525 | this.gridSchedulingPluginName = gridSchedulingPluginName; |
---|
| 526 | this.exectimeestimationplugin = exectimeestimationplugin; |
---|
| 527 | this.localAllocPolicyPluginName = localAllocPolicyPluginName; |
---|
| 528 | this.resdescFileName = resdescFileName; |
---|
| 529 | this.inputFolder = getSeparatorTerminatedPath(inputFolder); |
---|
| 530 | this.inputWorkloadFileName = inputWorkloadFileName; |
---|
| 531 | this.overwriteFiles = overwriteFiles; |
---|
| 532 | this.printHistory = printHistory; |
---|
[110] | 533 | //FileHandler.loadDataset(new File("iris.data"), 4, ","); |
---|
[104] | 534 | // the read mode |
---|
| 535 | this.createScenario = false; |
---|
| 536 | } |
---|
| 537 | |
---|
| 538 | public static String getSeparatorTerminatedPath(String path) { |
---|
| 539 | if (path.endsWith(File.separator)) |
---|
| 540 | return new String(path); |
---|
| 541 | else { |
---|
| 542 | StringBuilder result = new StringBuilder(path.length() |
---|
| 543 | + File.separator.length()); |
---|
| 544 | result.append(path); |
---|
| 545 | result.append(File.separator); |
---|
| 546 | return result.toString(); |
---|
| 547 | } |
---|
| 548 | } |
---|
| 549 | |
---|
| 550 | public void setNumberOfSimulations(int numberOfSimulations) { |
---|
| 551 | this.numberOfSimulations = numberOfSimulations; |
---|
| 552 | } |
---|
| 553 | |
---|
| 554 | public int getNumberOfSimulations() { |
---|
| 555 | return numberOfSimulations; |
---|
| 556 | } |
---|
| 557 | |
---|
| 558 | public void setWorkloadDescFileName(String workloadDescFileName) { |
---|
| 559 | this.workloadDescFileName = workloadDescFileName; |
---|
| 560 | } |
---|
| 561 | |
---|
| 562 | public String getWorkloadDescFileName() { |
---|
| 563 | return workloadDescFileName; |
---|
| 564 | } |
---|
| 565 | } |
---|