Package org.exist.storage

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

Related Classes of org.exist.storage.XQueryPool

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.