Clover coverage report - Maven Clover report
Coverage timestamp: Tue Sep 16 2008 01:16:37 EEST
file stats: LOC: 111   Methods: 2
NCLOC: 53   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
NodeWsml.java 0% 0% 0% 0%
coverage
 1    /*
 2    wsmo4j - a WSMO API and Reference Implementation
 3   
 4    Copyright (c) 2004-2005, OntoText Lab. / SIRMA
 5   
 6    This library is free software; you can redistribute it and/or modify it under
 7    the terms of the GNU Lesser General Public License as published by the Free
 8    Software Foundation; either version 2.1 of the License, or (at your option)
 9    any later version.
 10    This library is distributed in the hope that it will be useful, but WITHOUT
 11    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 12    FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 13    details.
 14    You should have received a copy of the GNU Lesser General Public License along
 15    with this library; if not, write to the Free Software Foundation, Inc.,
 16    59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 17    */
 18    package com.ontotext.wsmo4j.parser.xml;
 19   
 20    /**
 21    * <p>Title: WSMO4J</p>
 22    * <p>Description: WSMO API and a Reference Implementation</p>
 23    * <p>Copyright: Copyright (c) 2004-2005</p>
 24    * <p>Company: OntoText Lab. / SIRMA </p>
 25    * @author not attributable
 26    * @version 1.0
 27    *
 28    */
 29   
 30    import org.omwg.ontology.*;
 31    import org.w3c.dom.*;
 32    import org.wsmo.common.*;
 33    import org.wsmo.common.exception.*;
 34    import org.wsmo.mediator.*;
 35    import org.wsmo.service.*;
 36    import org.wsmo.wsml.*;
 37   
 38    import com.ontotext.wsmo4j.serializer.xml.*;
 39   
 40    /**
 41    * Helper type to serialize/deserialize xml element wsml
 42    *
 43    * @author not attributable
 44    */
 45    public class NodeWsml {
 46   
 47  0 static TopEntity deserialzieTopEntity(Node xmlNode, WsmlXmlParser parser)
 48    throws InvalidModelException, ParserException {
 49  0 if (xmlNode == null || xmlNode.getNodeName() != "wsml") {
 50  0 throw new IllegalArgumentException();
 51    }
 52   
 53    // TODO: Process wsmlVariant information
 54   
 55  0 NodeList nodes = xmlNode.getChildNodes();
 56  0 for (int i = 0; i < nodes.getLength(); i++) {
 57  0 Node node = nodes.item(i);
 58  0 if (node.getNodeName() == "ontology" && node.getNodeType() == Node.ELEMENT_NODE) {
 59  0 return NodeOntology.deserialize(node, parser);
 60    }
 61  0 else if (node.getNodeName().endsWith("Mediator")
 62    && node.getNodeType() == Node.ELEMENT_NODE) {
 63  0 return NodeMediator.processMediatorNode(node, parser);
 64    }
 65  0 else if (node.getNodeName() == "goal" && node.getNodeType() == Node.ELEMENT_NODE) {
 66  0 return NodeGoal.deserialize(node, parser);
 67    }
 68  0 else if (node.getNodeName() == "webService" && node.getNodeType() == Node.ELEMENT_NODE) {
 69  0 return NodeWebService.deserialize(node, parser);
 70    }
 71    }
 72   
 73  0 return null;
 74    }
 75   
 76  0 public static Element serializeTopEntity(TopEntity[] entities, WsmlXmlSerializer serializer) {
 77  0 Element wsmlElement = serializer.createElement("wsml");
 78  0 for (int i = 0; i < entities.length; i++) {
 79  0 if (entities[i] instanceof Ontology) {
 80  0 wsmlElement.appendChild(NodeOntology.serialize((Ontology) entities[i], serializer));
 81    }
 82  0 else if (entities[i] instanceof Mediator) {
 83  0 NodeMediator.serializeMediator(wsmlElement, (Mediator) entities[i], serializer);
 84    }
 85  0 else if (entities[i] instanceof Goal) {
 86  0 wsmlElement.appendChild(NodeGoal.serialize((Goal) entities[i], serializer));
 87    }
 88  0 else if (entities[i] instanceof WebService) {
 89  0 wsmlElement.appendChild(NodeWebService.serialize((WebService) entities[i], serializer));
 90    }
 91    }
 92   
 93  0 return wsmlElement;
 94    }
 95    }
 96   
 97    /*
 98    * $Log$
 99    * Revision 1.2 2007/04/04 08:37:59 alex_simov
 100    * The serializer is enabled for all types of topentities
 101    *
 102    * Revision 1.1 2005/11/28 14:03:48 vassil_momtchev
 103    * package refactored from com.ontotext.wsmo4j.xmlparser to com.ontotext.wsmo4j.parser.xml
 104    *
 105    * Revision 1.4 2005/08/31 09:24:22 vassil_momtchev
 106    * add InvalidModelException and ParserException to LogicalExpressionFactory::createLogixExpression methods
 107    *
 108    * Revision 1.3 2005/08/08 08:24:40 vassil_momtchev
 109    * javadoc added, bugfixes
 110    *
 111    */