use of org.commonjava.o11yphant.metrics.annotation.Measure in project indy by Commonjava.
the class ContentGeneratorManager method handleContentStorage.
@Measure
public void handleContentStorage(ArtifactStore transferStore, String path, Transfer txfr, EventMetadata eventMetadata) throws IndyWorkflowException {
for (final ContentGenerator generator : contentGenerators) {
logger.debug("{} Handling content storage of: {} in: {}", generator, path, transferStore.getKey());
generator.handleContentStorage(transferStore, path, txfr, eventMetadata);
}
}
use of org.commonjava.o11yphant.metrics.annotation.Measure in project indy by Commonjava.
the class StoreEnablementManager method onDisableTimeout.
@Measure
public void onDisableTimeout(@Observes ScheduleTriggerEvent evt) {
Logger logger = LoggerFactory.getLogger(getClass());
logger.debug("Checking for store-reenable event in: {} (trigger? {} Disable-Timeout? {})", evt, true, DISABLE_TIMEOUT.equals(evt.getJobType()));
if (DISABLE_TIMEOUT.equals(evt.getJobType())) {
handleDisableTimeout(evt.getPayload());
}
}
use of org.commonjava.o11yphant.metrics.annotation.Measure in project indy by Commonjava.
the class DefaultDownloadManager method listRecursively.
@Override
@Measure
public List<Transfer> listRecursively(final StoreKey src, final String startPath) throws IndyWorkflowException {
final List<Transfer> result = new ArrayList<>();
final Transfer transfer = getStorageReference(src, startPath);
recurseListing(transfer, result);
logger.debug("listRecursively result: {}", result);
return result;
}
use of org.commonjava.o11yphant.metrics.annotation.Measure in project indy by Commonjava.
the class DefaultDownloadManager method list.
@Override
@Measure
public List<StoreResource> list(final ArtifactStore store, final String path, final EventMetadata eventMetadata) throws IndyWorkflowException {
final List<StoreResource> result = new ArrayList<>();
if (store.getKey().getType() == StoreType.group) {
try {
final List<ListingResult> results = transfers.listAll(locationExpander.expand(new VirtualResource(LocationUtils.toLocations(store), path)), eventMetadata);
for (final ListingResult lr : results) {
if (lr != null && lr.getListing() != null) {
for (final String file : lr.getListing()) {
result.add(new StoreResource((KeyedLocation) lr.getLocation(), path, file));
}
}
}
} catch (final TransferLocationException e) {
fireIndyStoreErrorEvent(e);
logger.warn("Location Error: " + e.getMessage(), e);
throw new IndyWorkflowException("Failed to list ALL paths: {} from: {}. Reason: {}", e, path, store.getKey(), e.getMessage());
} catch (final TransferException e) {
logger.error(e.getMessage(), e);
throw new IndyWorkflowException("Failed to list ALL paths: {} from: {}. Reason: {}", e, path, store.getKey(), e.getMessage());
}
} else {
if (!PathMaskChecker.checkListingMask(store, path)) {
// if list not permitted for the path, return empty list
return result;
}
final KeyedLocation loc = LocationUtils.toLocation(store);
final StoreResource res = new StoreResource(loc, path);
if (store instanceof RemoteRepository) {
try {
final ListingResult lr = transfers.list(res, eventMetadata);
if (lr != null && lr.getListing() != null) {
for (final String file : lr.getListing()) {
result.add(new StoreResource(loc, path, file));
}
}
} catch (final TransferLocationException e) {
fireIndyStoreErrorEvent(e);
logger.warn("Location Error: " + e.getMessage(), e);
throw new IndyWorkflowException("Failed to list path: {} from: {}. Reason: {}", e, path, store.getKey(), e.getMessage());
} catch (final TransferException e) {
logger.error(e.getMessage(), e);
throw new IndyWorkflowException("Failed to list path: {} from: {}. Reason: {}", e, path, store.getKey(), e.getMessage());
}
} else {
try {
final ListingResult listing = transfers.list(res, eventMetadata);
if (listing != null && listing.getListing() != null) {
for (final String child : listing.getListing()) {
result.add(new StoreResource(loc, path, child));
}
}
} catch (final TransferLocationException e) {
fireIndyStoreErrorEvent(e);
logger.warn("Timeout / bad gateway: " + e.getMessage(), e);
throw new IndyWorkflowException("Failed to list path: {} from: {}. Reason: {}", e, path, store.getKey(), e.getMessage());
} catch (final TransferException e) {
logger.error(e.getMessage(), e);
throw new IndyWorkflowException("Failed to list path: {} from: {}. Reason: {}", e, path, store.getKey(), e.getMessage());
}
}
}
return dedupeListing(result);
}
use of org.commonjava.o11yphant.metrics.annotation.Measure in project indy by Commonjava.
the class DefaultContentManager method list.
@Override
@Measure
public List<StoreResource> list(final ArtifactStore store, final String path, final EventMetadata eventMetadata) throws IndyWorkflowException {
final EventMetadata metadata = setAllowRemoteDownloading(eventMetadata);
List<StoreResource> listed;
if (group == store.getKey().getType()) {
List<ArtifactStore> members = getOrderedConcreteStoresAndFilter((Group) store, path);
listed = new ArrayList<>();
contentGeneratorManager.generateGroupDirectoryContentAnd((Group) store, members, path, eventMetadata, listed::addAll);
for (final ArtifactStore member : members) {
List<StoreResource> storeListing = null;
try {
storeListing = list(member, path, metadata);
} catch (IndyWorkflowException e) {
e.filterLocationErrors();
}
if (storeListing != null) {
listed.addAll(storeListing);
}
}
} else {
listed = downloadManager.list(store, path, metadata);
contentGeneratorManager.generateDirectoryContentAnd(store, path, listed, metadata, listed::addAll);
}
return dedupeListing(listed);
}
Aggregations