Changeset 1018


Ignore:
Timestamp:
03/26/13 10:51:23 (12 years ago)
Author:
gosiaw
Message:

Input file is obligatory

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/test/DEBBTranslator/src/PLMXMLTranslator.java

    r1017 r1018  
    55 
    66import java.io.FileOutputStream; 
     7import java.io.IOException; 
    78import java.util.HashMap; 
    89 
     
    1516 */ 
    1617public 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"; 
    2118        private static final String DEFAULT_PLMXML_TRANSFORMATION_FILE_NAME = "src/test/DEBBTranslator/xml/PLMXMLTranslator.xsl"; 
    2219        private static final String DEFAULT_UPDATE_TRANSFORMATION_FILE_NAME = "src/test/DEBBTranslator/xml/DCWoRMSDEBBUpdater.xsl"; 
     
    4037         */ 
    4138        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; 
    4441                String debbTransformationFileName = DEFAULT_PLMXML_TRANSFORMATION_FILE_NAME; 
    4542                String schedulersAndEstimatorsFileName = DEFAULT_SCHEDULERS_AND_ESTIMATORS_FILE_NAME; 
    4643                String templateStartLevel = DEFAULT_TEMPLATE_START_LEVEL; 
    4744                 
    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                                 
    5375                        } 
     76                } 
    5477 
    55                         if (args.length > 1) { 
    56                                 outputFileName = args[1]; 
    57                                 if (outputFileName == null 
    58                                                 || (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                                 
    6285                        } 
     86                } 
    6387                         
    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); 
    8292                         
    83                 } 
    8493                 
    8594                if (inputFileName.compareTo(outputFileName) == 0) { 
     
    105114                resourceUnitClasses.put("Storage", "Storage"); 
    106115                 
    107                 System.out.println("inputFileName=" + inputFileName); 
    108                 System.out.println("outputFileName=" + outputFileName); 
    109                 System.out.println("schedulersAndEstimatorsFileName=" + schedulersAndEstimatorsFileName); 
    110                 System.out.println("templateStartLevel=" + templateStartLevel); 
    111116                 
    112117                try { 
Note: See TracChangeset for help on using the changeset viewer.