Search in sources :

Example 1 with EXistCollection

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;
}
Also used : CollectionManagementService(org.xmldb.api.modules.CollectionManagementService) EXistCollection(org.exist.xmldb.EXistCollection) EXistCollection(org.exist.xmldb.EXistCollection) XmldbURI(org.exist.xmldb.XmldbURI)

Aggregations

EXistCollection (org.exist.xmldb.EXistCollection)1 XmldbURI (org.exist.xmldb.XmldbURI)1 CollectionManagementService (org.xmldb.api.modules.CollectionManagementService)1