* Deletes an asset.
* @throws Exception if an error occurs.
*/
protected void deleteAsset() throws Exception {
String assetName = getParameterAsString("delete");
ResourcesManager resourcesManager = null;
try {
// Retrieve the resource instance via the ResourcesManager
resourcesManager = (ResourcesManager)
this.manager.lookup(ResourcesManager.ROLE);
Resource theResource =
resourcesManager.getResource(getSourceDocument(), assetName);
if (theResource == null)
throw new Exception("no such resource [" + assetName + "] exists for document [ " + getSourceDocument().getId() + "]");
// Lock the resource nodes
List nodes = new ArrayList();
nodes.addAll(Arrays.asList(theResource.getRepositoryNodes()));
lockInvolvedObjects((Transactionable[])nodes.toArray(new Transactionable[nodes.size()]));
// Delete the resource
resourcesManager.deleteResource(theResource);
} catch (final Exception e) {
getLogger().error("The resource could not be deleted: ", e);
addErrorMessage("The resource could not be deleted (see log files for details).");
} finally {