Element metadata = dataMan.getMetadata(context, id, forEditing, withValidationErrors, keepXlinkAttributes);
Element elem = dataMan.getElementByRef(metadata, ref);
if (elem == null)
throw new ObjectNotFoundEx("element with ref='" + ref + "'");
String fname = elem.getText();
// Remove the file and update the file upload/downloads tables
IResourceRemoveHandler removeHook = (IResourceRemoveHandler) context.getApplicationContext().getBean("resourceRemoveHandler");