/** */ public void endFunction() { super.endFunction(); FunctionCallExpr c = (FunctionCallExpr)peekFrame() .getLast(); String prefix = c.getPrefix(); // empty string prefix should resolve to xpath namespace, NOT bpel if ((prefix == null) || "".equals(prefix)) { return; } String ns = _nsContext.getNamespaceURI(prefix); if (ns == null) { throw new CompilationException( __msgs.errUndeclaredFunctionPrefix(prefix,c.getFunctionName())); } else if (isBpelNamespace(ns)) { if (Constants.EXT_FUNCTION_GETVARIABLEDATA.equals(c.getFunctionName())) { compileGetVariableData(c); } else if (Constants.EXT_FUNCTION_GETVARIABLEPROPRTY.equals(c .getFunctionName())) { compileGetVariableProperty(c); } else if (Constants.EXT_FUNCTION_GETLINKSTATUS.equals(c.getFunctionName())) { compileGetLinkStatus(c); } else if (Constants.EXT_FUNCTION_DOXSLTRANSFORM.equals(c.getFunctionName())) { compileDoXslTransform(c); } else { throw new CompilationException(__msgs.errUnknownBpelFunction(c.getFunctionName())); } } }
private static void extractPrefixes( Expr expr, Set<String> prefixes ) { if ( expr instanceof BinaryExpr ) { extractPrefixes( ( (BinaryExpr) expr ).getLHS(), prefixes ); extractPrefixes( ( (BinaryExpr) expr ).getRHS(), prefixes ); } else if ( expr instanceof FilterExpr ) { extractPrefixes( ( (FilterExpr) expr ).getExpr(), prefixes ); for ( Object pred : ( (FilterExpr) expr ).getPredicates() ) { extractPrefixes( (Predicate) pred, prefixes ); } } else if ( expr instanceof FunctionCallExpr ) { extractPrefix( ( (FunctionCallExpr) expr ).getPrefix(), prefixes ); for ( Object param : ( (FunctionCallExpr) expr ).getParameters() ) { extractPrefixes( (Expr) param, prefixes ); } } else if ( expr instanceof LocationPath ) { for ( Object step : ( (LocationPath) expr ).getSteps() ) { extractPrefixes( (Step) step, prefixes ); } } else if ( expr instanceof PathExpr ) { extractPrefixes( ( (PathExpr) expr ).getFilterExpr(), prefixes ); extractPrefixes( ( (PathExpr) expr ).getLocationPath(), prefixes ); } else if ( expr instanceof UnaryExpr ) { extractPrefixes( ( (UnaryExpr) expr ).getExpr(), prefixes ); } else if ( expr instanceof VariableReferenceExpr ) { extractPrefix( ( (VariableReferenceExpr) expr ).getPrefix(), prefixes ); } }