Package org.exist.source

Examples of org.exist.source.StringSource


        final long startTime = System.currentTimeMillis();
        DBBroker broker = null;
        Source source = null;
        CompiledXQuery compiled = null;
        try {
            source = new StringSource(xpath);
            broker = factory.getBrokerPool().get(user);
            compiled = compile(broker, source, parameters);
            final QueryResult result = doQuery(broker, compiled, null,
                    parameters);
            if(result.hasErrors())
View Full Code Here


    public HashMap<String, Object> compile(String query, HashMap<String, Object> parameters) throws EXistException, PermissionDeniedException {
        final HashMap<String, Object> ret = new HashMap<String, Object>();
        DBBroker broker = null;
        XQueryPool pool = null;
        CompiledXQuery compiled = null;
        final Source source = new StringSource(query);
        try {
            broker = factory.getBrokerPool().get(user);
            final XQuery xquery = broker.getXQueryService();
            pool = xquery.getXQueryPool();
            compiled = compile(broker, source, parameters);
View Full Code Here

        DBBroker broker = null;
        Source source = null;
        CompiledXQuery compiled = null;
        try {
            broker = factory.getBrokerPool().get(user);
            source = new StringSource(xpath);
            compiled = compile(broker, source, parameters);
            final QueryResult qr = doQuery(broker, compiled, null, parameters);
            if (qr == null)
                {return "<?xml version=\"1.0\"?>\n"
                        + "<exist:result xmlns:exist=\"" + Namespaces.EXIST_NS + "\" "
View Full Code Here

                    final NodeProxy node = new NodeProxy(doc, nodeId);
                    nodes = new ExtArrayNodeSet(1);
                    nodes.add(node);
                }
            }
            source = new StringSource(xpath);
            compiled = compile(broker, source, parameters);
           
            queryResult = doQuery(broker, compiled, nodes, parameters);
            if (queryResult == null)
                {return ret;}
View Full Code Here

        Source source = null;
        CompiledXQuery compiled = null;
        final HashMap<String, Object> parameters = new HashMap<String, Object>();
        try {
            broker = factory.getBrokerPool().get(user);
            source = new StringSource(xpath);
            compiled = compile(broker, source, parameters);
            final QueryResult qr = doQuery(broker, compiled, null, parameters);
            if (qr == null)
                {return new HashMap<String, Object>();}
            if (qr.hasErrors())
View Full Code Here

    BrokerPool brokerPool = BrokerPool.getInstance(MY_TEST_INSTANCE);

    //BUG: need to be released!
    broker = brokerPool.get(brokerPool.getSecurityManager().getSystemSubject());
    pool = new XQueryPool(configuration);
    stringSource = new StringSource(TEST_XQUERY_SOURCE);

    XQuery xquery = broker.getXQueryService();
    XQueryContext context = new XQueryContext(broker.getBrokerPool(), AccessContext.TEST);
    preCompiledXQuery = xquery.compile(context, stringSource);
    System.out.println("pre-compiled XQuery: " + preCompiledXQuery);
View Full Code Here

  }

  /** test with a new StringSource object having same content */
  public void testBorrowCompiledXQueryNewStringSource() {
    pool.returnCompiledXQuery(stringSource, preCompiledXQuery);
    StringSource localStringSource = new StringSource(TEST_XQUERY_SOURCE);

    callAndTestBorrowCompiledXQuery(localStringSource);
  }
View Full Code Here

  }

  /** test with a new StringSource object having same content */
  public void testBorrowCompiledXQueryNewStringSource2() {
    pool.returnCompiledXQuery(stringSource, preCompiledXQuery);
    StringSource localStringSource = new StringSource(TEST_XQUERY_SOURCE);

    callAndTestBorrowCompiledXQuery(localStringSource);
    callAndTestBorrowCompiledXQuery(localStringSource);
  }
View Full Code Here

    public XQueryPool getXQueryPool() {
        return broker.getBrokerPool().getXQueryPool();
    }
   
    public CompiledXQuery compile(final XQueryContext context, final String expression) throws XPathException, PermissionDeniedException {
      final Source source = new StringSource(expression);
      try {
            return compile(context, source);
        } catch(final IOException ioe) {
            //should not happen because expression is a String
            throw new XPathException(ioe.getMessage());
View Full Code Here

    }
       
        query.append(")");
       
        //compile the query
        return compileXQuery(broker, new StringSource(query.toString()), new XmldbURI[]{xqwsDescription.getCollectionURI()}, xqwsDescription.getCollectionURI(), request, response);
    }
View Full Code Here

TOP

Related Classes of org.exist.source.StringSource

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.