Changeset 562 for DCWoRMS/trunk/src/test


Ignore:
Timestamp:
11/06/12 14:47:56 (12 years ago)
Author:
gosiaw
Message:

ComputingResource? name corrected

File:
1 edited

Legend:

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

    r558 r562  
    3737public class DEBB2DCWoRMSTranslator { 
    3838 
    39         //      TODO: 
    40         //      1) Configuration file needed 
    41         //      2) Get rid of all nasty System.out - log4j instead 
    42         //      3) 
    43          
     39        // TODO: 
     40        // 1) Configuration file needed 
     41        // 2) Get rid of all nasty System.out - log4j instead 
     42        // 3) 
     43 
    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 = "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"; 
    4748        private static final String DEFAULT_DEBB_COMPONENT_FILE_NAME = "xml/DEBBComponents.xml"; 
    4849        private static DocumentBuilder xmlDocumentBuilder; 
     
    5051 
    5152        private static HashMap<String, String> computingResourceClasses = null; 
    52          
     53 
    5354        /** 
    5455         *  
     
    101102                        Element rootElement = dcwormsDocument.createElement("environment"); 
    102103                        dcwormsDocument.appendChild(rootElement); 
    103                         Comment comment = dcwormsDocument.createComment("CoolEmAll testbed description"); 
     104                        Comment comment = dcwormsDocument 
     105                                        .createComment("CoolEmAll testbed description"); 
    104106                        rootElement.appendChild(comment); 
    105                          
     107 
    106108                        // Creating resources element 
    107                         Element resourcesElement = dcwormsDocument.createElement("resources"); 
     109                        Element resourcesElement = dcwormsDocument 
     110                                        .createElement("resources"); 
    108111                        rootElement.appendChild(resourcesElement); 
    109                          
     112 
    110113                        // Creating (main) scheduler element 
    111114                        // TODO: Fill scheduler with reasonable data! 
    112                         Element schedulerElement = dcwormsDocument.createElement("scheduler"); 
     115                        Element schedulerElement = dcwormsDocument 
     116                                        .createElement("scheduler"); 
    113117                        comment = dcwormsDocument.createComment("Default scheduler"); 
    114118                        schedulerElement.appendChild(comment); 
     
    150154 
    151155                xmlDocumentBuilder = domFactory.newDocumentBuilder(); 
    152                  
    153                 //      TODO: Check it this is correct! 
    154                 //      TODO: Move it to configuration file 
     156 
     157                // TODO: Check it this is correct! 
     158                // TODO: Move it to configuration file 
    155159                computingResourceClasses = new HashMap<String, String>(); 
    156160                computingResourceClasses.put("ComputeBox2", "ComputeBox2"); 
     
    253257                result = expr.evaluate(plmxmlDocument, XPathConstants.NODE); 
    254258                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()); 
    257261 
    258262                // 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 
    259273                expr = xpath 
    260274                                .compile("plm:UserData/plm:UserValue[@title='DEBBLevel']/@value"); 
     
    264278                        System.out.println("debbLevel=" + debbLevel.getNodeValue()); 
    265279                } 
    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"); 
    267284                result = expr.evaluate(productRevisionView, XPathConstants.NODE); 
    268                 Node debbComponentFileName = (Node)result; 
     285                Node debbComponentFileName = (Node) result; 
    269286                if (debbComponentFileName == null) { 
    270                         //      Default DEBBComponent file is assumed 
    271                          
    272                          
     287                        // Default DEBBComponent file is assumed 
     288 
    273289                } 
    274290                System.out.println("debbComponentFileName=" + debbComponentFileName); 
     
    283299                        // TODO: how to translate DEBB level to class attribute? 
    284300                        Attr classAttribute = dcwormsDocument.createAttribute("class"); 
    285                         String dcwormsClass = computingResourceClasses.get(debbLevel.getNodeValue()); 
     301                        String dcwormsClass = computingResourceClasses.get(debbLevel 
     302                                        .getNodeValue()); 
    286303                        classAttribute.setValue(dcwormsClass); 
    287304                        computingResourceElement.setAttributeNode(classAttribute); 
Note: See TracChangeset for help on using the changeset viewer.