use of org.exist.xmldb.EXistCollection in project exist by eXist-db.
the class ExistXmldbEmbeddedServer method createCollection.
public Collection createCollection(final Collection collection, final String collectionName) throws XMLDBException {
final CollectionManagementService collectionManagementService = (CollectionManagementService) collection.getService("CollectionManagementService", "1.0");
Collection newCollection = collection.getChildCollection(collectionName);
if (newCollection == null) {
collectionManagementService.createCollection(collectionName);
}
final XmldbURI uri = XmldbURI.LOCAL_DB_URI.resolveCollectionPath(((EXistCollection) collection).getPathURI().append(collectionName));
if (asGuest) {
newCollection = DatabaseManager.getCollection(uri.toString(), TestUtils.GUEST_DB_USER, TestUtils.GUEST_DB_PWD);
} else {
newCollection = DatabaseManager.getCollection(uri.toString(), TestUtils.ADMIN_DB_USER, TestUtils.ADMIN_DB_PWD);
}
return newCollection;
}
Aggregations