Search in sources :

Example 6 with IndyMetrics

use of org.commonjava.indy.measure.annotation.IndyMetrics in project indy by Commonjava.

the class KojiContentManagerDecorator method retrieve.

@Override
@IndyMetrics(measure = @Measure(timers = @MetricNamed(name = IndyMetricsKojiNames.METHOD_CONTENTMANAGER_RETRIEVE + IndyMetricsNames.TIMER), meters = @MetricNamed(name = IndyMetricsKojiNames.METHOD_CONTENTMANAGER_RETRIEVE + IndyMetricsNames.METER)))
public Transfer retrieve(final ArtifactStore store, final String path, final EventMetadata eventMetadata) throws IndyWorkflowException {
    Logger logger = LoggerFactory.getLogger(getClass());
    logger.info("KOJI: Delegating initial retrieval attempt for: {}/{}", store.getKey(), path);
    Transfer result = delegate.retrieve(store, path, eventMetadata);
    if (result == null && StoreType.group == store.getKey().getType()) {
        logger.info("KOJI: Checking for Koji build matching: {}", path);
        Group group = (Group) store;
        RemoteRepository kojiProxy = findKojiBuildAnd(store, path, eventMetadata, null, this::createRemoteRepository);
        if (kojiProxy != null) {
            adjustTargetGroup(kojiProxy, group);
            result = delegate.retrieve(kojiProxy, path, eventMetadata);
        }
        if (result != null) {
            nfc.clearMissing(new ConcreteResource(LocationUtils.toLocation(store), path));
        }
    }
    // Finally, pass the Transfer back.
    return result;
}
Also used : Group(org.commonjava.indy.model.core.Group) Transfer(org.commonjava.maven.galley.model.Transfer) ConcreteResource(org.commonjava.maven.galley.model.ConcreteResource) RemoteRepository(org.commonjava.indy.model.core.RemoteRepository) Logger(org.slf4j.Logger) IndyMetrics(org.commonjava.indy.measure.annotation.IndyMetrics)

Aggregations

IndyMetrics (org.commonjava.indy.measure.annotation.IndyMetrics)6 Logger (org.slf4j.Logger)5 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 Inject (javax.inject.Inject)3 Measure (org.commonjava.indy.measure.annotation.Measure)3 KojiClient (com.redhat.red.build.koji.KojiClient)2 KojiClientException (com.redhat.red.build.koji.KojiClientException)2 KojiArchiveInfo (com.redhat.red.build.koji.model.xmlrpc.KojiArchiveInfo)2 KojiBuildArchiveCollection (com.redhat.red.build.koji.model.xmlrpc.KojiBuildArchiveCollection)2 KojiBuildInfo (com.redhat.red.build.koji.model.xmlrpc.KojiBuildInfo)2 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ApplicationScoped (javax.enterprise.context.ApplicationScoped)2 Group (org.commonjava.indy.model.core.Group)2 RemoteRepository (org.commonjava.indy.model.core.RemoteRepository)2 EventMetadata (org.commonjava.maven.galley.event.EventMetadata)2 ConcreteResource (org.commonjava.maven.galley.model.ConcreteResource)2 Transfer (org.commonjava.maven.galley.model.Transfer)2