Changeset 564 for DCWoRMS/trunk/src/test


Ignore:
Timestamp:
11/07/12 08:40:59 (12 years ago)
Author:
gosiaw
Message:

Extracting host names from PLM XML added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/trunk/src/test/DEBBTranslator/src/DEBB2DCWoRMSTranslator.java

    r562 r564  
    4343 
    4444        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 = 
    47          "xml/PLMXML_PSNCRECS.xml"; 
    48         private static final String DEFAULT_DEBB_COMPONENT_FILE_NAME = "xml/DEBBComponents.xml"; 
     45        private static final String DEFAULT_INPUT_FILE_NAME = "xml/PLMXML_HLRSSmallServerRoom.xml"; 
    4946        private static DocumentBuilder xmlDocumentBuilder; 
    5047        private static DocumentBuilderFactory domFactory; 
     
    250247                String partId = partRef.getNodeValue().substring(1); // Get rid of # at 
    251248                                                                                                                                // the beginning 
     249                // UserData - hostname 
     250                expr = xpath 
     251                                .compile("plm:UserData/plm:UserValue[@title='hostname']/@value"); 
     252                result = expr.evaluate(productInstance, XPathConstants.NODE); 
     253                Node debbHostName = (Node) result; 
     254 
     255                //      UserData - sequence 
     256                expr = xpath 
     257                                .compile("plm:UserData/plm:UserValue[@title='sequence']/@value"); 
     258                result = expr.evaluate(productInstance, XPathConstants.NODE); 
     259                Node debbSequence = (Node) result; 
    252260 
    253261                // 2) ProductRevisionView 
     
    257265                result = expr.evaluate(plmxmlDocument, XPathConstants.NODE); 
    258266                Node productRevisionView = (Node) result; 
    259 //              debbName = productRevisionView.getAttributes().getNamedItem("name"); 
    260 //              System.out.println("name=" + debbName.getNodeValue()); 
     267                // debbName = productRevisionView.getAttributes().getNamedItem("name"); 
     268                // System.out.println("name=" + debbName.getNodeValue()); 
    261269 
    262270                // 3) UserValue (to extract DEBB name, level or DEBBComponent file) 
     
    267275                Node debbComponentId = (Node) result; 
    268276                if (debbComponentId != null) { 
    269                         System.out.println("debbComponentId=" + debbComponentId.getNodeValue()); 
     277                        System.out.println("debbComponentId=" 
     278                                        + debbComponentId.getNodeValue()); 
    270279                } 
    271280 
     
    278287                        System.out.println("debbLevel=" + debbLevel.getNodeValue()); 
    279288                } 
    280                  
     289 
    281290                // DEBBComponentFile 
    282291                expr = xpath 
     
    297306                        nameAttribute.setValue(debbName.getNodeValue()); 
    298307                        computingResourceElement.setAttributeNode(nameAttribute); 
    299                         // TODO: how to translate DEBB level to class attribute? 
     308 
    300309                        Attr classAttribute = dcwormsDocument.createAttribute("class"); 
    301310                        String dcwormsClass = computingResourceClasses.get(debbLevel 
     
    303312                        classAttribute.setValue(dcwormsClass); 
    304313                        computingResourceElement.setAttributeNode(classAttribute); 
     314 
     315                        if (debbHostName != null) { 
     316                                // TODO: Where to use this hostname information? 
     317                                Comment comment = dcwormsDocument.createComment("Host name " 
     318                                                + debbHostName); 
     319                                computingResourceElement.appendChild(comment); 
     320                        } 
     321 
     322                        if (debbSequence != null) { 
     323                                // TODO: Sequence is described unclearly in the deliverable, not 
     324                                // used in any example. Where to use this information if it 
     325                                // appears? 
     326                        } 
    305327                        debbParentElement.appendChild(computingResourceElement); 
    306328 
Note: See TracChangeset for help on using the changeset viewer.