Example usage for org.hibernate.internal.util.config ConfigurationHelper extractPropertyValue

List of usage examples for org.hibernate.internal.util.config ConfigurationHelper extractPropertyValue

Introduction

In this page you can find the example usage for org.hibernate.internal.util.config ConfigurationHelper extractPropertyValue.

Prototype

public static String extractPropertyValue(String propertyName, Map properties) 

Source Link

Document

Extract a property value by name from the given properties object.

Usage

From source file:org.infinispan.hibernate.cache.commons.InfinispanRegionFactory.java

License:LGPL

protected EmbeddedCacheManager createCacheManager(Properties properties, ServiceRegistry serviceRegistry) {
    if (properties.containsKey(INFINISPAN_USE_SYNCHRONIZATION_PROP)) {
        log.propertyUseSynchronizationDeprecated();
    }/*from   ww  w . j a v  a2  s .  c  o  m*/
    ConfigurationBuilderHolder cfgHolder;
    String configFile = ConfigurationHelper.extractPropertyValue(INFINISPAN_CONFIG_RESOURCE_PROP, properties);
    if (configFile != null) {
        cfgHolder = loadConfiguration(serviceRegistry, configFile);
    } else {
        cfgHolder = defaultConfiguration;
    }

    // We cannot just add the default configurations not defined in provided configuration
    // since WF overrides this method - we have to deal with missing configuration for each cache separately
    String globalStatsStr = extractProperty(INFINISPAN_GLOBAL_STATISTICS_PROP, properties);
    if (globalStatsStr != null) {
        globalStats = Boolean.parseBoolean(globalStatsStr);
    }
    if (globalStats != null) {
        cfgHolder.getGlobalConfigurationBuilder().globalJmxStatistics().enabled(globalStats);
    }

    return createCacheManager(cfgHolder);
}

From source file:org.infinispan.hibernate.cache.commons.InfinispanRegionFactory.java

License:LGPL

private String extractProperty(String key, Properties properties) {
    final String value = ConfigurationHelper.extractPropertyValue(key, properties);
    log.debugf("Configuration override via property %s: %s", key, value);
    return value;
}

From source file:org.infinispan.hibernate.cache.v51.InfinispanRegionFactory.java

License:LGPL

@Override
public void start(SessionFactoryOptions settings, Properties properties) throws CacheException {
    log.debug("Starting Infinispan region factory");

    // determine the CacheKeysFactory to use...
    this.cacheKeysFactory = determineCacheKeysFactory(settings, properties);

    try {//from w  w  w. j  av  a  2s . co m
        this.settings = settings;
        transactionManagerlookup = createTransactionManagerLookup(settings, properties);
        transactionManager = transactionManagerlookup.getTransactionManager();

        final Enumeration keys = properties.propertyNames();
        while (keys.hasMoreElements()) {
            final String key = (String) keys.nextElement();
            int prefixLoc;
            if ((prefixLoc = key.indexOf(PREFIX)) != -1) {
                parseProperty(prefixLoc, key, extractProperty(key, properties));
            }
        }

        String globalStatsProperty = ConfigurationHelper.extractPropertyValue(INFINISPAN_GLOBAL_STATISTICS_PROP,
                properties);
        globalStats = (globalStatsProperty != null) ? Boolean.valueOf(globalStatsProperty) : null;
        if (properties.containsKey(INFINISPAN_USE_SYNCHRONIZATION_PROP)) {
            log.propertyUseSynchronizationDeprecated();
        }

        ServiceRegistry serviceRegistry = settings.getServiceRegistry();
        manager = createCacheManager(properties, serviceRegistry);
        defineDataTypeCacheConfigurations(serviceRegistry);
    } catch (CacheException ce) {
        throw ce;
    } catch (Throwable t) {
        throw log.unableToStart(t);
    }
}

From source file:org.infinispan.hibernate.cache.v53.InfinispanRegionFactory.java

License:LGPL

private String extractProperty(String key, Map properties) {
    final String value = ConfigurationHelper.extractPropertyValue(key, properties);
    log.debugf("Configuration override via property %s: %s", key, value);
    return value;
}