use of org.commonjava.maven.galley.event.FileDeletionEvent in project indy by Commonjava.
the class MergedFileUploadListener method reMerge.
private void reMerge(final Group group, final String path) throws IOException {
logger.debug("Updating merged metadata file: {} in group: {}", path, group.getKey());
final Transfer[] toDelete = { fileManager.getStorageReference(group, path), fileManager.getStorageReference(group, path + GroupMergeHelper.MERGEINFO_SUFFIX), fileManager.getStorageReference(group, path + GroupMergeHelper.SHA_SUFFIX), fileManager.getStorageReference(group, path + GroupMergeHelper.MD5_SUFFIX) };
for (final Transfer item : toDelete) {
logger.debug("Attempting to delete: {}", item);
if (item.exists()) {
final boolean result = item.delete();
logger.debug("Deleted: {} (success? {})", item, result);
if (fileEvent != null) {
logger.debug("Firing deletion event for: {}", item);
fileEvent.fire(new FileDeletionEvent(item, new EventMetadata()));
}
}
}
}
use of org.commonjava.maven.galley.event.FileDeletionEvent in project galley by Commonjava.
the class Transfer method delete.
public boolean delete(final boolean fireEvents, final EventMetadata eventMetadata) throws IOException {
provider.waitForWriteUnlock(resource);
try {
if (decorator != null) {
decorator.decorateDelete(this, eventMetadata);
}
Logger contentLogger = LoggerFactory.getLogger(DELETE_CONTENT_LOG);
if (contentLogger.isTraceEnabled()) {
contentLogger.trace("Starting delete of: {} ({}) from:\n ", resource, eventMetadata, join(Thread.currentThread().getStackTrace(), "\n "));
} else {
contentLogger.info("Starting delete of: {} ({})", resource, eventMetadata);
}
final boolean deleted = provider.delete(resource);
if (deleted) {
contentLogger.info("Finished delete of: {}", resource);
if (fireEvents) {
fileEventManager.fire(new FileDeletionEvent(this, eventMetadata));
}
} else {
contentLogger.info("Failed to delete: {}", resource);
}
return deleted;
} catch (final IOException e) {
if (fireEvents) {
fileEventManager.fire(new FileErrorEvent(this, e, eventMetadata));
}
throw e;
}
}
Aggregations