Package com.marklogic.xcc

Examples of com.marklogic.xcc.ResultSequence


 
  public void testRelToAbs2() throws Exception {
    XdmValue[] params = new XdmValue[] {
        ValueFactory.newXSString(absURL),
        ValueFactory.newXSString("./lena.jpg")};
    ResultSequence rs = executeLibraryModule(modulePath, moduleNamespace, "rel-to-abs", params);
    String s = (String)rs.itemAt(0).asString();
    assertEquals(s, "http://www.example.com/a/b/lena.jpg");         
  }
View Full Code Here


 
  public void testRelToAbs3() throws Exception {
    XdmValue[] params = new XdmValue[] {
        ValueFactory.newXSString(absURL),
        ValueFactory.newXSString("../../lena.jpg")};
    ResultSequence rs = executeLibraryModule(modulePath, moduleNamespace, "rel-to-abs", params);
    String s = (String)rs.itemAt(0).asString();
    assertEquals(s, "http://www.example.com/lena.jpg");         
  }
View Full Code Here

 
  public void testRelToAbs4() throws Exception {
    XdmValue[] params = new XdmValue[] {
        ValueFactory.newXSString(absURL),
        ValueFactory.newXSString("/lena.jpg")};
    ResultSequence rs = executeLibraryModule(modulePath, moduleNamespace, "rel-to-abs", params);
    String s = (String)rs.itemAt(0).asString();
    assertEquals(s, "http://www.example.com/lena.jpg");         
  }
View Full Code Here

 
  public void testRelToAbs5() throws Exception {
    XdmValue[] params = new XdmValue[] {
        ValueFactory.newXSString(absURL),
        ValueFactory.newXSString("../x/lena.jpg")};
    ResultSequence rs = executeLibraryModule(modulePath, moduleNamespace, "rel-to-abs", params);
    String s = (String)rs.itemAt(0).asString();
    assertEquals(s, "http://www.example.com/a/x/lena.jpg");         
  }
View Full Code Here

 
  public void testRelToAbs6() throws Exception {
    XdmValue[] params = new XdmValue[] {
        ValueFactory.newXSString(absURL),
        ValueFactory.newXSString("../../x/y/lena.jpg")};
    ResultSequence rs = executeLibraryModule(modulePath, moduleNamespace, "rel-to-abs", params);
    String s = (String)rs.itemAt(0).asString();
    assertEquals(s, "http://www.example.com/x/y/lena.jpg");         
  }
View Full Code Here

 
  public void testRelToAbs7() throws Exception {
    XdmValue[] params = new XdmValue[] {
        ValueFactory.newXSString(absURL),
        ValueFactory.newXSString("?w=90&h=60&f=lena.jpg")};
    ResultSequence rs = executeLibraryModule(modulePath, moduleNamespace, "rel-to-abs", params);
    String s = (String)rs.itemAt(0).asString();
    assertEquals(s, "http://www.example.com/a/b/c?w=90&h=60&f=lena.jpg");         
  }
View Full Code Here

 
  public void testRelToAbs8() throws Exception {
    XdmValue[] params = new XdmValue[] {
        ValueFactory.newXSString(absURL),
        ValueFactory.newXSString("#lena")};
    ResultSequence rs = executeLibraryModule(modulePath, moduleNamespace, "rel-to-abs", params);
    String s = (String)rs.itemAt(0).asString();
    assertEquals(s, "http://www.example.com/a/b/c#lena");         
  }
View Full Code Here

 
  public void testRelToAbs9() throws Exception {
    XdmValue[] params = new XdmValue[] {
        ValueFactory.newXSString(absURL),
        ValueFactory.newXSString("http://www.google.com")};
    ResultSequence rs = executeLibraryModule(modulePath, moduleNamespace, "rel-to-abs", params);
    String s = (String)rs.itemAt(0).asString();
    assertEquals(s, "http://www.google.com");         
  }
View Full Code Here

                + "let $status := \n"
                + " xdmp:server-status(xdmp:host(), xdmp:server())\n"
                + "let $modules := $status/mlss:modules\n"
                + "let $root := $status/mlss:root\n"
                + "return (data($modules), data($root))");
        ResultSequence rs = null;
        try {
            rs = session.submitRequest(q);
        } catch (RequestException e) {
            e.printStackTrace();
        } finally {
            session.close();
        }
        while (rs.hasNext()) {
            ResultItem rsItem = rs.next();
            XdmItem item = rsItem.getItem();
            if (rsItem.getIndex() == 0 && item.asString().equals("0")) {
                options.setModulesDatabase("");
            }
            if (rsItem.getIndex() == 1) {
View Full Code Here

            req.setNewStringVariable("TYPE",
                    TransformOptions.COLLECTION_TYPE);
            req.setNewStringVariable("PATTERN", "[,\\s]+");
            req.setOptions(requestOptions);

            ResultSequence res = session.submitRequest(req);

            // like a Pascal string, the first item will be the count
            total = ((XSInteger) res.next().getItem()).asPrimitiveInt();
            logger.info("expecting total " + total);
            if (0 == total) {
                logger.info("nothing to process");
                stop();
                return;
            }

            uriQueue.setExpected(total);
            uriQueue.start();

            monitor.setTaskCount(total);
            monitorThread.start();

            // this may return millions of items:
            // try to be memory-efficient
            count = 0;
            String uri;
            // check pool occasionally, for fast-fail
            while (res.hasNext() && null != pool) {
                uri = res.next().asString();
                uriQueue.add(uri);
                if (null == pool) {
                    break;
                }
                count++;
View Full Code Here

TOP

Related Classes of com.marklogic.xcc.ResultSequence

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.