Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.commonjava.indy.IndyWorkflowException;
import org.commonjava.indy.model.core.io.IndyObjectMapper;
import org.commonjava.indy.subsys.infinispan.BasicCacheHandle;
import org.commonjava.indy.subsys.infinispan.CacheProducer;
import org.infinispan.Cache;
import org.infinispan.manager.EmbeddedCacheManager;
Expand Down Expand Up @@ -46,14 +47,11 @@ public class IspnCacheController
@Inject
private IndyObjectMapper mapper;

private EmbeddedCacheManager cacheManager;

private Map<String, String> string2keyMapper;

@PostConstruct
private void setUp()
{
cacheManager = cacheProducer.getCacheManager();
string2keyMapper = new HashMap<>();
string2keyMapper.put( "content-index", "org.commonjava.indy.content.index.ISPFieldStringKey2StringMapper" );
string2keyMapper.put( "default", "org.commonjava.indy.pkg.maven.content.StoreKey2StringMapper" );
Expand All @@ -66,7 +64,7 @@ public void clean( String name ) throws IndyWorkflowException
throw new IndyWorkflowException( "Can not clean cache, name: " + name );
}

Cache<Object, Object> cache = cacheManager.getCache( name );
BasicCacheHandle cache = cacheProducer.getBasicCache( name );
if ( cache == null )
{
throw new IndyWorkflowException( "Cache not found, name: " + name );
Expand All @@ -77,7 +75,7 @@ public void clean( String name ) throws IndyWorkflowException
// only work for some caches for debugging
public String export( String cacheName, String key ) throws Exception
{
Cache<Object, Object> cache = cacheManager.getCache( cacheName );
BasicCacheHandle cache = cacheProducer.getBasicCache( cacheName );
if ( cache == null )
{
throw new IndyWorkflowException( "Cache not found, name: " + cacheName );
Expand All @@ -99,7 +97,7 @@ public String export( String cacheName, String key ) throws Exception
}
else
{
return mapper.writeValueAsString( cache.entrySet() );
return mapper.writeValueAsString( cache.getCache().entrySet() );
}
}

Expand Down