Clover coverage report -
Coverage timestamp: Sat Jul 7 2007 16:41:13 CEST
file stats: LOC: 226   Methods: 20
NCLOC: 86   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
WebServiceService.java - 0% 0% 0%
coverage
 1    /**
 2    * JTRunner is free software; you can redistribute it and/or modify it under the
 3    * terms of the GNU General Public License as published by the Free Software
 4    * Foundation; either version 2, or (at your option) any later version.
 5    */
 6   
 7    package jtr.config.ws;
 8   
 9    import java.io.Serializable;
 10    import java.util.Collection;
 11    import java.util.HashMap;
 12   
 13    import javax.xml.namespace.QName;
 14   
 15    /**
 16    * This class is the object oriented representation of a <code>service</code>
 17    * element of a <code>jtr.xml</code> configuration file.<br>
 18    * It can be assimilated to the concept of WSDL <i>service</i>. As such it
 19    * hosts information like ports and port types, and is uniquely identified by
 20    * a <code>QName</code>.<br>
 21    * Moreover a service definition might include type mapping information too.
 22    * A type mapping states which Java class should be used to represent an XML
 23    * data type. These classes are used to marshall and unmarshall messages at
 24    * runtime.
 25    *
 26    * @author Francesco Russo (frusso@dev.java.net)
 27    * @version 4.0
 28    * @since 3.0
 29    */
 30    public class WebServiceService implements Serializable {
 31    /**
 32    * Default constructor.
 33    */
 34  0 public WebServiceService() {
 35  0 portTypes = new HashMap<QName,WebServicePortType>();
 36  0 ports = new HashMap<String,WebServicePort>();
 37  0 typeMappings = new HashMap<QName,WebServiceTypeMapping>();
 38    }
 39   
 40    /**
 41    * Get the configured port types.
 42    * @return Collection<WebServicePortType>
 43    */
 44  0 public Collection<WebServicePortType> getPortTypes() {
 45  0 return portTypes.values();
 46    }
 47   
 48    /**
 49    * Get the unique name.
 50    * @return String
 51    */
 52  0 public String getName() {
 53  0 return name;
 54    }
 55   
 56    /**
 57    * Set the service namespace.
 58    * @param nameSpace
 59    */
 60  0 public void setNameSpace(String nameSpace) {
 61  0 this.nameSpace = nameSpace;
 62    }
 63   
 64    /**
 65    * Set the collection of port types.
 66    * @param portTypes
 67    */
 68  0 public void setPortTypes(Collection<WebServicePortType> portTypes) {
 69  0 for(WebServicePortType pt : portTypes) {
 70  0 this.addPortType(pt);
 71    }
 72    }
 73   
 74    /**
 75    * Set the service name.
 76    * @param name
 77    */
 78  0 public void setName(String name) {
 79  0 this.name = name;
 80    }
 81   
 82    /**
 83    * Set the collection of available ports.
 84    * @param ports
 85    */
 86  0 public void setPorts(Collection<WebServicePort> ports) {
 87  0 for(WebServicePort p : ports) {
 88  0 this.addPort(p);
 89    }
 90    }
 91   
 92    /**
 93    * Get the service namespace.
 94    * @return String
 95    */
 96  0 public String getNameSpace() {
 97  0 return nameSpace;
 98    }
 99   
 100    /**
 101    * Get the collection of configured ports.
 102    * @return Collection<WebServicePort>
 103    */
 104  0 public Collection<WebServicePort> getPorts() {
 105  0 return ports.values();
 106    }
 107   
 108    /**
 109    * Add a single port type the the set of configured ones.
 110    * @param pt
 111    */
 112  0 public void addPortType(WebServicePortType pt) {
 113  0 portTypes.put(new QName(pt.getNameSpace(),pt.getName()),pt);
 114    }
 115   
 116    /**
 117    * Add a single port to the set of configured ones.
 118    * @param port
 119    */
 120  0 public void addPort(WebServicePort port) {
 121  0 ports.put(port.getName(),port);
 122    }
 123   
 124    /**
 125    * Get the collection of type mappings available for the current service
 126    * specification.
 127    * @return Returns the typeMappings.
 128    */
 129  0 public Collection<WebServiceTypeMapping> getTypeMappings() {
 130  0 return typeMappings.values();
 131    }
 132   
 133    /**
 134    * Set the type mappings for the current service specification.
 135    * @param typeMappings
 136    * The typeMappings to set.
 137    */
 138  0 public void setTypeMappings(Collection<WebServiceTypeMapping> typeMappings) {
 139  0 for(WebServiceTypeMapping tm : typeMappings) {
 140  0 this.addTypeMapping(tm);
 141    }
 142    }
 143   
 144    /**
 145    * Add a single type mapping to the current service specification.
 146    * @param qualifiedName
 147    * @param tm
 148    */
 149  0 public void addTypeMapping(QName qualifiedName, WebServiceTypeMapping tm) {
 150  0 tm.setQualifiedName(qualifiedName);
 151  0 this.typeMappings.put(qualifiedName,tm);
 152    }
 153   
 154    /**
 155    * Add a single type mapping to the current service specification.
 156    * @param nameSpace
 157    * @param name
 158    * @param javaClassName
 159    */
 160  0 public void addTypeMapping(String nameSpace, String name, String javaClassName) {
 161  0 WebServiceTypeMapping mapping = new WebServiceTypeMapping();
 162  0 mapping.setQualifiedName(nameSpace, name);
 163  0 mapping.setJavaClassName(javaClassName);
 164  0 this.addTypeMapping(mapping);
 165    }
 166   
 167    /**
 168    * Add a single type mapping to the current service specification.
 169    * @param qName
 170    * @param javaClassName
 171    */
 172  0 public void addTypeMapping(QName qName, String javaClassName) {
 173  0 WebServiceTypeMapping mapping = new WebServiceTypeMapping();
 174  0 mapping.setQualifiedName(qName);
 175  0 mapping.setJavaClassName(javaClassName);
 176  0 this.addTypeMapping(mapping);
 177    }
 178   
 179    /**
 180    * Add a single type mapping to the current service specification.
 181    * @param typeMapping
 182    */
 183  0 public void addTypeMapping(WebServiceTypeMapping typeMapping) {
 184  0 typeMappings.put(typeMapping.getQualifiedName(),typeMapping);
 185    }
 186   
 187    /**
 188    * Get the port type identified by the given <code>QName</code> or
 189    * <code>null</code> if nothing can be found.
 190    * @param qName
 191    * @return WebServicePortType
 192    */
 193  0 public WebServicePortType getPortType(QName qName) {
 194  0 return portTypes.get(qName);
 195    }
 196   
 197    /**
 198    * Get the port identified by the given <code>name</code> or
 199    * <code>null</code> if nothing can be found.
 200    * @param name
 201    * @return WebServicePort
 202    */
 203  0 public WebServicePort getPort(String name) {
 204  0 return ports.get(name);
 205    }
 206   
 207    /**
 208    * Get the type mapping identified by the given <code>QName</code> or
 209    * <code>null</code> if nothing can be found.
 210    * @param qName
 211    * @return WebServiceTypeMapping
 212    */
 213  0 public WebServiceTypeMapping getTypeMapping(QName qName) {
 214  0 return typeMappings.get(qName);
 215    }
 216   
 217    private String nameSpace;
 218   
 219    private String name;
 220   
 221    private HashMap<QName,WebServicePortType> portTypes;
 222   
 223    private HashMap<String,WebServicePort> ports;
 224   
 225    private HashMap<QName,WebServiceTypeMapping> typeMappings;
 226    }