use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.
the class DBUtils method removeCollection.
public static void removeCollection(final Collection parent, final String name) throws XMLDBException {
final CollectionManagementService service = getCollectionManagementService(parent);
service.removeCollection(name);
}
use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.
the class RemoteDatabaseImplTest method testGetCollection.
@Test
public void testGetCollection() throws ClassNotFoundException, IllegalAccessException, InstantiationException, XMLDBException, SyntaxException, PermissionDeniedException {
Class<?> cl = Class.forName(DB_DRIVER);
Database database = (Database) cl.newInstance();
DatabaseManager.registerDatabase(database);
Collection rootCollection = DatabaseManager.getCollection(getUri() + XmldbURI.ROOT_COLLECTION, "admin", "");
CollectionManagementService cms = (CollectionManagementService) rootCollection.getService("CollectionManagementService", "1.0");
Collection adminCollection = cms.createCollection(ADMIN_COLLECTION_NAME);
UserManagementService ums = (UserManagementService) rootCollection.getService("UserManagementService", "1.0");
if (ums != null) {
Permission p = ums.getPermissions(adminCollection);
p.setMode(Permission.USER_STRING + "=+read,+write," + Permission.GROUP_STRING + "=-read,-write," + Permission.OTHER_STRING + "=-read,-write");
ums.setPermissions(adminCollection, p);
Collection guestCollection = DatabaseManager.getCollection(getUri() + XmldbURI.ROOT_COLLECTION + "/" + ADMIN_COLLECTION_NAME, "guest", "guest");
Resource resource = guestCollection.createResource("testguest", "BinaryResource");
resource.setContent("123".getBytes());
try {
guestCollection.storeResource(resource);
fail();
} catch (XMLDBException e) {
}
cms.removeCollection(ADMIN_COLLECTION_NAME);
}
}
use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.
the class AnnotationsTest method setUp.
@BeforeClass
public static void setUp() throws XMLDBException, ClassNotFoundException, InstantiationException, IllegalAccessException {
CollectionManagementService service = (CollectionManagementService) existEmbeddedServer.getRoot().getService("CollectionManagementService", "1.0");
Collection testCollection = service.createCollection("test");
assertNotNull(testCollection);
}
use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.
the class CleanupTest method tearDown.
@After
public void tearDown() throws XMLDBException {
final CollectionManagementService service = (CollectionManagementService) existEmbeddedServer.getRoot().getService("CollectionManagementService", "1.0");
service.removeCollection("test");
}
use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.
the class RenameCollectionTest method setUp.
@Before
public void setUp() throws XMLDBException {
final Collection root = DatabaseManager.getCollection(getBaseUri() + "/db", TestUtils.ADMIN_DB_USER, TestUtils.ADMIN_DB_PWD);
final CollectionManagementService service = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
testCollection = service.createCollection(TEST_COLLECTION_NAME);
assertNotNull(testCollection);
}
Aggregations