Search in sources :

Example 76 with MapStoreConfig

use of com.hazelcast.config.MapStoreConfig in project ddf by codice.

the class HazelcastNotificationStore method getHazelcastConfig.

private Config getHazelcastConfig(BundleContext context, String xmlConfigFilename) {
    Config cfg = null;
    Bundle bundle = context.getBundle();
    URL xmlConfigFileUrl = null;
    if (StringUtils.isNotBlank(xmlConfigFilename)) {
        xmlConfigFileUrl = bundle.getResource(xmlConfigFilename);
    }
    XmlConfigBuilder xmlConfigBuilder = null;
    if (xmlConfigFileUrl != null) {
        try {
            xmlConfigBuilder = new XmlConfigBuilder(xmlConfigFileUrl.openStream());
            cfg = xmlConfigBuilder.build();
            LOGGER.debug("Successfully built hazelcast config from XML config file {}", xmlConfigFilename);
        } catch (FileNotFoundException e) {
            LOGGER.info("FileNotFoundException trying to build hazelcast config from XML file " + xmlConfigFilename, e);
            cfg = null;
        } catch (IOException e) {
            LOGGER.info("IOException trying to build hazelcast config from XML file " + xmlConfigFilename, e);
            cfg = null;
        }
    }
    if (cfg == null) {
        LOGGER.info("Falling back to using generic Config for hazelcast");
        cfg = new Config();
    } else if (LOGGER.isDebugEnabled()) {
        MapConfig mapConfig = cfg.getMapConfig("persistentNotifications");
        if (mapConfig == null) {
            LOGGER.debug("mapConfig is NULL for persistentNotifications - try persistent*");
            mapConfig = cfg.getMapConfig("persistent*");
            if (mapConfig == null) {
                LOGGER.debug("mapConfig is NULL for persistent*");
            }
        } else {
            MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
            if (mapStoreConfig != null) {
                LOGGER.debug("mapStoreConfig factoryClassName = {}", mapStoreConfig.getFactoryClassName());
            } else {
                LOGGER.debug("mapStoreConfig is null");
            }
        }
    }
    return cfg;
}
Also used : XmlConfigBuilder(com.hazelcast.config.XmlConfigBuilder) Config(com.hazelcast.config.Config) MapConfig(com.hazelcast.config.MapConfig) NetworkConfig(com.hazelcast.config.NetworkConfig) JoinConfig(com.hazelcast.config.JoinConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig) Bundle(org.osgi.framework.Bundle) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) MapConfig(com.hazelcast.config.MapConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig) URL(java.net.URL)

Aggregations

MapStoreConfig (com.hazelcast.config.MapStoreConfig)76 Config (com.hazelcast.config.Config)70 MapConfig (com.hazelcast.config.MapConfig)61 HazelcastInstance (com.hazelcast.core.HazelcastInstance)51 Test (org.junit.Test)50 QuickTest (com.hazelcast.test.annotation.QuickTest)43 ParallelTest (com.hazelcast.test.annotation.ParallelTest)42 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)23 GroupConfig (com.hazelcast.config.GroupConfig)21 IMap (com.hazelcast.core.IMap)12 AssertTask (com.hazelcast.test.AssertTask)12 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)12 MapIndexConfig (com.hazelcast.config.MapIndexConfig)10 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)9 NightlyTest (com.hazelcast.test.annotation.NightlyTest)8 HashSet (java.util.HashSet)8 NearCacheConfig (com.hazelcast.config.NearCacheConfig)6 HashMap (java.util.HashMap)6 Map (java.util.Map)6 MapStoreAdapter (com.hazelcast.core.MapStoreAdapter)5