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);