当前位置: 首页>>代码示例>>Java>>正文


Java PropertiesHelper.getString方法代码示例

本文整理汇总了Java中org.hibernate.util.PropertiesHelper.getString方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesHelper.getString方法的具体用法?Java PropertiesHelper.getString怎么用?Java PropertiesHelper.getString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.util.PropertiesHelper的用法示例。


在下文中一共展示了PropertiesHelper.getString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public void configure(Type type, Properties params, Dialect dialect) {

		tableName = PropertiesHelper.getString(TABLE, params, DEFAULT_TABLE_NAME);
		columnName = PropertiesHelper.getString(COLUMN, params, DEFAULT_COLUMN_NAME);
		String schemaName = params.getProperty(SCHEMA);
		String catalogName = params.getProperty(CATALOG);

		if ( tableName.indexOf( '.' )<0 ) {
			tableName = Table.qualify( catalogName, schemaName, tableName );
		}

		query = "select " + 
			columnName + 
			" from " + 
			dialect.appendLockHint(LockMode.UPGRADE, tableName) +
			dialect.getForUpdateString();

		update = "update " + 
			tableName + 
			" set " + 
			columnName + 
			" = ? where " + 
			columnName + 
			" = ?";
	}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:26,代码来源:TableGenerator.java

示例2: getConfigFilePath

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public static String getConfigFilePath(Properties props) {
    String configResourcePath = PropertiesHelper.getString(CacheEnvironment.CONFIG_FILE_PATH_LEGACY, props, null);
    if (StringHelper.isEmpty(configResourcePath)) {
        configResourcePath = PropertiesHelper.getString(CacheEnvironment.CONFIG_FILE_PATH, props, null);
    }
    return configResourcePath;
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:8,代码来源:CacheEnvironment.java

示例3: createQueryCacheFactory

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
protected QueryCacheFactory createQueryCacheFactory(Properties properties) {
	String queryCacheFactoryClassName = PropertiesHelper.getString(
			Environment.QUERY_CACHE_FACTORY, properties, "org.hibernate.cache.StandardQueryCacheFactory"
	);
	log.info("Query cache factory: " + queryCacheFactoryClassName);
	try {
		return (QueryCacheFactory) ReflectHelper.classForName(queryCacheFactoryClassName).newInstance();
	}
	catch (Exception cnfe) {
		throw new HibernateException("could not instantiate QueryCacheFactory: " + queryCacheFactoryClassName, cnfe);
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:13,代码来源:SettingsFactory.java

示例4: createCacheProvider

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
protected CacheProvider createCacheProvider(Properties properties) {
	String cacheClassName = PropertiesHelper.getString(
			Environment.CACHE_PROVIDER, properties, DEF_CACHE_PROVIDER
	);
	log.info("Cache provider: " + cacheClassName);
	try {
		return (CacheProvider) ReflectHelper.classForName(cacheClassName).newInstance();
	}
	catch (Exception cnfe) {
		throw new HibernateException("could not instantiate CacheProvider: " + cacheClassName, cnfe);
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:13,代码来源:SettingsFactory.java

示例5: createQueryTranslatorFactory

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
protected QueryTranslatorFactory createQueryTranslatorFactory(Properties properties) {
	String className = PropertiesHelper.getString(
			Environment.QUERY_TRANSLATOR, properties, "org.hibernate.hql.ast.ASTQueryTranslatorFactory"
	);
	log.info("Query translator: " + className);
	try {
		return (QueryTranslatorFactory) ReflectHelper.classForName(className).newInstance();
	}
	catch (Exception cnfe) {
		throw new HibernateException("could not instantiate QueryTranslatorFactory: " + className, cnfe);
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:13,代码来源:SettingsFactory.java

示例6: configure

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
	identifierType = type;
	boolean forceTableUse = PropertiesHelper.getBoolean( FORCE_TBL_PARAM, params, false );

	String sequenceName = PropertiesHelper.getString( SEQUENCE_PARAM, params, DEF_SEQUENCE_NAME );
	if ( sequenceName.indexOf( '.' ) < 0 ) {
		String schemaName = params.getProperty( SCHEMA );
		String catalogName = params.getProperty( CATALOG );
		sequenceName = Table.qualify( catalogName, schemaName, sequenceName );
	}
	int initialValue = PropertiesHelper.getInt( INITIAL_PARAM, params, DEFAULT_INITIAL_VALUE );
	int incrementSize = PropertiesHelper.getInt( INCREMENT_PARAM, params, DEFAULT_INCREMENT_SIZE );

	String valueColumnName = PropertiesHelper.getString( VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN );

	String defOptStrategy = incrementSize <= 1 ? OptimizerFactory.NONE : OptimizerFactory.POOL;
	String optimizationStrategy = PropertiesHelper.getString( OPT_PARAM, params, defOptStrategy );
	if ( OptimizerFactory.NONE.equals( optimizationStrategy ) && incrementSize > 1 ) {
		log.warn( "config specified explicit optimizer of [" + OptimizerFactory.NONE + "], but [" + INCREMENT_PARAM + "=" + incrementSize + "; honoring optimizer setting" );
		incrementSize = 1;
	}
	if ( dialect.supportsSequences() && !forceTableUse ) {
		if ( OptimizerFactory.POOL.equals( optimizationStrategy ) && !dialect.supportsPooledSequences() ) {
			// TODO : may even be better to fall back to a pooled table strategy here so that the db stored values remain consistent...
			optimizationStrategy = OptimizerFactory.HILO;
		}
		databaseStructure = new SequenceStructure( dialect, sequenceName, initialValue, incrementSize );
	}
	else {
		databaseStructure = new TableStructure( dialect, sequenceName, valueColumnName, initialValue, incrementSize );
	}

	optimizer = OptimizerFactory.buildOptimizer( optimizationStrategy, identifierType.getReturnedClass(), incrementSize );
	databaseStructure.prepare( optimizer );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:36,代码来源:SequenceStyleGenerator.java

示例7: configure

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
	tableName = PropertiesHelper.getString( TABLE_PARAM, params, DEF_TABLE );
	if ( tableName.indexOf( '.' ) < 0 ) {
		String schemaName = params.getProperty( SCHEMA );
		String catalogName = params.getProperty( CATALOG );
		tableName = Table.qualify( catalogName, schemaName, tableName );
	}

	segmentColumnName = PropertiesHelper.getString( SEGMENT_COLUMN_PARAM, params, DEF_SEGMENT_COLUMN );
	segmentValue = params.getProperty( SEGMENT_VALUE_PARAM );
	if ( StringHelper.isEmpty( segmentValue ) ) {
		log.debug( "explicit segment value for id generator [" + tableName + '.' + segmentColumnName + "] suggested; using default [" + DEF_SEGMENT_VALUE + "]" );
		segmentValue = DEF_SEGMENT_VALUE;
	}
	segmentValueLength = PropertiesHelper.getInt( SEGMENT_LENGTH_PARAM, params, DEF_SEGMENT_LENGTH );
	valueColumnName = PropertiesHelper.getString( VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN );
	initialValue = PropertiesHelper.getInt( INITIAL_PARAM, params, DEFAULT_INITIAL_VALUE );
	incrementSize = PropertiesHelper.getInt( INCREMENT_PARAM, params, DEFAULT_INCREMENT_SIZE );
	identifierType = type;

	String query = "select " + valueColumnName +
			" from " + tableName + " tbl" +
			" where tbl." + segmentColumnName + "=?";
	HashMap lockMap = new HashMap();
	lockMap.put( "tbl", LockMode.UPGRADE );
	this.query = dialect.applyLocksToSql( query, lockMap, CollectionHelper.EMPTY_MAP );

	update = "update " + tableName +
			" set " + valueColumnName + "=? " +
			" where " + valueColumnName + "=? and " + segmentColumnName + "=?";

	insert = "insert into " + tableName + " (" + segmentColumnName + ", " + valueColumnName + ") " + " values (?,?)";

	String defOptStrategy = incrementSize <= 1 ? OptimizerFactory.NONE : OptimizerFactory.POOL;
	String optimizationStrategy = PropertiesHelper.getString( OPT_PARAM, params, defOptStrategy );
	optimizer = OptimizerFactory.buildOptimizer( optimizationStrategy, identifierType.getReturnedClass(), incrementSize );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:38,代码来源:TableGenerator.java

示例8: configure

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
	sequenceName = PropertiesHelper.getString(SEQUENCE, params, "hibernate_sequence");
	parameters = params.getProperty(PARAMETERS);
	String schemaName = params.getProperty(SCHEMA);
	String catalogName = params.getProperty(CATALOG);

	if (sequenceName.indexOf( '.' ) < 0) {
		sequenceName = Table.qualify( catalogName, schemaName, sequenceName );
	}

	this.identifierType = type;
	sql = dialect.getSequenceNextValString(sequenceName);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:14,代码来源:SequenceGenerator.java

示例9: testPlaceholderReplacement

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public void testPlaceholderReplacement() {
	PropertiesHelper.resolvePlaceHolders( props );

	String str = PropertiesHelper.getString( "my.nonexistent.prop", props, "did.not.exist" );
	assertEquals( "did.not.exist", str );
	str = PropertiesHelper.getString( "my.nonexistent.prop", props, null );
	assertNull( str );
	str = PropertiesHelper.getString( "my.string.prop", props, "na" );
	assertEquals( "replacement did not occur", "string", str );
	str = PropertiesHelper.getString( "my.string.prop", props, "did.not.exist" );
	assertEquals( "replacement did not occur", "string", str );

	boolean bool = PropertiesHelper.getBoolean( "my.nonexistent.prop", props );
	assertFalse( "non-exists as boolean", bool );
	bool = PropertiesHelper.getBoolean( "my.nonexistent.prop", props, false );
	assertFalse( "non-exists as boolean", bool );
	bool = PropertiesHelper.getBoolean( "my.nonexistent.prop", props, true );
	assertTrue( "non-exists as boolean", bool );
	bool = PropertiesHelper.getBoolean( "my.boolean.prop", props );
	assertTrue( "boolean replacement did not occur", bool );
	bool = PropertiesHelper.getBoolean( "my.boolean.prop", props, false );
	assertTrue( "boolean replacement did not occur", bool );

	int i = PropertiesHelper.getInt( "my.nonexistent.prop", props, -1 );
	assertEquals( -1, i );
	i = PropertiesHelper.getInt( "my.int.prop", props, 100 );
	assertEquals( 1, i );

	Integer I = PropertiesHelper.getInteger( "my.nonexistent.prop", props );
	assertNull( I );
	I = PropertiesHelper.getInteger( "my.integer.prop", props );
	assertEquals( I, new Integer( 1 ) );

	str = props.getProperty( "partial.prop1" );
	assertEquals( "partial replacement (ends)", "tmp/middle/dir/tmp.txt", str );

	str = props.getProperty( "partial.prop2" );
	assertEquals( "partial replacement (midst)", "basedir/tmp/myfile.txt", str );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:40,代码来源:PropertiesHelperTest.java

示例10: loadInstance

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public HazelcastInstance loadInstance() throws CacheException {
    if (props == null) {
        throw new NullPointerException("Hibernate environment properties is null!");
    }
    if (client != null && client.getLifecycleService().isRunning()) {
        logger.log(Level.WARNING, "Current HazelcastClient is already active! Shutting it down...");
        unloadInstance();
    }
    String address = PropertiesHelper.getString(CacheEnvironment.NATIVE_CLIENT_ADDRESS, props, null);
    if (address == null) {
        String[] hosts = PropertiesHelper.toStringArray(CacheEnvironment.NATIVE_CLIENT_HOSTS, ",", props);
        if (hosts != null && hosts.length > 0) {
            address = hosts[0];
            logger.log(Level.WARNING, "Hibernate property '" + CacheEnvironment.NATIVE_CLIENT_HOSTS + "' " +
                    "is deprecated, use '" + CacheEnvironment.NATIVE_CLIENT_ADDRESS + "' instead!");
        }
    }
    String group = PropertiesHelper.getString(CacheEnvironment.NATIVE_CLIENT_GROUP, props, null);
    String pass = PropertiesHelper.getString(CacheEnvironment.NATIVE_CLIENT_PASSWORD, props, null);
    if (address == null || group == null || pass == null) {
        throw new CacheException("Configuration properties " + CacheEnvironment.NATIVE_CLIENT_ADDRESS + ", "
                + CacheEnvironment.NATIVE_CLIENT_GROUP + " and " + CacheEnvironment.NATIVE_CLIENT_PASSWORD
                + " are mandatory to use native client!");
    }
    ClientConfig clientConfig = new ClientConfig();
    clientConfig.setGroupConfig(new GroupConfig(group, pass)).addAddress(address);
    clientConfig.setUpdateAutomatic(true);
    return (client = HazelcastClient.newHazelcastClient(clientConfig));
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:30,代码来源:HazelcastClientLoader.java

示例11: getInstanceName

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public static String getInstanceName(Properties props) {
    return PropertiesHelper.getString(HAZELCAST_INSTANCE_NAME, props, null);
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:4,代码来源:CacheEnvironment.java

示例12: buildBytecodeProvider

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public static BytecodeProvider buildBytecodeProvider(Properties properties) {
	String provider = PropertiesHelper.getString( Environment.BYTECODE_PROVIDER, properties, "cglib" );
	log.info( "Bytecode provider name : " + provider );
	return buildBytecodeProvider( provider );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:6,代码来源:Environment.java

示例13: configure

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
	tableName = PropertiesHelper.getString(ID_TABLE, params, DEFAULT_TABLE);
	pkColumnName = PropertiesHelper.getString(PK_COLUMN_NAME, params, DEFAULT_PK_COLUMN);
	valueColumnName = PropertiesHelper.getString(VALUE_COLUMN_NAME, params, DEFAULT_VALUE_COLUMN);
	String schemaName = params.getProperty(SCHEMA);
	String catalogName = params.getProperty(CATALOG);
	keySize = PropertiesHelper.getInt(PK_LENGTH_NAME, params, DEFAULT_PK_LENGTH);
	String keyValue = PropertiesHelper.getString(PK_VALUE_NAME, params, params.getProperty(TABLE) );

	if ( tableName.indexOf( '.' )<0 ) {
		tableName = Table.qualify( catalogName, schemaName, tableName );
	}

	query = "select " +
		valueColumnName +
		" from " +
		dialect.appendLockHint(LockMode.UPGRADE, tableName) +
		" where " + pkColumnName + " = '" + keyValue + "'" +
		dialect.getForUpdateString();

	update = "update " +
		tableName +
		" set " +
		valueColumnName +
		" = ? where " +
		valueColumnName +
		" = ? and " +
		pkColumnName +
		" = '" + 
		keyValue 
		+ "'";
	
	insert = "insert into " + tableName +
		"(" + pkColumnName + ", " +	valueColumnName + ") " +
		"values('"+ keyValue +"', ?)";


	//hilo config
	maxLo = PropertiesHelper.getInt(MAX_LO, params, Short.MAX_VALUE);
	lo = maxLo + 1; // so we "clock over" on the first invocation
	returnClass = type.getReturnedClass();
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:43,代码来源:MultipleHiLoPerTableGenerator.java

示例14: configure

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public void configure(Type type, Properties params, Dialect d) {
	sep = PropertiesHelper.getString("separator", params, "");
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:4,代码来源:UUIDHexGenerator.java


注:本文中的org.hibernate.util.PropertiesHelper.getString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。