Changeset 1019 for DCWoRMS


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

Changes in construction of default output file name (if it is not specified)

File:
1 edited

Legend:

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

    r1018 r1019  
    44package test.DEBBTranslator.src; 
    55 
     6import java.io.File; 
    67import java.io.FileOutputStream; 
    78import java.io.IOException; 
     
    2021        private static final String DEFAULT_SCHEDULERS_AND_ESTIMATORS_FILE_NAME = "../../debb2dcworms/example/example1.xml"; 
    2122        private static final String DEFAULT_TEMPLATE_START_LEVEL = "Node"; 
     23         
     24        private static final String PLMXML_PREFIX = "PLMXML"; 
     25        private static final String DCWORMS_PREFIX = "DCWORMS"; 
    2226         
    2327        private static HashMap<String, String> computingResourceClasses; 
     
    6266                                || (outputFileName != null && outputFileName.isEmpty() == true)) { 
    6367                 
    64                         outputFileName = inputFileName.replace("PLMXML", "DCWORMS"); 
     68                        if (inputFileName.contains(PLMXML_PREFIX)) { 
     69                                //      If file name contains PLMXML replace it by DCWORMS 
     70                                outputFileName = inputFileName.replace(PLMXML_PREFIX, DCWORMS_PREFIX); 
     71                        } else { 
     72                                String pathSeparator = File.separator; 
     73//                              System.out.println("pathSeparator=" + pathSeparator);    
     74                                 
     75                                //      Otherwise add DCWORMS_ prefix 
     76                                String path = ""; 
     77                                int position = inputFileName.lastIndexOf(pathSeparator) ; 
     78                                if (position >= 0) { 
     79                                        path = inputFileName.substring(0, position); 
     80                                } 
     81//                              System.out.println("path=" + path);      
     82                                 
     83                                String name = inputFileName.substring(position + 1); 
     84//                              System.out.println("name=" + name);              
     85                                outputFileName = path + "DCWORMS" + "_" + name; 
     86                        } 
     87                         
    6588                } 
    6689                         
Note: See TracChangeset for help on using the changeset viewer.