use of org.commonjava.maven.galley.event.FileAccessEvent in project indy by Commonjava.
the class MergedFileUploadListener method reMergeUploaded.
// NOTE: Disabling @Observes on this because I'm pretty sure the ContentManager is handling it now.
public void reMergeUploaded(/*@Observes*/
final FileEvent event) {
if (event instanceof FileAccessEvent) {
return;
}
final String path = event.getTransfer().getPath();
final StoreKey key = getKey(event);
if (!path.endsWith(MavenMetadataMerger.METADATA_NAME) && !path.endsWith(ArchetypeCatalogMerger.CATALOG_NAME)) {
return;
}
try {
final Set<Group> groups = dataManager.query().getGroupsContaining(key);
if (groups != null) {
for (final Group group : groups) {
try {
reMerge(group, path);
} catch (final IOException e) {
logger.error(String.format("Failed to delete: %s from group: %s. Error: %s", path, group, e.getMessage()), e);
}
}
}
} catch (final IndyDataException e) {
logger.warn("Failed to regenerate maven-metadata.xml for groups after deployment to: {}" + "\nCannot retrieve associated groups: {}", e, key, e.getMessage());
}
}
use of org.commonjava.maven.galley.event.FileAccessEvent in project galley by Commonjava.
the class Transfer method openInputStream.
public InputStream openInputStream(final boolean fireEvents, final EventMetadata eventMetadata) throws IOException {
provider.waitForReadUnlock(resource);
try {
InputStream stream = provider.openInputStream(resource);
if (stream == null) {
return null;
}
if (fireEvents) {
stream = new TransferInputStream(stream, new FileAccessEvent(this, eventMetadata), fileEventManager);
}
stream = decorator == null ? stream : decorator.decorateRead(stream, this, eventMetadata);
logger.trace("Returning stream: {} for transfer: {}", stream.getClass().getName(), this);
return stream;
} catch (final IOException e) {
if (fireEvents) {
fileEventManager.fire(new FileErrorEvent(this, e, eventMetadata));
}
throw e;
}
}
Aggregations