<commit_before>/*
 * #%L
 * OptionsSupport.java - mongodb-binding - Yahoo!, Inc.
 * %%
 * Copyright (C) 2015 Yahoo!, Inc.
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

package com.yahoo.ycsb.db;

import java.util.Properties;

/**
 * OptionsSupport provides methods for handling legacy options.
 * 
 * @author rjm
 */
public final class OptionsSupport {

    /** Value for an unavailable property. */
    protected static final String UNAVAILABLE = "n/a";

    /**
     * Updates the URL with the appropriate attributes if legacy properties are
     * set and the URL does not have the property already set.
     * 
     * @param url
     *            The URL to update.
     * @param props
     *            The legacy properties.
     * @return The updated URL.
     */
    public static String updateUrl(String url, Properties props) {
        String result = url;

        // max connections.
        final String maxConnections = props.getProperty(
                "mongodb.maxconnections", UNAVAILABLE).toLowerCase();
        if (!UNAVAILABLE.equals(maxConnections)) {
            result = addUrlOption(result, "maxPoolSize", maxConnections);
        }

        // Blocked thread multiplier.
        final String threadsAllowedToBlockForConnectionMultiplier = props
                .getProperty(
                        "mongodb.threadsAllowedToBlockForConnectionMultiplier",
                        UNAVAILABLE).toLowerCase();
        if (!UNAVAILABLE.equals(threadsAllowedToBlockForConnectionMultiplier)) {
            result = addUrlOption(result, "waitQueueMultiple",
                    threadsAllowedToBlockForConnectionMultiplier);
        }<commit_msg>Changed visibility of static field from protected to private in final OptionsSupport class for MongoDB.<commit_after>/*
 * #%L
 * OptionsSupport.java - mongodb-binding - Yahoo!, Inc.
 * %%
 * Copyright (C) 2015 Yahoo!, Inc.
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

package com.yahoo.ycsb.db;

import java.util.Properties;

/**
 * OptionsSupport provides methods for handling legacy options.
 * 
 * @author rjm
 */
public final class OptionsSupport {

    /** Value for an unavailable property. */
    private static final String UNAVAILABLE = "n/a";

    /**
     * Updates the URL with the appropriate attributes if legacy properties are
     * set and the URL does not have the property already set.
     * 
     * @param url
     *            The URL to update.
     * @param props
     *            The legacy properties.
     * @return The updated URL.
     */
    public static String updateUrl(String url, Properties props) {
        String result = url;

        // max connections.
        final String maxConnections = props.getProperty(
                "mongodb.maxconnections", UNAVAILABLE).toLowerCase();
        if (!UNAVAILABLE.equals(maxConnections)) {
            result = addUrlOption(result, "maxPoolSize", maxConnections);
        }

        // Blocked thread multiplier.
        final String threadsAllowedToBlockForConnectionMultiplier = props
                .getProperty(
                        "mongodb.threadsAllowedToBlockForConnectionMultiplier",
                        UNAVAILABLE).toLowerCase();
        if (!UNAVAILABLE.equals(threadsAllowedToBlockForConnectionMultiplier)) {
            result = addUrlOption(result, "waitQueueMultiple",
                    threadsAllowedToBlockForConnectionMultiplier);
        }
{'fraction_non_alphanumeric': 0.08284948637784725, 'fraction_numerical': 0.003573023671281822, 'mean_word_length': 2.5889423076923075, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4553133', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1121, 'n_words': 404}