Changeset 562 for DCWoRMS/trunk/src/test
- Timestamp:
- 11/06/12 14:47:56 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/src/test/DEBBTranslator/src/DEBB2DCWoRMSTranslator.java
r558 r562 37 37 public class DEBB2DCWoRMSTranslator { 38 38 39 // 40 // 41 // 42 // 43 39 // TODO: 40 // 1) Configuration file needed 41 // 2) Get rid of all nasty System.out - log4j instead 42 // 3) 43 44 44 private static final String DEFAULT_OUTPUT_FILE_NAME = "xml/DCWORMS_TEST.xml"; 45 private static final String DEFAULT_INPUT_FILE_NAME = "xml/PLMXML_HLRSSmallServerRoom.xml"; 46 // private static final String DEFAULT_INPUT_FILE_NAME = "xml/PLMXML_HLRSRECSv2.xml"; 45 // private static final String DEFAULT_INPUT_FILE_NAME = "xml/PLMXML_HLRSSmallServerRoom.xml"; 46 private static final String DEFAULT_INPUT_FILE_NAME = 47 "xml/PLMXML_PSNCRECS.xml"; 47 48 private static final String DEFAULT_DEBB_COMPONENT_FILE_NAME = "xml/DEBBComponents.xml"; 48 49 private static DocumentBuilder xmlDocumentBuilder; … … 50 51 51 52 private static HashMap<String, String> computingResourceClasses = null; 52 53 53 54 /** 54 55 * … … 101 102 Element rootElement = dcwormsDocument.createElement("environment"); 102 103 dcwormsDocument.appendChild(rootElement); 103 Comment comment = dcwormsDocument.createComment("CoolEmAll testbed description"); 104 Comment comment = dcwormsDocument 105 .createComment("CoolEmAll testbed description"); 104 106 rootElement.appendChild(comment); 105 107 106 108 // Creating resources element 107 Element resourcesElement = dcwormsDocument.createElement("resources"); 109 Element resourcesElement = dcwormsDocument 110 .createElement("resources"); 108 111 rootElement.appendChild(resourcesElement); 109 112 110 113 // Creating (main) scheduler element 111 114 // TODO: Fill scheduler with reasonable data! 112 Element schedulerElement = dcwormsDocument.createElement("scheduler"); 115 Element schedulerElement = dcwormsDocument 116 .createElement("scheduler"); 113 117 comment = dcwormsDocument.createComment("Default scheduler"); 114 118 schedulerElement.appendChild(comment); … … 150 154 151 155 xmlDocumentBuilder = domFactory.newDocumentBuilder(); 152 153 // 154 // 156 157 // TODO: Check it this is correct! 158 // TODO: Move it to configuration file 155 159 computingResourceClasses = new HashMap<String, String>(); 156 160 computingResourceClasses.put("ComputeBox2", "ComputeBox2"); … … 253 257 result = expr.evaluate(plmxmlDocument, XPathConstants.NODE); 254 258 Node productRevisionView = (Node) result; 255 debbName = productRevisionView.getAttributes().getNamedItem("name");256 System.out.println("name=" + debbName.getNodeValue());259 // debbName = productRevisionView.getAttributes().getNamedItem("name"); 260 // System.out.println("name=" + debbName.getNodeValue()); 257 261 258 262 // 3) UserValue (to extract DEBB name, level or DEBBComponent file) 263 // DEBBComponentId 264 expr = xpath 265 .compile("plm:UserData/plm:UserValue[@title='DEBBComponentId']/@value"); 266 result = expr.evaluate(productRevisionView, XPathConstants.NODE); 267 Node debbComponentId = (Node) result; 268 if (debbComponentId != null) { 269 System.out.println("debbComponentId=" + debbComponentId.getNodeValue()); 270 } 271 272 // DEBBLevel 259 273 expr = xpath 260 274 .compile("plm:UserData/plm:UserValue[@title='DEBBLevel']/@value"); … … 264 278 System.out.println("debbLevel=" + debbLevel.getNodeValue()); 265 279 } 266 expr = xpath.compile("plm:UserData/plm:UserValue[@title='DEBBComponentFile']/@value"); 280 281 // DEBBComponentFile 282 expr = xpath 283 .compile("plm:UserData/plm:UserValue[@title='DEBBComponentFile']/@value"); 267 284 result = expr.evaluate(productRevisionView, XPathConstants.NODE); 268 Node debbComponentFileName = (Node) result;285 Node debbComponentFileName = (Node) result; 269 286 if (debbComponentFileName == null) { 270 // Default DEBBComponent file is assumed 271 272 287 // Default DEBBComponent file is assumed 288 273 289 } 274 290 System.out.println("debbComponentFileName=" + debbComponentFileName); … … 283 299 // TODO: how to translate DEBB level to class attribute? 284 300 Attr classAttribute = dcwormsDocument.createAttribute("class"); 285 String dcwormsClass = computingResourceClasses.get(debbLevel.getNodeValue()); 301 String dcwormsClass = computingResourceClasses.get(debbLevel 302 .getNodeValue()); 286 303 classAttribute.setValue(dcwormsClass); 287 304 computingResourceElement.setAttributeNode(classAttribute);
Note: See TracChangeset
for help on using the changeset viewer.