Examples of QueryProcessor


Examples of com.google.gerrit.server.query.change.QueryProcessor

  protected void doGet(HttpServletRequest req, HttpServletResponse rsp)
      throws IOException {
    rsp.setContentType("text/json");
    rsp.setCharacterEncoding("UTF-8");

    QueryProcessor p = processor.get();
    OutputFormat format = OutputFormat.JSON;
    try {
      format = OutputFormat.valueOf(get(req, "format", format.toString()));
    } catch (IllegalArgumentException err) {
      error(rsp, "invalid format");
      return;
    }

    switch (format) {
      case JSON:
        rsp.setContentType("text/json");
        rsp.setCharacterEncoding("UTF-8");
        break;

      case TEXT:
        rsp.setContentType("text/plain");
        rsp.setCharacterEncoding("UTF-8");
        break;

      default:
        error(rsp, "invalid format");
        return;
    }

    p.setIncludeComments(get(req, "comments", false));
    p.setIncludeCurrentPatchSet(get(req, "current-patch-set", false));
    p.setIncludePatchSets(get(req, "patch-sets", false));
    p.setIncludeApprovals(get(req, "all-approvals", false));
    p.setOutput(rsp.getOutputStream(), format);
    p.query(get(req, "q", "status:open"));
  }
View Full Code Here

Examples of net.sf.saxon.query.QueryProcessor

                    " or the empty string.",
                    YVerificationMessage.ERROR_STATUS));
        } else {
            Configuration configuration = new Configuration();
            StaticQueryContext staticQueryContext = new StaticQueryContext();
            QueryProcessor qp = new QueryProcessor(configuration, staticQueryContext);
            try {
                qp.compileQuery(xQuery);
            } catch (XPathException e) {
                messages.add(new YVerificationMessage(this, this +
                        "(id= " + this.getID() + ") the XQuery could not be successfully" +
                        " parsed. [" + e.getMessage() + "]",
                        YVerificationMessage.ERROR_STATUS));
View Full Code Here

Examples of net.sf.saxon.query.QueryProcessor

            //JDOM code for produce string for reading by SAXON
            XMLOutputter outputter = new XMLOutputter();
            //SAXON XQuery code
            Configuration configuration = new Configuration();
            StaticQueryContext staticQueryContext = new StaticQueryContext();
            QueryProcessor qp = new QueryProcessor(configuration, staticQueryContext);
            XQueryExpression xQueryExpression = qp.compileQuery(query);
            //if SAXON worked with JDOM directly we could replace the next with:
            ///DocumentInfo saxonDocInfo = qp.buildDocument(new DocumentWrapper(_parentDecomposition.getInternalDataDocument(), null));
            DocumentInfo saxonDocInfo = qp.buildDocument(new StreamSource(
                    new StringReader(outputter.outputString(document))));
            DynamicQueryContext dynamicQueryContext = new DynamicQueryContext();
            dynamicQueryContext.setContextNode(saxonDocInfo);
            resultObj = xQueryExpression.evaluateSingle(dynamicQueryContext);
            NodeInfo nodeInfo = (NodeInfo) resultObj;
View Full Code Here

Examples of net.sf.saxon.query.QueryProcessor

            //JDOM code for produce string for reading by SAXON
            XMLOutputter outputter = new XMLOutputter();
            //SAXON XQuery code
            Configuration configuration = new Configuration();
            StaticQueryContext staticQueryContext = new StaticQueryContext();
            QueryProcessor qp = new QueryProcessor(configuration, staticQueryContext);
            XQueryExpression xQueryExpression = qp.compileQuery(query);
            //if SAXON worked with JDOM directly (like it claims to) we could replace the next with:
            ///DocumentInfo saxonDocInfo = qp.buildDocument(new DocumentWrapper(_parentDecomposition.getInternalDataDocument(), null));
            DocumentInfo saxonDocInfo = qp.buildDocument(new StreamSource(
                    new StringReader(outputter.outputString(element))));
            DynamicQueryContext dynamicQueryContext = new DynamicQueryContext();
            dynamicQueryContext.setContextNode(saxonDocInfo);
            List nodeList = xQueryExpression.evaluate(dynamicQueryContext);
            //my code to parse SAXON resulting XML tree and produce a string
View Full Code Here

Examples of net.sf.saxon.query.QueryProcessor

public class XPathSaxonUser {
    public static void main(String[] args) {

        net.sf.saxon.Configuration config = new Configuration();
        net.sf.saxon.query.StaticQueryContext context = new net.sf.saxon.query.StaticQueryContext();
        QueryProcessor qp = new QueryProcessor(config, context);
        try {
            XQueryExpression exp = qp.compileQuery("generate-id(/bye_mum/hi_there)");

            DocumentInfo doc = qp.buildDocument(new StreamSource(new StringReader(
                    "<bye_mum inf='h'><hi_there/></bye_mum>")));
            DynamicQueryContext dynamicQueryContext = new DynamicQueryContext();
            dynamicQueryContext.setContextNode(doc);
            Object o = exp.evaluateSingle(dynamicQueryContext);
System.out.println("o = " + o);
View Full Code Here

Examples of org.jboss.dna.graph.query.process.QueryProcessor

        return queryEngine;
    }

    protected QueryEngine getQueryEngine( Optimizer optimizer ) {
        Planner planner = new CanonicalPlanner();
        Processor processor = new QueryProcessor() {
            /**
             * {@inheritDoc}
             *
             * @see org.jboss.dna.graph.query.process.QueryProcessor#createAccessComponent(org.jboss.dna.graph.query.model.QueryCommand,
             *      org.jboss.dna.graph.query.QueryContext, org.jboss.dna.graph.query.plan.PlanNode,
View Full Code Here

Examples of org.jboss.dna.graph.query.process.QueryProcessor

            observable.register(this.searchObserver);

            // Set up the query engine ...
            Planner planner = new CanonicalPlanner();
            Optimizer optimizer = new RuleBasedOptimizer();
            Processor processor = new QueryProcessor() {

                /**
                 * {@inheritDoc}
                 *
                 * @see org.jboss.dna.graph.query.process.QueryProcessor#createAccessComponent(org.jboss.dna.graph.query.model.QueryCommand,
View Full Code Here

Examples of org.teiid.query.processor.QueryProcessor

        Command command = helpGetCommand("SELECT * FROM xmltest.doc6", metadata); //$NON-NLS-1$
        XMLPlan plan = TestXMLPlanner.preparePlan(command, metadata, new DefaultCapabilitiesFinder(), null);

        BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
        CommandContext context = new CommandContext("pID", null, null, null, 1);                                 //$NON-NLS-1$
        QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataMgr);
        processor.setNonBlocking(true);
        BatchCollector collector = processor.createBatchCollector();
        TeiidComponentException failOnDefaultException = null;
        try{
            collector.collectTuples();
        } catch (TeiidComponentException e){
            failOnDefaultException = e;
View Full Code Here

Examples of org.teiid.query.processor.QueryProcessor

    public void helpTestProcessor(FakeProcessorPlan plan, long timeslice, List[] expectedResults) throws TeiidException {
        BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
        FakeDataManager dataManager = new FakeDataManager();

        CommandContext context = new CommandContext("pid", "group", null, null, 1); //$NON-NLS-1$ //$NON-NLS-2$
        QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataManager);
        BatchCollector collector = processor.createBatchCollector();
        TupleBuffer tsID = null;
        while(true) {
            try {
                tsID = collector.collectTuples();        
                break;
View Full Code Here

Examples of org.teiid.query.processor.QueryProcessor

    Option option = new Option();
    option.setNoCache(true);
    option.addNoCacheGroup(fullName);
    proc.setOption(option);
    Determinism determinismLevel = context.resetDeterminismLevel();
    QueryProcessor qp = context.getQueryProcessorFactory().createQueryProcessor(proc.toString(), fullName.toUpperCase(), context);
    qp.setNonBlocking(true);
    qp.getContext().setDataObjects(null);
    BatchCollector bc = qp.createBatchCollector();
    TupleBuffer tb = bc.collectTuples();
    CachedResults cr = new CachedResults();
    cr.setResults(tb, qp.getProcessorPlan());
    cr.setHint(hint);
    if (hint != null && hint.getDeterminism() != null) {
      LogManager.logTrace(LogConstants.CTX_DQP, new Object[] { "Cache hint modified the query determinism from ",determinismLevel, " to ", hint.getDeterminism() }); //$NON-NLS-1$ //$NON-NLS-2$
      determinismLevel = hint.getDeterminism();
    }
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.