public Resource removeResource(ResourceIdentity resid) {
return removeResourceInternal(resid, true);
}
private synchronized Resource removeResourceInternal(ResourceIdentity resid, boolean writeXML) {
Resource res = getResource(resid);
List<Capability> ccaps = res.getCapabilities(ContentNamespace.CONTENT_NAMESPACE);
if (!ccaps.isEmpty()) {
Capability ccap = ccaps.iterator().next();
URL fileURL = (URL) ccap.getAttribute(ContentNamespace.CAPABILITY_URL_ATTRIBUTE);
File contentFile = new File(fileURL.toExternalForm().substring("file:".length()));
if (contentFile.exists()) {
deleteRecursive(contentFile.getParentFile());
}
}
super.removeResource(res.getIdentity());
if (writeXML == true) {
writeRepositoryXML();
}
return res;
}