ode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r548009 - /incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReplyGenerator.java
Date Sun, 17 Jun 2007 05:00:04 GMT
Author: mriou
Date: Sat Jun 16 22:00:01 2007
New Revision: 548009

URL: http://svn.apache.org/viewvc?view=rev&rev=548009
Log:
Error message for a reply defined with a partnerLink without myRole.

Modified:
    incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReplyGenerator.java

Modified: incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReplyGenerator.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReplyGenerator.java?view=diff&rev=548009&r1=548008&r2=548009
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReplyGenerator.java
(original)
+++ incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReplyGenerator.java
Sat Jun 16 22:00:01 2007
@@ -18,15 +18,18 @@
  */
 package org.apache.ode.bpel.compiler;
 
+import org.apache.ode.bpel.compiler.api.CompilationException;
 import org.apache.ode.bpel.compiler.bom.Activity;
 import org.apache.ode.bpel.compiler.bom.Correlation;
-import org.apache.ode.bpel.compiler.api.CompilationException;
-import org.apache.ode.bpel.o.*;
+import org.apache.ode.bpel.o.OActivity;
+import org.apache.ode.bpel.o.OMessageVarType;
+import org.apache.ode.bpel.o.OProcess;
+import org.apache.ode.bpel.o.OReply;
+import org.apache.ode.bpel.o.OScope;
 import org.apache.ode.utils.msg.MessageBundle;
 
-import java.util.Iterator;
-
 import javax.wsdl.Fault;
+import java.util.Iterator;
 
 
 /**
@@ -34,75 +37,77 @@
  */
 class ReplyGenerator extends DefaultActivityGenerator  {
 
-  private static final CommonCompilationMessages _cmsgsGeneral =
-    MessageBundle.getMessages(CommonCompilationMessages.class);
+    private static final CommonCompilationMessages _cmsgsGeneral =
+            MessageBundle.getMessages(CommonCompilationMessages.class);
 
-  private static final ReplyGeneratorMessages __cmsgsLocal =
-    MessageBundle.getMessages(ReplyGeneratorMessages.class);
+    private static final ReplyGeneratorMessages __cmsgsLocal =
+            MessageBundle.getMessages(ReplyGeneratorMessages.class);
 
-  public OActivity newInstance(Activity src) {
+    public OActivity newInstance(Activity src) {
         return new OReply(_context.getOProcess(), _context.getCurrent());
-  }
-
-  public void compile(OActivity output, Activity src) {
-    org.apache.ode.bpel.compiler.bom.ReplyActivity replyDef = (org.apache.ode.bpel.compiler.bom.ReplyActivity)
src;
-    OReply oreply = (OReply) output;
-
-    oreply.isFaultReply = replyDef.getFaultName() != null;
-    oreply.partnerLink = _context.resolvePartnerLink(replyDef.getPartnerLink());
-    oreply.messageExchangeId = replyDef.getMessageExchangeId();
-    if (replyDef.getVariable() != null) {
-      oreply.variable = _context.resolveVariable(replyDef.getVariable());
-      if (!(oreply.variable.type instanceof OMessageVarType))
-        throw new CompilationException(_cmsgsGeneral.errMessageVariableRequired(oreply.variable.name));
-    }
-
-    // The portType on the reply is not necessary, so we check its validty only when present.
-    if (replyDef.getPortType() != null && !oreply.partnerLink.myRolePortType.getQName().equals(replyDef.getPortType()))
-      throw new CompilationException(_cmsgsGeneral.errPortTypeMismatch(replyDef.getPortType(),oreply.partnerLink.myRolePortType.getQName()));
-
-    oreply.operation = _context.resolveMyRoleOperation(oreply.partnerLink, replyDef.getOperation());
-    if (oreply.operation.getOutput() == null)
-      throw new CompilationException(_cmsgsGeneral.errTwoWayOperationExpected(oreply.operation.getName()));
-
-    if (oreply.isFaultReply) {
-      Fault flt = null;
-      if (replyDef.getFaultName().getNamespaceURI().equals(oreply.partnerLink.myRolePortType.getQName().getNamespaceURI()))
-        flt = oreply.operation.getFault(replyDef.getFaultName().getLocalPart());
-      if (flt == null)
-        throw new CompilationException(__cmsgsLocal.errUndeclaredFault(replyDef.getFaultName().getLocalPart(),
oreply.operation.getName()));
-      if (oreply.variable != null && !((OMessageVarType)oreply.variable.type).messageType.equals(flt.getMessage().getQName()))
-        throw new CompilationException(_cmsgsGeneral.errVariableTypeMismatch(oreply.variable.name,
flt.getMessage().getQName(), ((OMessageVarType)oreply.variable.type).messageType));
-      oreply.fault = replyDef.getFaultName();
-    } else /* !oreply.isFaultReply */ {
-      assert oreply.fault == null;
-      if (oreply.variable == null)
-        throw new CompilationException(__cmsgsLocal.errOutputVariableMustBeSpecified());
-      if (!((OMessageVarType)oreply.variable.type).messageType.equals(oreply.operation.getOutput().getMessage().getQName()))
-        throw new CompilationException(_cmsgsGeneral.errVariableTypeMismatch(oreply.variable.name,
oreply.operation.getOutput().getMessage().getQName(),((OMessageVarType)oreply.variable.type).messageType));
     }
 
-    for (Correlation correlation  : replyDef.getCorrelations()) {
-      OScope.CorrelationSet cset = _context.resolveCorrelationSet(correlation.getCorrelationSet());
-
-      switch (correlation.getInitiate()) {
-        case UNSET:
-        case NO:
-          oreply.assertCorrelations.add(cset);
-          break;
-        case YES:
-          oreply.initCorrelations.add(cset);
-          break;
-        default:
-          // TODO: Make error for this.
-          throw new AssertionError();
-      }
-
-      for (Iterator<OProcess.OProperty> j = cset.properties.iterator(); j.hasNext();
) {
-        OProcess.OProperty property = j.next();
-        // Force resolution of alias, to make sure that we have one for this variable-property
pair.
-        _context.resolvePropertyAlias(oreply.variable, property.name);
-      }
+    public void compile(OActivity output, Activity src) {
+        org.apache.ode.bpel.compiler.bom.ReplyActivity replyDef = (org.apache.ode.bpel.compiler.bom.ReplyActivity)
src;
+        OReply oreply = (OReply) output;
+
+        oreply.isFaultReply = replyDef.getFaultName() != null;
+        oreply.partnerLink = _context.resolvePartnerLink(replyDef.getPartnerLink());
+        oreply.messageExchangeId = replyDef.getMessageExchangeId();
+        if (replyDef.getVariable() != null) {
+            oreply.variable = _context.resolveVariable(replyDef.getVariable());
+            if (!(oreply.variable.type instanceof OMessageVarType))
+                throw new CompilationException(_cmsgsGeneral.errMessageVariableRequired(oreply.variable.name));
+        }
+
+        if (oreply.partnerLink.myRolePortType == null)
+            throw new CompilationException(_cmsgsGeneral.errPartnerLinkDoesNotDeclareMyRole(oreply.partnerLink.getName()));
+        // The portType on the reply is not necessary, so we check its validty only when
present.
+        if (replyDef.getPortType() != null && !oreply.partnerLink.myRolePortType.getQName().equals(replyDef.getPortType()))
+            throw new CompilationException(_cmsgsGeneral.errPortTypeMismatch(replyDef.getPortType(),oreply.partnerLink.myRolePortType.getQName()));
+
+        oreply.operation = _context.resolveMyRoleOperation(oreply.partnerLink, replyDef.getOperation());
+        if (oreply.operation.getOutput() == null)
+            throw new CompilationException(_cmsgsGeneral.errTwoWayOperationExpected(oreply.operation.getName()));
+
+        if (oreply.isFaultReply) {
+            Fault flt = null;
+            if (replyDef.getFaultName().getNamespaceURI().equals(oreply.partnerLink.myRolePortType.getQName().getNamespaceURI()))
+                flt = oreply.operation.getFault(replyDef.getFaultName().getLocalPart());
+            if (flt == null)
+                throw new CompilationException(__cmsgsLocal.errUndeclaredFault(replyDef.getFaultName().getLocalPart(),
oreply.operation.getName()));
+            if (oreply.variable != null && !((OMessageVarType)oreply.variable.type).messageType.equals(flt.getMessage().getQName()))
+                throw new CompilationException(_cmsgsGeneral.errVariableTypeMismatch(oreply.variable.name,
flt.getMessage().getQName(), ((OMessageVarType)oreply.variable.type).messageType));
+            oreply.fault = replyDef.getFaultName();
+        } else /* !oreply.isFaultReply */ {
+            assert oreply.fault == null;
+            if (oreply.variable == null)
+                throw new CompilationException(__cmsgsLocal.errOutputVariableMustBeSpecified());
+            if (!((OMessageVarType)oreply.variable.type).messageType.equals(oreply.operation.getOutput().getMessage().getQName()))
+                throw new CompilationException(_cmsgsGeneral.errVariableTypeMismatch(oreply.variable.name,
oreply.operation.getOutput().getMessage().getQName(),((OMessageVarType)oreply.variable.type).messageType));
+        }
+
+        for (Correlation correlation  : replyDef.getCorrelations()) {
+            OScope.CorrelationSet cset = _context.resolveCorrelationSet(correlation.getCorrelationSet());
+
+            switch (correlation.getInitiate()) {
+                case UNSET:
+                case NO:
+                    oreply.assertCorrelations.add(cset);
+                    break;
+                case YES:
+                    oreply.initCorrelations.add(cset);
+                    break;
+                default:
+                    // TODO: Make error for this.
+                    throw new AssertionError();
+            }
+
+            for (Iterator<OProcess.OProperty> j = cset.properties.iterator(); j.hasNext();
) {
+                OProcess.OProperty property = j.next();
+                // Force resolution of alias, to make sure that we have one for this variable-property
pair.
+                _context.resolvePropertyAlias(oreply.variable, property.name);
+            }
+        }
     }
-  }
 }



Mime
View raw message