<commit_before>/**
 * JBoss, Home of Professional Open Source
 * Copyright Red Hat, Inc., and individual contributors.
 *
 * 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.
 */
package org.jboss.aerogear.unifiedpush.message.configuration;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;

import org.jboss.aerogear.unifiedpush.api.VariantType;
import org.jboss.aerogear.unifiedpush.message.sender.SenderType;
import org.jboss.aerogear.unifiedpush.message.util.ConfigurationUtils;
import org.jboss.aerogear.unifiedpush.utils.AeroGearLogger;

/**
 * Loads and stores configuration for specific Push Networks.
 *
 * UPS provides sensible defaults specific to each Push Network and its limitations.
 *
 * Configuration can be changed by overriding system properties, e.g. via as VM args.
 *
 * Example: In order to change the configuration of {@link SenderConfiguration#batchSize()} for APNs (iOS) service,
 * one can provide following system property: <tt>-Daerogear.ios.batchSize=12000</tt>.
 *
 * The name of the network (<tt>aerogear.&lt;network&gt;.&lt;property&gt;</tt>) is specified by {@link VariantType#getTypeName()}.
 *
 * Look at {@link SenderConfiguration} for more details about available configurations.
 *
 * @see SenderConfiguration
 */
public class SenderConfigurationProvider {

    private final AeroGearLogger logger = AeroGearLogger.getInstance(SenderConfigurationProvider.class);

    @Produces @ApplicationScoped @SenderType(VariantType.ANDROID)
    public SenderConfiguration produceAndroidConfiguration() {
        return loadConfigurationFor(VariantType.ANDROID, new SenderConfiguration(10, 1000));
    }

    @Produces @ApplicationScoped @SenderType(VariantType.ADM)
    public SenderConfiguration produceAdmConfiguration() {
        return loadConfigurationFor(VariantType.ADM, new SenderConfiguration(10, 1000));
    }

    @Produces @ApplicationScoped @SenderType(VariantType.IOS)
    public SenderConfiguration produceIosConfiguration() {
        return loadConfigurationFor(VariantType.IOS, new SenderConfiguration(3, 10000));
    }

    @Produces @ApplicationScoped @SenderType(VariantType.SIMPLE_PUSH)
    public SenderConfiguration produceSimplePushConfiguration() {<commit_msg>using tested 2k batch size for iOS tokens<commit_after>/**
 * JBoss, Home of Professional Open Source
 * Copyright Red Hat, Inc., and individual contributors.
 *
 * 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.
 */
package org.jboss.aerogear.unifiedpush.message.configuration;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;

import org.jboss.aerogear.unifiedpush.api.VariantType;
import org.jboss.aerogear.unifiedpush.message.sender.SenderType;
import org.jboss.aerogear.unifiedpush.message.util.ConfigurationUtils;
import org.jboss.aerogear.unifiedpush.utils.AeroGearLogger;

/**
 * Loads and stores configuration for specific Push Networks.
 *
 * UPS provides sensible defaults specific to each Push Network and its limitations.
 *
 * Configuration can be changed by overriding system properties, e.g. via as VM args.
 *
 * Example: In order to change the configuration of {@link SenderConfiguration#batchSize()} for APNs (iOS) service,
 * one can provide following system property: <tt>-Daerogear.ios.batchSize=12000</tt>.
 *
 * The name of the network (<tt>aerogear.&lt;network&gt;.&lt;property&gt;</tt>) is specified by {@link VariantType#getTypeName()}.
 *
 * Look at {@link SenderConfiguration} for more details about available configurations.
 *
 * @see SenderConfiguration
 */
public class SenderConfigurationProvider {

    private final AeroGearLogger logger = AeroGearLogger.getInstance(SenderConfigurationProvider.class);

    @Produces @ApplicationScoped @SenderType(VariantType.ANDROID)
    public SenderConfiguration produceAndroidConfiguration() {
        return loadConfigurationFor(VariantType.ANDROID, new SenderConfiguration(10, 1000));
    }

    @Produces @ApplicationScoped @SenderType(VariantType.ADM)
    public SenderConfiguration produceAdmConfiguration() {
        return loadConfigurationFor(VariantType.ADM, new SenderConfiguration(10, 1000));
    }

    @Produces @ApplicationScoped @SenderType(VariantType.IOS)
    public SenderConfiguration produceIosConfiguration() {
        return loadConfigurationFor(VariantType.IOS, new SenderConfiguration(3, 2000));
    }

    @Produces @ApplicationScoped @SenderType(VariantType.SIMPLE_PUSH)
    public SenderConfiguration produceSimplePushConfiguration() {
{'fraction_non_alphanumeric': 0.08515244452462566, 'fraction_numerical': 0.009742016958325817, 'mean_word_length': 5.0, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '23820', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1472, 'n_words': 467}