Package org.exist.fluent

Examples of org.exist.fluent.Transaction


      db = null;
    }
  }
   
  private static void wipeDatabase() throws Exception {
    Transaction tx = db.requireTransactionWithBroker();
    try {
      Collection root = tx.broker.getCollection(XmldbURI.ROOT_COLLECTION_URI);
      for (Iterator<XmldbURI> it = root.collectionIterator(tx.broker); it.hasNext(); ) {
        XmldbURI childName = it.next();
        if (!childName.getCollectionPath().equals(XmldbURI.SYSTEM_COLLECTION_NAME)) {
          tx.broker.removeCollection(tx.tx, tx.broker.getCollection(root.getURI().append(childName)));
        }
      }
      for (Iterator<DocumentImpl> it = root.iterator(tx.broker); it.hasNext(); ) {
        DocumentImpl doc = it.next();
        if (doc instanceof BinaryDocument) {
          root.removeBinaryResource(tx.tx, tx.broker, doc);
        } else {
          root.removeXMLResource(tx.tx, tx.broker, doc.getFileURI());
        }
      }
      tx.commit();
    } finally {
      tx.abortIfIncomplete();
    }
  }
View Full Code Here

TOP

Related Classes of org.exist.fluent.Transaction

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.