@Override public void readElement(final XMLExtendedStreamReader reader, final ConfigurationBuilderHolder holder) throws XMLStreamException { ConfigurationBuilder builder = holder.getCurrentConfigurationBuilder(); Element element = Element.forName(reader.getLocalName()); switch (element) { case JDBM_STORE: { parseJdbmStore(reader, builder.loaders(), holder.getClassLoader()); break; } default: { throw ParseUtils.unexpectedElement(reader); } } }
@Override public void readElement(final XMLExtendedStreamReader reader, final ConfigurationBuilderHolder holder) throws XMLStreamException { ConfigurationBuilder builder = holder.getCurrentConfigurationBuilder(); Element element = Element.forName(reader.getLocalName()); switch (element) { case BDBJE_STORE: { parseBdbjeStore(reader, builder.loaders(), holder.getClassLoader()); break; } default: { throw ParseUtils.unexpectedElement(reader); } } }
@Override public void readElement(final XMLExtendedStreamReader reader, final ConfigurationBuilderHolder holder) throws XMLStreamException { ConfigurationBuilder builder = holder.getCurrentConfigurationBuilder(); Element element = Element.forName(reader.getLocalName()); switch (element) { case BDBJE_STORE: { parseBdbjeStore(reader, builder.loaders(), holder.getClassLoader()); break; } default: { throw ParseUtils.unexpectedElement(reader); } } }
@Override public void readElement(final XMLExtendedStreamReader reader, final ConfigurationBuilderHolder holder) throws XMLStreamException { ConfigurationBuilder builder = holder.getCurrentConfigurationBuilder(); Element element = Element.forName(reader.getLocalName()); switch (element) { case JDBM_STORE: { parseJdbmStore(reader, builder.loaders(), holder.getClassLoader()); break; } default: { throw ParseUtils.unexpectedElement(reader); } } }
private void initTransactionManager() { Configuration conf = makeRequiredConfiguration(); // for the dummy cache disable, cache loaders if any was configured ConfigurationBuilder confBuilder = new ConfigurationBuilder().read(conf); confBuilder.loaders().clearCacheLoaders(); conf = confBuilder.build(); String DUMMY_CACHE = "dummy-cache"; logger.debug("Configuration for {} is: {}", DUMMY_CACHE, conf.toString()); try { this.cacheManager.defineConfiguration(DUMMY_CACHE, conf); Cache<?, ?> dummyCache = this.cacheManager.getCache(DUMMY_CACHE); TransactionManager tm = dummyCache.getAdvancedCache().getTransactionManager(); this.transactionManager = tm; } catch (Exception e) { logger.error("Failed to get Repository TransactionManager", e); throw new PersistenceException(e); } }
private void initTransactionManager() { Configuration conf = makeRequiredConfiguration(); // for the dummy cache disable, cache loaders if any was configured ConfigurationBuilder confBuilder = new ConfigurationBuilder().read(conf); confBuilder.loaders().clearCacheLoaders(); conf = confBuilder.build(); String DUMMY_CACHE = "dummy-cache"; logger.debug("Configuration for {} is: {}", DUMMY_CACHE, conf.toString()); try { this.cacheManager.defineConfiguration(DUMMY_CACHE, conf); Cache<?, ?> dummyCache = this.cacheManager.getCache(DUMMY_CACHE); TransactionManager tm = dummyCache.getAdvancedCache().getTransactionManager(); this.transactionManager = tm; } catch (Exception e) { logger.error("Failed to get Repository TransactionManager", e); throw new PersistenceException(e); } }
public void testBdbjeCacheStoreConfigurationAdaptor() { ConfigurationBuilder b = new ConfigurationBuilder(); b.loaders().addStore(BdbjeCacheStoreConfigurationBuilder.class).location("/tmp/bdbje").cacheDbNamePrefix("myprefix").catalogDbName("mycatalog").fetchPersistentState(true).async().enable(); Configuration configuration = b.build(); BdbjeCacheStoreConfiguration store = (BdbjeCacheStoreConfiguration) configuration.loaders().cacheLoaders().get(0); assert store.location().equals("/tmp/bdbje"); assert store.cacheDbNamePrefix().equals("myprefix"); assert store.catalogDbName().equals("mycatalog"); assert store.fetchPersistentState(); assert store.async().enabled(); b = new ConfigurationBuilder(); b.loaders().addStore(BdbjeCacheStoreConfigurationBuilder.class).read(store); Configuration configuration2 = b.build(); BdbjeCacheStoreConfiguration store2 = (BdbjeCacheStoreConfiguration) configuration2.loaders().cacheLoaders().get(0); assert store2.location().equals("/tmp/bdbje"); assert store2.cacheDbNamePrefix().equals("myprefix"); assert store2.catalogDbName().equals("mycatalog"); assert store2.fetchPersistentState(); assert store2.async().enabled(); BdbjeCacheStoreConfig legacy = store.adapt(); assert legacy.getLocation().equals("/tmp/bdbje"); assert legacy.getCacheDbNamePrefix().equals("myprefix"); assert legacy.getCatalogDbName().equals("mycatalog"); assert legacy.isFetchPersistentState(); assert legacy.getAsyncStoreConfig().isEnabled(); } }
private org.infinispan.Cache<NotificationId, SubscriptionId> createCache() { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.loaders() .passivation(true) .addFileCacheStore() .location(super.diskStorePath) .purgeOnStartup(true) .async() .eviction() .maxEntries( EventCloudProperties.SUBSCRIBER_CACHE_MAX_ENTRIES.getValue()) .strategy(EvictionStrategy.LRU) .locking() .isolationLevel(IsolationLevel.NONE); this.cacheManager.defineConfiguration("default", builder.build()); return this.cacheManager.<NotificationId, SubscriptionId> getCache("default"); }