Changeset 1018 for DCWoRMS/branches/coolemall
- Timestamp:
- 03/26/13 10:51:23 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/test/DEBBTranslator/src/PLMXMLTranslator.java
r1017 r1018 5 5 6 6 import java.io.FileOutputStream; 7 import java.io.IOException; 7 8 import java.util.HashMap; 8 9 … … 15 16 */ 16 17 public class PLMXMLTranslator { 17 private static final String DEFAULT_INPUT_FILE_NAME = "src/test/DEBBTranslator/xml/example/PLMXML_HLRSSmallServerRoom.xml";18 private static final String DEFAULT_OUTPUT_FILE_NAME = DEFAULT_INPUT_FILE_NAME.replace("PLMXML", "DCWORMS");19 20 // private static final String DEFAULT_INPUT_FILE_NAME = "src/test/DEBBTranslator/xml/PLMXML_PSNCRECS.xml";21 18 private static final String DEFAULT_PLMXML_TRANSFORMATION_FILE_NAME = "src/test/DEBBTranslator/xml/PLMXMLTranslator.xsl"; 22 19 private static final String DEFAULT_UPDATE_TRANSFORMATION_FILE_NAME = "src/test/DEBBTranslator/xml/DCWoRMSDEBBUpdater.xsl"; … … 40 37 */ 41 38 public static void main(String[] args) throws Exception { 42 String inputFileName = DEFAULT_INPUT_FILE_NAME;43 String outputFileName = DEFAULT_OUTPUT_FILE_NAME;39 String inputFileName = null; 40 String outputFileName = null; 44 41 String debbTransformationFileName = DEFAULT_PLMXML_TRANSFORMATION_FILE_NAME; 45 42 String schedulersAndEstimatorsFileName = DEFAULT_SCHEDULERS_AND_ESTIMATORS_FILE_NAME; 46 43 String templateStartLevel = DEFAULT_TEMPLATE_START_LEVEL; 47 44 48 if (args != null && args.length > 0) { 49 inputFileName = args[0]; 50 if (inputFileName == null 51 || (inputFileName != null && inputFileName.isEmpty() == true)) { 52 inputFileName = DEFAULT_INPUT_FILE_NAME; 45 if (args == null || args.length == 0) { 46 throw new IOException("No arguments specified. Please specify at least input file path."); 47 } 48 49 // Input file 50 inputFileName = args[0]; 51 if (inputFileName == null 52 || (inputFileName != null && inputFileName.isEmpty() == true)) { 53 54 throw new IOException("Input file not specified!"); 55 } 56 57 if (args.length > 1) { 58 // Output file 59 outputFileName = args[1]; 60 } 61 if (outputFileName == null 62 || (outputFileName != null && outputFileName.isEmpty() == true)) { 63 64 outputFileName = inputFileName.replace("PLMXML", "DCWORMS"); 65 } 66 67 68 if (args.length > 2) { 69 // File where schedulers and estimators are defined (optional) 70 schedulersAndEstimatorsFileName = args[2]; 71 if (schedulersAndEstimatorsFileName == null 72 || (schedulersAndEstimatorsFileName != null && schedulersAndEstimatorsFileName.isEmpty() == true)) { 73 schedulersAndEstimatorsFileName = DEFAULT_SCHEDULERS_AND_ESTIMATORS_FILE_NAME; 74 53 75 } 76 } 54 77 55 if (args.length > 1) {56 outputFileName = args[1];57 if (outputFileName == null58 || (outputFileName != null && outputFileName.isEmpty() == true)) {59 outputFileName = DEFAULT_OUTPUT_FILE_NAME;60 61 }78 if (args.length > 3) { 79 // Level from which all computing resources are defined in templates (optional) 80 templateStartLevel = args[3]; 81 if (templateStartLevel == null 82 || (templateStartLevel != null && templateStartLevel.isEmpty() == true)) { 83 templateStartLevel = DEFAULT_TEMPLATE_START_LEVEL; 84 62 85 } 86 } 63 87 64 if (args.length > 2) { 65 schedulersAndEstimatorsFileName = args[2]; 66 if (schedulersAndEstimatorsFileName == null 67 || (schedulersAndEstimatorsFileName != null && schedulersAndEstimatorsFileName.isEmpty() == true)) { 68 schedulersAndEstimatorsFileName = DEFAULT_SCHEDULERS_AND_ESTIMATORS_FILE_NAME; 69 70 } 71 } 72 73 if (args.length > 3) { 74 templateStartLevel = args[3]; 75 if (templateStartLevel == null 76 || (templateStartLevel != null && templateStartLevel.isEmpty() == true)) { 77 templateStartLevel = DEFAULT_TEMPLATE_START_LEVEL; 78 79 } 80 } 81 88 System.out.println("inputFileName=" + inputFileName); 89 System.out.println("outputFileName=" + outputFileName); 90 System.out.println("schedulersAndEstimatorsFileName=" + schedulersAndEstimatorsFileName); 91 System.out.println("templateStartLevel=" + templateStartLevel); 82 92 83 }84 93 85 94 if (inputFileName.compareTo(outputFileName) == 0) { … … 105 114 resourceUnitClasses.put("Storage", "Storage"); 106 115 107 System.out.println("inputFileName=" + inputFileName);108 System.out.println("outputFileName=" + outputFileName);109 System.out.println("schedulersAndEstimatorsFileName=" + schedulersAndEstimatorsFileName);110 System.out.println("templateStartLevel=" + templateStartLevel);111 116 112 117 try {
Note: See TracChangeset
for help on using the changeset viewer.