Package org.apache.ode.bpel.compiler.bom

Examples of org.apache.ode.bpel.compiler.bom.ReplyActivity


    public OActivity newInstance(Activity src) {
        return new OReply(_context.getOProcess(), _context.getCurrent());
    }

    public void compile(OActivity output, Activity src) {
        ReplyActivity replyDef = (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:
View Full Code Here

TOP

Related Classes of org.apache.ode.bpel.compiler.bom.ReplyActivity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.