Search in sources :

Example 1 with PathMap

use of org.commonjava.storage.pathmapped.model.PathMap in project indy by Commonjava.

the class PathMappedMavenGACache method scan.

/**
 * Scan the stores to find all GAs.
 * @param notScanned
 * @param gaMap
 * @param completed
 */
private void scan(final Collection<String> notScanned, final Map<String, Set<String>> gaMap, final Set<String> completed) {
    PathDB pathDB = pathMappedFileManager.getPathDB();
    notScanned.forEach(storeName -> {
        Set<String> gaSet = new HashSet<>();
        pathDB.traverse("maven:hosted:" + storeName, ROOT_DIR, pathMap -> {
            String gaPath = getGAPath(pathMap);
            if (isNotBlank(gaPath)) {
                gaSet.add(gaPath);
            }
        }, 0, PathDB.FileType.file);
        gaSet.forEach(ga -> {
            gaMap.computeIfAbsent(ga, k -> new HashSet<>()).add(storeName);
        });
        logger.info("Scan result, store: {}, gaSet: {}", storeName, gaSet);
        completed.add(storeName);
    });
}
Also used : CacheProvider(org.commonjava.maven.galley.spi.cache.CacheProvider) PathMappedFileManager(org.commonjava.storage.pathmapped.core.PathMappedFileManager) Row(com.datastax.driver.core.Row) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) Timer(java.util.Timer) MINUTES(java.util.concurrent.TimeUnit.MINUTES) IndyLifecycleException(org.commonjava.indy.action.IndyLifecycleException) ROOT_DIR(org.commonjava.storage.pathmapped.util.PathMapUtils.ROOT_DIR) ArrayList(java.util.ArrayList) PreparedStatement(com.datastax.driver.core.PreparedStatement) Inject(javax.inject.Inject) HashSet(java.util.HashSet) ResultSet(com.datastax.driver.core.ResultSet) Lists(com.google.common.collect.Lists) PathMap(org.commonjava.storage.pathmapped.model.PathMap) BoundStatement(com.datastax.driver.core.BoundStatement) Session(com.datastax.driver.core.Session) CacheProducer(org.commonjava.indy.subsys.infinispan.CacheProducer) Map(java.util.Map) TimerTask(java.util.TimerTask) Path(java.nio.file.Path) PKG_TYPE_MAVEN(org.commonjava.indy.pkg.PackageTypeConstants.PKG_TYPE_MAVEN) Logger(org.slf4j.Logger) ArtifactStore(org.commonjava.indy.model.core.ArtifactStore) Collections.emptySet(java.util.Collections.emptySet) Collection(java.util.Collection) StoreType(org.commonjava.indy.model.core.StoreType) Set(java.util.Set) PathDB(org.commonjava.storage.pathmapped.spi.PathDB) SchemaUtils.getSchemaCreateKeyspace(org.commonjava.indy.subsys.cassandra.util.SchemaUtils.getSchemaCreateKeyspace) Collectors(java.util.stream.Collectors) CassandraClient(org.commonjava.indy.subsys.cassandra.CassandraClient) CacheHandle(org.commonjava.indy.subsys.infinispan.CacheHandle) List(java.util.List) StringUtils.isNotBlank(org.apache.commons.lang3.StringUtils.isNotBlank) StartupAction(org.commonjava.indy.action.StartupAction) StringUtils.isBlank(org.apache.commons.lang3.StringUtils.isBlank) Paths(java.nio.file.Paths) IndyConfiguration(org.commonjava.indy.conf.IndyConfiguration) PostConstruct(javax.annotation.PostConstruct) PathMappedCacheProvider(org.commonjava.maven.galley.cache.pathmapped.PathMappedCacheProvider) ApplicationScoped(javax.enterprise.context.ApplicationScoped) IndyDataException(org.commonjava.indy.data.IndyDataException) StoreDataManager(org.commonjava.indy.data.StoreDataManager) PathDB(org.commonjava.storage.pathmapped.spi.PathDB) HashSet(java.util.HashSet)

Aggregations

BoundStatement (com.datastax.driver.core.BoundStatement)1 PreparedStatement (com.datastax.driver.core.PreparedStatement)1 ResultSet (com.datastax.driver.core.ResultSet)1 Row (com.datastax.driver.core.Row)1 Session (com.datastax.driver.core.Session)1 Lists (com.google.common.collect.Lists)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections.emptySet (java.util.Collections.emptySet)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1 MINUTES (java.util.concurrent.TimeUnit.MINUTES)1 Collectors (java.util.stream.Collectors)1