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

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


    }

    public class DoXslTransform implements XPathFunction {
        public Object evaluate(List params) throws XPathFunctionException {
            if (params.size() < 2 || params.size() % 2 != 0) {
                throw new CompilationException(
                        __msgs.errInvalidNumberOfArguments(Constants.EXT_FUNCTION_DOXSLTRANSFORM));
            }

            String xslUri = (String) params.get(0);
            OXslSheet xslSheet = _cctx.compileXslt(xslUri);
            try {
                XslTransformHandler.getInstance().parseXSLSheet(xslSheet.uri, xslSheet.sheetBody,
                        new XslCompileUriResolver(_cctx, _out));
            } catch (Exception e) {
                throw new CompilationException(__msgs.errXslCompilation(xslUri, e.toString()));
            }

            _out.xslSheets.put(xslSheet.uri, xslSheet);
            return "";
        }
View Full Code Here


     * Compile time checking for the non standard ode:splitToElements function.
     */
    public class SplitToElements implements XPathFunction {
        public Object evaluate(List params) throws XPathFunctionException {
            if (params.size() < 3 || params.size() > 4) {
                throw new CompilationException(
                        __msgs.errInvalidNumberOfArguments(Constants.NON_STDRD_FUNCTION_SPLITTOELEMENTS));
            }
            return "";
        }
View Full Code Here

    }

    String ns = _nsContext.getNamespaceURI(prefix);

    if (ns == null) {
      throw new CompilationException(
          __msgs.errUndeclaredFunctionPrefix(prefix,c.getFunctionName()));
    } else if (isBpelNamespace(ns)) {
      try {
        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()));
        }
      } catch (CompilationException ce) {
        throw new CompilationExceptionWrapper(ce);
      }
    }
View Full Code Here

  private void compileGetLinkStatus(FunctionCallExpr c)
                           throws CompilationException {
    List params = c.getParameters();

    if (params.size() != 1) {
      throw  new CompilationException(__msgs.errInvalidNumberOfArguments(c.getFunctionName()));
    }

    String linkName = getLiteralFromExpression((Expr)params.get(0));

    OLink olink = _cctx.resolveLink(linkName);
View Full Code Here

  private void compileGetVariableData(FunctionCallExpr c)
                                     throws CompilationException {
    List params = c.getParameters();

    if (params.size() < 1 || params.size() > 3) {
      throw new CompilationException(
                                __msgs.errInvalidNumberOfArguments(c.getFunctionName()));

    }
    String varname = getLiteralFromExpression((Expr)params.get(0));
    String partname = params.size() > 1 ? getLiteralFromExpression((Expr)params.get(1)) : null;
View Full Code Here

  private void compileGetVariableProperty(FunctionCallExpr c)
                                 throws CompilationException{
    List params = c.getParameters();

    if (params.size() != 2) {
      throw new CompilationException(
                          __msgs.errInvalidNumberOfArguments(Constants.EXT_FUNCTION_GETVARIABLEPROPRTY));
    }

    String varName = getLiteralFromExpression((Expr)params.get(0));
    OScope.Variable v = _cctx.resolveVariable(varName);
    _out.vars.put(varName, v);

    String propName = getLiteralFromExpression((Expr)params.get(1));
    QName qname = _nsContext.derefQName(propName);

    if (qname == null)
      throw new CompilationException(
                                __msgs.errInvalidQName(propName));

    OProcess.OProperty property = _cctx.resolveProperty(qname);
    // Make sure we can...
    _cctx.resolvePropertyAlias(v, qname);
View Full Code Here

  }

  private void compileDoXslTransform(FunctionCallExpr c) throws CompilationException {
    List params = c.getParameters();
    if (params.size() < 2 || params.size() % 2 != 0) {
      throw new CompilationException(
          __msgs.errInvalidNumberOfArguments(Constants.EXT_FUNCTION_DOXSLTRANSFORM));
    }

    String xslUri = getLiteralFromExpression((Expr)params.get(0));
    OXslSheet xslSheet = _cctx.compileXslt(xslUri);
    try {
      XslTransformHandler.getInstance().parseXSLSheet(xslSheet.uri, xslSheet.sheetBody,
                      new XslCompileUriResolver(_cctx, _out));
    } catch (Exception e) {
      throw new CompilationException(
          __msgs.errInvalidNumberOfArguments(xslUri));
    }

    _out.xslSheets.put(xslSheet.uri, xslSheet);
  }
View Full Code Here

    expr = expr.simplify();

    if (expr instanceof LiteralExpr)
      return ((LiteralExpr)expr).getLiteral();

    throw new CompilationException(__msgs.errLiteralExpected(expr.getText()));
  }
View Full Code Here

        try {
            WSDLReader r = _wsdlFactory.newWSDLReader();
            WSDLLocatorImpl locator = new WSDLLocatorImpl(_resourceFinder, from.resolve(wsdlImport));
            def = (Definition4BPEL) r.readWSDL(locator);
        } catch (WSDLException e) {
            recoveredFromError(sloc, new CompilationException(__cmsgs.errWsdlParseError(e
                    .getFaultCode(), e.getLocation(), e.getMessage())));
            throw new CompilationException(__cmsgs.errWsdlImportFailed(wsdlImport.toASCIIString(), e.getFaultCode())
                    .setSource(sloc), e);
        }

        try {
            _wsdlRegistry.addDefinition(def, _resourceFinder, from.resolve(wsdlImport));
View Full Code Here

                xsdStream.close();
            }
            schemas.put(resFrom, data);
            _wsdlRegistry.addSchemas(schemas);
        } catch (XsdException e) {
            CompilationException ce =  new CompilationException(__cmsgs.errInvalidImport(location.toString()));
            recoveredFromError(sloc, ce);
        } catch (MalformedURLException e) {
            CompilationException ce =  new CompilationException(__cmsgs.errInvalidImport(location.toString()));
            recoveredFromError(sloc, ce);
        } catch (IOException e) {
            CompilationException ce =  new CompilationException(__cmsgs.errInvalidImport(location.toString()));
            recoveredFromError(sloc, ce);
        }
    }
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.