- Timestamp:
- 03/26/13 11:54:04 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/test/DEBBTranslator/src/PLMXMLTranslator.java
r1019 r1020 12 12 import javax.xml.transform.TransformerFactory; 13 13 14 import org.apache.log4j.BasicConfigurator; 15 import org.apache.log4j.Logger; 16 14 17 /** 15 18 * @author gosiaw … … 17 20 */ 18 21 public class PLMXMLTranslator { 22 23 private static Logger logger = Logger.getLogger(PLMXMLTranslator.class); 24 19 25 private static final String DEFAULT_PLMXML_TRANSFORMATION_FILE_NAME = "src/test/DEBBTranslator/xml/PLMXMLTranslator.xsl"; 20 26 private static final String DEFAULT_UPDATE_TRANSFORMATION_FILE_NAME = "src/test/DEBBTranslator/xml/DCWoRMSDEBBUpdater.xsl"; … … 41 47 */ 42 48 public static void main(String[] args) throws Exception { 49 50 // To initialize log4j properly 51 BasicConfigurator.configure(); 52 43 53 String inputFileName = null; 44 54 String outputFileName = null; … … 48 58 49 59 if (args == null || args.length == 0) { 50 throw new IOException("No arguments specified. Please specify at least input file path."); 60 String errorMessage = "No arguments specified. Please specify at least input file path."; 61 logger.error(errorMessage); 62 throw new IOException(errorMessage); 51 63 } 52 64 … … 56 68 || (inputFileName != null && inputFileName.isEmpty() == true)) { 57 69 58 throw new IOException("Input file not specified!"); 70 String errorMessage = "Input file not specified!"; 71 logger.error(errorMessage); 72 73 throw new IOException(errorMessage); 59 74 } 60 75 … … 71 86 } else { 72 87 String pathSeparator = File.separator; 73 // System.out.println("pathSeparator=" + pathSeparator);88 // logger.debug("pathSeparator=" + pathSeparator); 74 89 75 90 // Otherwise add DCWORMS_ prefix … … 79 94 path = inputFileName.substring(0, position); 80 95 } 81 // System.out.println("path=" + path);96 // logger.debug("path=" + path); 82 97 83 98 String name = inputFileName.substring(position + 1); 84 // System.out.println("name=" + name);99 // logger.debug("name=" + name); 85 100 outputFileName = path + "DCWORMS" + "_" + name; 86 101 } … … 109 124 } 110 125 111 System.out.println("inputFileName=" + inputFileName);112 System.out.println("outputFileName=" + outputFileName);113 System.out.println("schedulersAndEstimatorsFileName=" + schedulersAndEstimatorsFileName);114 System.out.println("templateStartLevel=" + templateStartLevel);126 logger.debug("inputFileName=" + inputFileName); 127 logger.debug("outputFileName=" + outputFileName); 128 logger.debug("schedulersAndEstimatorsFileName=" + schedulersAndEstimatorsFileName); 129 logger.debug("templateStartLevel=" + templateStartLevel); 115 130 116 131 117 132 if (inputFileName.compareTo(outputFileName) == 0) { 118 133 String errorMessage = "Input and output file cannot be the same"; 119 System.out.println("errorMessage");134 logger.error("errorMessage"); 120 135 throw new Exception(errorMessage); 121 136 } … … 152 167 new javax.xml.transform.stream.StreamResult( 153 168 new FileOutputStream(outputFileName))); 154 System.out.println("File " + inputFileName + " transformed into " + outputFileName + " file");169 logger.debug("File " + inputFileName + " transformed into " + outputFileName + " file"); 155 170 156 171 String debbUpdateTransformationFileName = DEFAULT_UPDATE_TRANSFORMATION_FILE_NAME; … … 161 176 updateTransformer.transform(new javax.xml.transform.stream.StreamSource(outputFileName), 162 177 new javax.xml.transform.stream.StreamResult(outputFileName)); 163 System.out.println("File " + outputFileName + " transformed (sorted and updated) into " + outputFileName + " file");178 logger.debug("File " + outputFileName + " transformed (sorted and updated) into " + outputFileName + " file"); 164 179 } catch (Exception e) { 165 180 e.printStackTrace();
Note: See TracChangeset
for help on using the changeset viewer.