<commit_before>package com.netflix.governator;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import javax.inject.Inject;
import javax.inject.Singleton;

import com.google.inject.Module;
import com.google.inject.util.Modules;
import com.netflix.governator.annotations.SuppressLifecycleUninitialized;
import com.netflix.governator.internal.DefaultPropertySource;
import com.netflix.governator.internal.GovernatorFeatureSet;
import com.netflix.governator.internal.ModulesEx;
import com.netflix.governator.spi.ModuleListTransformer;
import com.netflix.governator.spi.ModuleTransformer;
import com.netflix.governator.spi.PropertySource;

/**
 * Main entry point for creating a LifecycleInjector with guice extensions such as 
 * support for @PostConstruct, @PreDestroy annotations and LifecycleListener.
 * 
 * Example:
 * <code>
     new Governator()
        .addModules(
            new ArchaiusGovernatorModule(),
            new JettyModule(),
            new JerseyServletModule() {
                {@literal @}@Override
                protected void configureServlets() {
                    serve("/*").with(GuiceContainer.class);
                    
                    bind(GuiceContainer.class).asEagerSingleton();
                    bind(HelloWorldApp.class).asEagerSingleton();
                }  
            }
        )
        .run()
        .awaitTermination();
 * </code>
 */
public class Governator {
    protected Set<String>                 profiles          = new LinkedHashSet<>();
    protected List<Module>                modules           = new ArrayList<>();
    protected List<ModuleListTransformer> transformers      = new ArrayList<>();
    protected List<Module>                overrideModules   = new ArrayList<>();
    protected IdentityHashMap<GovernatorFeature<?>, Object> featureOverrides  = new IdentityHashMap<>();
    
    // This is a hack to make sure that if archaius is used at some point we make use
    // of the bridge so any access to the legacy Archaius1 API is actually backed by 
    // the Archaius2 implementation
    static {
        System.setProperty("archaius.default.configuration.class",      "com.netflix.archaius.bridge.StaticAbstractConfiguration");
        System.setProperty("archaius.default.deploymentContext.class",  "com.netflix.archaius.bridge.StaticDeploymentContext");
    }
    
    @Singleton
    @SuppressLifecycleUninitialized
    class GovernatorFeatureSetImpl implements GovernatorFeatureSet {
        private final IdentityHashMap<GovernatorFeature<?>, Object> featureOverrides;
        
        @Inject
        private PropertySource properties = new DefaultPropertySource();
        
        @Inject
        public GovernatorFeatureSetImpl(IdentityHashMap<GovernatorFeature<?>, Object> featureOverrides) {
            this.featureOverrides = featureOverrides;
        }
        <commit_msg>Deprecate the Governator class<commit_after>package com.netflix.governator;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import javax.inject.Inject;
import javax.inject.Singleton;

import com.google.inject.Module;
import com.google.inject.util.Modules;
import com.netflix.governator.annotations.SuppressLifecycleUninitialized;
import com.netflix.governator.internal.DefaultPropertySource;
import com.netflix.governator.internal.GovernatorFeatureSet;
import com.netflix.governator.internal.ModulesEx;
import com.netflix.governator.spi.ModuleListTransformer;
import com.netflix.governator.spi.ModuleTransformer;
import com.netflix.governator.spi.PropertySource;

/**
 * Main entry point for creating a LifecycleInjector with guice extensions such as 
 * support for @PostConstruct, @PreDestroy annotations and LifecycleListener.
 * 
 * Example:
 * <code>
     new Governator()
        .addModules(
            new ArchaiusGovernatorModule(),
            new JettyModule(),
            new JerseyServletModule() {
                {@literal @}@Override
                protected void configureServlets() {
                    serve("/*").with(GuiceContainer.class);
                    
                    bind(GuiceContainer.class).asEagerSingleton();
                    bind(HelloWorldApp.class).asEagerSingleton();
                }  
            }
        )
        .run()
        .awaitTermination();
 * </code>
 * 
 * @deprecated 2015-12-13 Use {@link ModuleBuilder} instead
 */
@Deprecated
public class Governator {
    protected Set<String>                 profiles          = new LinkedHashSet<>();
    protected List<Module>                modules           = new ArrayList<>();
    protected List<ModuleListTransformer> transformers      = new ArrayList<>();
    protected List<Module>                overrideModules   = new ArrayList<>();
    protected IdentityHashMap<GovernatorFeature<?>, Object> featureOverrides  = new IdentityHashMap<>();
    
    // This is a hack to make sure that if archaius is used at some point we make use
    // of the bridge so any access to the legacy Archaius1 API is actually backed by 
    // the Archaius2 implementation
    static {
        System.setProperty("archaius.default.configuration.class",      "com.netflix.archaius.bridge.StaticAbstractConfiguration");
        System.setProperty("archaius.default.deploymentContext.class",  "com.netflix.archaius.bridge.StaticDeploymentContext");
    }
    
    @Singleton
    @SuppressLifecycleUninitialized
    class GovernatorFeatureSetImpl implements GovernatorFeatureSet {
        private final IdentityHashMap<GovernatorFeature<?>, Object> featureOverrides;
        
        @Inject
        private PropertySource properties = new DefaultPropertySource();
        
        @Inject
        public GovernatorFeatureSetImpl(IdentityHashMap<GovernatorFeature<?>, Object> featureOverrides) {
            this.featureOverrides = featureOverrides;
        }
        
{'fraction_non_alphanumeric': 0.089115316189552, 'fraction_numerical': 0.0019408054342552159, 'mean_word_length': 2.9641025641025642, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '375849', 'n_tokens_mistral': 1586, 'n_tokens_neox': 1590, 'n_words': 360}