1717
1818import org .commonjava .indy .IndyWorkflowException ;
1919import org .commonjava .indy .model .core .io .IndyObjectMapper ;
20+ import org .commonjava .indy .subsys .infinispan .BasicCacheHandle ;
2021import org .commonjava .indy .subsys .infinispan .CacheProducer ;
2122import org .infinispan .Cache ;
2223import org .infinispan .manager .EmbeddedCacheManager ;
@@ -46,14 +47,11 @@ public class IspnCacheController
4647 @ Inject
4748 private IndyObjectMapper mapper ;
4849
49- private EmbeddedCacheManager cacheManager ;
50-
5150 private Map <String , String > string2keyMapper ;
5251
5352 @ PostConstruct
5453 private void setUp ()
5554 {
56- cacheManager = cacheProducer .getCacheManager ();
5755 string2keyMapper = new HashMap <>();
5856 string2keyMapper .put ( "content-index" , "org.commonjava.indy.content.index.ISPFieldStringKey2StringMapper" );
5957 string2keyMapper .put ( "default" , "org.commonjava.indy.pkg.maven.content.StoreKey2StringMapper" );
@@ -66,7 +64,7 @@ public void clean( String name ) throws IndyWorkflowException
6664 throw new IndyWorkflowException ( "Can not clean cache, name: " + name );
6765 }
6866
69- Cache < Object , Object > cache = cacheManager . getCache ( name );
67+ BasicCacheHandle cache = cacheProducer . getBasicCache ( name );
7068 if ( cache == null )
7169 {
7270 throw new IndyWorkflowException ( "Cache not found, name: " + name );
@@ -77,7 +75,7 @@ public void clean( String name ) throws IndyWorkflowException
7775 // only work for some caches for debugging
7876 public String export ( String cacheName , String key ) throws Exception
7977 {
80- Cache < Object , Object > cache = cacheManager . getCache ( cacheName );
78+ BasicCacheHandle cache = cacheProducer . getBasicCache ( cacheName );
8179 if ( cache == null )
8280 {
8381 throw new IndyWorkflowException ( "Cache not found, name: " + cacheName );
@@ -99,7 +97,7 @@ public String export( String cacheName, String key ) throws Exception
9997 }
10098 else
10199 {
102- return mapper .writeValueAsString ( cache .entrySet () );
100+ return mapper .writeValueAsString ( cache .getCache (). entrySet () );
103101 }
104102 }
105103
0 commit comments