Examples of CompilationException


Examples of com.dbxml.db.core.query.CompilationException

         boolean hasDocName = docName != null && docName.length() > 0;
         boolean hasXpath = xpath != null && xpath.length() > 0;

         if ( hasDocName && hasXpath )
            throw new CompilationException("'document' and 'xpath' attributes are mutually exclusive");
         else if ( hasDocName ) {
            Document doc = null;
            try {
               doc = domAdapter.getDocument(tx, docName);
            }
            catch ( DBException e ) {
               // Null is ok
            }

            if ( doc != null ) {
               try {
                  String path = context.getCanonicalDocumentName(new Key(docName));
                  String systemID = XSLTQueryResolver.URL_PREFIX + path;
                  src = new DOMSource(doc, systemID);
               }
               catch ( Exception e ) {
                  // This shouldn't happen
               }
            }
            else
               throw new CompilationException("Document '" + docName + "' not found");
         }
         else if ( hasXpath ) {
            ResultSet rs;
            if ( keys != null )
               rs = context.queryDocument(tx, XPathQueryResolver.STYLE_XPATH, xpath, nsMap, keys);
            else
               rs = context.queryCollection(tx, XPathQueryResolver.STYLE_XPATH, xpath, nsMap);

            Document doc = ResultSetWrapper.toDocument(rs);
            String path = context.getCanonicalName();
            String systemID = XSLTQueryResolver.URL_PREFIX+path+"/";
            src = new DOMSource(doc, systemID);
         }
         else {
            NodeList nl = sourceElem.getChildNodes();
            Element e = null;
            for ( int i = 0; i < nl.getLength(); i++ ) {
               Node n = nl.item(i);
               if ( n.getNodeType() == Node.ELEMENT_NODE ) {
                  if ( e == null )
                     e = (Element)n;
                  else
                     throw new CompilationException("Only a single Element is allowed for inline source");
               }
            }
            String path = context.getCanonicalName();
            String systemID = XSLTQueryResolver.URL_PREFIX+path+"/";
            src = new DOMSource(e, systemID);
         }
      }
      catch ( DBException e ) {
         try {
            tx.cancel();
         }
         catch ( DBException ex ) {
            ex.printStackTrace(System.err);
         }

         if ( e instanceof QueryException )
            throw (QueryException)e;
         else
            throw new CompilationException(e);
      }
      finally {
         if ( tx.getStatus() == Transaction.ACTIVE ) {
            try {
               tx.commit();
View Full Code Here

Examples of com.luxoft.dnepr.courses.compiler.CompilationException

    private  Compilable firstOperand;
    private Compilable secondOperand;
    public byte[] compile() {
        try {
            if (firstOperand == null || secondOperand == null) {
                throw new CompilationException("Not enough operands!");
            }
            ByteArrayOutputStream result = new ByteArrayOutputStream();
            result.write(firstOperand.compile());
            result.write(secondOperand.compile());
            result.write(compileSelf());
            return result.toByteArray();
        } catch (IOException e) {
            throw new CompilationException(e);
        }
    }
View Full Code Here

Examples of eu.admire.dispel.engine.CompilationException

        {
            LOG.debug("Compiling DISPEL for used object: " + object);
        }
        if (object.getDispel() == null)
        {
            CompilationException exc = new CompilationException();
            exc.initCause(new NoDispelException(object));
            throw exc;
        }
        DISPELCompiler compiler = new DISPELCompiler();
        DISPELGraphBuilder builder = new DISPELGraphBuilder(registry, optimiser);
           
        compiler.setRequestBuilder(builder);
        builder.setCompiler(compiler);
        SimpleErrorListener listener = new SimpleErrorListener();
        compiler.addErrorListener(listener);
        compiler.parse(object.getDispel());
       
        if (listener.getError() != null)
        {
            CompilationException exc = new CompilationException();
            exc.initCause(listener.getError());
            throw exc;
        }
        LOG.debug("Compilation complete for object: " + object.getName());

        // Write the functions obtained to our function store
View Full Code Here

Examples of org.ajax4jsf.templatecompiler.builder.CompilationException

    Node functionNameNode = nnm.getNamedItem(FUNCTION_NAME_ATTRIBUTE_NAME);

    if (functionNameNode != null) {
      this.functionName = functionNameNode.getNodeValue();
    } else {
      throw new CompilationException("function name is not set");
    }

    Node nodeUseOnlyThisParameters = nnm
        .getNamedItem(USE_ONLY_THIS_PARAMETERS);
    if (nodeUseOnlyThisParameters != null) {
      this.useOnlyEnumeratingParaments = Boolean
          .getBoolean(nodeUseOnlyThisParameters.getNodeValue());
    } // if

    // read name of variable if need
    Node variableName = nnm.getNamedItem(VAR_ATTRIBUTE_NAME);
    if (variableName != null) {
      this.variable = variableName.getNodeValue();
    } // if

    // read name of parameters if need
    ParameterProcessor parameterProcessor = new ParameterProcessor(element,
        componentBean);

    this.parameters = parameterProcessor.getParameters();
    log.debug(this.parameters);

    List decodeFunctionName = null;

    decodeFunctionName = Arrays.asList(this.functionName
        .split(FUNCTION_DELIMITER));
    if (null == decodeFunctionName) {
      decodeFunctionName = new ArrayList();
      decodeFunctionName.add(this.functionName);
    }

    ArrayList functionNames = new ArrayList();
    String lastClassName = componentBean.getFullBaseclass();

    for (Iterator iter = decodeFunctionName.iterator(); iter.hasNext();) {
      String elementFunction = (String) iter.next();

      try {
        log.debug("Try to load class : " + lastClassName);

        Class clazz = componentBean.loadClass(lastClassName);

        if (!iter.hasNext()) {
          String method = getMethod(clazz, elementFunction);
          if (method != null) {
            log.debug(method);
            functionNames.add(method);
          } else {
            log.error("Method  " + elementFunction
                + " not found in class : " + lastClassName);
            throw new CompilationException();
          }

        } else {
          //
          // Probing properties !!!!
          //

          PropertyDescriptor propertyDescriptor = getPropertyDescriptor(
              clazz, elementFunction);

          if (propertyDescriptor != null) {
            functionNames.add(propertyDescriptor.getReadMethod()
                .getName()
                + "()");
            log.debug("Property " + elementFunction
                + " mapped to function  : "
                + propertyDescriptor.getReadMethod().getName());
            lastClassName = propertyDescriptor.getPropertyType()
                .getName();
          } else {
            log.error("Property " + elementFunction
                + " not found in class : " + lastClassName);
            throw new CompilationException();
          }
        }

      } catch (Throwable e) {

        log.error("Error load class : " + lastClassName + ", "
            + e.getLocalizedMessage());
        e.printStackTrace();
        throw new CompilationException("Error load class : "
            + lastClassName, e);
      }

    }
View Full Code Here

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

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

     * 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

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

    }

    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

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

  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

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

  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

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

  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
TOP
Copyright © 2018 www.massapi.com. 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.