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 ga...@apache.org on 2004/06/19 00:02:12 UTC

cvs commit: ws-fx/addressing/test/addressing/tools PingService.java TestTools.java

gawor       2004/06/18 15:02:11

  Modified:    addressing/src/org/apache/axis/message/addressing
                        AddressingHeaders.java AttributedURI.java
                        EndpointReference.java EndpointReferenceType.java
                        ReferencePropertiesType.java
               addressing/src/org/apache/axis/message/addressing/handler
                        AddressingHandler.java
               addressing/test/addressing/tools PingService.java
                        TestTools.java
  Log:
  EndpointReferenceType extensibility and some minor code cleanup
  
  Revision  Changes    Path
  1.11      +5 -1      ws-fx/addressing/src/org/apache/axis/message/addressing/AddressingHeaders.java
  
  Index: AddressingHeaders.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/AddressingHeaders.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AddressingHeaders.java	18 Jun 2004 20:56:56 -0000	1.10
  +++ AddressingHeaders.java	18 Jun 2004 22:02:11 -0000	1.11
  @@ -23,7 +23,11 @@
   
   import javax.xml.namespace.QName;
   import javax.xml.parsers.ParserConfigurationException;
  -import javax.xml.soap.*;
  +import javax.xml.soap.SOAPEnvelope;
  +import javax.xml.soap.SOAPHeaderElement;
  +import javax.xml.soap.SOAPHeader;
  +import javax.xml.soap.Name;
  +
   import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.List;
  
  
  
  1.9       +4 -1      ws-fx/addressing/src/org/apache/axis/message/addressing/AttributedURI.java
  
  Index: AttributedURI.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/AttributedURI.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AttributedURI.java	18 Jun 2004 20:56:56 -0000	1.8
  +++ AttributedURI.java	18 Jun 2004 22:02:11 -0000	1.9
  @@ -26,7 +26,10 @@
   import javax.xml.soap.SOAPElement;
   import javax.xml.soap.SOAPHeaderElement;
   import javax.xml.soap.Name;
  -import java.util.*;
  +
  +import java.util.Iterator;
  +import java.util.List;
  +import java.util.ArrayList;
   
   import org.w3c.dom.Element;
   
  
  
  
  1.12      +20 -0     ws-fx/addressing/src/org/apache/axis/message/addressing/EndpointReference.java
  
  Index: EndpointReference.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/EndpointReference.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- EndpointReference.java	18 Jun 2004 20:56:56 -0000	1.11
  +++ EndpointReference.java	18 Jun 2004 22:02:11 -0000	1.12
  @@ -18,8 +18,14 @@
   package org.apache.axis.message.addressing;
   
   import org.apache.axis.message.addressing.util.TextExtractor;
  +
   import org.apache.axis.types.URI;
   import org.apache.axis.utils.XMLUtils;
  +import org.apache.axis.message.MessageElement;
  +
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
  @@ -42,6 +48,9 @@
    * @author Davanum Srinivas (dims@yahoo.com)
    */
   public class EndpointReference extends EndpointReferenceType {
  +    
  +    private static Log log =
  +        LogFactory.getLog(EndpointReference.class.getName());
   
       /**
        * Constructor EndpointReference
  @@ -202,6 +211,17 @@
           ReferencePropertiesType referenceProperties = getProperties();
           if (referenceProperties != null && referenceProperties.size() > 0) {
               referenceProperties.append(parent);
  +        }
  +        MessageElement [] any = get_any();
  +        if (any != null && any.length > 0) {
  +            for (int i = 0; i < any.length; i++) {
  +                try {
  +                    parent.appendChild(doc.importNode(any[i].getAsDOM(), 
  +                                                      true));
  +                } catch (Exception e) {
  +                    log.debug("", e);
  +                }
  +            }
           }
           return parent;
       }
  
  
  
  1.12      +43 -1     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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- EndpointReferenceType.java	1 Jun 2004 22:09:05 -0000	1.11
  +++ EndpointReferenceType.java	18 Jun 2004 22:02:11 -0000	1.12
  @@ -17,7 +17,11 @@
   
   package org.apache.axis.message.addressing;
   
  +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;
   
   /**
  @@ -42,7 +46,7 @@
    * 
    * @author Davanum Srinivas (dims@yahoo.com)
    */
  -public class EndpointReferenceType {
  +public class EndpointReferenceType implements AnyContentType {
       /**
        * Field address
        */
  @@ -63,6 +67,11 @@
        */
       private ReferencePropertiesType properties = new ReferencePropertiesType();
   
  +    /*
  +     * Field extensibility elements
  +     */
  +    private MessageElement [] _any;
  +
       /**
        * Constructor EndpointReferenceType
        */
  @@ -104,6 +113,12 @@
               }
               setProperties(props);
           }
  +        MessageElement [] any = endpoint.get_any();
  +        if (any != null && any.length > 0) {
  +            MessageElement [] newAny = new MessageElement[any.length];
  +            System.arraycopy(any, 0, newAny, 0, any.length);
  +            set_any(newAny);
  +        }
       }
       
       /**
  @@ -178,6 +193,22 @@
           this.serviceName = serviceName;
       }
   
  +    /**
  +     * Method get_any
  +     * @return
  +     */
  +    public MessageElement[] get_any() {
  +        return _any;
  +    }
  +    
  +    /**
  +     * Method set_any
  +     * @param _any
  +     */
  +    public void set_any(MessageElement[] _any) {
  +        this._any = _any;
  +    }
  +    
       public String toString() {
           StringBuffer buf = new StringBuffer();
           if (this.address != null) {
  @@ -198,6 +229,17 @@
           }
           if (this.properties != null) {
               buf.append(this.properties);
  +        }
  +        if (this._any != null) {
  +            for (int i=0;i<this._any.length;i++) {
  +                buf.append("Extensibility Element[" + i + "]:\n");
  +                try {
  +                    buf.append(XMLUtils.ElementToString(this._any[i].getAsDOM()));
  +                } catch (Exception e) {
  +                    buf.append("<error converting: " + e.getMessage() + ">");
  +                }
  +                buf.append("\n");
  +            }
           }
           return buf.toString();
       }
  
  
  
  1.9       +4 -2      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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ReferencePropertiesType.java	1 Jun 2004 22:09:05 -0000	1.8
  +++ ReferencePropertiesType.java	18 Jun 2004 22:02:11 -0000	1.9
  @@ -26,8 +26,10 @@
   import java.util.LinkedList;
   
   import org.apache.axis.message.MessageElement;
  +import org.apache.axis.encoding.AnyContentType;
   import org.apache.axis.utils.XMLUtils;
  -import org.apache.axis.components.logger.LogFactory;
  +
  +import org.apache.commons.logging.LogFactory;
   import org.apache.commons.logging.Log;
   
   import javax.xml.namespace.QName;
  @@ -50,7 +52,7 @@
    * 
    * @author Davanum Srinivas (dims@yahoo.com)
    */
  -public class ReferencePropertiesType implements Serializable { 
  +public class ReferencePropertiesType implements Serializable, AnyContentType { 
   
       private static Log log = 
           LogFactory.getLog(ReferencePropertiesType.class.getName());
  
  
  
  1.17      +2 -1      ws-fx/addressing/src/org/apache/axis/message/addressing/handler/AddressingHandler.java
  
  Index: AddressingHandler.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/handler/AddressingHandler.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- AddressingHandler.java	18 Jun 2004 20:56:56 -0000	1.16
  +++ AddressingHandler.java	18 Jun 2004 22:02:11 -0000	1.17
  @@ -21,7 +21,6 @@
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
   import org.apache.axis.client.Call;
  -import org.apache.axis.components.logger.LogFactory;
   import org.apache.axis.components.uuid.UUIDGen;
   import org.apache.axis.components.uuid.UUIDGenFactory;
   import org.apache.axis.handlers.BasicHandler;
  @@ -34,7 +33,9 @@
   import org.apache.axis.message.addressing.MessageID;
   import org.apache.axis.message.addressing.To;
   import org.apache.axis.types.URI;
  +
   import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   
   import javax.xml.namespace.QName;
   import java.util.ArrayList;
  
  
  
  1.3       +19 -0     ws-fx/addressing/test/addressing/tools/PingService.java
  
  Index: PingService.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/test/addressing/tools/PingService.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PingService.java	7 Apr 2004 19:35:05 -0000	1.2
  +++ PingService.java	18 Jun 2004 22:02:11 -0000	1.3
  @@ -66,6 +66,12 @@
       public static final String PORT_NAME =
           "123456";
   
  +    public static final QName EX_E = 
  +        new QName("http://foobar", "Handle");
  +    
  +    public static final String EX_E_VALUE = 
  +        "FOOOOOOOOOO";
  +
       public void ping() 
           throws RemoteException {
           MessageContext ctx = MessageContext.getCurrentContext();
  @@ -150,6 +156,19 @@
           if (!any[1].getQName().equals(RP_2)) {
               throw new RemoteException("Expected: " + RP_2 + 
                                         " but was: " + any[1].getQName());
  +        }
  +        
  +        any = request.get_any();
  +        if (any == null || any.length != 1) {
  +            throw new RemoteException("Expected one exensibility element");
  +        }
  +        if (!any[0].getQName().equals(EX_E)) {
  +            throw new RemoteException("Expected: " + EX_E +
  +                                      " but was: " + any[0].getQName());
  +        }
  +        if (!any[0].getValue().equals(EX_E_VALUE)) {
  +            throw new RemoteException("Expected: " + EX_E_VALUE +
  +                                      " but was: " + any[0].getValue());
           }
           
           EndpointReferenceType ept = new EndpointReferenceType();
  
  
  
  1.3       +9 -1      ws-fx/addressing/test/addressing/tools/TestTools.java
  
  Index: TestTools.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/addressing/test/addressing/tools/TestTools.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestTools.java	7 Apr 2004 19:35:05 -0000	1.2
  +++ TestTools.java	18 Jun 2004 22:02:11 -0000	1.3
  @@ -22,6 +22,8 @@
   import addressing.tools.ping.PingServiceAddressingLocator;
   import addressing.tools.ping.PingServicePortType;
   
  +import org.apache.axis.message.MessageElement;
  +
   import org.apache.axis.message.addressing.EndpointReferenceType;
   import org.apache.axis.message.addressing.Address;
   import org.apache.axis.message.addressing.PortType;
  @@ -94,7 +96,7 @@
                                      ss.getLocalPort() + 
                                      "/axis/services/PingService"));
           epr.setProperties(props);
  -        
  +
           PingServiceAddressingLocator locator = 
               new PingServiceAddressingLocator();
           PingServicePortType port = locator.getPingPort(epr);
  @@ -142,6 +144,12 @@
                                                      PingService.PORT_NAME));
           request.setProperties(props);
           
  +        // add extensiblity element 
  +        MessageElement extensibility_element = new MessageElement();
  +        extensibility_element.setQName(PingService.EX_E);
  +        extensibility_element.setObjectValue(PingService.EX_E_VALUE);
  +        request.set_any(new MessageElement [] {extensibility_element});
  +
           PingServiceAddressingLocator locator = 
               new PingServiceAddressingLocator();