Author: macbean Date: Mon Jul 14 10:23:42 2014 New Revision: 1610378 URL: http://svn.apache.org/r1610378 Log: QPID-5822: [Java Broker] change to JE param setting logic to handle EnvironmentParams.SUPPORTED_PARAMS not always containing ALL valid params
Modified: qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeFactory.java Modified: qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeFactory.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeFactory.java?rev=1610378&r1=1610377&r2=1610378&view=diff ============================================================================== --- qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeFactory.java (original) +++ qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeFactory.java Mon Jul 14 10:23:42 2014 @@ -23,9 +23,7 @@ package org.apache.qpid.server.store.ber import java.util.Collections; import java.util.HashMap; import java.util.Map; - -import com.sleepycat.je.config.ConfigParam; -import com.sleepycat.je.config.EnvironmentParams; +import java.util.regex.Pattern; import org.apache.qpid.server.model.ConfiguredObject; import org.apache.qpid.server.store.berkeleydb.EnvironmentFacade; @@ -34,6 +32,9 @@ import org.apache.qpid.server.store.berk public class ReplicatedEnvironmentFacadeFactory implements EnvironmentFacadeFactory { + public static final Pattern NON_REP_JE_PARAM_PATTERN = Pattern.compile("^je\\.(?!rep\\.).*"); + public static final Pattern REP_JE_PARAM_PATTERN = Pattern.compile("^je\\.rep\\..*"); + @Override public EnvironmentFacade createEnvironmentFacade(final ConfiguredObject<?> parent) { @@ -113,27 +114,27 @@ public class ReplicatedEnvironmentFacade private Map<String, String> buildEnvironmentConfigParameters(ConfiguredObject<?> parent) { - return buildConfig(parent, false); + return buildConfig(parent, NON_REP_JE_PARAM_PATTERN); } private Map<String, String> buildReplicationConfigParameters(ConfiguredObject<?> parent) { - return buildConfig(parent, true); + return buildConfig(parent, REP_JE_PARAM_PATTERN); } - private Map<String, String> buildConfig(ConfiguredObject<?> parent, boolean selectReplicationParaemeters) + private Map<String, String> buildConfig(ConfiguredObject<?> parent, Pattern paramName) { Map<String, String> targetMap = new HashMap<>(); - for (ConfigParam entry : EnvironmentParams.SUPPORTED_PARAMS.values()) + for (String name : parent.getContext().keySet()) { - final String name = entry.getName(); - if (entry.isForReplication() == selectReplicationParaemeters && parent.getContext().containsKey(name)) + if (paramName.matcher(name).matches()) { String contextValue = parent.getContext().get(name); targetMap.put(name, contextValue); } } + return Collections.unmodifiableMap(targetMap); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org