Package org.exist.xmldb

Examples of org.exist.xmldb.XQueryService


   */
  private final XQueryService getXQueryService(Database db) {
    try {
      Collection collection = DatabaseManager.getCollection(eXistUrl + XmldbURI.ROOT_COLLECTION, "admin", "admin");
      if (collection != null) {
        XQueryService service = (XQueryService)collection.getService("XQueryService", "1.0");
        collection.close();
        return service;
      }
    } catch (XMLDBException e) {
      fail(e.getMessage());
View Full Code Here


   */
  private XQueryService setupDatabase() {   
    try {
      Database  eXist = registerDatabase();
      // Obtain XQuery service
      XQueryService service = null;   
      service = getXQueryService(eXist);
      return service;
    } catch (Exception e) {
      fail("Unable to register database: "  + e.getMessage());
    }
View Full Code Here

      System.out.println("processing use-case: " + files[i].getAbsolutePath());
      System.out.println("========================================================================");
      String query = readQuery(files[i]);
      System.out.println(query);
      System.out.println("_________________________________________________________________________________");
      XQueryService service = (XQueryService)root.getService("XQueryService", "1.0");
      ResourceSet results;
      try {
        results = service.query(query);
        for(int j = 0; j < results.getSize(); j++) {
          String output = (String)results.getResource(j).getContent();
          System.out.println(output);
        }
      } catch (Exception e) {
View Full Code Here

        TestRunner.run(QueryPoolTest.class);
    }
   
    public void testDifferentQueries() {
        try {
            XQueryService service = (XQueryService) testCollection.getService("XQueryService", "1.0");
            for (int i = 0; i < 10000; i++) {
                System.out.println("Inserting node " + i + "...");
                String query = "update insert <node id='id" + Integer.toHexString(i) + "'>" +
                        "<p>Some longer text <b>content</b> in this node. Some longer text <b>content</b> in this node. " +
                        "Some longer text <b>content</b> in this node. Some longer text <b>content</b> in this node.</p>" +
                        "</node> " +
                        "into //test[@id = 't1']";
                service.execute(new StringSource(query));
            }
        } catch (XMLDBException e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
View Full Code Here

    } catch (XMLDBException e) {
      fail("Unable to register database: "  + e.getMessage());
    }

    // Obtain XQuery service
    XQueryService service = null;
    try {
      service = getXQueryService(eXist);
      if (service == null) {
        fail("Failed to obtain xquery service instance!");
      }
View Full Code Here

   * @throws XMLDBException on database error
   */
  private final XQueryService getXQueryService(Database db) throws XMLDBException {
    Collection collection = DatabaseManager.getCollection(eXistUrl + XmldbURI.ROOT_COLLECTION, "admin", "");
    if (collection != null) {
      XQueryService service = (XQueryService)collection.getService("XQueryService", "1.0");
      collection.close();
      return service;
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.exist.xmldb.XQueryService

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.