Changeset 615 for DCWoRMS


Ignore:
Timestamp:
11/14/12 14:04:48 (12 years ago)
Author:
gosiaw
Message:

Bug connected with taking file names from args[] corrected

File:
1 edited

Legend:

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

    r611 r615  
    8080                if (args != null && args.length > 0) { 
    8181                        inputFileName = args[0]; 
    82                         if (inputFileName != null && inputFileName.isEmpty() == false) { 
     82                        if (inputFileName == null || (inputFileName != null && inputFileName.isEmpty() == true)) { 
    8383                                inputFileName = DEFAULT_PLMXML_INPUT_FILE_NAME; 
    8484                        } 
    8585 
    86                         outputFileName = args[1]; 
    87                         if (outputFileName != null && outputFileName.isEmpty() == false) { 
    88                                 outputFileName = DEFAULT_DCWORMS_OUTPUT_FILE_NAME; 
     86                        if (args.length > 1) { 
     87                                outputFileName = args[1]; 
     88                                if (outputFileName == null || (outputFileName != null && outputFileName.isEmpty() == true)) { 
     89                                        outputFileName = DEFAULT_DCWORMS_OUTPUT_FILE_NAME; 
     90                                } 
    8991                        } 
    9092                } 
     
    115117                        Element rootElement = dcwormsDocument.createElement("environment"); 
    116118 
    117                         //      Information about namespaces and schema validating output xml 
    118                         //      Should be: 
    119                         //      <environment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    120                 //           xsi:noNamespaceSchemaLocation="DCWormsResSchema.xsd"> 
    121                          
     119                        // Information about namespaces and schema validating output xml 
     120                        // Should be: 
     121                        // <environment 
     122                        // xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     123                        // xsi:noNamespaceSchemaLocation="DCWormsResSchema.xsd"> 
     124 
    122125                        Attr schemaAttribute = dcwormsDocument 
    123                         .createAttribute("xsi:noNamespaceSchemaLocation"); 
     126                                        .createAttribute("xsi:noNamespaceSchemaLocation"); 
    124127                        schemaAttribute.setValue(DEFAULT_SCHEMA_NAME); 
    125128                        Attr namespaceAttribute = dcwormsDocument 
    126                         .createAttribute("xmlns:xsi"); 
     129                                        .createAttribute("xmlns:xsi"); 
    127130                        namespaceAttribute.setValue(DEFAULT_NAMESPACE); 
    128131                        rootElement.setAttributeNode(schemaAttribute); 
    129132                        rootElement.setAttributeNode(namespaceAttribute); 
    130                          
    131                          
     133 
    132134                        dcwormsDocument.appendChild(rootElement); 
    133135                        Comment comment = dcwormsDocument 
    134136                                        .createComment("CoolEmAll testbed description"); 
    135137                        rootElement.appendChild(comment); 
    136                         // rootElement.setAttributeNS("http://www.w3.org/2001/XMLSchema-instance", 
    137                         // "xmlns:xsi", "value"); 
    138138 
    139139                        // Creating resources element 
     
    408408                                                + debbComponentNode.getNodeName()); 
    409409                        } 
    410                          
     410 
    411411                        // DOMSource/DOMResult 
    412412                        try { 
    413 //                              DOMSource domSource = new DOMSource(debbParentElement); 
     413                                // DOMSource domSource = new DOMSource(debbParentElement); 
    414414                                DOMSource domSource = new DOMSource(debbComponentNode); 
    415415                                Source xsltSource = new StreamSource( 
    416416                                                DEFAULT_DEBB_COMPONENT_TRANSFORMATION_FILE_NAME); 
    417417                                DOMResult domResult = new DOMResult(computingResourceElement); 
    418 //                              StreamResult systemOutResult = new StreamResult(System.out); 
     418                                // StreamResult systemOutResult = new StreamResult(System.out); 
    419419                                // create an instance of TransformerFactory 
    420420                                TransformerFactory transFact = TransformerFactory.newInstance(); 
     
    424424 
    425425                                trans.transform(domSource, domResult); 
    426                                 System.out.println("result node=" + domResult.getNode().getNodeName()); 
     426                                System.out.println("result node=" 
     427                                                + domResult.getNode().getNodeName()); 
    427428                        } catch (NullPointerException npEx) { 
    428429                                System.out.println("NullPointerException on debb " 
    429430                                                + debbComponentIdNode.getNodeValue()); 
    430431                        } 
    431                          
     432 
    432433                        if (debbHostNameNode != null) { 
    433434                                Element parameterElement = dcwormsDocument 
     
    491492 
    492493                        // ***************************************************************** 
    493  
    494494 
    495495                        // Find component 
Note: See TracChangeset for help on using the changeset viewer.