/* Check that the properties have valid names and values. */
Enumeration propNames = props.propertyNames();
while (propNames.hasMoreElements()) {
String name = (String) propNames.nextElement();
/* Is this a valid property name? */
ConfigParam param =
EnvironmentParams.SUPPORTED_PARAMS.get(name);
if (param == null) {
/* See if the parameter is an multi-value parameter. */
String mvParamName = ConfigParam.multiValueParamName(name);
param = EnvironmentParams.SUPPORTED_PARAMS.get(mvParamName);
if (param == null) {
/*
* Remove the property only if:
* 1. The parameter name indicates it's a replication
* parameter
* 2. The Environment is being opened in standalone mode
* 3. The parameter is being initialized in the properties
* file
* See SR [#19080].
*/
if (configClassName == null && !isRepConfigInstance &&
name.contains(EnvironmentParams.REP_PARAM_PREFIX)) {
props.remove(name);
continue;
}
throw new IllegalArgumentException
(name +
" is not a valid BDBJE environment configuration");
}
}
/*
* Only verify that the parameter is "for replication" if this is
* being validated on behalf of a FooConfig class, not a
* je.properties file.
*/
if (configClassName != null) {
/* We're validating a config instance, not a file. */
if (isRepConfigInstance) {
if (!param.isForReplication()) {
throw new IllegalArgumentException
(name +
" is not a replication parameter and cannot " +
" be set through " + configClassName);
}
} else {
if (param.isForReplication()) {
throw new IllegalArgumentException
(name +
" is a replication parameter and cannot be set " +
" through " + configClassName);
}
}
}
/* Is this a valid property value? */
param.validateValue(props.getProperty(name));
}
}