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; }
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(); }
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); }
public static String getInstanceName(Properties props) { return PropertiesHelper.getString(HAZELCAST_INSTANCE_NAME, props, null); }