(CollectionManagementService) collection.getService("CollectionManagementService", "1.0");
service.removeCollection(name);
} catch (XMLDBException e) {
String message = "Failed to remove collection " + name + ": " + e.errorCode;
getLogger().error(message, e);
throw new SourceException(message);
}
} else {
try {
base = this.url.substring(0, this.url.lastIndexOf("/"));
name = this.url.substring(this.url.lastIndexOf("/")+1);
Collection collection = DatabaseManager.getCollection(base, user, password);
Resource resource = collection.getResource(name);
if (resource == null) {
String message = "Resource " + name + " does not exist";
getLogger().debug(message);
throw new SourceException(message);
} else {
collection.removeResource(resource);
getLogger().debug("Removed resource: "+ name);
}
} catch (XMLDBException e) {
String message = "Failed to delete resource " + name + ": " + e.errorCode;
getLogger().debug(message, e);
throw new SourceException(message);
}
}
}