public String get(String key) { return get(key, null); }
public TypedProperties(Properties properties) { this(); putAll(properties); }
public TypedProperties copy() { return new TypedProperties(this); }
public void merge(Properties properties) { Set<Object> keys = properties.keySet(); for (Object key : keys) { if (containsKey(key)) { setProperty((String) key, properties.getProperty((String) key)); } } }
public static ResettableBasicDataSource create(TypedProperties properties, ISecurityService securityService) { properties = properties.copy(); properties.putAll(System.getProperties()); ResettableBasicDataSource dataSource = new ResettableBasicDataSource(); dataSource.setDriverClassName(properties.get( BasicDataSourcePropertyConstants.DB_POOL_DRIVER, null)); try { dataSource.setUrl(properties.get(BasicDataSourcePropertyConstants.DB_POOL_URL, null)); String user = properties.get(BasicDataSourcePropertyConstants.DB_POOL_USER, ""); if (user != null && user.startsWith(SecurityConstants.PREFIX_ENC)) { user = securityService.decrypt(user.substring(SecurityConstants.PREFIX_ENC.length())); String password = properties.get(BasicDataSourcePropertyConstants.DB_POOL_PASSWORD, ""); if (password != null && password.startsWith(SecurityConstants.PREFIX_ENC)) { password = securityService.decrypt(password.substring(SecurityConstants.PREFIX_ENC dataSource.setInitialSize(properties.getInt( BasicDataSourcePropertyConstants.DB_POOL_INITIAL_SIZE, 2)); dataSource.setMaxActive(properties.getInt( BasicDataSourcePropertyConstants.DB_POOL_MAX_ACTIVE, 10)); dataSource.setMaxWait(properties.getInt(BasicDataSourcePropertyConstants.DB_POOL_MAX_WAIT, 5000)); dataSource.setMaxIdle(properties.getInt(BasicDataSourcePropertyConstants.DB_POOL_MAX_IDLE, 8)); dataSource.setMinIdle(properties.getInt(BasicDataSourcePropertyConstants.DB_POOL_MIN_IDLE, 0)); dataSource.setMinEvictableIdleTimeMillis(properties.getInt( BasicDataSourcePropertyConstants.DB_POOL_MIN_EVICTABLE_IDLE_TIME_MILLIS, 60000));
public static ISecurityService create(SecurityServiceType serviceType, TypedProperties properties) { try { if (properties == null) { properties = new TypedProperties(System.getProperties()); } String className = properties.get(SecurityConstants.CLASS_NAME_SECURITY_SERVICE, serviceType == SecurityServiceType.SERVER ? "org.jumpmind.security.BouncyCastleSecurityService" : SecurityService.class.getName()); ISecurityService securityService = (ISecurityService) Class.forName(className).newInstance(); securityService.init(); return securityService; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
protected TypedProperties rereadDatabaseParameters(Properties p) { if (databaseHasBeenInitialized) { TypedProperties properties = rereadDatabaseParameters(ParameterConstants.ALL, ParameterConstants.ALL); properties.putAll(rereadDatabaseParameters(ParameterConstants.ALL, p.getProperty(ParameterConstants.NODE_GROUP_ID))); properties.putAll(rereadDatabaseParameters( p.getProperty(ParameterConstants.EXTERNAL_ID), p.getProperty(ParameterConstants.NODE_GROUP_ID))); databaseHasBeenInitialized = true; return properties; } else { return new TypedProperties(); } }
public void setProperty(String key, long value) { setProperty(key, Long.toString(value)); }
public int getInt(String key) { return getInt(key, 0); }
public boolean is(String key) { return is(key, false); }
@SuppressWarnings("unchecked") public <T> List<T> instantiate(String key) { String[] clazzes = getArray(key, new String[0]); List<T> objects = new ArrayList<T>(clazzes.length); try { for (String clazz : clazzes) { Class<?> c = Class.forName(clazz); if (c != null) { objects.add((T) c.newInstance()); } } return objects; } catch (Exception ex) { log.warn(ex.getMessage(), ex); return objects; } }
public void setProperty(String key, int value) { setProperty(key, Integer.toString(value)); }
public String getString(String key, String defaultVal) { String value = null; if (StringUtils.isBlank(value)) { value = getParameters().get(key, defaultVal); } if (this.parameterFilter != null) { value = this.parameterFilter.filterParameter(key, value); } return StringUtils.isBlank(value) ? defaultVal : value; }
public Object mapRow(Row row) { String value = row.getString("param_value"); if (value != null) { properties.setProperty(row.getString("param_key"), row.getString("param_value")); } return row; } }, externalId, nodeGroupId);
protected TypedProperties rereadDatabaseParameters(String externalId, String nodeGroupId) { final TypedProperties properties = new TypedProperties(); sqlTemplate.query(sql.getSql("selectParametersSql"), new ISqlRowMapper<Object>() { public Object mapRow(Row row) { String value = row.getString("param_value"); if (value != null) { properties.setProperty(row.getString("param_key"), row.getString("param_value")); } return row; } }, externalId, nodeGroupId); return properties; }
TypedProperties properties = this.propertiesFactory.reload(); this.platform = createDatabasePlatform(properties); this.parameterService = new ParameterService(platform, propertiesFactory, properties.get( ParameterConstants.RUNTIME_CONFIG_TABLE_PREFIX, "sym"));