Changeset 623


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

Some comments added.

File:
1 edited

Legend:

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

    r617 r623  
    1111import javax.xml.parsers.ParserConfigurationException; 
    1212import javax.xml.transform.OutputKeys; 
    13 import javax.xml.transform.Source; 
    1413import javax.xml.transform.Transformer; 
    1514import javax.xml.transform.TransformerConfigurationException; 
     
    6564        private static XPath xpath; 
    6665        private static Document dcwormsDocument; 
    67         private static Logger logger = Logger.getLogger(DEBB2DCWoRMSTranslator.class); 
     66        private static Logger logger = Logger 
     67                        .getLogger(DEBB2DCWoRMSTranslator.class); 
    6868        private static StreamSource xsltDEBBComponentTransformationSource; 
    6969        private static Transformer xsltDEBBComponentTransformationTransformer; 
    70          
     70 
    7171        /** 
    7272         *  
     
    8585                if (args != null && args.length > 0) { 
    8686                        inputFileName = args[0]; 
    87                         if (inputFileName == null || (inputFileName != null && inputFileName.isEmpty() == true)) { 
     87                        if (inputFileName == null 
     88                                        || (inputFileName != null && inputFileName.isEmpty() == true)) { 
    8889                                inputFileName = DEFAULT_PLMXML_INPUT_FILE_NAME; 
    8990                        } 
     
    9192                        if (args.length > 1) { 
    9293                                outputFileName = args[1]; 
    93                                 if (outputFileName == null || (outputFileName != null && outputFileName.isEmpty() == true)) { 
     94                                if (outputFileName == null 
     95                                                || (outputFileName != null && outputFileName.isEmpty() == true)) { 
    9496                                        outputFileName = DEFAULT_DCWORMS_OUTPUT_FILE_NAME; 
    9597                                } 
     
    9799                } 
    98100                BasicConfigurator.configure(); 
    99                  
     101 
    100102                logger.debug("inputFileName=" + inputFileName); 
    101103                logger.debug("outputFileName=" + outputFileName); 
    102                  
    103  
    104                  
     104 
    105105                try { 
    106106                        initialize(); 
     
    187187        } 
    188188 
    189         private static void initialize() throws ParserConfigurationException, TransformerConfigurationException { 
     189        private static void initialize() throws ParserConfigurationException, 
     190                        TransformerConfigurationException { 
    190191                domFactory = DocumentBuilderFactory.newInstance(); 
    191192                domFactory.setNamespaceAware(true); // never forget this! 
     
    197198                xmlDocumentBuilder = domFactory.newDocumentBuilder(); 
    198199 
    199                 //      XSLT transformation for translating information stored DEBB Components file(s) 
     200                // XSLT transformation for translating information stored DEBB 
     201                // Components file(s) 
    200202                xsltDEBBComponentTransformationSource = new StreamSource( 
    201203                                DEFAULT_DEBB_COMPONENT_TRANSFORMATION_FILE_NAME); 
    202204                // create an instance of TransformerFactory 
    203                 TransformerFactory transFact = TransformerFactory.newInstance();                 
     205                TransformerFactory transFact = TransformerFactory.newInstance(); 
    204206                xsltDEBBComponentTransformationTransformer = transFact 
    205                 .newTransformer(xsltDEBBComponentTransformationSource); 
    206                  
     207                                .newTransformer(xsltDEBBComponentTransformationSource); 
     208 
    207209                // TODO: Check it this is correct! 
    208210                // TODO: Move it to configuration file 
     
    427429 
    428430                        // ***************************************************************** 
    429                         //      4) Translation of information about DEBB taken from corresponding DEBB components file 
     431                        // 4) Translation of information about DEBB taken from corresponding 
     432                        // DEBB components file 
    430433                        try { 
    431                                 //      Each DEBB can be described in separate document 
    432                                 //      DOMSource -> DOMResult 
     434                                // Each DEBB can be described in separate document 
     435                                // DOMSource -> DOMResult 
     436                                // Starting parsing DEBB Components document from specified node 
     437                                // works fine with Saxon, but doesn't with Xalan 
    433438                                DOMSource domSource = new DOMSource(debbComponentNode); 
    434439                                DOMResult domResult = new DOMResult(computingResourceElement); 
    435440 
    436  
    437  
    438  
    439                                 xsltDEBBComponentTransformationTransformer.transform(domSource, domResult); 
    440                                 logger.debug("result node=" 
    441                                                 + domResult.getNode().getNodeName()); 
     441                                xsltDEBBComponentTransformationTransformer.transform(domSource, 
     442                                                domResult); 
     443                                logger.debug("result node=" + domResult.getNode().getNodeName()); 
    442444                        } catch (NullPointerException npEx) { 
    443                                 logger.info("Cannot find debb " + debbComponentIdNode.getNodeValue() + " in corresponding DEBB Components file"); 
    444                         } 
    445  
    446                         //      5) Adding several minor details about DEBB stored in PLM XML document: 
    447                         //      Name of the host 
     445                                logger.info("Cannot find debb " 
     446                                                + debbComponentIdNode.getNodeValue() 
     447                                                + " in corresponding DEBB Components " 
     448                                                + debbComponentFileName + " file"); 
     449                        } 
     450 
     451                        // 5) Adding several minor details about DEBB stored in PLM XML 
     452                        // document: 
     453                        // Name of the host 
    448454                        if (debbHostNameNode != null) { 
    449455                                Element parameterElement = dcwormsDocument 
     
    460466                        } 
    461467 
    462                         //      Sequence 
     468                        // Sequence 
    463469                        if (debbSequenceNode != null) { 
    464470                                // TODO: Sequence is described unclearly in the deliverable, not 
     
    478484                        debbParentElement.appendChild(computingResourceElement); 
    479485 
    480                         //      Label 
     486                        // Label 
    481487                        if (debbLabelNode != null) { 
    482488                                Element parameterElement = dcwormsDocument 
     
    494500                        } 
    495501 
    496                         //      Location 
     502                        // Location 
    497503                        if (debbLocationNode != null) { 
    498504                                Element parameterElement = dcwormsDocument 
     
    508514                                computingResourceElement.appendChild(parameterElement); 
    509515                        } 
    510  
    511516 
    512517                        // ***************************************************************** 
Note: See TracChangeset for help on using the changeset viewer.