axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r395085 - in /webservices/axis2/trunk/java/modules: addressing/src/org/apache/axis2/handlers/addressing/ addressing/test/org/apache/axis2/handlers/addressing/ core/src/org/apache/axis2/addressing/ core/src/org/apache/axis2/client/ core/src/...
Date Tue, 18 Apr 2006 23:28:54 GMT
Author: dims
Date: Tue Apr 18 16:28:51 2006
New Revision: 395085

URL: http://svn.apache.org/viewcvs?rev=395085&view=rev
Log:
Fix for AXIS2-585 - WS-Addressing - Incorrect cardinality for RelatesTo in handler and on
API

The API in MessageContext and Options now look like the following:
public RelatesTo[] getRelatesTo()
public void setRelatesTo(RelatesTo[] list)
public void addRelatesTo(RelatesTo relatesTo)
public RelatesTo getRelatesTo(String type)

David, Eran, 
PLEASE review the code ASAP!


Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/AddressingConstants.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/CallbackReceiver.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java
    webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/OperationContextTest.java
    webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/engine/MessageContextTest.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java?rev=395085&r1=395084&r2=395085&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
Tue Apr 18 16:28:51 2006
@@ -207,7 +207,7 @@
                         relationshipType == null
                                 ? relationshipTypeDefaultValue
                                 : relationshipType.getAttributeValue());
-        messageContextOptions.setRelatesTo(relatesTo);
+        messageContextOptions.addRelatesTo(relatesTo);
         soapHeaderBlock.setProcessed();
     }
 

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java?rev=395085&r1=395084&r2=395085&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
Tue Apr 18 16:28:51 2006
@@ -187,26 +187,28 @@
     private void processRelatesTo(SOAPEnvelope envelope, Options messageContextOptions, OMNamespace
addressingNamespaceObject) {
         if (!isAddressingHeaderAlreadyAvailable(WSA_RELATES_TO, envelope, addressingNamespaceObject))
         {
-            RelatesTo relatesTo = messageContextOptions.getRelatesTo();
-            OMElement relatesToHeader = null;
+            RelatesTo[] relatesTo = messageContextOptions.getRelatesTo();
 
             if (relatesTo != null) {
-                relatesToHeader =
-                        processStringInfo(relatesTo.getValue(),
-                                WSA_RELATES_TO,
-                                envelope, addressingNamespaceObject);
-            }
+                for (int i = 0; i < relatesTo.length; i++) {
+                    OMElement relatesToHeader =
+                            processStringInfo(relatesTo[i].getValue(),
+                                    WSA_RELATES_TO,
+                                    envelope, addressingNamespaceObject);
 
-            if (relatesToHeader != null)
-                if ("".equals(relatesTo.getRelationshipType())) {
-                    relatesToHeader.addAttribute(WSA_RELATES_TO_RELATIONSHIP_TYPE,
-                            Submission.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE,
-                            addressingNamespaceObject);
-                } else {
-                    relatesToHeader.addAttribute(WSA_RELATES_TO_RELATIONSHIP_TYPE,
-                            relatesTo.getRelationshipType(),
-                            addressingNamespaceObject);
+                    if (relatesToHeader != null) {
+                        if ("".equals(relatesTo[i].getRelationshipType())) {
+                            relatesToHeader.addAttribute(WSA_RELATES_TO_RELATIONSHIP_TYPE,
+                                    Submission.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE,
+                                    addressingNamespaceObject);
+                        } else {
+                            relatesToHeader.addAttribute(WSA_RELATES_TO_RELATIONSHIP_TYPE,
+                                    relatesTo[i].getRelationshipType(),
+                                    addressingNamespaceObject);
+                        }
+                    }
                 }
+            }
         }
     }
 

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java?rev=395085&r1=395084&r2=395085&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
Tue Apr 18 16:28:51 2006
@@ -106,7 +106,7 @@
 
         org.apache.axis2.addressing.RelatesTo relatesTo = new org.apache.axis2.addressing.RelatesTo(
                 "http://www.relatesTo.org/service/", "TestRelation");
-        msgCtxt.setRelatesTo(relatesTo);
+        msgCtxt.addRelatesTo(relatesTo);
 
         msgCtxt.setEnvelope(
                 OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/AddressingConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/AddressingConstants.java?rev=395085&r1=395084&r2=395085&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/AddressingConstants.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/AddressingConstants.java
Tue Apr 18 16:28:51 2006
@@ -64,6 +64,8 @@
 
         public static final String WSA_INTERFACE_NAME = "InterfaceName";
 
+        public static final String WSA_DEFAULT_RELATIONSHIP_TYPE = "http://www.w3.org/2005/08/addressing/reply";
+
         // fault information
         public static final String FAULT_HEADER_PROB_HEADER_QNAME = "ProblemHeaderQName";
         public static final String FAULT_HEADER_PROB_HEADER = "ProblemHeader";

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java?rev=395085&r1=395084&r2=395085&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java Tue
Apr 18 16:28:51 2006
@@ -6,6 +6,7 @@
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.RelatesTo;
+import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.description.TransportInDescription;
 import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.AxisConfiguration;
@@ -16,6 +17,9 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Collections;
+import java.util.Arrays;
+import java.util.List;
 
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -77,7 +81,8 @@
 
     private String messageId;
 
-    private RelatesTo relatesTo;
+    // Array of RelatesTo objects
+    private List relationships;
 
     private EndpointReference replyTo;
 
@@ -188,11 +193,35 @@
         return myPropValue;
     }
 
-    public RelatesTo getRelatesTo() {
-        if (relatesTo == null && parent != null) {
+    public RelatesTo getRelatesTo(String type) {
+        if (relationships == null && parent != null) {
+            return parent.getRelatesTo(type);
+        }
+        for(int i=0;relationships != null && i<relationships.size();i++) {
+            RelatesTo relatesTo = (RelatesTo) relationships.get(i);
+            String relationshipType = relatesTo.getRelationshipType();
+            if(type.equals(AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE) &&
relationshipType == null) {
+                return relatesTo;
+            }
+            if(relationshipType != null && relationshipType.equals(type)) {
+                return relatesTo;
+            }
+        }
+        return null;
+    }
+
+    public RelatesTo[] getRelatesTo() {
+        if (relationships == null && parent != null) {
             return parent.getRelatesTo();
         }
-        return relatesTo;
+        if(relationships == null) {
+            return null;
+        }
+        return (RelatesTo[]) relationships.toArray(new RelatesTo[relationships.size()]);
+    }
+
+    public void setRelatesTo(RelatesTo[] list) {
+        relationships = list == null ? null : Arrays.asList(list);
     }
 
     public EndpointReference getReplyTo() {
@@ -355,8 +384,11 @@
         properties.put(propertyKey, property);
     }
 
-    public void setRelatesTo(RelatesTo relatesTo) {
-        this.relatesTo = relatesTo;
+    public void addRelatesTo(RelatesTo relatesTo) {
+        if(relationships == null) {
+            relationships = new ArrayList(5);
+        }
+        relationships.add(relatesTo);
     }
 
     public void setReplyTo(EndpointReference replyTo) {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java?rev=395085&r1=395084&r2=395085&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
Tue Apr 18 16:28:51 2006
@@ -477,13 +477,20 @@
     }
 
     /**
-     * @return Returns RelatesTo.
+     * @return Returns RelatesTo array.
      */
-    public RelatesTo getRelatesTo() {
+    public RelatesTo[] getRelatesTo() {
         return options.getRelatesTo();
     }
 
     /**
+     * @return Returns RelatesTo.
+     */
+    public RelatesTo getRelatesTo(String type) {
+        return options.getRelatesTo(type);
+    }
+
+    /**
      * @return Returns EndpointReference.
      */
     public EndpointReference getReplyTo() {
@@ -759,8 +766,8 @@
     /**
      * @param reference
      */
-    public void setRelatesTo(RelatesTo reference) {
-        options.setRelatesTo(reference);
+    public void addRelatesTo(RelatesTo reference) {
+        options.addRelatesTo(reference);
     }
 
     /**
@@ -893,5 +900,9 @@
 
     public void setIncomingTransportName(String incomingTransportName) {
         this.incomingTransportName = incomingTransportName;
+    }
+
+    public void setRelatesTo(RelatesTo[] list) {
+        options.setRelatesTo(list);
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java?rev=395085&r1=395084&r2=395085&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
Tue Apr 18 16:28:51 2006
@@ -1,6 +1,7 @@
 package org.apache.axis2.description;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
@@ -270,11 +271,11 @@
             ConfigurationContext configContext = msgContext.getConfigurationContext();
 
             operationContext =
-                    configContext.getOperationContext(msgContext.getRelatesTo().getValue());
+                    configContext.getOperationContext(msgContext.getRelatesTo(AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE).getValue());
 
             if (null == operationContext) {
                 throw new AxisFault(Messages.getMessage("cannotCorrealteMsg",
-                        this.getName().toString(), msgContext.getRelatesTo().getValue()));
+                        this.getName().toString(), msgContext.getRelatesTo(AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE).getValue()));
             }
         }
 
@@ -307,7 +308,7 @@
             throws AxisFault {
         OperationContext operationContext;
 
-        if (null == msgContext.getRelatesTo()) {
+        if (null == msgContext.getRelatesTo(AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE))
{
 
             // Its a new incoming message so get the factory to create a new
             // one
@@ -318,11 +319,11 @@
             ConfigurationContext configContext = msgContext.getConfigurationContext();
 
             operationContext =
-                    configContext.getOperationContext(msgContext.getRelatesTo().getValue());
+                    configContext.getOperationContext(msgContext.getRelatesTo(AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE).getValue());
 
             if (null == operationContext) {
                 throw new AxisFault(Messages.getMessage("cannotCorrelateMsg",
-                        this.getName().toString(), msgContext.getRelatesTo().getValue()));
+                        this.getName().toString(), msgContext.getRelatesTo(AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE).getValue()));
             }
         }
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java?rev=395085&r1=395084&r2=395085&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java
Tue Apr 18 16:28:51 2006
@@ -112,9 +112,9 @@
         // first check we can dispatch using the relates to
         if (msgctx.getRelatesTo() != null) {
             log.debug(Messages.getMessage("checkingrelatesto",
-                    msgctx.getRelatesTo().getValue()));
+                    msgctx.getRelatesTo(AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE).getValue()));
 
-            String relatesTo = msgctx.getRelatesTo().getValue();
+            String relatesTo = msgctx.getRelatesTo(AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE).getValue();
 
             if ((relatesTo != null) || "".equals(relatesTo)) {
                 OperationContext operationContext =

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java?rev=395085&r1=395084&r2=395085&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
Tue Apr 18 16:28:51 2006
@@ -153,7 +153,7 @@
         faultContext.setTransportOut(processingContext.getTransportOut());
 
         faultContext.setMessageID(UUIDGenerator.getUUID());
-        faultContext.setRelatesTo(
+        faultContext.addRelatesTo(
                 new RelatesTo(
                         processingContext.getOptions().getMessageId(),
                         AddressingConstants.Final.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE));

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/CallbackReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/CallbackReceiver.java?rev=395085&r1=395084&r2=395085&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/CallbackReceiver.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/CallbackReceiver.java
Tue Apr 18 16:28:51 2006
@@ -2,6 +2,7 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.RelatesTo;
+import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.client.async.AsyncResult;
 import org.apache.axis2.client.async.Callback;
 import org.apache.axis2.context.MessageContext;
@@ -27,7 +28,7 @@
     }
 
     public void receive(MessageContext messageCtx) throws AxisFault {
-        RelatesTo relatesTO = messageCtx.getOptions().getRelatesTo();
+        RelatesTo relatesTO = messageCtx.getOptions().getRelatesTo(AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE);
         String messageID = relatesTO.getValue();
         Callback callback = (Callback) callbackStore.get(messageID);
         AsyncResult result = new AsyncResult(messageCtx);

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java?rev=395085&r1=395084&r2=395085&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java Tue Apr
18 16:28:51 2006
@@ -76,7 +76,7 @@
 
         newmsgCtx.setFaultTo(oldOptions.getTo());
         newmsgCtx.setFrom(oldOptions.getTo());
-        newmsgCtx.setRelatesTo(
+        newmsgCtx.addRelatesTo(
                 new RelatesTo(
                         oldOptions.getMessageId(),
                         AddressingConstants.Submission.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE));

Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/OperationContextTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/OperationContextTest.java?rev=395085&r1=395084&r2=395085&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/OperationContextTest.java
(original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/OperationContextTest.java
Tue Apr 18 16:28:51 2006
@@ -56,7 +56,7 @@
 
         MessageContext messageContext2 = this.getBasicMessageContext();
         messageContext2.setMessageID(UUIDGenerator.getUUID());
-        messageContext2.getOptions().setRelatesTo(
+        messageContext2.getOptions().addRelatesTo(
                 new RelatesTo(messageContext1.getMessageID()));
         OperationContext operationContext2 = axisOperation
                 .findOperationContext(messageContext2, sessionContext);

Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/engine/MessageContextTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/engine/MessageContextTest.java?rev=395085&r1=395084&r2=395085&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/engine/MessageContextTest.java
(original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/engine/MessageContextTest.java
Tue Apr 18 16:28:51 2006
@@ -21,6 +21,7 @@
 import org.apache.axiom.soap.SOAPProcessingException;
 import org.apache.axis2.AbstractTestCase;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisService;
@@ -54,7 +55,7 @@
         assertNull(msgctx.getFrom());
 
         msgctx.setRelatesTo(null);
-        assertNull(msgctx.getRelatesTo());
+        assertNull(msgctx.getRelatesTo(AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE));
 
         msgctx.setReplyTo(null);
         assertNull(msgctx.getReplyTo());



Mime
View raw message