private static String resolveFromEnv(String str) { if (gwcEnvironment == null) { gwcEnvironment = GeoWebCacheExtensions.bean(GeoWebCacheEnvironment.class); } if (gwcEnvironment != null && str != null && GeoWebCacheEnvironment.ALLOW_ENV_PARAMETRIZATION) { Object result = gwcEnvironment.resolveValue(str); if (result == null) { return null; } return result.toString(); } return str; }
private static String resolveFromEnv(String str) { if (gwcEnvironment == null) { gwcEnvironment = GeoWebCacheExtensions.bean(GeoWebCacheEnvironment.class); } if (gwcEnvironment != null && str != null && GeoWebCacheEnvironment.ALLOW_ENV_PARAMETRIZATION) { Object result = gwcEnvironment.resolveValue(str); if (result == null) { return null; } return result.toString(); } return str; }
public static DiskQuotaConfig loadConfiguration(final Reader reader, XStream xstream) { DiskQuotaConfig fromXML = (DiskQuotaConfig) xstream.fromXML(reader); final GeoWebCacheEnvironment gwcEnvironment = GeoWebCacheExtensions.bean(GeoWebCacheEnvironment.class); if (gwcEnvironment != null && GeoWebCacheEnvironment.ALLOW_ENV_PARAMETRIZATION) { fromXML.setQuotaStore((String) gwcEnvironment.resolveValue(fromXML.getQuotaStore())); } return fromXML; }
public void testSystemProperty() { // check for a property we did set up in the setUp GeoWebCacheEnvironment genv = new GeoWebCacheEnvironment(); assertEquals("ABC", genv.resolveValue("${TEST_SYS_PROPERTY}")); Properties props = new Properties(); props.setProperty("TEST_SYS_PROPERTY", "DEF"); props.setProperty("TEST_PROPERTY", "WWW"); genv.setProps(props); assertEquals("ABC", genv.resolveValue("${TEST_SYS_PROPERTY}")); assertEquals("WWW", genv.resolveValue("${TEST_PROPERTY}")); } }
&& gwcEnvironment != null && GeoWebCacheEnvironment.ALLOW_ENV_PARAMETRIZATION) { conf.setDialect((String) gwcEnvironment.resolveValue(getDialect())); conf.setJNDISource((String) gwcEnvironment.resolveValue(getJNDISource())); ConnectionPoolConfiguration connectionPoolConfig = getConnectionPool(); if (connectionPoolConfig != null) { SerializationUtils.clone(connectionPoolConfig); expConnectionPoolConfig.setDriver( (String) gwcEnvironment.resolveValue(connectionPoolConfig.getDriver())); expConnectionPoolConfig.setUrl( (String) gwcEnvironment.resolveValue(connectionPoolConfig.getUrl())); expConnectionPoolConfig.setUsername( (String) gwcEnvironment.resolveValue(connectionPoolConfig.getUsername())); expConnectionPoolConfig.setPassword( (String) gwcEnvironment.resolveValue(connectionPoolConfig.getPassword())); expConnectionPoolConfig.setValidationQuery( (String) gwcEnvironment.resolveValue( connectionPoolConfig.getValidationQuery()));