Author: jkaputin
Date: Fri Nov 10 08:49:36 2006
New Revision: 473391

URL: http://svn.apache.org/viewvc?view=rev&rev=473391
Log:
WODEN-69 Added support for deriving default message
label to the BaseWSDLReader.parseBindingFaultReference
method and modified the defaulting behaviour in
parseInterfaceFaultReference to match this. This fix
supports the 3 MEPs defined by the Part 2 Adjuncts
spec (in-only, robust-in-only, in-out), but it is not
extensible for other user-defined types.

Modified:
    incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java
    
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingOperationImpl.java
    
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/Constants.java

Modified: 
incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java?view=diff&rev=473391&r1=473390&r2=473391
==============================================================================
--- 
incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java 
(original)
+++ 
incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java 
Fri Nov 10 08:49:36 2006
@@ -886,14 +886,45 @@
         }
         else
         {
-            //TODO this is a temp fix, correct action to use MEP to determine 
default
-            if(faultRef.getDirection().equals(Direction.IN))
+            //This is a limited solution supporting the 3 MEPs in the Part 2 
spec. 
+            //TODO generic support for user-defined, extensible MEPs.
+            
+            InterfaceOperationElement iop = 
(InterfaceOperationElement)faultRef.getParentElement();
+            URI mep = iop.getPattern();
+            
+            if(Constants.MEP_URI_IN_OUT.equals(mep))
+            {
+                //Ruleset is fault-replaces-message, so fault is in same 
direction as msg.
+                //The <output> is replaced by an <outfault>.
+                //The <input> is replaced by an <infault>.
+                //The <outfault> msg label should match the <output> msg label.
+                if(Constants.ELEM_OUTFAULT.equals(faultRefEl.getLocalName()))
+                {
+                    faultRef.setMessageLabel(MessageLabel.OUT);
+                }
+                else
+                {
+                    faultRef.setMessageLabel(MessageLabel.IN);
+                }
+            }
+            else if(Constants.MEP_URI_ROBUST_IN_ONLY.equals(mep))  
             {
-                faultRef.setMessageLabel(MessageLabel.IN);
+                //Ruleset is message-triggers-fault, so fault is opposite 
direction to msg.
+                //The <input> can trigger an <outfault>. 
+                //The <outfault> msg label should match the <input> msg label.
+                if(Constants.ELEM_OUTFAULT.equals(faultRefEl.getLocalName()))
+                {
+                    faultRef.setMessageLabel(MessageLabel.IN); //the 
<outfault> is triggered by the <input>
+                }
+                else
+                {
+                    //TODO this MEP may have only <outfault>s, not <infault>s, 
so treat this as an error.
+                    faultRef.setMessageLabel(MessageLabel.OUT);
+                }
             }
-            else
+            else if(Constants.MEP_URI_IN_ONLY.equals(mep))
             {
-                faultRef.setMessageLabel(MessageLabel.OUT);
+                //TODO Ruleset is no-faults, so treat this as an error.
             }
         }
 
@@ -953,7 +984,8 @@
         }
         else
         {
-            //TODO this is a temp fix, correct action to use MEP to determine 
default
+            //This is a limited solution supporting the 3 MEPs in the Part 2 
spec. 
+            //TODO generic support for user-defined, extensible MEPs.
             if(message.getDirection().equals(Direction.IN))
             {
                 message.setMessageLabel(MessageLabel.IN);
@@ -1285,8 +1317,50 @@
         if(msgLabel != null)
         {
             faultRef.setMessageLabel(new NCName(msgLabel));
-            //Note, the BindFaultRef component does not expose msg label so no 
derived default is needed.
-            //The msgLabel attr is only used for validating against a 
placeholder message from a MEP.
+        } 
+        else
+        {
+            //This is a limited solution supporting the 3 MEPs in the Part 2 
spec. 
+            //TODO generic support for user-defined, extensible MEPs.
+            
+            BindingOperationElement bop = 
(BindingOperationElement)faultRef.getParentElement();
+            InterfaceOperationElement iop = bop.getInterfaceOperationElement();
+            URI mep = (iop != null ? iop.getPattern() : null); //iop might be 
null if the WSDL is invalid
+            
+            if(Constants.MEP_URI_IN_OUT.equals(mep))
+            {
+                //Ruleset is fault-replaces-message, so fault is in same 
direction as msg.
+                //The <output> is replaced by an <outfault>.
+                //The <input> is replaced by an <infault>.
+                //The <outfault> msg label should match the <output> msg label.
+                if(Constants.ELEM_OUTFAULT.equals(faultRefEl.getLocalName()))
+                {
+                    faultRef.setMessageLabel(MessageLabel.OUT);
+                }
+                else
+                {
+                    faultRef.setMessageLabel(MessageLabel.IN);
+                }
+            }
+            else if(Constants.MEP_URI_ROBUST_IN_ONLY.equals(mep))  
+            {
+                //Ruleset is message-triggers-fault, so fault is opposite 
direction to msg.
+                //The <input> can trigger an <outfault>. 
+                //The <outfault> msg label should match the <input> msg label.
+                if(Constants.ELEM_OUTFAULT.equals(faultRefEl.getLocalName()))
+                {
+                    faultRef.setMessageLabel(MessageLabel.IN); //the 
<outfault> is triggered by the <input>
+                }
+                else
+                {
+                    //TODO this MEP may have only <outfault>s, not <infault>s, 
so treat this as an error.
+                    faultRef.setMessageLabel(MessageLabel.OUT);
+                }
+            }
+            else if(Constants.MEP_URI_IN_ONLY.equals(mep))
+            {
+                //TODO Ruleset is no-faults, so treat this as an error.
+            }
         }
 
         parseExtensionAttributes(faultRefEl, 
BindingFaultReferenceElement.class, faultRef, desc);
@@ -1352,7 +1426,8 @@
         }
         else
         {
-            //TODO this is a temp fix, correct action to use MEP to determine 
default
+            //This is a limited solution supporting the 3 MEPs in the Part 2 
spec. 
+            //TODO generic support for user-defined, extensible MEPs.
             if(message.getDirection().equals(Direction.IN))
             {
                 message.setMessageLabel(MessageLabel.IN);

Modified: 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingOperationImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingOperationImpl.java?view=diff&rev=473391&r1=473390&r2=473391
==============================================================================
--- 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingOperationImpl.java
 (original)
+++ 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingOperationImpl.java
 Fri Nov 10 08:49:36 2006
@@ -116,7 +116,8 @@
         BindingElement binding = (BindingElement)getParentElement();
         InterfaceElement interfac = binding.getInterfaceElement();
         if(interfac != null) {
-            oper = interfac.getInterfaceOperationElement(fRef);
+            InterfaceOperation operComp = 
((InterfaceImpl)interfac).getInScopeInterfaceOperation(fRef);
+            oper = operComp.toElement();
         }
         return oper;
 

Modified: 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/Constants.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/Constants.java?view=diff&rev=473391&r1=473390&r2=473391
==============================================================================
--- 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/Constants.java 
(original)
+++ 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/Constants.java 
Fri Nov 10 08:49:36 2006
@@ -17,6 +17,8 @@
 //TODO - check if any constants copied from w4j can be deleted
 package org.apache.woden.internal.wsdl20;
 
+import java.net.URI;
+
 import javax.xml.namespace.QName;
 
 /**
@@ -128,6 +130,14 @@
     public static final String NMTOKEN_NONE = "#none";
     public static final String NMTOKEN_OTHER = "#other";
     public static final String NMTOKEN_ELEMENT = "#element";
+    
+    //Message Exchange Patterns
+    public static final URI MEP_URI_IN_ONLY = 
+        URI.create("http://www.w3.org/2006/01/wsdl/in-only";);
+    public static final URI MEP_URI_ROBUST_IN_ONLY = 
+        URI.create("http://www.w3.org/2006/01/wsdl/robust-in-only";);
+    public static final URI MEP_URI_IN_OUT = 
+        URI.create("http://www.w3.org/2006/01/wsdl/in-out";);
     
     /* Constants representing the values of the properties used to 
      * configure the Woden runtime (i.e. different to WSDL 2.0 properties).



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to