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();
}
}