Search in sources :

Example 1 with METADATA_NAME

use of org.commonjava.indy.pkg.maven.content.group.MavenMetadataMerger.METADATA_NAME in project indy by Commonjava.

the class KojiMavenMetadataProvider method handleExpired.

private void handleExpired(ProjectRef key) {
    Logger logger = LoggerFactory.getLogger(getClass());
    if (!kojiConfig.isEnabled()) {
        logger.debug("Koji add-on is disabled.");
        return;
    }
    logger.info("Koji metadata expired for GA: {}", key);
    try {
        Set<Group> affected = storeDataManager.query().getAll(s -> group == s.getType() && kojiConfig.isEnabledFor(s)).stream().map(s -> (Group) s).collect(Collectors.toSet());
        if (storeDataManager instanceof AbstractStoreDataManager) {
            affected = ((AbstractStoreDataManager) storeDataManager).filterAffectedGroups(affected);
        }
        if (!affected.isEmpty()) {
            logger.info("Triggering metadata cleanup from Koji metadata expiration, for GA: {} in groups: {}", key, affected);
            String path = ArtifactPathUtils.formatMetadataPath(key, METADATA_NAME);
            clearPaths(affected, path);
        }
    } catch (IndyDataException ex) {
        logger.error("Failed to clear group metadata for expired Koji metadata: " + key, ex);
    } catch (TransferException ex) {
        logger.error("Failed to format metadata path for: " + key, ex);
    }
}
Also used : Date(java.util.Date) LoggerFactory(org.slf4j.LoggerFactory) KojiTagInfo(com.redhat.red.build.koji.model.xmlrpc.KojiTagInfo) BasicCacheHandle(org.commonjava.indy.subsys.infinispan.BasicCacheHandle) Cache(org.infinispan.Cache) RemoteCache(org.infinispan.client.hotrod.RemoteCache) WeftExecutorService(org.commonjava.cdi.util.weft.WeftExecutorService) DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) WeftManaged(org.commonjava.cdi.util.weft.WeftManaged) CacheProducer(org.commonjava.indy.subsys.infinispan.CacheProducer) Map(java.util.Map) KojiArchiveInfo(com.redhat.red.build.koji.model.xmlrpc.KojiArchiveInfo) StoreKey(org.commonjava.indy.model.core.StoreKey) StoreType.group(org.commonjava.indy.model.core.StoreType.group) GroupMergeHelper(org.commonjava.indy.core.content.group.GroupMergeHelper) ConcreteResource(org.commonjava.maven.galley.model.ConcreteResource) Listener(org.infinispan.notifications.Listener) ClientListener(org.infinispan.client.hotrod.annotation.ClientListener) TimeZone(java.util.TimeZone) KojiClient(com.redhat.red.build.koji.KojiClient) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) CacheEntryExpired(org.infinispan.notifications.cachelistener.annotation.CacheEntryExpired) Collectors(java.util.stream.Collectors) List(java.util.List) InvalidVersionSpecificationException(org.commonjava.atlas.maven.ident.version.InvalidVersionSpecificationException) KojiBuildInfo(com.redhat.red.build.koji.model.xmlrpc.KojiBuildInfo) EventMetadata(org.commonjava.maven.galley.event.EventMetadata) Metadata(org.apache.maven.artifact.repository.metadata.Metadata) PostConstruct(javax.annotation.PostConstruct) ApplicationScoped(javax.enterprise.context.ApplicationScoped) Pattern(java.util.regex.Pattern) KojiBuildArchiveCollection(com.redhat.red.build.koji.model.xmlrpc.KojiBuildArchiveCollection) DirectContentAccess(org.commonjava.indy.content.DirectContentAccess) IndyDataException(org.commonjava.indy.data.IndyDataException) PoolUtils.detectOverloadVoid(org.commonjava.indy.core.ctl.PoolUtils.detectOverloadVoid) IndyKojiConfig(org.commonjava.indy.koji.conf.IndyKojiConfig) Locker(org.commonjava.cdi.util.weft.Locker) MavenMetadataProvider(org.commonjava.indy.pkg.maven.content.group.MavenMetadataProvider) SimpleDateFormat(java.text.SimpleDateFormat) SimpleProjectRef(org.commonjava.atlas.maven.ident.ref.SimpleProjectRef) Callable(java.util.concurrent.Callable) AtomicReference(java.util.concurrent.atomic.AtomicReference) VersionUtils(org.commonjava.atlas.maven.ident.util.VersionUtils) Group(org.commonjava.indy.model.core.Group) ConcurrentHashSet(org.infinispan.commons.util.concurrent.ConcurrentHashSet) ArrayList(java.util.ArrayList) InvalidRefException(org.commonjava.atlas.maven.ident.ref.InvalidRefException) AbstractStoreDataManager(org.commonjava.indy.db.common.AbstractStoreDataManager) ClientCacheEntryExpired(org.infinispan.client.hotrod.annotation.ClientCacheEntryExpired) Inject(javax.inject.Inject) Transfer(org.commonjava.maven.galley.model.Transfer) MetadataCacheManager(org.commonjava.indy.pkg.maven.content.MetadataCacheManager) CacheEntryExpiredEvent(org.infinispan.notifications.cachelistener.event.CacheEntryExpiredEvent) Calendar(java.util.Calendar) Measure(org.commonjava.o11yphant.metrics.annotation.Measure) ExecutorConfig(org.commonjava.cdi.util.weft.ExecutorConfig) IndyWorkflowException(org.commonjava.indy.IndyWorkflowException) KojiMavenVersionMetadataLocks(org.commonjava.indy.koji.inject.KojiMavenVersionMetadataLocks) DrainingExecutorCompletionService(org.commonjava.cdi.util.weft.DrainingExecutorCompletionService) KojiClientException(com.redhat.red.build.koji.KojiClientException) ArtifactPathUtils(org.commonjava.maven.galley.maven.util.ArtifactPathUtils) METADATA_NAME(org.commonjava.indy.pkg.maven.content.group.MavenMetadataMerger.METADATA_NAME) Versioning(org.apache.maven.artifact.repository.metadata.Versioning) LocationUtils(org.commonjava.indy.util.LocationUtils) Logger(org.slf4j.Logger) ArtifactStore(org.commonjava.indy.model.core.ArtifactStore) ProjectRef(org.commonjava.atlas.maven.ident.ref.ProjectRef) IOException(java.io.IOException) NotFoundCache(org.commonjava.maven.galley.spi.nfc.NotFoundCache) CacheHandle(org.commonjava.indy.subsys.infinispan.CacheHandle) File(java.io.File) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) KojiBuildState(com.redhat.red.build.koji.model.xmlrpc.KojiBuildState) ClientCacheEntryExpiredEvent(org.infinispan.client.hotrod.event.ClientCacheEntryExpiredEvent) KojiMavenVersionMetadataCache(org.commonjava.indy.koji.inject.KojiMavenVersionMetadataCache) SingleVersion(org.commonjava.atlas.maven.ident.version.SingleVersion) Collections(java.util.Collections) StoreDataManager(org.commonjava.indy.data.StoreDataManager) TransferException(org.commonjava.maven.galley.TransferException) IndyDataException(org.commonjava.indy.data.IndyDataException) Group(org.commonjava.indy.model.core.Group) TransferException(org.commonjava.maven.galley.TransferException) AbstractStoreDataManager(org.commonjava.indy.db.common.AbstractStoreDataManager) Logger(org.slf4j.Logger)

Aggregations

KojiClient (com.redhat.red.build.koji.KojiClient)1 KojiClientException (com.redhat.red.build.koji.KojiClientException)1 KojiArchiveInfo (com.redhat.red.build.koji.model.xmlrpc.KojiArchiveInfo)1 KojiBuildArchiveCollection (com.redhat.red.build.koji.model.xmlrpc.KojiBuildArchiveCollection)1 KojiBuildInfo (com.redhat.red.build.koji.model.xmlrpc.KojiBuildInfo)1 KojiBuildState (com.redhat.red.build.koji.model.xmlrpc.KojiBuildState)1 KojiTagInfo (com.redhat.red.build.koji.model.xmlrpc.KojiTagInfo)1 File (java.io.File)1 IOException (java.io.IOException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 Collections (java.util.Collections)1 Date (java.util.Date)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 TimeZone (java.util.TimeZone)1 Callable (java.util.concurrent.Callable)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1