⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bpelcompiler.java

📁 bpel执行引擎用来执行bpel业务流程
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        }        throw new CompilationException(__cmsgs.errUndeclaredVariable(varName));    }    public List<OScope.Variable> getAccessibleVariables() {        ArrayList<OScope.Variable> result = new ArrayList<OScope.Variable>();        for (Iterator<OScope> i = _structureStack.oscopeIterator(); i.hasNext();) {            result.addAll(i.next().variables.values());        }        return result;    }    public OScope.Variable resolveMessageVariable(String inputVar) throws CompilationException {        OScope.Variable var = resolveVariable(inputVar);        if (!(var.type instanceof OMessageVarType))            throw new CompilationException(__cmsgs.errMessageVariableRequired(inputVar));        return var;    }    public OScope.Variable resolveMessageVariable(String inputVar, QName messageType) throws CompilationException {        OScope.Variable var = resolveMessageVariable(inputVar);        if (!((OMessageVarType) var.type).messageType.equals(messageType))            throw new CompilationException(__cmsgs.errVariableTypeMismatch(var.name, messageType,                    ((OMessageVarType) var.type).messageType));        return var;    }    public OProcess.OProperty resolveProperty(QName name) {        for (OProcess.OProperty prop : _oprocess.properties) {            if (prop.name.equals(name))                return prop;        }        throw new CompilationException(__cmsgs.errUndeclaredProperty(name));    }    public OProcess.OPropertyAlias resolvePropertyAlias(OScope.Variable variable, QName propertyName) {        if (!(variable.type instanceof OMessageVarType))            throw new CompilationException(__cmsgs.errMessageVariableRequired(variable.name));        OProcess.OProperty property = resolveProperty(propertyName);        OProcess.OPropertyAlias alias = property.getAlias(variable.type);        if (alias == null)            throw new CompilationException(__cmsgs.errUndeclaredPropertyAlias(variable.type.toString(), propertyName));        return alias;    }    public OScope resolveCompensatableScope(final String scopeToCompensate) throws CompilationException {        if (_recoveryContextStack.isEmpty())            throw new CompilationException(__cmsgs.errCompensateNAtoContext());        OScope recoveryContext = _recoveryContextStack.peek();        OScope scopeToComp = CollectionsX.find_if(recoveryContext.compensatable, new MemberOfFunction<OScope>() {            public boolean isMember(OScope o) {                return o.name != null && o.name.equals(scopeToCompensate);            }        });        if (scopeToComp == null)            throw new CompilationException(__cmsgs.errCompensateOfInvalidScope(scopeToCompensate));        return scopeToComp;     }    public String getSourceLocation() {        return _processDef.getSource() == null ? null : _processDef.getSource();    }    public OScope.CorrelationSet resolveCorrelationSet(String csetName) {        for (Iterator<OScope> i = _structureStack.oscopeIterator(); i.hasNext();) {            OScope.CorrelationSet cset = i.next().getCorrelationSet(csetName);            if (cset != null)                return cset;        }        throw new CompilationException(__cmsgs.errUndeclaredCorrelationSet(csetName));    }    @SuppressWarnings("unchecked")    public OMessageVarType resolveMessageType(QName messageType) {        OMessageVarType msgType = _oprocess.messageTypes.get(messageType);        if (msgType == null) {            Message msg = _wsdlRegistry.getMessage(messageType);            if (msg == null) {                throw new CompilationException(__cmsgs.errUndeclaredMessage(messageType.getLocalPart(), messageType                        .getNamespaceURI()));            }            List<OMessageVarType.Part> parts = new ArrayList<OMessageVarType.Part>();            CollectionsX.transform(parts, ((List<Part>) msg.getOrderedParts(null)),                    new UnaryFunction<Part, OMessageVarType.Part>() {                        public OMessageVarType.Part apply(Part part) {                            OVarType partType;                            if (part.getElementName() != null) {                                partType = resolveElementType(part.getElementName());                            } else {                                partType = resolveXsdType(part.getTypeName());                            }                            OMessageVarType.Part opart = new OMessageVarType.Part(_oprocess, part.getName(), partType);                            opart.debugInfo = createDebugInfo(_processDef, "Message Variable Part: " + part.getName());                            return opart;                        }                    });            msgType = new OMessageVarType(_oprocess, msg.getQName(), parts);            msgType.debugInfo = createDebugInfo(_processDef, "Message Type: " + msg.getQName());            _oprocess.messageTypes.put(msg.getQName(), msgType);        }        return msgType;    }    public OXsdTypeVarType resolveXsdType(QName typeName) throws CompilationException {        OXsdTypeVarType type = _oprocess.xsdTypes.get(typeName);        if (type == null) {            SchemaModel model = null;            try {                model = _wsdlRegistry.getSchemaModel();            } catch (IllegalArgumentException iaa) { }            if (model == null || !model.knowsSchemaType(typeName))                throw new CompilationException(__cmsgs.errUndeclaredXsdType(typeName));                        type = new OXsdTypeVarType(_oprocess);            type.debugInfo = createDebugInfo(_processDef, "XSD Type: " + typeName);            type.xsdType = typeName;            type.simple = _wsdlRegistry.getSchemaModel().isSimpleType(typeName);            _oprocess.xsdTypes.put(typeName, type);        }        return type;    }    public OMessageVarType.Part resolvePart(OScope.Variable var, String partname) {        if (!(var.type instanceof OMessageVarType))            throw new CompilationException(__cmsgs.errMessageVariableRequired(var.name));        OMessageVarType msgVarType = (OMessageVarType) var.type;        OMessageVarType.Part part = msgVarType.parts.get(partname);        if (part == null)            throw new CompilationException(__cmsgs.errUndeclaredMessagePart(var.name,                    ((OMessageVarType) var.type).messageType, partname));        return part;    }    public OMessageVarType.Part resolveHeaderPart(OScope.Variable var, String partname) {        if (!(var.type instanceof OMessageVarType))            throw new CompilationException(__cmsgs.errMessageVariableRequired(var.name));        OMessageVarType msgVarType = (OMessageVarType) var.type;        return msgVarType.parts.get(partname);    }    public PartnerLinkType resolvePartnerLinkType(QName partnerLinkType) {        PartnerLinkType plinkType = _wsdlRegistry.getPartnerLinkType(partnerLinkType);        if (plinkType == null)            throw new CompilationException(__cmsgs.errUndeclaredPartnerLinkType(partnerLinkType));        return plinkType;    }    public OPartnerLink resolvePartnerLink(String name) {        for (Iterator<OScope> i = _structureStack.oscopeIterator(); i.hasNext();) {            OPartnerLink oplink = i.next().getLocalPartnerLink(name);            if (oplink != null)                return oplink;        }        throw new CompilationException(__cmsgs.errUndeclaredPartnerLink(name));    }    @SuppressWarnings("unchecked")    public Operation resolvePartnerRoleOperation(final OPartnerLink partnerLink, final String operationName) {        if (partnerLink.partnerRolePortType == null) {            throw new CompilationException(__cmsgs.errPartnerLinkDoesNotDeclarePartnerRole(partnerLink.getName()));        }        Operation found = CollectionsX.find_if((List<Operation>) partnerLink.partnerRolePortType.getOperations(),                new MemberOfFunction<Operation>() {                    public boolean isMember(Operation o) {                        // Guard against WSDL4j funny business.                        if ((o.getInput() == null || o.getInput().getMessage() == null)                                && (o.getOutput() == null || o.getOutput().getMessage() == null)) {                            return false;                        }                        return o.getName().equals(operationName);                    }                });        if (found == null)            throw new CompilationException(__cmsgs.errUndeclaredOperation(partnerLink.partnerRolePortType.getQName(),                    operationName));        return found;    }    @SuppressWarnings("unchecked")    public Operation resolveMyRoleOperation(final OPartnerLink partnerLink, final String operationName) {        if (partnerLink.myRolePortType == null) {            throw new CompilationException(__cmsgs.errPartnerLinkDoesNotDeclareMyRole(partnerLink.getName()));        }        Operation found = CollectionsX.find_if((List<Operation>) partnerLink.myRolePortType.getOperations(),                new MemberOfFunction<Operation>() {                    public boolean isMember(Operation o) {                        // Again, guard against WSDL4J's "help"                        if ((o.getInput() == null || o.getInput().getMessage() == null)                                && (o.getOutput() == null || o.getOutput().getMessage() == null))                            return false;                        return o.getName().equals(operationName);                    }                });        if (found == null) {            throw new CompilationException(__cmsgs.errUndeclaredOperation(partnerLink.myRolePortType.getQName(),                    operationName));        }        return found;    }    /**     * Produce a boolean {@link OExpression} expression that returns a constant     * value.     *      * @param value     *            constant value to return     * @return {@link OExpression} returning a constant value.     */    public OExpression constantExpr(boolean value) {        OConstantExpression ce = new OConstantExpression(_oprocess, value ? Boolean.TRUE : Boolean.FALSE);        ce.debugInfo = createDebugInfo(_processDef, "Constant Boolean Expression: " + value);        ce.expressionLanguage = _konstExprLang;        return ce;    }    public OLValueExpression compileLValueExpr(Expression expression) throws CompilationException {        return (OLValueExpression) compileExpr(expression, false, true);    }    public OExpression compileJoinCondition(Expression expression) throws CompilationException {        return compileExpr(expression, true, false);    }    public OExpression compileExpr(Expression expression) throws CompilationException {        return compileExpr(expression, false, false);    }    public OExpression compileExpr(String expr, NSContext nc) {        // Does this really work?        BpelObject cur = _structureStack.topSource();        return compileExpr(new Expression11(cur.getElement(),cur.getElement().getOwnerDocument().createTextNode(expr)),false,false);    }    private OExpression compileExpr(Expression expression, boolean isJoinCondition, boolean isLValue) {        String expLang = getExpressionLanguage(expression);        ExpressionCompiler ec = findExpLangCompiler(expLang);        ec.setCompilerContext(this);        try {            OExpression oexpr = (isJoinCondition) ? ec.compileJoinCondition(expression) : ec.compile(expression);            oexpr.debugInfo = createDebugInfo(expression, expression.toString());            OExpressionLanguage expLanguage = _expLanguages.get(expLang);            if (expLanguage == null) {                expLanguage = new OExpressionLanguage(_oprocess, ec.getProperties());                expLanguage.debugInfo = createDebugInfo(_processDef, "Expression Language: " + expLang);                expLanguage.expressionLanguageUri = expLang;                _expLanguages.put(expLang, expLanguage);                _oprocess.expressionLanguages.add(expLanguage);            }            oexpr.expressionLanguage = expLanguage;            // Cleaning up expression compiler for furter compilation            ec.setCompilerContext(null);                        return oexpr;        } catch (CompilationException ce) {            if (ce.getCompilationMessage().source == null)                ce.getCompilationMessage().setSource(expression);            throw ce;        }    }    public OProcess getOProcess() throws CompilationException {        return _oprocess;    }    public void recoveredFromError(SourceLocation where, CompilationException bce) throws CompilationException {        if (bce.getCompilationMessage().source == null)            bce.getCompilationMessage().source = where;        if (_compileListener == null) {            switch (bce.getCompilationMessage().severity) {            case CompilationMessage.INFO:                if (__log.isInfoEnabled()) {                    __log.info(bce.toErrorMessage());                }                break;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -