Changeset 617
- Timestamp:
- 11/15/12 08:33:43 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/src/test/DEBBTranslator/src/test/DEBBTranslator/src/DEBB2DCWoRMSTranslator.java
r616 r617 66 66 private static Document dcwormsDocument; 67 67 private static Logger logger = Logger.getLogger(DEBB2DCWoRMSTranslator.class); 68 private static StreamSource xsltDEBBComponentTransformationSource; 69 private static Transformer xsltDEBBComponentTransformationTransformer; 68 70 69 71 /** … … 185 187 } 186 188 187 private static void initialize() throws ParserConfigurationException {189 private static void initialize() throws ParserConfigurationException, TransformerConfigurationException { 188 190 domFactory = DocumentBuilderFactory.newInstance(); 189 191 domFactory.setNamespaceAware(true); // never forget this! … … 195 197 xmlDocumentBuilder = domFactory.newDocumentBuilder(); 196 198 199 // XSLT transformation for translating information stored DEBB Components file(s) 200 xsltDEBBComponentTransformationSource = new StreamSource( 201 DEFAULT_DEBB_COMPONENT_TRANSFORMATION_FILE_NAME); 202 // create an instance of TransformerFactory 203 TransformerFactory transFact = TransformerFactory.newInstance(); 204 xsltDEBBComponentTransformationTransformer = transFact 205 .newTransformer(xsltDEBBComponentTransformationSource); 206 197 207 // TODO: Check it this is correct! 198 208 // TODO: Move it to configuration file … … 390 400 391 401 // ***************************************************************** 392 // Add computingResource element for the DEBB402 // 3) Add computingResource element for the DEBB 393 403 if (debbLevelNode != null) { 394 404 Element computingResourceElement = dcwormsDocument … … 417 427 418 428 // ***************************************************************** 419 // Translation of information about debb taken from DEBB components file 420 // DOMSource/DOMResult 429 // 4) Translation of information about DEBB taken from corresponding DEBB components file 421 430 try { 422 // DOMSource domSource = new DOMSource(debbParentElement); 431 // Each DEBB can be described in separate document 432 // DOMSource -> DOMResult 423 433 DOMSource domSource = new DOMSource(debbComponentNode); 424 Source xsltSource = new StreamSource(425 DEFAULT_DEBB_COMPONENT_TRANSFORMATION_FILE_NAME);426 434 DOMResult domResult = new DOMResult(computingResourceElement); 427 // StreamResult systemOutResult = new StreamResult(System.out); 428 // create an instance of TransformerFactory 429 TransformerFactory transFact = TransformerFactory.newInstance(); 430 431 javax.xml.transform.Transformer trans = transFact 432 .newTransformer(xsltSource); 433 434 trans.transform(domSource, domResult); 435 436 437 438 439 xsltDEBBComponentTransformationTransformer.transform(domSource, domResult); 435 440 logger.debug("result node=" 436 441 + domResult.getNode().getNodeName()); … … 439 444 } 440 445 446 // 5) Adding several minor details about DEBB stored in PLM XML document: 447 // Name of the host 441 448 if (debbHostNameNode != null) { 442 449 Element parameterElement = dcwormsDocument … … 453 460 } 454 461 462 // Sequence 455 463 if (debbSequenceNode != null) { 456 464 // TODO: Sequence is described unclearly in the deliverable, not … … 470 478 debbParentElement.appendChild(computingResourceElement); 471 479 480 // Label 472 481 if (debbLabelNode != null) { 473 482 Element parameterElement = dcwormsDocument … … 485 494 } 486 495 496 // Location 487 497 if (debbLocationNode != null) { 488 498 Element parameterElement = dcwormsDocument … … 499 509 } 500 510 511 501 512 // ***************************************************************** 502 503 // Find component 504 505 // ***************************************************************** 506 // Get nested instances - nested DEBBs and ask them to transform 513 // 6) Get nested instances - nested DEBBs and ask them to transform 507 514 // themselves 508 515 Node instanceRefsNode = productRevisionViewNode.getAttributes()
Note: See TracChangeset
for help on using the changeset viewer.