/** * Checks that the immutable values in the environment config used to open an environment match * those in the config object saved by the underlying shared EnvironmentImpl. * * @param handleConfigProps are the config property values that were specified by configuration * object from the Environment. */ void checkImmutablePropsForEquality(Properties handleConfigProps) throws IllegalArgumentException { Iterator<String> iter = EnvironmentParams.SUPPORTED_PARAMS.keySet().iterator(); while (iter.hasNext()) { String paramName = iter.next(); ConfigParam param = EnvironmentParams.SUPPORTED_PARAMS.get(paramName); assert param != null; if (!param.isMutable() && !param.isForReplication()) { String paramVal = props.getProperty(paramName); String useParamVal = handleConfigProps.getProperty(paramName); if ((paramVal != null) ? (!paramVal.equals(useParamVal)) : (useParamVal != null)) { throw new IllegalArgumentException( paramName + " is set to " + useParamVal + " in the config parameter" + " which is incompatible" + " with the value of " + paramVal + " in the" + " underlying environment"); } } } }
/** * Removes all immutable props. Unchecked suppress here because Properties don't play well with * generics in Java 1.5 */ @SuppressWarnings("unchecked") private void clearImmutableProps() { Enumeration propNames = props.propertyNames(); while (propNames.hasMoreElements()) { String paramName = (String) propNames.nextElement(); ConfigParam param = EnvironmentParams.SUPPORTED_PARAMS.get(paramName); assert param != null; if (!param.isMutable()) { props.remove(paramName); } } }
/** * Copies all mutable props to the given config object. Unchecked suppress here because Properties * don't play well with generics in Java 1.5 */ @SuppressWarnings("unchecked") void copyMutablePropsTo(EnvironmentMutableConfig toConfig) { Properties toProps = toConfig.props; Enumeration propNames = props.propertyNames(); while (propNames.hasMoreElements()) { String paramName = (String) propNames.nextElement(); ConfigParam param = EnvironmentParams.SUPPORTED_PARAMS.get(paramName); assert param != null; if (param.isMutable()) { String newVal = props.getProperty(paramName); toProps.setProperty(paramName, newVal); } } toConfig.exceptionListener = this.exceptionListener; toConfig.cacheMode = this.cacheMode; }