Search in sources :

Example 1 with CacheHandle

use of org.commonjava.indy.subsys.infinispan.CacheHandle in project indy by Commonjava.

the class MetadataCacheProducer method registerTransformer.

private void registerTransformer(BasicCacheHandle handler) {
    // for embedded mode
    if (handler instanceof CacheHandle) {
        ((CacheHandle<MetadataKey, MetadataKey>) handler).executeCache(cache -> {
            SearchManagerImplementor searchManager = (SearchManagerImplementor) Search.getSearchManager(cache);
            searchManager.registerKeyTransformer(MetadataKey.class, MetadataKeyTransformer.class);
            return null;
        });
    }
    if (handler.getCache() instanceof RemoteCache) {
        ((RemoteCache) handler.getCache()).addClientListener(cacheListener);
    } else {
        ((Cache) handler.getCache()).addListener(cacheListener);
    }
}
Also used : SearchManagerImplementor(org.infinispan.query.spi.SearchManagerImplementor) BasicCacheHandle(org.commonjava.indy.subsys.infinispan.BasicCacheHandle) CacheHandle(org.commonjava.indy.subsys.infinispan.CacheHandle) RemoteCache(org.infinispan.client.hotrod.RemoteCache) Cache(org.infinispan.Cache) RemoteCache(org.infinispan.client.hotrod.RemoteCache)

Example 2 with CacheHandle

use of org.commonjava.indy.subsys.infinispan.CacheHandle in project indy by Commonjava.

the class KojiMavenMetadataProviderTest method setup.

@Before
public void setup() throws Exception {
    contentMetadata.clear();
    Thread.currentThread().setName(named.getMethodName());
    cacheMgr = new DefaultCacheManager();
    String mdCacheName = "koji-maven-metadata";
    cache = new CacheHandle(mdCacheName, cacheMgr.getCache(mdCacheName, true));
    kojiConfig = new IndyKojiConfig();
    kojiConfig.setEnabled(true);
    kojiConfig.setLockTimeoutSeconds(2);
    kojiConfig.setMaxConnections(2);
    kojiConfig.setMetadataTimeoutSeconds(2);
    kojiConfig.setRequestTimeoutSeconds(1);
    kojiConfig.setStorageRootUrl(server.formatUrl("kojiroot"));
    kojiConfig.setUrl(server.formatUrl("koji"));
    kojiConfig.setTargetGroups(Collections.singletonMap("public", "public"));
}
Also used : DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) CacheHandle(org.commonjava.indy.subsys.infinispan.CacheHandle) IndyKojiConfig(org.commonjava.indy.koji.conf.IndyKojiConfig) Before(org.junit.Before)

Example 3 with CacheHandle

use of org.commonjava.indy.subsys.infinispan.CacheHandle in project indy by Commonjava.

the class ContentControllerTest method setup.

@Before
public void setup() throws Exception {
    contentMetadata.clear();
    fixture.initMissingComponents();
    final StoreDataManager storeManager = new MemoryStoreDataManager(true);
    WeftExecutorService rescanService = new PoolWeftExecutorService("test-rescan-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
    final DownloadManager fileManager = new DefaultDownloadManager(storeManager, fixture.getTransferManager(), fixture.getLocationExpander(), rescanService);
    WeftExecutorService contentAccessService = new PoolWeftExecutorService("test-content-access-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
    final DirectContentAccess dca = new DefaultDirectContentAccess(fileManager, contentAccessService);
    final ContentManager contentManager = new DefaultContentManager(storeManager, fileManager, new IndyObjectMapper(true), new SpecialPathManagerImpl(), new MemoryNotFoundCache(), new DefaultContentDigester(dca, new CacheHandle<String, TransferMetadata>("content-metadata", contentMetadata)), new ContentGeneratorManager());
    final TemplatingEngine templates = new TemplatingEngine(new GStringTemplateEngine(), new DataFileManager(fixture.getTemp().newFolder("indy-home"), new DataFileEventManager()));
    content = new ContentController(storeManager, contentManager, templates, new IndyObjectMapper(true), new MimeTyper());
}
Also used : PoolWeftExecutorService(org.commonjava.cdi.util.weft.PoolWeftExecutorService) DefaultContentDigester(org.commonjava.indy.core.content.DefaultContentDigester) DataFileEventManager(org.commonjava.indy.subsys.datafile.change.DataFileEventManager) DefaultContentManager(org.commonjava.indy.core.content.DefaultContentManager) ContentManager(org.commonjava.indy.content.ContentManager) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) GStringTemplateEngine(groovy.text.GStringTemplateEngine) DefaultContentManager(org.commonjava.indy.core.content.DefaultContentManager) DownloadManager(org.commonjava.indy.content.DownloadManager) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) MimeTyper(org.commonjava.indy.util.MimeTyper) SpecialPathManagerImpl(org.commonjava.maven.galley.io.SpecialPathManagerImpl) PoolWeftExecutorService(org.commonjava.cdi.util.weft.PoolWeftExecutorService) WeftExecutorService(org.commonjava.cdi.util.weft.WeftExecutorService) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) DirectContentAccess(org.commonjava.indy.content.DirectContentAccess) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) CacheHandle(org.commonjava.indy.subsys.infinispan.CacheHandle) TemplatingEngine(org.commonjava.indy.subsys.template.TemplatingEngine) DataFileManager(org.commonjava.indy.subsys.datafile.DataFileManager) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) StoreDataManager(org.commonjava.indy.data.StoreDataManager) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) ContentGeneratorManager(org.commonjava.indy.core.content.ContentGeneratorManager) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) Before(org.junit.Before)

Aggregations

CacheHandle (org.commonjava.indy.subsys.infinispan.CacheHandle)3 Before (org.junit.Before)2 GStringTemplateEngine (groovy.text.GStringTemplateEngine)1 PoolWeftExecutorService (org.commonjava.cdi.util.weft.PoolWeftExecutorService)1 WeftExecutorService (org.commonjava.cdi.util.weft.WeftExecutorService)1 ContentManager (org.commonjava.indy.content.ContentManager)1 DirectContentAccess (org.commonjava.indy.content.DirectContentAccess)1 DownloadManager (org.commonjava.indy.content.DownloadManager)1 ContentGeneratorManager (org.commonjava.indy.core.content.ContentGeneratorManager)1 DefaultContentDigester (org.commonjava.indy.core.content.DefaultContentDigester)1 DefaultContentManager (org.commonjava.indy.core.content.DefaultContentManager)1 DefaultDirectContentAccess (org.commonjava.indy.core.content.DefaultDirectContentAccess)1 DefaultDownloadManager (org.commonjava.indy.core.content.DefaultDownloadManager)1 StoreDataManager (org.commonjava.indy.data.StoreDataManager)1 IndyKojiConfig (org.commonjava.indy.koji.conf.IndyKojiConfig)1 MemoryStoreDataManager (org.commonjava.indy.mem.data.MemoryStoreDataManager)1 IndyObjectMapper (org.commonjava.indy.model.core.io.IndyObjectMapper)1 DataFileManager (org.commonjava.indy.subsys.datafile.DataFileManager)1 DataFileEventManager (org.commonjava.indy.subsys.datafile.change.DataFileEventManager)1 BasicCacheHandle (org.commonjava.indy.subsys.infinispan.BasicCacheHandle)1