Return-Path: Delivered-To: apmail-incubator-ode-commits-archive@locus.apache.org Received: (qmail 9551 invoked from network); 17 Jun 2007 05:00:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Jun 2007 05:00:26 -0000 Received: (qmail 20669 invoked by uid 500); 17 Jun 2007 05:00:30 -0000 Delivered-To: apmail-incubator-ode-commits-archive@incubator.apache.org Received: (qmail 20628 invoked by uid 500); 17 Jun 2007 05:00:29 -0000 Mailing-List: contact ode-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ode-dev@incubator.apache.org Delivered-To: mailing list ode-commits@incubator.apache.org Received: (qmail 20619 invoked by uid 99); 17 Jun 2007 05:00:29 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Jun 2007 22:00:29 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Jun 2007 22:00:25 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 4D13F1A981A; Sat, 16 Jun 2007 22:00:05 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: ode-commits@incubator.apache.org From: mriou@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070617050005.4D13F1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 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 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); + } + } } - } }