}
return bd;
}
private String setAdminCredentials(String uri, String username, String password, String adminPassword) throws XMLDBException, URISyntaxException {
final XmldbURI dbUri;
if(!uri.endsWith(XmldbURI.ROOT_COLLECTION)) {
dbUri = XmldbURI.xmldbUriFor(uri + XmldbURI.ROOT_COLLECTION);
} else {
dbUri = XmldbURI.xmldbUriFor(uri);
}
final Collection root = DatabaseManager.getCollection(dbUri.toString(), username, password);
final UserManagementService mgmt = (UserManagementService)root.getService("UserManagementService", "1.0");
final Account dba = mgmt.getAccount(SecurityManager.DBA_USER);
if (dba == null) {
throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, "'"+SecurityManager.DBA_USER+"' account can't be found.");
}