use of org.commonjava.indy.koji.model.IndyKojiConstants.KOJI_ORIGIN in project indy by Commonjava.
the class KojiRemoteContenIndexingRescanManager method indexPostRescan.
public void indexPostRescan(@Observes final ArtifactStorePostRescanEvent e) throws IndyWorkflowException {
Collection<ArtifactStore> repos = e.getStores();
for (ArtifactStore repo : repos) {
if (repo.getType() == StoreType.remote && repo.getName().startsWith(KOJI_ORIGIN)) {
LOGGER.trace("Rebuild content index for koji remote: {}", repo.getKey());
final RemoteRepository kojiRemote = (RemoteRepository) repo;
try {
Set<Group> affected = storeDataManager.query().getGroupsAffectedBy(kojiRemote.getKey());
Set<StoreKey> affetctedGroupKeys = affected.stream().map(g -> g.getKey()).collect(Collectors.toSet());
StoreKey[] gKeys = affetctedGroupKeys.toArray(new StoreKey[affetctedGroupKeys.size()]);
kojiRemote.getPathMaskPatterns().forEach(path -> contentIndexManager.indexPathInStores(path, kojiRemote.getKey(), gKeys));
} catch (IndyDataException ex) {
LOGGER.error(String.format("Can not get the affected groups for hosted repo %s due to %s", kojiRemote.getKey(), ex.getMessage()), ex);
}
}
}
}
Aggregations