Clover coverage report - Apache Addressing - 1.0
Coverage timestamp: Tue Mar 22 2005 07:59:24 EST
file stats: LOC: 403   Methods: 23
NCLOC: 211   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
EndpointReferenceType.java 38.9% 77% 87% 70.3%
coverage coverage
 1   
 /*
 2   
  * Copyright  1999-2004 The Apache Software Foundation.
 3   
  *
 4   
  *  Licensed under the Apache License, Version 2.0 (the "License");
 5   
  *  you may not use this file except in compliance with the License.
 6   
  *  You may obtain a copy of the License at
 7   
  *
 8   
  *      http://www.apache.org/licenses/LICENSE-2.0
 9   
  *
 10   
  *  Unless required by applicable law or agreed to in writing, software
 11   
  *  distributed under the License is distributed on an "AS IS" BASIS,
 12   
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13   
  *  See the License for the specific language governing permissions and
 14   
  *  limitations under the License.
 15   
  *
 16   
  */
 17   
 
 18   
 package org.apache.axis.message.addressing;
 19   
 
 20   
 import org.apache.axis.encoding.AnyContentType;
 21   
 import org.apache.axis.message.MessageElement;
 22   
 import org.apache.axis.types.URI;
 23   
 import org.apache.axis.utils.XMLUtils;
 24   
 
 25   
 import java.io.Serializable;
 26   
 
 27   
 /**
 28   
  * Java content class for EndpointReferenceType complex type.
 29   
  * <p>The following schema fragment specifies the expected content contained within this java content object. (defined at http://schemas.xmlsoap.org/ws/2004/08/addressing line 46)
 30   
  * <p>
 31   
  * <pre>
 32   
  * &lt;complexType name="EndpointReferenceType">
 33   
  *   &lt;complexContent>
 34   
  *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 35   
  *       &lt;sequence>
 36   
  *         &lt;element name="Address" type="{http://schemas.xmlsoap.org/ws/2004/08/addressing}AttributedURI"/>
 37   
  *         &lt;element name="ReferenceProperties" type="{http://schemas.xmlsoap.org/ws/2004/08/addressing}ReferencePropertiesType" minOccurs="0"/>
 38   
  *         &lt;element name="ReferenceParameters" type="{http://schemas.xmlsoap.org/ws/2004/08/addressing}ReferenceParametersType" minOccurs="0"/>
 39   
  *         &lt;element name="PortType" type="{http://schemas.xmlsoap.org/ws/2004/08/addressing}AttributedQName" minOccurs="0"/>
 40   
  *         &lt;element name="ServiceName" type="{http://schemas.xmlsoap.org/ws/2004/08/addressing}ServiceNameType" minOccurs="0"/>
 41   
  *         &lt;any/>
 42   
  *       &lt;/sequence>
 43   
  *     &lt;/restriction>
 44   
  *   &lt;/complexContent>
 45   
  * &lt;/complexType>
 46   
  * </pre>
 47   
  * 
 48   
  * @author Davanum Srinivas (dims@yahoo.com)
 49   
  */
 50   
 public class EndpointReferenceType implements AnyContentType, Serializable {
 51   
     /**
 52   
      * Field address
 53   
      */
 54   
     private AttributedURI address;
 55   
 
 56   
     /**
 57   
      * Field portType
 58   
      */
 59   
     private AttributedQName portType;
 60   
 
 61   
     /**
 62   
      * Field serviceName
 63   
      */
 64   
     private ServiceNameType serviceName;
 65   
 
 66   
     /**
 67   
      * Field properties
 68   
      */
 69   
     private ReferencePropertiesType properties = new ReferencePropertiesType();
 70   
 
 71   
     /**
 72   
      * Field parameters
 73   
      */
 74   
     private ReferenceParametersType parameters = new ReferenceParametersType();
 75   
 
 76   
     /*
 77   
      * Field extensibility elements
 78   
      */
 79   
     private MessageElement [] _any;
 80   
 
 81   
     /**
 82   
      * Constructor EndpointReferenceType
 83   
      */
 84  56
     public EndpointReferenceType() {
 85   
     }
 86   
 
 87   
     /**
 88   
      * Constructor EndpointReferenceType
 89   
      * 
 90   
      * @param address 
 91   
      */
 92  0
     public EndpointReferenceType(URI address) {
 93  0
         this.address = new AttributedURI(address);
 94   
     }
 95   
 
 96   
     /**
 97   
      * Constructor EndpointReferenceType
 98   
      * 
 99   
      * @param address 
 100   
      */
 101  0
     public EndpointReferenceType(Address address) {
 102  0
         this.address = address;
 103   
     }
 104   
 
 105   
     /**
 106   
      * Constructor EndpointReferenceType (performs shallow copy)
 107   
      * 
 108   
      * @param endpoint 
 109   
      */
 110  11
     public EndpointReferenceType(EndpointReferenceType endpoint) {
 111  11
         this(endpoint, false);
 112   
     }
 113   
 
 114   
     /**
 115   
      * Constructor EndpointReferenceType
 116   
      * 
 117   
      * @param endpoint 
 118   
      * @param deepCopy
 119   
      */
 120  13
     public EndpointReferenceType(EndpointReferenceType endpoint,
 121   
                                  boolean deepCopy) {
 122  13
         if (deepCopy) {
 123  1
             deepCopy(endpoint);
 124   
         } else {
 125  12
             shallowCopy(endpoint);
 126   
         }
 127   
     }
 128   
     
 129  12
     private void shallowCopy(EndpointReferenceType endpoint) {
 130  12
         setAddress(endpoint.getAddress());
 131  12
         setPortType(endpoint.getPortType());
 132  12
         setServiceName(endpoint.getServiceName());
 133  12
         ReferencePropertiesType properties = endpoint.getProperties();
 134  12
         if (properties != null) {
 135  12
             setProperties(new ReferencePropertiesType(properties, false));
 136   
         }
 137  12
         ReferenceParametersType parameters = endpoint.getParameters();
 138  12
         if (parameters != null) {
 139  12
             setParameters(new ReferenceParametersType(parameters, false));
 140   
         }
 141   
         // handle extensibility
 142  12
         MessageElement [] any = endpoint.get_any();
 143  12
         if (any != null && any.length > 0) {
 144  2
             MessageElement [] newAny = new MessageElement[any.length];
 145  2
             System.arraycopy(any, 0, newAny, 0, any.length);
 146  2
             set_any(newAny);
 147   
         }
 148   
     }
 149   
 
 150  1
     private void deepCopy(EndpointReferenceType endpoint) {
 151  1
         AttributedURI address = endpoint.getAddress();
 152  1
         if (address != null) {
 153  1
             setAddress(new AttributedURI(address));
 154   
         }
 155  1
         AttributedQName port = endpoint.getPortType();
 156  1
         if (port != null) {
 157  1
             setPortType(new AttributedQName(port));
 158   
         }
 159  1
         ServiceNameType serviceName = endpoint.getServiceName();
 160  1
         if (serviceName != null) {
 161  1
             setServiceName(new ServiceNameType(serviceName));
 162   
         }
 163  1
         ReferencePropertiesType properties = endpoint.getProperties();
 164  1
         if (properties != null) {
 165  1
             setProperties(new ReferencePropertiesType(properties, true));
 166   
         }
 167  1
         ReferenceParametersType parameters = endpoint.getParameters();
 168  1
         if (parameters != null) {
 169  1
             setParameters(new ReferenceParametersType(parameters, true));
 170   
         }
 171   
         // handle extensibility
 172  1
         MessageElement elem = null;
 173  1
         MessageElement [] any = endpoint.get_any();
 174  1
         if (any != null) {
 175  1
             MessageElement [] newAny = new MessageElement[any.length];
 176  1
             for (int i=0; i<any.length; i++) {
 177  1
                 elem = any[i];
 178  1
                 try {
 179  1
                     newAny[i] = new MessageElement(elem.getAsDOM());
 180   
                 } catch (Exception e) {
 181   
                     // if failed just copy reference
 182  0
                     newAny[i] = elem;
 183   
                 }
 184   
             }
 185  1
             set_any(newAny);
 186   
         }
 187   
     }
 188   
     
 189   
     /**
 190   
      * Method getAddress
 191   
      * 
 192   
      * @return 
 193   
      */
 194  77
     public AttributedURI getAddress() {
 195  77
         return address;
 196   
     }
 197   
 
 198   
     /**
 199   
      * Method setAddress
 200   
      * 
 201   
      * @param address 
 202   
      */
 203  69
     public void setAddress(AttributedURI address) {
 204  69
         this.address = address;
 205   
     }
 206   
 
 207   
     /**
 208   
      * Method getPortType
 209   
      * 
 210   
      * @return 
 211   
      */
 212  59
     public AttributedQName getPortType() {
 213  59
         return portType;
 214   
     }
 215   
 
 216   
     /**
 217   
      * Method setPortType
 218   
      * 
 219   
      * @param portType 
 220   
      */
 221  25
     public void setPortType(AttributedQName portType) {
 222  25
         this.portType = portType;
 223   
     }
 224   
 
 225   
     /**
 226   
      * Method getProperties
 227   
      * 
 228   
      * @return 
 229   
      */
 230  43
     public ReferencePropertiesType getProperties() {
 231  43
         return properties;
 232   
     }
 233   
 
 234   
     /**
 235   
      * Method setProperties
 236   
      * 
 237   
      * @param properties 
 238   
      */
 239  26
     public void setProperties(ReferencePropertiesType properties) {
 240  26
         this.properties = properties;
 241   
     }
 242   
 
 243   
     /**
 244   
      * Method getParameters
 245   
      * 
 246   
      * @return 
 247   
      */
 248  16
     public ReferenceParametersType getParameters() {
 249  16
         return parameters;
 250   
     }
 251   
 
 252   
     /**
 253   
      * Method setParameters
 254   
      * 
 255   
      * @param parameters 
 256   
      */
 257  15
     public void setParameters(ReferenceParametersType parameters) {
 258  15
         this.parameters = parameters;
 259   
     }
 260   
 
 261   
     /**
 262   
      * Method getServiceName
 263   
      * 
 264   
      * @return 
 265   
      */
 266  63
     public ServiceNameType getServiceName() {
 267  63
         return serviceName;
 268   
     }
 269   
 
 270   
     /**
 271   
      * Method setServiceName
 272   
      * 
 273   
      * @param serviceName 
 274   
      */
 275  25
     public void setServiceName(ServiceNameType serviceName) {
 276  25
         this.serviceName = serviceName;
 277   
     }
 278   
 
 279   
     /**
 280   
      * Method get_any
 281   
      * @return
 282   
      */
 283  39
     public MessageElement[] get_any() {
 284  39
         return _any;
 285   
     }
 286   
     
 287   
     /**
 288   
      * Method set_any
 289   
      * @param _any
 290   
      */
 291  8
     public void set_any(MessageElement[] _any) {
 292  8
         this._any = _any;
 293   
     }
 294   
     
 295  0
     public String toString() {
 296  0
         StringBuffer buf = new StringBuffer();
 297  0
         if (this.address != null) {
 298  0
             buf.append("Address: " + this.address);
 299  0
             buf.append("\n");
 300   
         }
 301  0
         if (this.portType != null) {
 302  0
             buf.append("Port Type: " + this.portType);
 303  0
             buf.append("\n");
 304   
         }
 305  0
         if (this.serviceName != null) {
 306  0
             buf.append("Service Name: " + this.serviceName);
 307  0
             buf.append("\n");
 308  0
             if (this.serviceName.getPort() != null) {
 309  0
                 buf.append("Port Name: " + this.serviceName.getPort());
 310  0
                 buf.append("\n");
 311   
             }
 312   
         }
 313  0
         if (this.properties != null) {
 314  0
             buf.append(this.properties);
 315   
         }
 316  0
         if (this._any != null) {
 317  0
             for (int i=0;i<this._any.length;i++) {
 318  0
                 buf.append("Extensibility Element[" + i + "]:\n");
 319  0
                 try {
 320  0
                     buf.append(XMLUtils.ElementToString(this._any[i].getAsDOM()));
 321   
                 } catch (Exception e) {
 322  0
                     buf.append("<error converting: " + e.getMessage() + ">");
 323   
                 }
 324  0
                 buf.append("\n");
 325   
             }
 326   
         }
 327  0
         return buf.toString();
 328   
     }
 329   
 
 330   
     // Axis bits to serialize/deserialize the fields correctly
 331   
     
 332   
     // Type metadata
 333   
     private static org.apache.axis.description.TypeDesc typeDesc =
 334   
         new org.apache.axis.description.TypeDesc(EndpointReferenceType.class, true);
 335   
 
 336   
     static {
 337  5
         typeDesc.setXmlType(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING_DEFAULT, "EndpointReferenceType"));
 338  5
         org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
 339  5
         elemField.setFieldName("address");
 340  5
         elemField.setXmlName(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING_DEFAULT, "Address"));
 341  5
         elemField.setXmlType(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING_DEFAULT, "AttributedURI"));
 342  5
         typeDesc.addFieldDesc(elemField);
 343  5
         elemField = new org.apache.axis.description.ElementDesc();
 344  5
         elemField.setFieldName("properties");
 345  5
         elemField.setXmlName(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING_DEFAULT, "ReferenceProperties"));
 346  5
         elemField.setXmlType(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING_DEFAULT, "ReferencePropertiesType"));
 347  5
         elemField.setMinOccurs(0);
 348  5
         typeDesc.addFieldDesc(elemField);
 349  5
         elemField = new org.apache.axis.description.ElementDesc();
 350  5
         elemField.setFieldName("parameters");
 351  5
         elemField.setXmlName(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING_DEFAULT, "ReferenceParameters"));
 352  5
         elemField.setXmlType(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING_DEFAULT, "ReferenceParametersType"));
 353  5
         elemField.setMinOccurs(0);
 354  5
         typeDesc.addFieldDesc(elemField);
 355  5
         elemField = new org.apache.axis.description.ElementDesc();
 356  5
         elemField.setFieldName("portType");
 357  5
         elemField.setXmlName(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING_DEFAULT, "PortType"));
 358  5
         elemField.setXmlType(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING_DEFAULT, "AttributedQName"));
 359  5
         elemField.setMinOccurs(0);
 360  5
         typeDesc.addFieldDesc(elemField);
 361  5
         elemField = new org.apache.axis.description.ElementDesc();
 362  5
         elemField.setFieldName("serviceName");
 363  5
         elemField.setXmlName(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING_DEFAULT, "ServiceName"));
 364  5
         elemField.setXmlType(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING_DEFAULT, "ServiceNameType"));
 365  5
         elemField.setMinOccurs(0);
 366  5
         typeDesc.addFieldDesc(elemField);
 367   
     }
 368   
 
 369   
     /**
 370   
      * Return type metadata object
 371   
      */
 372  1
     public static org.apache.axis.description.TypeDesc getTypeDesc() {
 373  1
         return typeDesc;
 374   
     }
 375   
 
 376   
 
 377   
     /**
 378   
      * Get Custom Serializer
 379   
      */
 380  3
     public static org.apache.axis.encoding.Serializer getSerializer(
 381   
            java.lang.String mechType, 
 382   
            java.lang.Class _javaType,  
 383   
            javax.xml.namespace.QName _xmlType) {
 384  3
         return 
 385   
           new  org.apache.axis.encoding.ser.BeanSerializer(
 386   
             _javaType, _xmlType, typeDesc);
 387   
     }
 388   
 
 389   
     /**
 390   
      * Get Custom Deserializer
 391   
      */
 392  3
     public static org.apache.axis.encoding.Deserializer getDeserializer(
 393   
            java.lang.String mechType, 
 394   
            java.lang.Class _javaType,  
 395   
            javax.xml.namespace.QName _xmlType) {
 396  3
         return 
 397   
           new  org.apache.axis.encoding.ser.BeanDeserializer(
 398   
             _javaType, _xmlType, typeDesc);
 399   
     }
 400   
 }
 401   
 
 402   
 
 403