Examples of CompiledXQuery


Examples of org.exist.xquery.CompiledXQuery

                    LOG.error("broker unable to retrieve XQueryService");
                    return;
                }

                final XQueryPool xqpool = xquery.getXQueryPool();
                CompiledXQuery compiled = xqpool.borrowCompiledXQuery(broker, source);
                XQueryContext context;
                if (compiled == null)
                    {context = xquery.newContext(AccessContext.REST);}
                else
                    {context = compiled.getContext();}
                context.setStaticallyKnownDocuments(new XmldbURI[] { pathUri });
                context.setBaseURI(new AnyURIValue(pathUri.toString()));

                if (compiled == null)
                    {compiled = xquery.compile(context, source);}
                else {
                    compiled.getContext().updateContext(context);
                    context.getWatchDog().reset();
                }

                final Properties outputProperties = new Properties();
                Sequence result = null;
View Full Code Here

Examples of org.exist.xquery.CompiledXQuery

          XQueryContext queryContext = xquery.newContext(AccessContext.REST);
 
      // Find correct script load path
      queryContext.setModuleLoadPath(XmldbURI.create(uri).removeLastSegment().toString());
 
      CompiledXQuery compiled;
      try {
        compiled = xquery.compile(queryContext, source);
      } catch (IOException e) {
        e.printStackTrace();
        return null;
View Full Code Here

Examples of org.exist.xquery.CompiledXQuery

                    source = new StringSource(xpointer);
                }
                final XQuery xquery = serializer.broker.getXQueryService();
                final XQueryPool pool = xquery.getXQueryPool();
                XQueryContext context;
                CompiledXQuery compiled = pool.borrowCompiledXQuery(serializer.broker, source);
                if (compiled != null)
                    {context = compiled.getContext();}
                else
                    {context = xquery.newContext(AccessContext.XINCLUDE);}
                context.declareNamespaces(namespaces);
                context.declareNamespace("xinclude", XINCLUDE_NS);
               
View Full Code Here

Examples of org.exist.xquery.CompiledXQuery

        DBBroker broker = null;
        Sequence result= null;
        try {
            broker = brokerPool.get(user);
           
            CompiledXQuery compiled =null;
            final XQuery xquery = broker.getXQueryService();
            final XQueryContext context = xquery.newContext(AccessContext.INTERNAL_PREFIX_LOOKUP);
           
            if(collection!=null){
                context.declareVariable(COLLECTION, collection);
View Full Code Here

Examples of org.exist.xquery.CompiledXQuery

      context.setDebuggeeJoint(null);
      context.undeclareGlobalVariable(Debuggee.SESSION);
      context.undeclareGlobalVariable(Debuggee.IDEKEY);
     
      XQuery service = broker.getXQueryService();
      CompiledXQuery compiled = service.compile(context, script);
     
      Sequence resultSequence = service.execute(compiled, null);
 
          SAXSerializer sax = null;
          Serializer serializer = broker.getSerializer();
View Full Code Here

Examples of org.exist.xquery.CompiledXQuery

      if (!mime.isXMLType() && !mime.equals(xqueryMimeType)) {
        throw new BadRequestException(
            "The xquery mime type is not an XML mime type nor application/xquery");
      }

      CompiledXQuery compiledQuery = null;
      try {
        final StringBuilder builder = new StringBuilder();
        final Reader r = new InputStreamReader(request.getInputStream(), charset);
        final char[] buffer = new char[4096];
        int len;
View Full Code Here

Examples of org.exist.xquery.CompiledXQuery

   
    if (collection == null)
      {throw new BadRequestException("Collection " + request.getPath() + " does not exist.");}

    final XQuery xquery = broker.getXQueryService();
    CompiledXQuery feedQuery = xquery.getXQueryPool().borrowCompiledXQuery(broker, config.querySource);

    XQueryContext context;
    if (feedQuery == null) {
      context = xquery.newContext(AccessContext.REST);
      context.setModuleLoadPath(getContext().getModuleLoadPath());
      try {
        feedQuery = xquery.compile(context, config.querySource);
      } catch (final XPathException ex) {
        throw new EXistException("Cannot compile xquery "
            + config.querySource.getURL(), ex);
      } catch (final IOException ex) {
        throw new EXistException(
            "I/O exception while compiling xquery "
                + config.querySource.getURL(), ex);
      }
    } else {
      context = feedQuery.getContext();
      context.setModuleLoadPath(getContext().getModuleLoadPath());
    }

    context.setStaticallyKnownDocuments(new XmldbURI[] { XmldbURI.create(
        request.getPath()).append(AtomProtocol.FEED_DOCUMENT_NAME) });
View Full Code Here

Examples of org.exist.xquery.CompiledXQuery

    }
    TriggerStatePerThread.setTransaction(transaction);
   
    final XQueryContext context = service.newContext(AccessContext.TRIGGER);
         //TODO : further initialisations ?
        CompiledXQuery compiledQuery;
        try
        {
          //compile the XQuery
          compiledQuery = service.compile(context, query);
View Full Code Here

Examples of org.exist.xquery.CompiledXQuery

    // avoid infinite recursion by allowing just one trigger per thread
    if(!TriggerStatePerThread.verifyUniqueTriggerPerThreadBeforeFinish(this, src))
      {return;}
   
        final XQueryContext context = service.newContext(AccessContext.TRIGGER);
        CompiledXQuery compiledQuery = null;
        try {
          //compile the XQuery
          compiledQuery = service.compile(context, query);
         
          //declare external variables
View Full Code Here

Examples of org.exist.xquery.CompiledXQuery

    final XQueryContext context = service.newContext(AccessContext.TRIGGER);
        if (query instanceof DBSource) {
            context.setModuleLoadPath(XmldbURI.EMBEDDED_SERVER_URI_PREFIX + ((DBSource)query).getDocumentPath().removeLastSegment().toString());
        }

        CompiledXQuery compiledQuery;
        try {
          //compile the XQuery
          compiledQuery = service.compile(context, query);

          //declare user defined parameters as external variables
          for(final Iterator itUserVarName = userDefinedVariables.keySet().iterator(); itUserVarName.hasNext();) {
            final String varName = (String)itUserVarName.next();
            final String varValue = userDefinedVariables.getProperty(varName);
         
            context.declareVariable(bindingPrefix + varName, new StringValue(varValue));
          }
         
          //reset & prepareForExecution for execution
          compiledQuery.reset();

          context.getWatchDog().reset();

            //do any preparation before execution
            context.prepareForExecution();
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.