Package org.apache.ode.bpel.compiler.api

Examples of org.apache.ode.bpel.compiler.api.CompilationException


        OProcess.OPropertyAlias alias = new OProcess.OPropertyAlias(_oprocess);
        alias.debugInfo = createDebugInfo(_processDef, "PropertyAlias " + src.getPropertyName() + " for "
                + src.getMessageType());
        if (src.getMessageType() == null){
            throw new CompilationException(__cmsgs.errAliasUndeclaredMessage(src.getPropertyName(),
                    src.getQuery().getPath()));
        }

        OMessageVarType messageType = resolveMessageType(src.getMessageType());
        alias.varType = messageType;
        // bpel 2.0 excludes declaration of part;
        // bpel 1.1 requires it
        if (src.getPart() != null) {
            alias.part = messageType.parts.get(src.getPart());
            if (alias.part == null)
                throw new CompilationException(__cmsgs.errUnknownPartInAlias(src.getPart(),
                        messageType.messageType.toString()));
        }
        if (src.getQuery() != null)
            alias.location = compileExpr(src.getQuery());
        property.aliases.add(alias);
View Full Code Here


    private void compileLinkTarget(LinkTarget target) {
        OLink ol = resolveLink(target.getLinkName());
        assert ol != null;
        ol.debugInfo = createDebugInfo(target, target.toString());
        if (ol.target != null)
            throw new CompilationException(__cmsgs.errDuplicateLinkTarget(target.getLinkName()).setSource(target));
        ol.target = _structureStack.topActivity();

        _structureStack.topActivity().targetLinks.add(ol);
    }
View Full Code Here

    private void compileLinkSource(LinkSource linksrc) {
        OLink ol = resolveLink(linksrc.getLinkName());
        assert ol != null;
        ol.debugInfo = createDebugInfo(linksrc, linksrc.toString());
        if (ol.source != null)
            throw new CompilationException(__cmsgs.errDuplicateLinkSource(linksrc.getLinkName()).setSource(linksrc));
        ol.source = _structureStack.topActivity();
        ol.transitionCondition = linksrc.getTransitionCondition() == null ? constantExpr(true) : compileExpr(linksrc
                .getTransitionCondition());

        _structureStack.topActivity().sourceLinks.add(ol);
View Full Code Here

            oplink.initializePartnerRole = plink.isInitializePartnerRole();

            if (plink.hasMyRole()) {
                PartnerLinkType.Role myRole = plinkType.getRole(plink.getMyRole());
                if (myRole == null)
                    throw new CompilationException(__cmsgs.errUndeclaredRole(plink.getMyRole(), plinkType.getName()));
                oplink.myRoleName = myRole.getName();
                QName portType = myRole.getPortType();
                if (portType == null)
                    throw new CompilationException(__cmsgs.errMissingMyRolePortType(portType, plink.getMyRole(), plinkType.getName()));
                oplink.myRolePortType = resolvePortType(portType);
            }

            if (plink.isInitializePartnerRole() && !plink.hasPartnerRole()) {
                throw new CompilationException(__cmsgs.errPartnerLinkNoPartnerRoleButInitialize(plink.getName()));
            }
            if (plink.hasPartnerRole()) {
                PartnerLinkType.Role partnerRole = plinkType.getRole(plink.getPartnerRole());
                if (partnerRole == null)
                    throw new CompilationException(__cmsgs.errUndeclaredRole(plink.getPartnerRole(), plinkType
                            .getName()));
                oplink.partnerRoleName = partnerRole.getName();
                QName portType = partnerRole.getPortType();
                if (portType == null)
                    throw new CompilationException(__cmsgs.errMissingPartnerRolePortType(portType, plink.getPartnerRole(), plinkType.getName()));
                oplink.partnerRolePortType = resolvePortType(portType);
            }

            oplink.declaringScope = _structureStack.topScope();
            if (oplink.declaringScope.partnerLinks.containsKey(oplink.name))
                throw new CompilationException(__cmsgs.errDuplicatePartnerLinkDecl(oplink.name));
            oplink.declaringScope.partnerLinks.put(oplink.name, oplink);
            _oprocess.allPartnerLinks.add(oplink);
        } catch (CompilationException ce) {
            ce.getCompilationMessage().setSource(plink);
            throw ce;
View Full Code Here

        boolean previousAtomicScope = _atomicScope;
        if (src.getAtomicScope() != null) {
            boolean newValue = src.getAtomicScope().booleanValue();
            if (_atomicScope)
                throw new CompilationException(__cmsgs.errAtomicScopeNesting(newValue));
           
            oscope.atomicScope = _atomicScope = newValue;
        }
        try {
            compile(oscope, src, new Runnable() {
View Full Code Here

        if (onAlarm.getFor() != null && onAlarm.getUntil() == null) {
            oalarm.forExpr = compileExpr(onAlarm.getFor());
        } else if (onAlarm.getFor() == null && onAlarm.getUntil() != null) {
            oalarm.untilExpr = compileExpr(onAlarm.getUntil());
        } else if (onAlarm.getFor() != null && onAlarm.getUntil() != null) {
            throw new CompilationException(__cmsgs.errInvalidAlarm().setSource(onAlarm));
        } else if (onAlarm.getRepeatEvery() == null) {
            throw new CompilationException(__cmsgs.errInvalidAlarm().setSource(onAlarm));
        }

        if (onAlarm.getRepeatEvery() != null)
            oalarm.repeatExpr = compileExpr(onAlarm.getRepeatEvery());

        oalarm.activity = compile(onAlarm.getActivity());

        // Check links crossing restrictions.
        for (OLink link : oalarm.incomingLinks)
            try {
                throw new CompilationException(__cmsgs.errLinkCrossesEventHandlerBoundary(link.name).setSource(onAlarm));
            } catch (CompilationException ce) {
                recoveredFromError(onAlarm, ce);
            }

        for (OLink link : oalarm.outgoingLinks)
            try {
                throw new CompilationException(__cmsgs.errLinkCrossesEventHandlerBoundary(link.name).setSource(onAlarm));
            } catch (CompilationException ce) {
                recoveredFromError(onAlarm, ce);
            }

        oscope.eventHandler.onAlarms.add(oalarm);
View Full Code Here

                    oevent.variable = resolveMessageVariable(onEvent.getVariable());
                    break;
                case BPEL20_DRAFT:
                case BPEL20:
                    if (onEvent.getMessageType() == null && onEvent.getElementType() == null)
                        throw new CompilationException(__cmsgs.errVariableDeclMissingType(onEvent.getVariable())
                                .setSource(onEvent));
                    if (onEvent.getMessageType() != null && onEvent.getElementType() != null)
                        throw new CompilationException(__cmsgs.errVariableDeclInvalid(onEvent.getVariable()).setSource(
                                onEvent));

                    OVarType varType;
                    if (onEvent.getMessageType() != null)
                        varType = resolveMessageType(onEvent.getMessageType());
                    else if (onEvent.getElement() != null)
                        varType = resolveElementType(onEvent.getElementType());
                    else
                        throw new CompilationException(__cmsgs
                                .errUnrecognizedVariableDeclaration(onEvent.getVariable()));

                    oevent.variable = new OScope.Variable(_oprocess, varType);
                    oevent.variable.name = onEvent.getVariable();
                    oevent.variable.declaringScope = _structureStack.topScope();

                    oevent.addLocalVariable(oevent.variable);
                    break;
                default:
                    throw new AssertionError("Unexpected BPEL VERSION constatnt: " + _processDef.getBpelVersion());
                }

                oevent.partnerLink = resolvePartnerLink(onEvent.getPartnerLink());
                oevent.operation = resolveMyRoleOperation(oevent.partnerLink, onEvent.getOperation());
                oevent.messageExchangeId = onEvent.getMessageExchangeId();

                if (onEvent.getPortType() != null
                        && !onEvent.getPortType().equals(oevent.partnerLink.myRolePortType.getQName()))
                    throw new CompilationException(__cmsgs.errPortTypeMismatch(onEvent.getPortType(),
                            oevent.partnerLink.myRolePortType.getQName()));

                for (Correlation correlation : onEvent.getCorrelations()) {
                    OScope.CorrelationSet cset = resolveCorrelationSet(correlation.getCorrelationSet());

                    switch (correlation.getInitiate()) {
                    case UNSET:
                    case NO:
                        if (oevent.matchCorrelation != null)
                            throw new CompilationException(__cmsgs.errTODO("Matching multiple correlations sets."));
                        oevent.matchCorrelation = cset;
                        oevent.partnerLink.addCorrelationSetForOperation(oevent.operation, cset);
                        break;
                    case YES:
                        oevent.initCorrelations.add(cset);
                        break;
                    case JOIN:
                        throw new CompilationException(__cmsgs.errTODO("Rendezvous."));
                    }

                    for (OProcess.OProperty property : cset.properties) {
                        // Force resolution of alias, to make sure that we have
                        // one for this variable-property pair.
                        resolvePropertyAlias(oevent.variable, property.name);
                    }

                }

                oevent.activity = compile(onEvent.getActivity());
            }
        });

        // Check links crossing restrictions.
        for (OLink link : oevent.incomingLinks)
            try {
                throw new CompilationException(__cmsgs.errLinkCrossesEventHandlerBoundary(link.name));
            } catch (CompilationException ce) {
                recoveredFromError(onEvent, ce);
            }

        for (OLink link : oevent.outgoingLinks)
            try {
                throw new CompilationException(__cmsgs.errLinkCrossesEventHandlerBoundary(link.name));
            } catch (CompilationException ce) {
                recoveredFromError(onEvent, ce);
            }

        oscope.eventHandler.onMessages.add(oevent);
View Full Code Here

    private void compile(final Variable src) {
        final OScope oscope = _structureStack.topScope();

        if (src.getKind() == null)
            throw new CompilationException(__cmsgs.errVariableDeclMissingType(src.getName()).setSource(src));

        if (oscope.getLocalVariable(src.getName()) != null)
            throw new CompilationException(__cmsgs.errDuplicateVariableDecl(src.getName()).setSource(src));

        OVarType varType;
        switch (src.getKind()) {
        case ELEMENT:
            varType = resolveElementType(src.getTypeName());
            break;
        case MESSAGE:
            varType = resolveMessageType(src.getTypeName());
            break;
        case SCHEMA:
            varType = resolveXsdType(src.getTypeName());
            break;
        default:
            throw new CompilationException(__cmsgs.errUnrecognizedVariableDeclaration(src.getName()));
        }

        OScope.Variable ovar = new OScope.Variable(_oprocess, varType);
        ovar.name = src.getName();
        ovar.declaringScope = oscope;
View Full Code Here

                                OScope.Variable faultVar;
                                switch (_processDef.getBpelVersion()) {
                                case BPEL11:
                                    faultVar = resolveVariable(catchSrc.getFaultVariable());
                                    if (!(faultVar.type instanceof OMessageVarType))
                                        throw new CompilationException(__cmsgs.errMessageVariableRequired(
                                                catchSrc.getFaultVariable()).setSource(catchSrc));
                                    break;
                                case BPEL20_DRAFT:
                                case BPEL20:
                                    if (catchSrc.getFaultVariableMessageType() == null
                                            && catchSrc.getFaultVariableElementType() == null)
                                        throw new CompilationException(__cmsgs.errVariableDeclMissingType(
                                                catchSrc.getFaultVariable()).setSource(catchSrc));
                                    if (catchSrc.getFaultVariableMessageType() != null
                                            && catchSrc.getFaultVariableElementType() != null)
                                        throw new CompilationException(__cmsgs.errVariableDeclMissingType(
                                                catchSrc.getFaultVariable()).setSource(catchSrc));

                                    OVarType faultVarType;
                                    if (catchSrc.getFaultVariableMessageType() != null)
                                        faultVarType = resolveMessageType(catchSrc.getFaultVariableMessageType());
                                    else if (catchSrc.getFaultVariableElementType() != null)
                                        faultVarType = resolveElementType(catchSrc.getFaultVariableElementType());
                                    else
                                        throw new CompilationException(__cmsgs
                                                .errUnrecognizedVariableDeclaration(catchSrc.getFaultVariable()));

                                    faultVar = new OScope.Variable(_oprocess, faultVarType);
                                    faultVar.name = catchSrc.getFaultVariable();
                                    faultVar.declaringScope = _structureStack.topScope();
View Full Code Here

    public OXslSheet compileXslt(String docStrUri) throws CompilationException {
        URI docUri;
        try {
            docUri = new URI(FileUtils.encodePath(docStrUri));
        } catch (URISyntaxException e) {
            throw new CompilationException(__cmsgs.errInvalidDocXsltUri(docStrUri));
        }
       
        String sheetBody = loadXsltSheet(_processURI.resolve(docUri));
        if (sheetBody == null) {
            throw new CompilationException(__cmsgs.errCantFindXslt(docStrUri));
        }

        OXslSheet oXslSheet = new OXslSheet(_oprocess);
        oXslSheet.uri = docUri;
        oXslSheet.sheetBody = sheetBody;
View Full Code Here

TOP

Related Classes of org.apache.ode.bpel.compiler.api.CompilationException

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.