Examples of XQueryPool


Examples of org.exist.storage.XQueryPool

        broker = brokerPool.get(user);
//        DocumentSet docs = collection.getCollection().allDocs(broker, new DocumentSet(), true, true);
        final XmldbURI[] docs = new XmldbURI[] { XmldbURI.create(collection.getName()) };

        final XQuery xquery = broker.getXQueryService();
        final XQueryPool pool = xquery.getXQueryPool();
        XQueryContext context;
        CompiledXQuery compiled = pool.borrowCompiledXQuery(broker, source);
        if(compiled == null)
            {context = xquery.newContext(accessCtx);}
        else
            {context = compiled.getContext();}
        //context.setBackwardsCompatibility(xpathCompatible);
        context.setStaticallyKnownDocuments(docs);

        if (variableDecls.containsKey(Debuggee.PREFIX+":session")) {
          context.declareVariable(Debuggee.SESSION, variableDecls.get(Debuggee.PREFIX+":session"));
          variableDecls.remove(Debuggee.PREFIX+":session");
        }

        setupContext(source, context);
       
        if(compiled == null)
            {compiled = xquery.compile(context, source);}
        try {
            result = xquery.execute(compiled, null, properties);
        } finally {
            pool.returnCompiledXQuery(source, compiled);
        }
      } catch (final EXistException e) {
        throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e);
      } catch (final XPathException e) {
        throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e);
View Full Code Here

Examples of org.exist.storage.XQueryPool

            return Sequence.EMPTY_SEQUENCE; // no controller found
        }
        final String basePath = staticRewrite == null ? "." : staticRewrite.getTarget();
       
        final XQuery xquery = broker.getXQueryService();
        final XQueryPool xqyPool = xquery.getXQueryPool();
   
        CompiledXQuery compiled = null;
        if (compiledCache) {
      compiled = xqyPool.borrowCompiledXQuery(broker, sourceInfo.source);
        }
        XQueryContext queryContext;
        if (compiled == null) {
      queryContext = xquery.newContext(AccessContext.REST);
    } else {
      queryContext = compiled.getContext();
    }
        // Find correct module load path
    queryContext.setModuleLoadPath(sourceInfo.moduleLoadPath);
        declareVariables(queryContext, sourceInfo, staticRewrite, basePath, request, response);
        if (compiled == null) {
      try {
        compiled = xquery.compile(queryContext, sourceInfo.source);
      } catch (final IOException e) {
        throw new ServletException("Failed to read query from " + query, e);
      }
    }
        model.setSourceInfo(sourceInfo);
       
//    This used by controller.xql only ?
//    String xdebug = request.getParameter("XDEBUG_SESSION_START");
//    if (xdebug != null)
//      compiled.getContext().setDebugMode(true);

//      outputProperties.put("base-uri", collectionURI.toString());

        try {
      return xquery.execute(compiled, null, outputProperties);
    } finally {
            queryContext.runCleanupTasks();
      xqyPool.returnCompiledXQuery(sourceInfo.source, compiled);
    }
    }
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.