@Override public <E extends Event<Map>> void handle(E event) throws EventHandlingException { if (logger.isTraceEnabled()) { logger.trace("entering handle()"); } ApplicationArchive archive = (ApplicationArchive) event.getPayload().get("archive"); File file = archive.getFile(getFileSystemStoragePathPrefix()); if (file.exists()) { if (!file.delete()) { logger.error( "Failed to delete archive " + archive.getFile(getFileSystemStoragePathPrefix())); } } else { logger.warn( "Failed to find archive " + archive.getFile(getFileSystemStoragePathPrefix()) + ". It may have yet to be deployed."); } File directory = archive.getExplodedPath(getFileSystemStoragePathPrefix()); if (directory.exists()) { try { FileUtils.deleteDirectory(directory); } catch (IOException ioe) { String msg = "Unable to delete directory " + directory; logger.error(msg); throw new EventHandlingException(msg, ioe); } } if (logger.isTraceEnabled()) { logger.trace("exiting handle()"); } }