You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by di...@apache.org on 2004/10/17 05:14:59 UTC

cvs commit: ws-fx/addressing/src/org/apache/axis/message/addressing EndpointReferenceType.java ReferenceParametersType.java ReferencePropertiesType.java

dims        2004/10/16 20:14:59

  Modified:    addressing/src/org/apache/axis/message/addressing
                        EndpointReferenceType.java
                        ReferenceParametersType.java
                        ReferencePropertiesType.java
  Log:
  Cleanup the new ReferenceParameters stuff in 2004/08 xsd.
  
  Revision  Changes    Path
  1.16      +40 -4     ws-fx/addressing/src/org/apache/axis/message/addressing/EndpointReferenceType.java
  
  Index: EndpointReferenceType.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/EndpointReferenceType.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- EndpointReferenceType.java	16 Oct 2004 18:27:46 -0000	1.15
  +++ EndpointReferenceType.java	17 Oct 2004 03:14:59 -0000	1.16
  @@ -17,14 +17,12 @@
   
   package org.apache.axis.message.addressing;
   
  -import java.io.Serializable;
  -
  +import org.apache.axis.encoding.AnyContentType;
   import org.apache.axis.message.MessageElement;
   import org.apache.axis.types.URI;
  -import org.apache.axis.encoding.AnyContentType;
   import org.apache.axis.utils.XMLUtils;
   
  -import org.w3c.dom.Element;
  +import java.io.Serializable;
   
   /**
    * Java content class for EndpointReferenceType complex type.
  @@ -37,6 +35,7 @@
    *       <sequence>
    *         <element name="Address" type="{http://schemas.xmlsoap.org/ws/2004/08/addressing}AttributedURI"/>
    *         <element name="ReferenceProperties" type="{http://schemas.xmlsoap.org/ws/2004/08/addressing}ReferencePropertiesType" minOccurs="0"/>
  + *         <element name="ReferenceParameters" type="{http://schemas.xmlsoap.org/ws/2004/08/addressing}ReferenceParametersType" minOccurs="0"/>
    *         <element name="PortType" type="{http://schemas.xmlsoap.org/ws/2004/08/addressing}AttributedQName" minOccurs="0"/>
    *         <element name="ServiceName" type="{http://schemas.xmlsoap.org/ws/2004/08/addressing}ServiceNameType" minOccurs="0"/>
    *         <any/>
  @@ -69,6 +68,11 @@
        */
       private ReferencePropertiesType properties = new ReferencePropertiesType();
   
  +    /**
  +     * Field parameters
  +     */
  +    private ReferenceParametersType parameters = new ReferenceParametersType();
  +
       /*
        * Field extensibility elements
        */
  @@ -130,6 +134,10 @@
           if (properties != null) {
               setProperties(new ReferencePropertiesType(properties, false));
           }
  +        ReferenceParametersType parameters = endpoint.getParameters();
  +        if (parameters != null) {
  +            setParameters(new ReferenceParametersType(parameters, false));
  +        }
           // handle extensibility
           MessageElement [] any = endpoint.get_any();
           if (any != null && any.length > 0) {
  @@ -156,6 +164,10 @@
           if (properties != null) {
               setProperties(new ReferencePropertiesType(properties, true));
           }
  +        ReferenceParametersType parameters = endpoint.getParameters();
  +        if (parameters != null) {
  +            setParameters(new ReferenceParametersType(parameters, true));
  +        }
           // handle extensibility
           MessageElement elem = null;
           MessageElement [] any = endpoint.get_any();
  @@ -229,6 +241,24 @@
       }
   
       /**
  +     * Method getParameters
  +     * 
  +     * @return 
  +     */
  +    public ReferenceParametersType getParameters() {
  +        return parameters;
  +    }
  +
  +    /**
  +     * Method setParameters
  +     * 
  +     * @param parameters 
  +     */
  +    public void setParameters(ReferenceParametersType parameters) {
  +        this.parameters = parameters;
  +    }
  +
  +    /**
        * Method getServiceName
        * 
        * @return 
  @@ -314,6 +344,12 @@
           elemField.setFieldName("properties");
           elemField.setXmlName(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING, "ReferenceProperties"));
           elemField.setXmlType(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING, "ReferencePropertiesType"));
  +        elemField.setMinOccurs(0);
  +        typeDesc.addFieldDesc(elemField);
  +        elemField = new org.apache.axis.description.ElementDesc();
  +        elemField.setFieldName("parameters");
  +        elemField.setXmlName(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING, "ReferenceParameters"));
  +        elemField.setXmlType(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING, "ReferenceParametersType"));
           elemField.setMinOccurs(0);
           typeDesc.addFieldDesc(elemField);
           elemField = new org.apache.axis.description.ElementDesc();
  
  
  
  1.2       +184 -53   ws-fx/addressing/src/org/apache/axis/message/addressing/ReferenceParametersType.java
  
  Index: ReferenceParametersType.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/ReferenceParametersType.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ReferenceParametersType.java	16 Oct 2004 18:27:46 -0000	1.1
  +++ ReferenceParametersType.java	17 Oct 2004 03:14:59 -0000	1.2
  @@ -1,90 +1,218 @@
  -/**
  - * ReferenceParametersType.java
  +/*
  + * Copyright  1999-2004 The Apache Software Foundation.
  + *
  + *  Licensed under the Apache License, Version 2.0 (the "License");
  + *  you may not use this file except in compliance with the License.
  + *  You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + *  Unless required by applicable law or agreed to in writing, software
  + *  distributed under the License is distributed on an "AS IS" BASIS,
  + *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + *  See the License for the specific language governing permissions and
  + *  limitations under the License.
    *
  - * This file was auto-generated from WSDL
  - * by the Apache Axis 1.2RC1 Oct 15, 2004 (11:23:46 EDT) WSDL2Java emitter.
    */
   
   package org.apache.axis.message.addressing;
   
  -public class ReferenceParametersType  implements java.io.Serializable, org.apache.axis.encoding.AnyContentType {
  -    private org.apache.axis.message.MessageElement [] _any;
  +import org.apache.axis.encoding.AnyContentType;
  +import org.apache.axis.message.MessageElement;
  +import org.apache.axis.utils.XMLUtils;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.w3c.dom.Document;
  +import org.w3c.dom.Element;
  +
  +import javax.xml.namespace.QName;
  +import java.io.Serializable;
  +
  +/**
  + * Java content class for ReferenceParametersType complex type.
  + * <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 62)
  + * <p>
  + * <pre>
  + * &lt;complexType name="ReferenceParametersType">
  + *   &lt;complexContent>
  + *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
  + *       &lt;sequence>
  + *         &lt;any/>
  + *       &lt;/sequence>
  + *     &lt;/restriction>
  + *   &lt;/complexContent>
  + * &lt;/complexType>
  + * </pre>
  + * 
  + * @author Davanum Srinivas (dims@yahoo.com)
  + */
  +public class ReferenceParametersType implements Serializable, AnyContentType { 
  +
  +    private static Log log = 
  +        LogFactory.getLog(ReferenceParametersType.class.getName());
   
  +    private MessageElement [] _any;
  +
  +    /**
  +     * Constructor ReferenceParameters
  +     */
       public ReferenceParametersType() {
       }
  +    
  +    /**
  +     * Constructor ReferenceParameters
  +     */
  +    public ReferenceParametersType(java.lang.Object element) {
  +    	add(element);
  +    }
  +
  +    /**
  +     * Constructor ReferenceParameters (performs shallow copy)
  +     * 
  +     * @param properties
  +     */
  +    public ReferenceParametersType(ReferenceParametersType properties) {
  +        this(properties, false);
  +    }
  +    
  +    /**
  +     * Constructor ReferenceParameters
  +     * 
  +     * @param properties
  +     * @param deepCopy
  +     */
  +    public ReferenceParametersType(ReferenceParametersType properties, 
  +                                   boolean deepCopy) {
  +        if (properties == null) {
  +            throw new IllegalArgumentException();
  +        }
  +        MessageElement elem = null;
  +        for (int i = 0; i < properties.size(); i++) {
  +            elem = properties._any[i];
  +            if (deepCopy) {
  +                // deep copy
  +                try {
  +                    add(new MessageElement(elem.getAsDOM()));
  +                } catch (Exception e) {
  +                    // if failed just copy reference
  +                    add(elem);
  +                }
  +            } else {
  +                // shallow copy
  +                add(elem);
  +            }
  +        }
  +    }
   
  -    public ReferenceParametersType(
  -           org.apache.axis.message.MessageElement [] _any) {
  -           this._any = _any;
  +    public int size() {
  +        return (this._any == null) ? 0 : this._any.length;
       }
   
  +    public Object get(int index) {
  +        return this._any[index];
  +    }
  +
  +    /**
  +     * Get a (single) MessageElement matching the passed QName
  +     * @param qname
  +     * @return
  +     */
  +    public MessageElement get(QName qname) {
  +        for (int i = 0; i < _any.length; i++) {
  +            MessageElement messageElement = _any[i];
  +            if (messageElement.getQName().equals(qname))
  +                return messageElement;
  +        }
  +        return null;
  +    }
  +
  +    public void add(Object element) {
  +        MessageElement value = null;
  +        if (element instanceof MessageElement) {
  +            value = (MessageElement)element;
  +        } else if (element instanceof Element) {
  +            value = new MessageElement((Element)element);
  +        } else {
  +            throw new IllegalArgumentException();
  +        }
  +
  +        if (this._any == null) {
  +            this._any = new MessageElement[] {value};
  +        } else {
  +            MessageElement [] any = null;
  +            any = new MessageElement[this._any.length + 1];
  +            System.arraycopy(this._any, 0,
  +                             any, 0, 
  +                             this._any.length);
  +            any[this._any.length] = value;
  +            this._any = any;
  +        }
  +    }
  +
  +    /**
  +     * append DOM node to parent
  +     * 
  +     * @param parent 
  +     */
  +    public void append(Element parent, String elementName) {
  +        Document doc = parent.getOwnerDocument();
  +        Element refProp = doc.createElementNS(Constants.NS_URI_ADDRESSING,
  +                                              elementName);
  +        MessageElement [] any = get_any();
  +        if (any != null) {
  +            try {
  +                for (int i=0;i<any.length;i++) {
  +                    refProp.appendChild(doc.importNode(any[i].getAsDOM(), 
  +                                                       true));
  +                }
  +            } catch (Exception e) {
  +                log.debug("", e);
  +            }
  +        }
  +        parent.appendChild(refProp);
  +    }
   
       /**
        * Gets the _any value for this ReferenceParametersType.
        * 
        * @return _any
        */
  -    public org.apache.axis.message.MessageElement [] get_any() {
  +    public MessageElement [] get_any() {
           return _any;
       }
  -
  -
  +    
       /**
        * Sets the _any value for this ReferenceParametersType.
        * 
        * @param _any
        */
  -    public void set_any(org.apache.axis.message.MessageElement [] _any) {
  +    public void set_any(MessageElement [] _any) {
           this._any = _any;
       }
  -
  -    private java.lang.Object __equalsCalc = null;
  -    public synchronized boolean equals(java.lang.Object obj) {
  -        if (!(obj instanceof ReferenceParametersType)) return false;
  -        ReferenceParametersType other = (ReferenceParametersType) obj;
  -        if (obj == null) return false;
  -        if (this == obj) return true;
  -        if (__equalsCalc != null) {
  -            return (__equalsCalc == obj);
  -        }
  -        __equalsCalc = obj;
  -        boolean _equals;
  -        _equals = true && 
  -            ((this._any==null && other.get_any()==null) || 
  -             (this._any!=null &&
  -              java.util.Arrays.equals(this._any, other.get_any())));
  -        __equalsCalc = null;
  -        return _equals;
  -    }
  -
  -    private boolean __hashCodeCalc = false;
  -    public synchronized int hashCode() {
  -        if (__hashCodeCalc) {
  -            return 0;
  -        }
  -        __hashCodeCalc = true;
  -        int _hashCode = 1;
  -        if (get_any() != null) {
  -            for (int i=0;
  -                 i<java.lang.reflect.Array.getLength(get_any());
  -                 i++) {
  -                java.lang.Object obj = java.lang.reflect.Array.get(get_any(), i);
  -                if (obj != null &&
  -                    !obj.getClass().isArray()) {
  -                    _hashCode += obj.hashCode();
  -                }
  +    
  +    public String toString() {
  +        if (this._any == null) {
  +            return "";
  +        }
  +        StringBuffer buf = new StringBuffer();
  +        for (int i=0;i<this._any.length;i++) {
  +            buf.append("Reference property[" + i + "]:\n");
  +            try {
  +                buf.append(XMLUtils.ElementToString(this._any[i].getAsDOM()));
  +            } catch (Exception e) {
  +                buf.append("<error converting: " + e.getMessage() + ">");
               }
  +            buf.append("\n");
           }
  -        __hashCodeCalc = false;
  -        return _hashCode;
  +        return buf.toString();
       }
   
       // Type metadata
       private static org.apache.axis.description.TypeDesc typeDesc =
           new org.apache.axis.description.TypeDesc(ReferenceParametersType.class, true);
  -
  +    
       static {
  -        typeDesc.setXmlType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2004/08/addressing", "ReferenceParametersType"));
  +        typeDesc.setXmlType(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING, "ReferenceParametersType"));
       }
   
       /**
  @@ -94,6 +222,7 @@
           return typeDesc;
       }
   
  +
       /**
        * Get Custom Serializer
        */
  @@ -119,3 +248,5 @@
       }
   
   }
  +
  +
  
  
  
  1.14      +5 -11     ws-fx/addressing/src/org/apache/axis/message/addressing/ReferencePropertiesType.java
  
  Index: ReferencePropertiesType.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/ReferencePropertiesType.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ReferencePropertiesType.java	16 Oct 2004 18:27:46 -0000	1.13
  +++ ReferencePropertiesType.java	17 Oct 2004 03:14:59 -0000	1.14
  @@ -17,22 +17,16 @@
   
   package org.apache.axis.message.addressing;
   
  -import org.w3c.dom.Element;
  -import org.w3c.dom.Node;
  -import org.w3c.dom.Document;
  -
  -import java.io.Serializable;
  -import java.util.Iterator;
  -import java.util.LinkedList;
  -
  -import org.apache.axis.message.MessageElement;
   import org.apache.axis.encoding.AnyContentType;
  +import org.apache.axis.message.MessageElement;
   import org.apache.axis.utils.XMLUtils;
  -
  -import org.apache.commons.logging.LogFactory;
   import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.w3c.dom.Document;
  +import org.w3c.dom.Element;
   
   import javax.xml.namespace.QName;
  +import java.io.Serializable;
   
   /**
    * Java content class for ReferencePropertiesType complex type.