HHH-5632 - Import initial services work

This commit is contained in:
Steve Ebersole 2010-10-07 12:25:17 -05:00
parent 7627ad2718
commit e3e5df4d2e
32 changed files with 1390 additions and 1225 deletions

View File

@ -29,7 +29,8 @@ import org.hibernate.cache.infinispan.tm.HibernateTransactionManagerLookup;
import org.hibernate.cache.infinispan.util.CacheAdapter;
import org.hibernate.cache.infinispan.util.CacheAdapterImpl;
import org.hibernate.cfg.Settings;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.infinispan.AdvancedCache;
import org.infinispan.Cache;
import org.infinispan.config.Configuration;
@ -295,9 +296,9 @@ public class InfinispanRegionFactory implements RegionFactory {
protected EmbeddedCacheManager createCacheManager(Properties properties) throws CacheException {
try {
String configLoc = PropertiesHelper.getString(INFINISPAN_CONFIG_RESOURCE_PROP, properties, DEF_INFINISPAN_CONFIG_RESOURCE);
String configLoc = ConfigurationHelper.getString(INFINISPAN_CONFIG_RESOURCE_PROP, properties, DEF_INFINISPAN_CONFIG_RESOURCE);
EmbeddedCacheManager manager = new DefaultCacheManager(configLoc, false);
String globalStats = PropertiesHelper.extractPropertyValue(INFINISPAN_GLOBAL_STATISTICS_PROP, properties);
String globalStats = ConfigurationHelper.extractPropertyValue(INFINISPAN_GLOBAL_STATISTICS_PROP, properties);
if (globalStats != null) {
manager.getGlobalConfiguration().setExposeGlobalJmxStatistics(Boolean.parseBoolean(globalStats));
}
@ -329,22 +330,22 @@ public class InfinispanRegionFactory implements RegionFactory {
int suffixLoc = -1;
if (!key.equals(INFINISPAN_CONFIG_RESOURCE_PROP) && (suffixLoc = key.indexOf(CONFIG_SUFFIX)) != -1) {
cfgOverride = getOrCreateConfig(prefixLoc, key, suffixLoc);
cfgOverride.setCacheName(PropertiesHelper.extractPropertyValue(key, properties));
cfgOverride.setCacheName( ConfigurationHelper.extractPropertyValue(key, properties));
} else if ((suffixLoc = key.indexOf(STRATEGY_SUFFIX)) != -1) {
cfgOverride = getOrCreateConfig(prefixLoc, key, suffixLoc);
cfgOverride.setEvictionStrategy(PropertiesHelper.extractPropertyValue(key, properties));
cfgOverride.setEvictionStrategy( ConfigurationHelper.extractPropertyValue(key, properties));
} else if ((suffixLoc = key.indexOf(WAKE_UP_INTERVAL_SUFFIX)) != -1) {
cfgOverride = getOrCreateConfig(prefixLoc, key, suffixLoc);
cfgOverride.setEvictionWakeUpInterval(Long.parseLong(PropertiesHelper.extractPropertyValue(key, properties)));
cfgOverride.setEvictionWakeUpInterval(Long.parseLong( ConfigurationHelper.extractPropertyValue(key, properties)));
} else if ((suffixLoc = key.indexOf(MAX_ENTRIES_SUFFIX)) != -1) {
cfgOverride = getOrCreateConfig(prefixLoc, key, suffixLoc);
cfgOverride.setEvictionMaxEntries(PropertiesHelper.getInt(key, properties, -1));
cfgOverride.setEvictionMaxEntries( ConfigurationHelper.getInt(key, properties, -1));
} else if ((suffixLoc = key.indexOf(LIFESPAN_SUFFIX)) != -1) {
cfgOverride = getOrCreateConfig(prefixLoc, key, suffixLoc);
cfgOverride.setExpirationLifespan(Long.parseLong(PropertiesHelper.extractPropertyValue(key, properties)));
cfgOverride.setExpirationLifespan(Long.parseLong( ConfigurationHelper.extractPropertyValue(key, properties)));
} else if ((suffixLoc = key.indexOf(MAX_IDLE_SUFFIX)) != -1) {
cfgOverride = getOrCreateConfig(prefixLoc, key, suffixLoc);
cfgOverride.setExpirationMaxIdle(Long.parseLong(PropertiesHelper.extractPropertyValue(key, properties)));
cfgOverride.setExpirationMaxIdle(Long.parseLong( ConfigurationHelper.extractPropertyValue(key, properties)));
}
// else if ((suffixLoc = key.indexOf(STATISTICS_SUFFIX)) != -1) {
// cfgOverride = getOrCreateConfig(prefixLoc, key, suffixLoc);
@ -429,7 +430,7 @@ public class InfinispanRegionFactory implements RegionFactory {
}
private TypeOverrides overrideStatisticsIfPresent(TypeOverrides override, Properties properties) {
String globalStats = PropertiesHelper.extractPropertyValue(INFINISPAN_GLOBAL_STATISTICS_PROP, properties);
String globalStats = ConfigurationHelper.extractPropertyValue(INFINISPAN_GLOBAL_STATISTICS_PROP, properties);
if (globalStats != null) {
override.setExposeStatistics(Boolean.parseBoolean(globalStats));
}

View File

@ -30,7 +30,7 @@ import javax.naming.NamingException;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.RegionFactory;
import org.hibernate.util.NamingHelper;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;
@ -62,7 +62,7 @@ public class JndiInfinispanRegionFactory extends InfinispanRegionFactory {
@Override
protected EmbeddedCacheManager createCacheManager(Properties properties) throws CacheException {
String name = PropertiesHelper.getString(CACHE_MANAGER_RESOURCE_PROP, properties, null);
String name = ConfigurationHelper.getString(CACHE_MANAGER_RESOURCE_PROP, properties, null);
if (name == null)
throw new CacheException("Configuration property " + CACHE_MANAGER_RESOURCE_PROP + " not set");
return locateCacheManager(name, NamingHelper.getJndiProperties(properties));

View File

@ -41,7 +41,7 @@ import org.hibernate.cache.jbc.query.QueryResultsRegionImpl;
import org.hibernate.cache.jbc.timestamp.TimestampsRegionImpl;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.Settings;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.jboss.cache.DefaultCacheFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -158,7 +158,7 @@ public class JBossCacheRegionFactory implements RegionFactory {
}
public static String getRegionPrefix(Properties properties) {
return PropertiesHelper.getString(Environment.CACHE_REGION_PREFIX, properties, null);
return ConfigurationHelper.getString(Environment.CACHE_REGION_PREFIX, properties, null);
}
}

View File

@ -32,7 +32,7 @@ import javax.naming.NamingException;
import org.hibernate.cache.CacheException;
import org.hibernate.cfg.Settings;
import org.hibernate.util.NamingHelper;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.jboss.cache.CacheManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -65,7 +65,7 @@ public class JndiMultiplexingCacheInstanceManager extends MultiplexingCacheInsta
@Override
public void start(Settings settings, Properties properties) throws CacheException {
String name = PropertiesHelper.getString(CACHE_FACTORY_RESOURCE_PROP, properties, null);
String name = ConfigurationHelper.getString(CACHE_FACTORY_RESOURCE_PROP, properties, null);
if (name == null)
throw new CacheException("Configuration property " + CACHE_FACTORY_RESOURCE_PROP + " not set");

View File

@ -32,7 +32,7 @@ import javax.naming.NamingException;
import org.hibernate.cache.CacheException;
import org.hibernate.cfg.Settings;
import org.hibernate.util.NamingHelper;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.jboss.cache.Cache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -70,7 +70,7 @@ public class JndiSharedCacheInstanceManager extends SharedCacheInstanceManager {
@Override
protected Cache createSharedCache(Settings settings, Properties properties) {
String name = PropertiesHelper.getString(CACHE_RESOURCE_PROP, properties, null);
String name = ConfigurationHelper.getString(CACHE_RESOURCE_PROP, properties, null);
if (name == null)
throw new CacheException("Configuration property " + CACHE_RESOURCE_PROP + " not set");

View File

@ -40,8 +40,8 @@ import org.hibernate.cache.CacheException;
import org.hibernate.cache.jbc.CacheInstanceManager;
import org.hibernate.cache.jbc.util.CacheHelper;
import org.hibernate.cfg.Settings;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.transaction.TransactionManagerLookup;
import org.hibernate.util.PropertiesHelper;
/**
* Allows building separate {@link Cache} instances for each type of region,
@ -317,9 +317,9 @@ public class MultiplexingCacheInstanceManager implements CacheInstanceManager {
if (buildCaches && jbcFactory == null) {
// See if the user configured a multiplexer stack
if (channelFactory == null) {
String muxStacks = PropertiesHelper.getString(CHANNEL_FACTORY_RESOURCE_PROP, properties, null);
String muxStacks = ConfigurationHelper.getString(CHANNEL_FACTORY_RESOURCE_PROP, properties, null);
if (muxStacks == null) {
muxStacks = PropertiesHelper.getString(LEGACY_CHANNEL_FACTORY_RESOURCE_PROP, properties, DEF_JGROUPS_RESOURCE);
muxStacks = ConfigurationHelper.getString(LEGACY_CHANNEL_FACTORY_RESOURCE_PROP, properties, DEF_JGROUPS_RESOURCE);
}
if (muxStacks != null) {
channelFactory = new JChannelFactory();
@ -327,9 +327,9 @@ public class MultiplexingCacheInstanceManager implements CacheInstanceManager {
}
}
String factoryRes = PropertiesHelper.getString(CACHE_FACTORY_RESOURCE_PROP, properties, null);
String factoryRes = ConfigurationHelper.getString(CACHE_FACTORY_RESOURCE_PROP, properties, null);
if (factoryRes == null) {
factoryRes = PropertiesHelper.getString(LEGACY_CACHE_FACTORY_RESOURCE_PROP, properties, DEF_CACHE_FACTORY_RESOURCE);
factoryRes = ConfigurationHelper.getString(LEGACY_CACHE_FACTORY_RESOURCE_PROP, properties, DEF_CACHE_FACTORY_RESOURCE);
}
jbcFactory = new CacheManagerImpl(factoryRes, channelFactory);
((CacheManagerImpl) jbcFactory).start();
@ -339,18 +339,18 @@ public class MultiplexingCacheInstanceManager implements CacheInstanceManager {
if (settings.isSecondLevelCacheEnabled()) {
if (buildCaches) {
entityConfig = PropertiesHelper
entityConfig = ConfigurationHelper
.getString(ENTITY_CACHE_RESOURCE_PROP, properties, null);
if (entityConfig == null) {
entityConfig = PropertiesHelper.getString(LEGACY_ENTITY_CACHE_RESOURCE_PROP,
entityConfig = ConfigurationHelper.getString(LEGACY_ENTITY_CACHE_RESOURCE_PROP,
properties, DEF_ENTITY_RESOURCE);
}
jbcEntityCache = jbcFactory.getCache(entityConfig, true);
// Default to collections sharing entity cache if there is one
collectionConfig = PropertiesHelper.getString(COLLECTION_CACHE_RESOURCE_PROP, properties, null);
collectionConfig = ConfigurationHelper.getString(COLLECTION_CACHE_RESOURCE_PROP, properties, null);
if (collectionConfig == null) {
collectionConfig = PropertiesHelper.getString(LEGACY_COLLECTION_CACHE_RESOURCE_PROP, properties, entityConfig);
collectionConfig = ConfigurationHelper.getString(LEGACY_COLLECTION_CACHE_RESOURCE_PROP, properties, entityConfig);
}
if (entityConfig.equals(collectionConfig)) {
jbcCollectionCache = jbcEntityCache;
@ -380,9 +380,9 @@ public class MultiplexingCacheInstanceManager implements CacheInstanceManager {
if (buildCaches) {
// Default to sharing the entity cache if there is one
String dfltQueryResource = (entityConfig == null ? DEF_QUERY_RESOURCE : entityConfig);
queryConfig = PropertiesHelper.getString(QUERY_CACHE_RESOURCE_PROP, properties, null);
queryConfig = ConfigurationHelper.getString(QUERY_CACHE_RESOURCE_PROP, properties, null);
if (queryConfig == null) {
queryConfig = PropertiesHelper.getString(LEGACY_QUERY_CACHE_RESOURCE_PROP, properties, dfltQueryResource);
queryConfig = ConfigurationHelper.getString(LEGACY_QUERY_CACHE_RESOURCE_PROP, properties, dfltQueryResource);
}
if (queryConfig.equals(entityConfig)) {
jbcQueryCache = jbcEntityCache;
@ -393,9 +393,9 @@ public class MultiplexingCacheInstanceManager implements CacheInstanceManager {
}
// For Timestamps, we default to a separate config
tsConfig = PropertiesHelper.getString(TIMESTAMP_CACHE_RESOURCE_PROP, properties, null);
tsConfig = ConfigurationHelper.getString(TIMESTAMP_CACHE_RESOURCE_PROP, properties, null);
if (tsConfig == null) {
tsConfig = PropertiesHelper.getString(LEGACY_TIMESTAMP_CACHE_RESOURCE_PROP, properties, DEF_TS_RESOURCE);
tsConfig = ConfigurationHelper.getString(LEGACY_TIMESTAMP_CACHE_RESOURCE_PROP, properties, DEF_TS_RESOURCE);
}
if (tsConfig.equals(queryConfig)) {
jbcTsCache = jbcQueryCache;

View File

@ -39,7 +39,7 @@ import org.hibernate.cache.CacheException;
import org.hibernate.cache.jbc.CacheInstanceManager;
import org.hibernate.cache.jbc.util.CacheHelper;
import org.hibernate.cfg.Settings;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
/**
* A {@link CacheInstanceManager} implementation where we use a single JBoss Cache
@ -149,9 +149,9 @@ public class SharedCacheInstanceManager implements CacheInstanceManager {
if (cache == null) {
if (channelFactory == null) {
String muxStacks = PropertiesHelper.getString(CHANNEL_FACTORY_RESOURCE_PROP, properties, null);
String muxStacks = ConfigurationHelper.getString(CHANNEL_FACTORY_RESOURCE_PROP, properties, null);
if (muxStacks == null) {
PropertiesHelper.getString(LEGACY_CHANNEL_FACTORY_RESOURCE_PROP, properties, DEF_JGROUPS_RESOURCE);
ConfigurationHelper.getString(LEGACY_CHANNEL_FACTORY_RESOURCE_PROP, properties, DEF_JGROUPS_RESOURCE);
}
if (muxStacks != null) {
channelFactory = new JChannelFactory();
@ -205,9 +205,9 @@ public class SharedCacheInstanceManager implements CacheInstanceManager {
*/
protected Cache createSharedCache(Settings settings, Properties properties)
{
String configResource = PropertiesHelper.getString(CACHE_RESOURCE_PROP, properties, null);
String configResource = ConfigurationHelper.getString(CACHE_RESOURCE_PROP, properties, null);
if (configResource == null) {
configResource = PropertiesHelper.getString(LEGACY_CACHE_RESOURCE_PROP, properties, DEFAULT_CACHE_RESOURCE);
configResource = ConfigurationHelper.getString(LEGACY_CACHE_RESOURCE_PROP, properties, DEFAULT_CACHE_RESOURCE);
}
return new DefaultCacheFactory().createCache(configResource, false);
}

View File

@ -31,7 +31,8 @@ import org.hibernate.cache.CacheException;
import org.hibernate.cache.QueryResultsRegion;
import org.hibernate.cache.jbc.TransactionalDataRegionAdapter;
import org.hibernate.cache.jbc.util.CacheHelper;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.jboss.cache.Cache;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Option;
@ -76,10 +77,10 @@ public class QueryResultsRegionImpl extends TransactionalDataRegionAdapter imple
// if they passed an config option to disable query replication
if (CacheHelper.isClusteredReplication(jbcCache)) {
if (properties.containsKey(QUERY_CACHE_LOCAL_ONLY_PROP)) {
localOnly = PropertiesHelper.getBoolean(QUERY_CACHE_LOCAL_ONLY_PROP, properties, false);
localOnly = ConfigurationHelper.getBoolean(QUERY_CACHE_LOCAL_ONLY_PROP, properties, false);
}
else {
localOnly = PropertiesHelper.getBoolean(LEGACY_QUERY_CACHE_LOCAL_ONLY_PROP, properties, false);
localOnly = ConfigurationHelper.getBoolean(LEGACY_QUERY_CACHE_LOCAL_ONLY_PROP, properties, false);
}
}
}

View File

@ -25,7 +25,7 @@ package org.hibernate.cache;
import java.util.Properties;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.util.StringHelper;
import com.opensymphony.oscache.base.CacheEntry;
@ -66,7 +66,7 @@ public class OSCacheProvider implements CacheProvider {
*/
public Cache buildCache(String region, Properties properties) throws CacheException {
int refreshPeriod = PropertiesHelper.getInt(
int refreshPeriod = ConfigurationHelper.getInt(
StringHelper.qualify(region, OSCACHE_REFRESH_PERIOD),
OSCACHE_PROPERTIES,
CacheEntry.INDEFINITE_EXPIRY
@ -76,7 +76,7 @@ public class OSCacheProvider implements CacheProvider {
// construct the cache
final OSCache cache = new OSCache(refreshPeriod, cron, region);
Integer capacity = PropertiesHelper.getInteger( StringHelper.qualify(region, OSCACHE_CAPACITY), OSCACHE_PROPERTIES );
Integer capacity = ConfigurationHelper.getInteger( StringHelper.qualify(region, OSCACHE_CAPACITY), OSCACHE_PROPERTIES );
if ( capacity!=null ) cache.setCacheCapacity( capacity.intValue() );
return cache;

View File

@ -37,7 +37,7 @@ import com.mchange.v2.c3p0.DataSources;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Environment;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.util.ReflectHelper;
/**
@ -101,9 +101,9 @@ public class C3P0ConnectionProvider implements ConnectionProvider {
Properties connectionProps = ConnectionProviderFactory.getConnectionProperties( props );
log.info( "C3P0 using driver: " + jdbcDriverClass + " at URL: " + jdbcUrl );
log.info( "Connection properties: " + PropertiesHelper.maskOut( connectionProps, "password" ) );
log.info( "Connection properties: " + ConfigurationHelper.maskOut( connectionProps, "password" ) );
autocommit = PropertiesHelper.getBoolean( Environment.AUTOCOMMIT, props );
autocommit = ConfigurationHelper.getBoolean( Environment.AUTOCOMMIT, props );
log.info( "autocommit mode: " + autocommit );
if ( jdbcDriverClass == null ) {
@ -128,12 +128,12 @@ public class C3P0ConnectionProvider implements ConnectionProvider {
try {
//swaldman 2004-02-07: modify to allow null values to signify fall through to c3p0 PoolConfig defaults
Integer minPoolSize = PropertiesHelper.getInteger( Environment.C3P0_MIN_SIZE, props );
Integer maxPoolSize = PropertiesHelper.getInteger( Environment.C3P0_MAX_SIZE, props );
Integer maxIdleTime = PropertiesHelper.getInteger( Environment.C3P0_TIMEOUT, props );
Integer maxStatements = PropertiesHelper.getInteger( Environment.C3P0_MAX_STATEMENTS, props );
Integer acquireIncrement = PropertiesHelper.getInteger( Environment.C3P0_ACQUIRE_INCREMENT, props );
Integer idleTestPeriod = PropertiesHelper.getInteger( Environment.C3P0_IDLE_TEST_PERIOD, props );
Integer minPoolSize = ConfigurationHelper.getInteger( Environment.C3P0_MIN_SIZE, props );
Integer maxPoolSize = ConfigurationHelper.getInteger( Environment.C3P0_MAX_SIZE, props );
Integer maxIdleTime = ConfigurationHelper.getInteger( Environment.C3P0_TIMEOUT, props );
Integer maxStatements = ConfigurationHelper.getInteger( Environment.C3P0_MAX_STATEMENTS, props );
Integer acquireIncrement = ConfigurationHelper.getInteger( Environment.C3P0_ACQUIRE_INCREMENT, props );
Integer idleTestPeriod = ConfigurationHelper.getInteger( Environment.C3P0_IDLE_TEST_PERIOD, props );
Properties c3props = new Properties();
@ -165,7 +165,7 @@ public class C3P0ConnectionProvider implements ConnectionProvider {
// revert to traditional hibernate behavior of setting initialPoolSize to minPoolSize
// unless otherwise specified with a c3p0.*-style parameter.
Integer initialPoolSize = PropertiesHelper.getInteger( C3P0_STYLE_INITIAL_POOL_SIZE, props );
Integer initialPoolSize = ConfigurationHelper.getInteger( C3P0_STYLE_INITIAL_POOL_SIZE, props );
if ( initialPoolSize == null && minPoolSize != null ) {
c3props.put( C3P0_STYLE_INITIAL_POOL_SIZE, String.valueOf( minPoolSize ).trim() );
}

View File

@ -30,7 +30,7 @@ import java.util.Properties;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Environment;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.util.StringHelper;
import org.hibernate.util.ConfigHelper;
@ -179,12 +179,12 @@ public class ProxoolConnectionProvider implements ConnectionProvider {
}
// Remember Isolation level
isolation = PropertiesHelper.getInteger(Environment.ISOLATION, props);
isolation = ConfigurationHelper.getInteger(Environment.ISOLATION, props);
if (isolation!=null) {
log.info("JDBC isolation level: " + Environment.isolationLevelToString( isolation.intValue() ) );
}
autocommit = PropertiesHelper.getBoolean(Environment.AUTOCOMMIT, props);
autocommit = ConfigurationHelper.getBoolean(Environment.AUTOCOMMIT, props);
log.info("autocommit mode: " + autocommit);
}

View File

@ -38,7 +38,7 @@ import org.hibernate.cache.NoCacheProvider;
import org.hibernate.cache.TimestampsRegion;
import org.hibernate.cache.CacheDataDescription;
import org.hibernate.cache.access.AccessType;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.util.ReflectHelper;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.Settings;
@ -57,7 +57,7 @@ public class RegionFactoryCacheProviderBridge implements RegionFactory {
private Settings settings;
public RegionFactoryCacheProviderBridge(Properties properties) {
String providerClassName = PropertiesHelper.getString( Environment.CACHE_PROVIDER, properties, DEF_PROVIDER );
String providerClassName = ConfigurationHelper.getString( Environment.CACHE_PROVIDER, properties, DEF_PROVIDER );
log.info( "Cache provider: " + providerClassName );
try {
cacheProvider = ( CacheProvider ) ReflectHelper.classForName( providerClassName ).newInstance();

View File

@ -129,6 +129,7 @@ import org.hibernate.id.PersistentIdentifierGenerator;
import org.hibernate.id.factory.DefaultIdentifierGeneratorFactory;
import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.impl.SessionFactoryImpl;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.mapping.AuxiliaryDatabaseObject;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
@ -164,7 +165,6 @@ import org.hibernate.util.ArrayHelper;
import org.hibernate.util.CollectionHelper;
import org.hibernate.util.ConfigHelper;
import org.hibernate.util.JoinedIterator;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.util.ReflectHelper;
import org.hibernate.util.SerializationHelper;
import org.hibernate.util.StringHelper;
@ -1836,7 +1836,7 @@ public class Configuration implements Serializable {
Environment.verifyProperties( properties );
Properties copy = new Properties();
copy.putAll( properties );
PropertiesHelper.resolvePlaceHolders( copy );
ConfigurationHelper.resolvePlaceHolders( copy );
Settings settings = buildSettings( copy );
return new SessionFactoryImpl(
@ -2821,7 +2821,7 @@ public class Configuration implements Serializable {
*/
public Settings buildSettings() {
Properties clone = ( Properties ) properties.clone();
PropertiesHelper.resolvePlaceHolders( clone );
ConfigurationHelper.resolvePlaceHolders( clone );
return buildSettingsInternal( clone );
}

View File

@ -39,8 +39,8 @@ import org.slf4j.LoggerFactory;
import org.hibernate.HibernateException;
import org.hibernate.Version;
import org.hibernate.bytecode.BytecodeProvider;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.util.ConfigHelper;
import org.hibernate.util.PropertiesHelper;
/**
@ -613,7 +613,7 @@ public final class Environment {
InputStream stream = ConfigHelper.getResourceAsStream("/hibernate.properties");
try {
GLOBAL_PROPERTIES.load(stream);
log.info( "loaded properties from resource hibernate.properties: " + PropertiesHelper.maskOut(GLOBAL_PROPERTIES, PASS) );
log.info( "loaded properties from resource hibernate.properties: " + ConfigurationHelper.maskOut(GLOBAL_PROPERTIES, PASS) );
}
catch (Exception e) {
log.error("problem loading properties from hibernate.properties");
@ -640,8 +640,8 @@ public final class Environment {
verifyProperties(GLOBAL_PROPERTIES);
ENABLE_BINARY_STREAMS = PropertiesHelper.getBoolean(USE_STREAMS_FOR_BINARY, GLOBAL_PROPERTIES);
ENABLE_REFLECTION_OPTIMIZER = PropertiesHelper.getBoolean(USE_REFLECTION_OPTIMIZER, GLOBAL_PROPERTIES);
ENABLE_BINARY_STREAMS = ConfigurationHelper.getBoolean(USE_STREAMS_FOR_BINARY, GLOBAL_PROPERTIES);
ENABLE_REFLECTION_OPTIMIZER = ConfigurationHelper.getBoolean(USE_REFLECTION_OPTIMIZER, GLOBAL_PROPERTIES);
if (ENABLE_BINARY_STREAMS) {
log.info("using java.io streams to persist binary types");
@ -805,7 +805,7 @@ public final class Environment {
}
public static BytecodeProvider buildBytecodeProvider(Properties properties) {
String provider = PropertiesHelper.getString( BYTECODE_PROVIDER, properties, "javassist" );
String provider = ConfigurationHelper.getString( BYTECODE_PROVIDER, properties, "javassist" );
log.info( "Bytecode provider name : " + provider );
return buildBytecodeProvider( provider );
}

View File

@ -50,6 +50,7 @@ import org.hibernate.dialect.resolver.DialectFactory;
import org.hibernate.exception.SQLExceptionConverter;
import org.hibernate.exception.SQLExceptionConverterFactory;
import org.hibernate.hql.QueryTranslatorFactory;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.jdbc.BatcherFactory;
import org.hibernate.jdbc.BatchingBatcherFactory;
import org.hibernate.jdbc.NonBatchingBatcherFactory;
@ -58,7 +59,6 @@ import org.hibernate.transaction.TransactionFactory;
import org.hibernate.transaction.TransactionFactoryFactory;
import org.hibernate.transaction.TransactionManagerLookup;
import org.hibernate.transaction.TransactionManagerLookupFactory;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.util.ReflectHelper;
import org.hibernate.util.StringHelper;
@ -105,7 +105,7 @@ public class SettingsFactory implements Serializable {
// it is used to control whether we should consult the JDBC metadata to determine
// certain Settings default values; it is useful to *not* do this when the database
// may not be available (mainly in tools usage).
boolean useJdbcMetadata = PropertiesHelper.getBoolean( "hibernate.temp.use_jdbc_metadata_defaults", props, true );
boolean useJdbcMetadata = ConfigurationHelper.getBoolean( "hibernate.temp.use_jdbc_metadata_defaults", props, true );
if ( useJdbcMetadata ) {
try {
Connection conn = connections.getConnection();
@ -169,42 +169,42 @@ public class SettingsFactory implements Serializable {
settings.setTransactionFactory(transactionFactory);
settings.setTransactionManagerLookup( createTransactionManagerLookup(properties) );
boolean flushBeforeCompletion = PropertiesHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
boolean flushBeforeCompletion = ConfigurationHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties);
log.info("Automatic flush during beforeCompletion(): " + enabledDisabled(flushBeforeCompletion) );
settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);
boolean autoCloseSession = PropertiesHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
boolean autoCloseSession = ConfigurationHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties);
log.info("Automatic session close at end of transaction: " + enabledDisabled(autoCloseSession) );
settings.setAutoCloseSessionEnabled(autoCloseSession);
//JDBC and connection settings:
int batchSize = PropertiesHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
int batchSize = ConfigurationHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0);
if ( !metaSupportsBatchUpdates ) batchSize = 0;
if (batchSize>0) log.info("JDBC batch size: " + batchSize);
settings.setJdbcBatchSize(batchSize);
boolean jdbcBatchVersionedData = PropertiesHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
boolean jdbcBatchVersionedData = ConfigurationHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false);
if (batchSize>0) log.info("JDBC batch updates for versioned data: " + enabledDisabled(jdbcBatchVersionedData) );
settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);
settings.setBatcherFactory( createBatcherFactory(properties, batchSize) );
boolean useScrollableResultSets = PropertiesHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, metaSupportsScrollable);
boolean useScrollableResultSets = ConfigurationHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, metaSupportsScrollable);
log.info("Scrollable result sets: " + enabledDisabled(useScrollableResultSets) );
settings.setScrollableResultSetsEnabled(useScrollableResultSets);
boolean wrapResultSets = PropertiesHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
boolean wrapResultSets = ConfigurationHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false);
log.debug( "Wrap result sets: " + enabledDisabled(wrapResultSets) );
settings.setWrapResultSetsEnabled(wrapResultSets);
boolean useGetGeneratedKeys = PropertiesHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, metaSupportsGetGeneratedKeys);
boolean useGetGeneratedKeys = ConfigurationHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, metaSupportsGetGeneratedKeys);
log.info("JDBC3 getGeneratedKeys(): " + enabledDisabled(useGetGeneratedKeys) );
settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);
Integer statementFetchSize = PropertiesHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties);
Integer statementFetchSize = ConfigurationHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties);
if (statementFetchSize!=null) log.info("JDBC result set fetch size: " + statementFetchSize);
settings.setJdbcFetchSize(statementFetchSize);
String releaseModeName = PropertiesHelper.getString( Environment.RELEASE_CONNECTIONS, properties, "auto" );
String releaseModeName = ConfigurationHelper.getString( Environment.RELEASE_CONNECTIONS, properties, "auto" );
log.info( "Connection release mode: " + releaseModeName );
ConnectionReleaseMode releaseMode;
if ( "auto".equals(releaseModeName) ) {
@ -228,22 +228,22 @@ public class SettingsFactory implements Serializable {
settings.setDefaultSchemaName(defaultSchema);
settings.setDefaultCatalogName(defaultCatalog);
Integer maxFetchDepth = PropertiesHelper.getInteger(Environment.MAX_FETCH_DEPTH, properties);
Integer maxFetchDepth = ConfigurationHelper.getInteger(Environment.MAX_FETCH_DEPTH, properties);
if (maxFetchDepth!=null) log.info("Maximum outer join fetch depth: " + maxFetchDepth);
settings.setMaximumFetchDepth(maxFetchDepth);
int batchFetchSize = PropertiesHelper.getInt(Environment.DEFAULT_BATCH_FETCH_SIZE, properties, 1);
int batchFetchSize = ConfigurationHelper.getInt(Environment.DEFAULT_BATCH_FETCH_SIZE, properties, 1);
log.info("Default batch fetch size: " + batchFetchSize);
settings.setDefaultBatchFetchSize(batchFetchSize);
boolean comments = PropertiesHelper.getBoolean(Environment.USE_SQL_COMMENTS, properties);
boolean comments = ConfigurationHelper.getBoolean(Environment.USE_SQL_COMMENTS, properties);
log.info( "Generate SQL with comments: " + enabledDisabled(comments) );
settings.setCommentsEnabled(comments);
boolean orderUpdates = PropertiesHelper.getBoolean(Environment.ORDER_UPDATES, properties);
boolean orderUpdates = ConfigurationHelper.getBoolean(Environment.ORDER_UPDATES, properties);
log.info( "Order SQL updates by primary key: " + enabledDisabled(orderUpdates) );
settings.setOrderUpdatesEnabled(orderUpdates);
boolean orderInserts = PropertiesHelper.getBoolean(Environment.ORDER_INSERTS, properties);
boolean orderInserts = ConfigurationHelper.getBoolean(Environment.ORDER_INSERTS, properties);
log.info( "Order SQL inserts for batching: " + enabledDisabled( orderInserts ) );
settings.setOrderInsertsEnabled( orderInserts );
@ -251,21 +251,21 @@ public class SettingsFactory implements Serializable {
settings.setQueryTranslatorFactory( createQueryTranslatorFactory(properties) );
Map querySubstitutions = PropertiesHelper.toMap(Environment.QUERY_SUBSTITUTIONS, " ,=;:\n\t\r\f", properties);
Map querySubstitutions = ConfigurationHelper.toMap(Environment.QUERY_SUBSTITUTIONS, " ,=;:\n\t\r\f", properties);
log.info("Query language substitutions: " + querySubstitutions);
settings.setQuerySubstitutions(querySubstitutions);
boolean jpaqlCompliance = PropertiesHelper.getBoolean( Environment.JPAQL_STRICT_COMPLIANCE, properties, false );
boolean jpaqlCompliance = ConfigurationHelper.getBoolean( Environment.JPAQL_STRICT_COMPLIANCE, properties, false );
settings.setStrictJPAQLCompliance( jpaqlCompliance );
log.info( "JPA-QL strict compliance: " + enabledDisabled( jpaqlCompliance ) );
// Second-level / query cache:
boolean useSecondLevelCache = PropertiesHelper.getBoolean(Environment.USE_SECOND_LEVEL_CACHE, properties, true);
boolean useSecondLevelCache = ConfigurationHelper.getBoolean(Environment.USE_SECOND_LEVEL_CACHE, properties, true);
log.info( "Second-level cache: " + enabledDisabled(useSecondLevelCache) );
settings.setSecondLevelCacheEnabled(useSecondLevelCache);
boolean useQueryCache = PropertiesHelper.getBoolean(Environment.USE_QUERY_CACHE, properties);
boolean useQueryCache = ConfigurationHelper.getBoolean(Environment.USE_QUERY_CACHE, properties);
log.info( "Query cache: " + enabledDisabled(useQueryCache) );
settings.setQueryCacheEnabled(useQueryCache);
@ -273,7 +273,7 @@ public class SettingsFactory implements Serializable {
// or query cache enabled. Note that useSecondLevelCache is enabled by default
settings.setRegionFactory( createRegionFactory( properties, ( useSecondLevelCache || useQueryCache ) ) );
boolean useMinimalPuts = PropertiesHelper.getBoolean(
boolean useMinimalPuts = ConfigurationHelper.getBoolean(
Environment.USE_MINIMAL_PUTS, properties, settings.getRegionFactory().isMinimalPutsEnabledByDefault()
);
log.info( "Optimize cache for minimal puts: " + enabledDisabled(useMinimalPuts) );
@ -284,7 +284,7 @@ public class SettingsFactory implements Serializable {
if (prefix!=null) log.info("Cache region prefix: "+ prefix);
settings.setCacheRegionPrefix(prefix);
boolean useStructuredCacheEntries = PropertiesHelper.getBoolean(Environment.USE_STRUCTURED_CACHE, properties, false);
boolean useStructuredCacheEntries = ConfigurationHelper.getBoolean(Environment.USE_STRUCTURED_CACHE, properties, false);
log.info( "Structured second-level cache entries: " + enabledDisabled(useStructuredCacheEntries) );
settings.setStructuredCacheEntriesEnabled(useStructuredCacheEntries);
@ -304,20 +304,20 @@ public class SettingsFactory implements Serializable {
//Statistics and logging:
boolean showSql = PropertiesHelper.getBoolean(Environment.SHOW_SQL, properties);
boolean showSql = ConfigurationHelper.getBoolean(Environment.SHOW_SQL, properties);
if (showSql) log.info("Echoing all SQL to stdout");
// settings.setShowSqlEnabled(showSql);
boolean formatSql = PropertiesHelper.getBoolean(Environment.FORMAT_SQL, properties);
boolean formatSql = ConfigurationHelper.getBoolean(Environment.FORMAT_SQL, properties);
// settings.setFormatSqlEnabled(formatSql);
settings.setSqlStatementLogger( new SQLStatementLogger( showSql, formatSql ) );
boolean useStatistics = PropertiesHelper.getBoolean(Environment.GENERATE_STATISTICS, properties);
boolean useStatistics = ConfigurationHelper.getBoolean(Environment.GENERATE_STATISTICS, properties);
log.info( "Statistics: " + enabledDisabled(useStatistics) );
settings.setStatisticsEnabled(useStatistics);
boolean useIdentifierRollback = PropertiesHelper.getBoolean(Environment.USE_IDENTIFIER_ROLLBACK, properties);
boolean useIdentifierRollback = ConfigurationHelper.getBoolean(Environment.USE_IDENTIFIER_ROLLBACK, properties);
log.info( "Deleted entity synthetic identifier rollback: " + enabledDisabled(useIdentifierRollback) );
settings.setIdentifierRollbackEnabled(useIdentifierRollback);
@ -337,11 +337,11 @@ public class SettingsFactory implements Serializable {
log.info( "Default entity-mode: " + defaultEntityMode );
settings.setDefaultEntityMode( defaultEntityMode );
boolean namedQueryChecking = PropertiesHelper.getBoolean( Environment.QUERY_STARTUP_CHECKING, properties, true );
boolean namedQueryChecking = ConfigurationHelper.getBoolean( Environment.QUERY_STARTUP_CHECKING, properties, true );
log.info( "Named query checking : " + enabledDisabled( namedQueryChecking ) );
settings.setNamedQueryStartupCheckingEnabled( namedQueryChecking );
boolean checkNullability = PropertiesHelper.getBoolean(Environment.CHECK_NULLABILITY, properties, true);
boolean checkNullability = ConfigurationHelper.getBoolean(Environment.CHECK_NULLABILITY, properties, true);
log.info( "Check Nullability in Core (should be disabled when Bean Validation is on): " + enabledDisabled(checkNullability) );
settings.setCheckNullability(checkNullability);
@ -373,7 +373,7 @@ public class SettingsFactory implements Serializable {
}
protected QueryCacheFactory createQueryCacheFactory(Properties properties) {
String queryCacheFactoryClassName = PropertiesHelper.getString(
String queryCacheFactoryClassName = ConfigurationHelper.getString(
Environment.QUERY_CACHE_FACTORY, properties, "org.hibernate.cache.StandardQueryCacheFactory"
);
log.info("Query cache factory: " + queryCacheFactoryClassName);
@ -386,9 +386,9 @@ public class SettingsFactory implements Serializable {
}
public static RegionFactory createRegionFactory(Properties properties, boolean cachingEnabled) {
String regionFactoryClassName = PropertiesHelper.getString( Environment.CACHE_REGION_FACTORY, properties, null );
String regionFactoryClassName = ConfigurationHelper.getString( Environment.CACHE_REGION_FACTORY, properties, null );
if ( regionFactoryClassName == null && cachingEnabled ) {
String providerClassName = PropertiesHelper.getString( Environment.CACHE_PROVIDER, properties, null );
String providerClassName = ConfigurationHelper.getString( Environment.CACHE_PROVIDER, properties, null );
if ( providerClassName != null ) {
// legacy behavior, apply the bridge...
regionFactoryClassName = RegionFactoryCacheProviderBridge.class.getName();
@ -419,7 +419,7 @@ public class SettingsFactory implements Serializable {
}
protected QueryTranslatorFactory createQueryTranslatorFactory(Properties properties) {
String className = PropertiesHelper.getString(
String className = ConfigurationHelper.getString(
Environment.QUERY_TRANSLATOR, properties, "org.hibernate.hql.ast.ASTQueryTranslatorFactory"
);
log.info("Query translator: " + className);

View File

@ -35,7 +35,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Environment;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.util.ReflectHelper;
/**
@ -60,14 +60,14 @@ public class DriverManagerConnectionProvider implements ConnectionProvider {
String driverClass = props.getProperty(Environment.DRIVER);
poolSize = PropertiesHelper.getInt(Environment.POOL_SIZE, props, 20); //default pool size 20
poolSize = ConfigurationHelper.getInt(Environment.POOL_SIZE, props, 20); //default pool size 20
log.info("Using Hibernate built-in connection pool (not for production use!)");
log.info("Hibernate connection pool size: " + poolSize);
autocommit = PropertiesHelper.getBoolean(Environment.AUTOCOMMIT, props);
autocommit = ConfigurationHelper.getBoolean(Environment.AUTOCOMMIT, props);
log.info("autocommit mode: " + autocommit);
isolation = PropertiesHelper.getInteger(Environment.ISOLATION, props);
isolation = ConfigurationHelper.getInteger(Environment.ISOLATION, props);
if (isolation!=null)
log.info( "JDBC isolation level: " + Environment.isolationLevelToString( isolation.intValue() ) );
@ -106,7 +106,7 @@ public class DriverManagerConnectionProvider implements ConnectionProvider {
log.info( "connection properties: " + connectionProps );
}
else if ( log.isInfoEnabled() ) {
log.info( "connection properties: " + PropertiesHelper.maskOut(connectionProps, "password") );
log.info( "connection properties: " + ConfigurationHelper.maskOut(connectionProps, "password") );
}
}

View File

@ -23,7 +23,7 @@
*/
package org.hibernate.engine.query;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.util.SimpleMRUCache;
import org.hibernate.util.SoftLimitMRUCache;
import org.hibernate.util.CollectionHelper;
@ -61,12 +61,12 @@ public class QueryPlanCache implements Serializable {
private SessionFactoryImplementor factory;
public QueryPlanCache(SessionFactoryImplementor factory) {
int maxStrongReferenceCount = PropertiesHelper.getInt(
int maxStrongReferenceCount = ConfigurationHelper.getInt(
Environment.QUERY_PLAN_CACHE_MAX_STRONG_REFERENCES,
factory.getProperties(),
SoftLimitMRUCache.DEFAULT_STRONG_REF_COUNT
);
int maxSoftReferenceCount = PropertiesHelper.getInt(
int maxSoftReferenceCount = ConfigurationHelper.getInt(
Environment.QUERY_PLAN_CACHE_MAX_SOFT_REFERENCES,
factory.getProperties(),
SoftLimitMRUCache.DEFAULT_SOFT_REF_COUNT

View File

@ -39,13 +39,13 @@ import org.hibernate.MappingException;
import org.hibernate.cfg.ObjectNameNormalizer;
import org.hibernate.id.enhanced.AccessCallback;
import org.hibernate.id.enhanced.OptimizerFactory;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.jdbc.util.FormatStyle;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.engine.TransactionHelper;
import org.hibernate.mapping.Table;
import org.hibernate.type.Type;
import org.hibernate.util.PropertiesHelper;
/**
*
@ -222,7 +222,7 @@ public class MultipleHiLoPerTableGenerator
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
tableName = normalizer.normalizeIdentifierQuoting( PropertiesHelper.getString( ID_TABLE, params, DEFAULT_TABLE ) );
tableName = normalizer.normalizeIdentifierQuoting( ConfigurationHelper.getString( ID_TABLE, params, DEFAULT_TABLE ) );
if ( tableName.indexOf( '.' ) < 0 ) {
tableName = dialect.quote( tableName );
final String schemaName = dialect.quote(
@ -240,16 +240,16 @@ public class MultipleHiLoPerTableGenerator
pkColumnName = dialect.quote(
normalizer.normalizeIdentifierQuoting(
PropertiesHelper.getString( PK_COLUMN_NAME, params, DEFAULT_PK_COLUMN )
ConfigurationHelper.getString( PK_COLUMN_NAME, params, DEFAULT_PK_COLUMN )
)
);
valueColumnName = dialect.quote(
normalizer.normalizeIdentifierQuoting(
PropertiesHelper.getString( VALUE_COLUMN_NAME, params, DEFAULT_VALUE_COLUMN )
ConfigurationHelper.getString( VALUE_COLUMN_NAME, params, DEFAULT_VALUE_COLUMN )
)
);
keySize = PropertiesHelper.getInt(PK_LENGTH_NAME, params, DEFAULT_PK_LENGTH);
String keyValue = PropertiesHelper.getString(PK_VALUE_NAME, params, params.getProperty(TABLE) );
keySize = ConfigurationHelper.getInt(PK_LENGTH_NAME, params, DEFAULT_PK_LENGTH);
String keyValue = ConfigurationHelper.getString(PK_VALUE_NAME, params, params.getProperty(TABLE) );
query = "select " +
valueColumnName +
@ -276,7 +276,7 @@ public class MultipleHiLoPerTableGenerator
//hilo config
maxLo = PropertiesHelper.getInt(MAX_LO, params, Short.MAX_VALUE);
maxLo = ConfigurationHelper.getInt(MAX_LO, params, Short.MAX_VALUE);
returnClass = type.getReturnedClass();
if ( maxLo >= 1 ) {

View File

@ -39,7 +39,7 @@ import org.hibernate.dialect.Dialect;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.mapping.Table;
import org.hibernate.type.Type;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
/**
* <b>sequence</b><br>
@ -79,7 +79,7 @@ public class SequenceGenerator implements PersistentIdentifierGenerator, Configu
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
sequenceName = normalizer.normalizeIdentifierQuoting(
PropertiesHelper.getString( SEQUENCE, params, "hibernate_sequence" )
ConfigurationHelper.getString( SEQUENCE, params, "hibernate_sequence" )
);
parameters = params.getProperty( PARAMETERS );

View File

@ -31,8 +31,8 @@ import org.hibernate.dialect.Dialect;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.id.enhanced.AccessCallback;
import org.hibernate.id.enhanced.OptimizerFactory;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.type.Type;
import org.hibernate.util.PropertiesHelper;
/**
* <b>seqhilo</b><br>
@ -59,7 +59,7 @@ public class SequenceHiLoGenerator extends SequenceGenerator {
public void configure(Type type, Properties params, Dialect d) throws MappingException {
super.configure(type, params, d);
maxLo = PropertiesHelper.getInt( MAX_LO, params, 9 );
maxLo = ConfigurationHelper.getInt( MAX_LO, params, 9 );
if ( maxLo >= 1 ) {
hiloOptimizer = new OptimizerFactory.LegacyHiLoAlgorithmOptimizer(

View File

@ -37,13 +37,13 @@ import org.slf4j.LoggerFactory;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.cfg.ObjectNameNormalizer;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.jdbc.util.FormatStyle;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.engine.TransactionHelper;
import org.hibernate.mapping.Table;
import org.hibernate.type.Type;
import org.hibernate.util.PropertiesHelper;
/**
* An <tt>IdentifierGenerator</tt> that uses a database
@ -98,7 +98,7 @@ public class TableGenerator extends TransactionHelper
ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
tableName = PropertiesHelper.getString( TABLE, params, DEFAULT_TABLE_NAME );
tableName = ConfigurationHelper.getString( TABLE, params, DEFAULT_TABLE_NAME );
if ( tableName.indexOf( '.' ) < 0 ) {
final String schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) );
final String catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) );
@ -115,7 +115,7 @@ public class TableGenerator extends TransactionHelper
columnName = dialect.quote(
normalizer.normalizeIdentifierQuoting(
PropertiesHelper.getString( COLUMN, params, DEFAULT_COLUMN_NAME )
ConfigurationHelper.getString( COLUMN, params, DEFAULT_COLUMN_NAME )
)
);

View File

@ -30,8 +30,8 @@ import org.hibernate.dialect.Dialect;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.id.enhanced.AccessCallback;
import org.hibernate.id.enhanced.OptimizerFactory;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.type.Type;
import org.hibernate.util.PropertiesHelper;
/**
* <b>hilo</b><br>
@ -61,7 +61,7 @@ public class TableHiLoGenerator extends TableGenerator {
public void configure(Type type, Properties params, Dialect d) {
super.configure(type, params, d);
maxLo = PropertiesHelper.getInt(MAX_LO, params, Short.MAX_VALUE);
maxLo = ConfigurationHelper.getInt(MAX_LO, params, Short.MAX_VALUE);
if ( maxLo >= 1 ) {
hiloOptimizer = new OptimizerFactory.LegacyHiLoAlgorithmOptimizer( type.getReturnedClass(), maxLo );

View File

@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.type.Type;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
/**
* <b>uuid</b><br>
@ -67,7 +67,7 @@ public class UUIDHexGenerator extends AbstractUUIDGenerator implements Configura
* {@inheritDoc}
*/
public void configure(Type type, Properties params, Dialect d) {
sep = PropertiesHelper.getString( "separator", params, "" );
sep = ConfigurationHelper.getString( "separator", params, "" );
}
/**

View File

@ -36,8 +36,8 @@ import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.cfg.ObjectNameNormalizer;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.mapping.Table;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.type.Type;
import org.hibernate.dialect.Dialect;
@ -159,7 +159,7 @@ public class SequenceStyleGenerator implements PersistentIdentifierGenerator, Co
*/
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
this.identifierType = type;
boolean forceTableUse = PropertiesHelper.getBoolean( FORCE_TBL_PARAM, params, false );
boolean forceTableUse = ConfigurationHelper.getBoolean( FORCE_TBL_PARAM, params, false );
final String sequenceName = determineSequenceName( params, dialect );
@ -191,7 +191,7 @@ public class SequenceStyleGenerator implements PersistentIdentifierGenerator, Co
optimizationStrategy,
identifierType.getReturnedClass(),
incrementSize,
PropertiesHelper.getInt( INITIAL_PARAM, params, -1 )
ConfigurationHelper.getInt( INITIAL_PARAM, params, -1 )
);
this.databaseStructure.prepare( optimizer );
}
@ -208,7 +208,7 @@ public class SequenceStyleGenerator implements PersistentIdentifierGenerator, Co
*/
protected String determineSequenceName(Properties params, Dialect dialect) {
ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
String sequenceName = PropertiesHelper.getString( SEQUENCE_PARAM, params, DEF_SEQUENCE_NAME );
String sequenceName = ConfigurationHelper.getString( SEQUENCE_PARAM, params, DEF_SEQUENCE_NAME );
if ( sequenceName.indexOf( '.' ) < 0 ) {
sequenceName = normalizer.normalizeIdentifierQuoting( sequenceName );
String schemaName = params.getProperty( SCHEMA );
@ -239,7 +239,7 @@ public class SequenceStyleGenerator implements PersistentIdentifierGenerator, Co
*/
protected String determineValueColumnName(Properties params, Dialect dialect) {
ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
String name = PropertiesHelper.getString( VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN );
String name = ConfigurationHelper.getString( VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN );
return dialect.quote( normalizer.normalizeIdentifierQuoting( name ) );
}
@ -254,7 +254,7 @@ public class SequenceStyleGenerator implements PersistentIdentifierGenerator, Co
* @return The initial value
*/
protected int determineInitialValue(Properties params) {
return PropertiesHelper.getInt( INITIAL_PARAM, params, DEFAULT_INITIAL_VALUE );
return ConfigurationHelper.getInt( INITIAL_PARAM, params, DEFAULT_INITIAL_VALUE );
}
/**
@ -267,7 +267,7 @@ public class SequenceStyleGenerator implements PersistentIdentifierGenerator, Co
* @return The increment size
*/
protected int determineIncrementSize(Properties params) {
return PropertiesHelper.getInt( INCREMENT_PARAM, params, DEFAULT_INCREMENT_SIZE );
return ConfigurationHelper.getInt( INCREMENT_PARAM, params, DEFAULT_INCREMENT_SIZE );
}
/**
@ -282,11 +282,11 @@ public class SequenceStyleGenerator implements PersistentIdentifierGenerator, Co
protected String determineOptimizationStrategy(Properties params, int incrementSize) {
// if the increment size is greater than one, we prefer pooled optimization; but we
// need to see if the user prefers POOL or POOL_LO...
String defaultPooledOptimizerStrategy = PropertiesHelper.getBoolean( Environment.PREFER_POOLED_VALUES_LO, params, false )
String defaultPooledOptimizerStrategy = ConfigurationHelper.getBoolean( Environment.PREFER_POOLED_VALUES_LO, params, false )
? OptimizerFactory.POOL_LO
: OptimizerFactory.POOL;
String defaultOptimizerStrategy = incrementSize <= 1 ? OptimizerFactory.NONE : defaultPooledOptimizerStrategy;
return PropertiesHelper.getString( OPT_PARAM, params, defaultOptimizerStrategy );
return ConfigurationHelper.getString( OPT_PARAM, params, defaultOptimizerStrategy );
}
/**

View File

@ -43,6 +43,7 @@ import org.hibernate.id.IdentifierGeneratorHelper;
import org.hibernate.id.IntegralDataTypeHolder;
import org.hibernate.id.PersistentIdentifierGenerator;
import org.hibernate.id.Configurable;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.type.Type;
import org.hibernate.dialect.Dialect;
import org.hibernate.HibernateException;
@ -52,7 +53,6 @@ import org.hibernate.LockMode;
import org.hibernate.cfg.ObjectNameNormalizer;
import org.hibernate.jdbc.util.FormatStyle;
import org.hibernate.mapping.Table;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.util.StringHelper;
/**
@ -305,16 +305,16 @@ public class TableGenerator extends TransactionHelper implements PersistentIdent
// if the increment size is greater than one, we prefer pooled optimization; but we
// need to see if the user prefers POOL or POOL_LO...
String defaultPooledOptimizerStrategy = PropertiesHelper.getBoolean( Environment.PREFER_POOLED_VALUES_LO, params, false )
String defaultPooledOptimizerStrategy = ConfigurationHelper.getBoolean( Environment.PREFER_POOLED_VALUES_LO, params, false )
? OptimizerFactory.POOL_LO
: OptimizerFactory.POOL;
final String defaultOptimizerStrategy = incrementSize <= 1 ? OptimizerFactory.NONE : defaultPooledOptimizerStrategy;
final String optimizationStrategy = PropertiesHelper.getString( OPT_PARAM, params, defaultOptimizerStrategy );
final String optimizationStrategy = ConfigurationHelper.getString( OPT_PARAM, params, defaultOptimizerStrategy );
optimizer = OptimizerFactory.buildOptimizer(
optimizationStrategy,
identifierType.getReturnedClass(),
incrementSize,
PropertiesHelper.getInt( INITIAL_PARAM, params, -1 )
ConfigurationHelper.getInt( INITIAL_PARAM, params, -1 )
);
}
@ -329,7 +329,7 @@ public class TableGenerator extends TransactionHelper implements PersistentIdent
* @return The table name to use.
*/
protected String determineGeneratorTableName(Properties params, Dialect dialect) {
String name = PropertiesHelper.getString( TABLE_PARAM, params, DEF_TABLE );
String name = ConfigurationHelper.getString( TABLE_PARAM, params, DEF_TABLE );
boolean isGivenNameUnqualified = name.indexOf( '.' ) < 0;
if ( isGivenNameUnqualified ) {
ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
@ -363,7 +363,7 @@ public class TableGenerator extends TransactionHelper implements PersistentIdent
*/
protected String determineSegmentColumnName(Properties params, Dialect dialect) {
ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
String name = PropertiesHelper.getString( SEGMENT_COLUMN_PARAM, params, DEF_SEGMENT_COLUMN );
String name = ConfigurationHelper.getString( SEGMENT_COLUMN_PARAM, params, DEF_SEGMENT_COLUMN );
return dialect.quote( normalizer.normalizeIdentifierQuoting( name ) );
}
@ -379,7 +379,7 @@ public class TableGenerator extends TransactionHelper implements PersistentIdent
*/
protected String determineValueColumnName(Properties params, Dialect dialect) {
ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
String name = PropertiesHelper.getString( VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN );
String name = ConfigurationHelper.getString( VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN );
return dialect.quote( normalizer.normalizeIdentifierQuoting( name ) );
}
@ -408,7 +408,7 @@ public class TableGenerator extends TransactionHelper implements PersistentIdent
* @return The default segment value to use.
*/
protected String determineDefaultSegmentValue(Properties params) {
boolean preferSegmentPerEntity = PropertiesHelper.getBoolean( CONFIG_PREFER_SEGMENT_PER_ENTITY, params, false );
boolean preferSegmentPerEntity = ConfigurationHelper.getBoolean( CONFIG_PREFER_SEGMENT_PER_ENTITY, params, false );
String defaultToUse = preferSegmentPerEntity ? params.getProperty( TABLE ) : DEF_SEGMENT_VALUE;
log.info( "explicit segment value for id generator [" + tableName + '.' + segmentColumnName + "] suggested; using default [" + defaultToUse + "]" );
return defaultToUse;
@ -424,15 +424,15 @@ public class TableGenerator extends TransactionHelper implements PersistentIdent
* @return The size of the segment column
*/
protected int determineSegmentColumnSize(Properties params) {
return PropertiesHelper.getInt( SEGMENT_LENGTH_PARAM, params, DEF_SEGMENT_LENGTH );
return ConfigurationHelper.getInt( SEGMENT_LENGTH_PARAM, params, DEF_SEGMENT_LENGTH );
}
protected int determineInitialValue(Properties params) {
return PropertiesHelper.getInt( INITIAL_PARAM, params, DEFAULT_INITIAL_VALUE );
return ConfigurationHelper.getInt( INITIAL_PARAM, params, DEFAULT_INITIAL_VALUE );
}
protected int determineIncrementSize(Properties params) {
return PropertiesHelper.getInt( INCREMENT_PARAM, params, DEFAULT_INCREMENT_SIZE );
return ConfigurationHelper.getInt( INCREMENT_PARAM, params, DEFAULT_INCREMENT_SIZE );
}
protected String buildSelectQuery(Dialect dialect) {

View File

@ -0,0 +1,80 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.internal.util.beans;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.lang.reflect.InvocationTargetException;
/**
* Utility for helping deal with {@link BeanInfo}
*
* @author Steve Ebersole
*/
public class BeanInfoHelper {
public static interface BeanInfoDelegate {
public void processBeanInfo(BeanInfo beanInfo) throws Exception;
}
private final Class beanClass;
private final Class stopClass;
public BeanInfoHelper(Class beanClass) {
this( beanClass, Object.class );
}
public BeanInfoHelper(Class beanClass, Class stopClass) {
this.beanClass = beanClass;
this.stopClass = stopClass;
}
public void applyToBeanInfo(Object bean, BeanInfoDelegate delegate) {
if ( ! beanClass.isInstance( bean ) ) {
throw new BeanIntrospectionException( "Bean [" + bean + "] was not of declared bean type [" + beanClass.getName() + "]" );
}
try {
BeanInfo info = Introspector.getBeanInfo( beanClass, stopClass );
try {
delegate.processBeanInfo( info );
}
catch ( RuntimeException e ) {
throw e;
}
catch ( InvocationTargetException e ) {
throw new BeanIntrospectionException( "Error delegating bean info use", e.getTargetException() );
}
catch ( Exception e ) {
throw new BeanIntrospectionException( "Error delegating bean info use", e );
}
finally {
Introspector.flushFromCaches( beanClass );
}
}
catch ( IntrospectionException e ) {
throw new BeanIntrospectionException( "Unable to determine bean info from class [" + beanClass.getName() + "]", e );
}
}
}

View File

@ -0,0 +1,41 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.internal.util.beans;
import org.hibernate.HibernateException;
/**
* Indicates a problem dealing with {@link BeanInfo} via the {@link BeanInfoHelper} delegate.
*
* @author Steve Ebersole
*/
public class BeanIntrospectionException extends HibernateException {
public BeanIntrospectionException(String string, Throwable root) {
super( string, root );
}
public BeanIntrospectionException(String s) {
super( s );
}
}

View File

@ -0,0 +1,41 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.internal.util.config;
import org.hibernate.HibernateException;
/**
* TODO : javadoc
*
* @author Steve Ebersole
*/
public class ConfigurationException extends HibernateException {
public ConfigurationException(String string, Throwable root) {
super( string, root );
}
public ConfigurationException(String s) {
super( s );
}
}

View File

@ -51,12 +51,12 @@ import org.hibernate.cfg.Environment;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.cfg.Settings;
import org.hibernate.dialect.Dialect;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.jdbc.util.FormatStyle;
import org.hibernate.jdbc.util.Formatter;
import org.hibernate.jdbc.util.SQLStatementLogger;
import org.hibernate.util.ConfigHelper;
import org.hibernate.util.JDBCExceptionReporter;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.util.ReflectHelper;
/**
@ -130,9 +130,9 @@ public class SchemaExport {
dropSQL = cfg.generateDropSchemaScript( dialect );
createSQL = cfg.generateSchemaCreationScript( dialect );
formatter = ( PropertiesHelper.getBoolean( Environment.FORMAT_SQL, props ) ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
formatter = ( ConfigurationHelper.getBoolean( Environment.FORMAT_SQL, props ) ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
importFiles = PropertiesHelper.getString( Environment.HBM2DDL_IMPORT_FILES, props, DEFAULT_IMPORT_FILE );
importFiles = ConfigurationHelper.getString( Environment.HBM2DDL_IMPORT_FILES, props, DEFAULT_IMPORT_FILE );
}
/**
@ -147,8 +147,8 @@ public class SchemaExport {
dialect = Dialect.getDialect( cfg.getProperties() );
dropSQL = cfg.generateDropSchemaScript( dialect );
createSQL = cfg.generateSchemaCreationScript( dialect );
formatter = ( PropertiesHelper.getBoolean( Environment.FORMAT_SQL, cfg.getProperties() ) ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
importFiles = PropertiesHelper.getString( Environment.HBM2DDL_IMPORT_FILES, cfg.getProperties(),
formatter = ( ConfigurationHelper.getBoolean( Environment.FORMAT_SQL, cfg.getProperties() ) ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
importFiles = ConfigurationHelper.getString( Environment.HBM2DDL_IMPORT_FILES, cfg.getProperties(),
DEFAULT_IMPORT_FILE
);
}

View File

@ -44,7 +44,7 @@ import org.hibernate.dialect.Dialect;
import org.hibernate.jdbc.util.FormatStyle;
import org.hibernate.jdbc.util.Formatter;
import org.hibernate.jdbc.util.SQLStatementLogger;
import org.hibernate.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.util.ReflectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -81,7 +81,7 @@ public class SchemaUpdate {
props.putAll( connectionProperties );
connectionHelper = new ManagedProviderConnectionHelper( props );
exceptions = new ArrayList();
formatter = ( PropertiesHelper.getBoolean( Environment.FORMAT_SQL, props ) ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
formatter = ( ConfigurationHelper.getBoolean( Environment.FORMAT_SQL, props ) ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
}
public SchemaUpdate(Configuration cfg, Settings settings) throws HibernateException {

View File

@ -26,6 +26,7 @@ package org.hibernate.util;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.internal.util.config.ConfigurationHelper;
import java.util.Properties;
import java.util.Iterator;
@ -268,7 +269,7 @@ public abstract class ExternalSessionFactoryConfig {
// ({sep}type=listenerClass)*
// where {sep} is any whitespace or comma
if ( StringHelper.isNotEmpty( customListenersString) ) {
String[] listenerEntries = PropertiesHelper.toStringArray( customListenersString, " ,\n\t\r\f" );
String[] listenerEntries = ConfigurationHelper.toStringArray( customListenersString, " ,\n\t\r\f" );
for ( int i = 0; i < listenerEntries.length; i++ ) {
final int keyValueSepPosition = listenerEntries[i].indexOf( '=' );
final String type = listenerEntries[i].substring( 0, keyValueSepPosition );
@ -299,7 +300,7 @@ public abstract class ExternalSessionFactoryConfig {
Configuration cfg = new Configuration().setProperties( buildProperties() );
String[] mappingFiles = PropertiesHelper.toStringArray( mapResources, " ,\n\t\r\f" );
String[] mappingFiles = ConfigurationHelper.toStringArray( mapResources, " ,\n\t\r\f" );
for ( int i = 0; i < mappingFiles.length; i++ ) {
cfg.addResource( mappingFiles[i] );
}

View File

@ -5,8 +5,8 @@ import java.util.Properties;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.testing.junit.UnitTestCase;
import org.hibernate.util.PropertiesHelper;
/**
* @author Steve Ebersole
@ -49,36 +49,36 @@ public class PropertiesHelperTest extends UnitTestCase {
}
public void testPlaceholderReplacement() {
PropertiesHelper.resolvePlaceHolders( props );
ConfigurationHelper.resolvePlaceHolders( props );
String str = PropertiesHelper.getString( "my.nonexistent.prop", props, "did.not.exist" );
String str = ConfigurationHelper.getString( "my.nonexistent.prop", props, "did.not.exist" );
assertEquals( "did.not.exist", str );
str = PropertiesHelper.getString( "my.nonexistent.prop", props, null );
str = ConfigurationHelper.getString( "my.nonexistent.prop", props, null );
assertNull( str );
str = PropertiesHelper.getString( "my.string.prop", props, "na" );
str = ConfigurationHelper.getString( "my.string.prop", props, "na" );
assertEquals( "replacement did not occur", "string", str );
str = PropertiesHelper.getString( "my.string.prop", props, "did.not.exist" );
str = ConfigurationHelper.getString( "my.string.prop", props, "did.not.exist" );
assertEquals( "replacement did not occur", "string", str );
boolean bool = PropertiesHelper.getBoolean( "my.nonexistent.prop", props );
boolean bool = ConfigurationHelper.getBoolean( "my.nonexistent.prop", props );
assertFalse( "non-exists as boolean", bool );
bool = PropertiesHelper.getBoolean( "my.nonexistent.prop", props, false );
bool = ConfigurationHelper.getBoolean( "my.nonexistent.prop", props, false );
assertFalse( "non-exists as boolean", bool );
bool = PropertiesHelper.getBoolean( "my.nonexistent.prop", props, true );
bool = ConfigurationHelper.getBoolean( "my.nonexistent.prop", props, true );
assertTrue( "non-exists as boolean", bool );
bool = PropertiesHelper.getBoolean( "my.boolean.prop", props );
bool = ConfigurationHelper.getBoolean( "my.boolean.prop", props );
assertTrue( "boolean replacement did not occur", bool );
bool = PropertiesHelper.getBoolean( "my.boolean.prop", props, false );
bool = ConfigurationHelper.getBoolean( "my.boolean.prop", props, false );
assertTrue( "boolean replacement did not occur", bool );
int i = PropertiesHelper.getInt( "my.nonexistent.prop", props, -1 );
int i = ConfigurationHelper.getInt( "my.nonexistent.prop", props, -1 );
assertEquals( -1, i );
i = PropertiesHelper.getInt( "my.int.prop", props, 100 );
i = ConfigurationHelper.getInt( "my.int.prop", props, 100 );
assertEquals( 1, i );
Integer I = PropertiesHelper.getInteger( "my.nonexistent.prop", props );
Integer I = ConfigurationHelper.getInteger( "my.nonexistent.prop", props );
assertNull( I );
I = PropertiesHelper.getInteger( "my.integer.prop", props );
I = ConfigurationHelper.getInteger( "my.integer.prop", props );
assertEquals( I, new Integer( 1 ) );
str = props.getProperty( "partial.prop1" );
@ -89,18 +89,18 @@ public class PropertiesHelperTest extends UnitTestCase {
}
public void testParseExceptions() {
boolean b = PropertiesHelper.getBoolean( "parse.error", props );
boolean b = ConfigurationHelper.getBoolean( "parse.error", props );
assertFalse( "parse exception case - boolean", b );
try {
PropertiesHelper.getInt( "parse.error", props, 20 );
ConfigurationHelper.getInt( "parse.error", props, 20 );
fail( "parse exception case - int" );
}
catch( NumberFormatException expected ) {
}
try {
PropertiesHelper.getInteger( "parse.error", props );
ConfigurationHelper.getInteger( "parse.error", props );
fail( "parse exception case - Integer" );
}
catch( NumberFormatException expected ) {