Tabnine Logo
Configurator.getConfig
Code IndexAdd Tabnine to your IDE (free)

How to use
getConfig
method
in
org.wikibrain.conf.Configurator

Best Java code snippets using org.wikibrain.conf.Configurator.getConfig (Showing top 9 results out of 315)

origin: shilad/wikibrain

public Config getMetricConfig(String name) throws ConfigurationException {
  return env.getConfigurator().getConfig(SRMetric.class, name);
}
origin: shilad/wikibrain

/**
 * Constructs a new factory that creates an sr metric with a particular name from the config
 * file. The overrides take precedence over any configuration parameters, and are relative to
 * the innermost configuration block for an SR metric (i.e. the nested dictionary with key
 * the name of the metric).
 *
 * @param language
 * @param configurator
 * @param name Name of metric from configuration file
 * @param configOverrides Optional configuration overrides, or null.
 * @throws ConfigurationException
 */
public ConfigMonolingualSRFactory(Language language, Configurator configurator, String name, Map<String, Object> configOverrides) throws ConfigurationException {
  this.config = ConfigFactory.empty();
  if (configOverrides != null) {
    config = config.withFallback(ConfigFactory.parseMap(configOverrides));
  }
  config = config.withFallback(configurator.getConfig(SRMetric.class, name));
  this.configurator = configurator;
  this.name = name;
  this.language = language;
}
origin: shilad/wikibrain

@Override
public String describeDisambiguator() {
  if (!config.hasPath("disambiguator")){
    return "none";
  }
  String disambigName = config.getString("disambiguator");
  try {
    Map dc = configurator.getConfig(Disambiguator.class, disambigName).root().unwrapped();
    String phraseName = null;
    if (dc.containsKey("phraseAnalyzer")) {
      phraseName = (String) dc.get("phraseAnalyzer");
    }
    if (phraseName == null || phraseName.equals("default")) {
      phraseName = configurator.getConf().get().getString("phrases.analyzer.default");
    }
    dc.put("phraseAnalyzer", phraseName);
    return disambigName + "=" + dc.toString();
  } catch (ConfigurationException e) {
    throw new IllegalStateException(e);
  }
}
origin: shilad/wikibrain

Config config = getConfig(klass, name);
Map<String, Object> cache = components.get(klass);
String key = makeCacheKey(name, runtimeParams);
origin: org.wikibrainapi/wikibrain-loader

  @Override
  public boolean runDiagnostic(PrintWriter writer) {
    Config config = null;
    try {
      config = env.getConfigurator().getConfig(WpDataSource.class, null);
    } catch (ConfigurationException e) {
      throw new IllegalStateException(e);
    }
    boolean passed = true;
    try {
      WpDataSource ds = env.getConfigurator().get(WpDataSource.class);
      ds.getConnection().close();
      writer.write("Connection to database succeeded. Active configuration:\n");
    } catch (Exception e) {
      writer.write("Connection to database FAILED! Active configuration:\n");
      passed = false;
    }
    for (Map.Entry<String, ConfigValue > entry : config.entrySet()) {
      writer.write("\t" + entry.getKey() + ": " + entry.getValue().render() + "\n");
    }
    return passed;
  }
}
origin: org.wikibrainapi/wikibrain-utils

Config config = getConfig(klass, name);
Map<String, Object> cache = components.get(klass);
String key = makeCacheKey(name, runtimeParams);
origin: shilad/wikibrain

  @Override
  public boolean runDiagnostic(PrintWriter writer) {
    Config config = null;
    try {
      config = env.getConfigurator().getConfig(WpDataSource.class, null);
    } catch (ConfigurationException e) {
      throw new IllegalStateException(e);
    }
    boolean passed = true;
    try {
      WpDataSource ds = env.getConfigurator().get(WpDataSource.class);
      ds.getConnection().close();
      writer.write("Connection to database succeeded. Active configuration:\n");
    } catch (Exception e) {
      writer.write("Connection to database FAILED! Active configuration:\n");
      passed = false;
    }
    for (Map.Entry<String, ConfigValue > entry : config.entrySet()) {
      writer.write("\t" + entry.getKey() + ": " + entry.getValue().render() + "\n");
    }
    return passed;
  }
}
origin: shilad/wikibrain

  config = env.getConfigurator().getConfig(PostGISDB.class, null);
} catch (ConfigurationException e) {
  throw new IllegalStateException(e);
origin: org.wikibrainapi/wikibrain-loader

  config = env.getConfigurator().getConfig(PostGISDB.class, null);
} catch (ConfigurationException e) {
  throw new IllegalStateException(e);
org.wikibrain.confConfiguratorgetConfig

Javadoc

Returns the config object associated with the given class and name.

Popular methods of Configurator

  • get
    Get a specific named instance of the component with the specified class.
  • <init>
    Constructs a new configuration object with the specified configuration.
  • getConf
  • construct
    Constructs an instance of the specified class with the passed in config. This bypasses the cache and
  • resolveComponentName
    If the component name is "default" or null, return the name of the default implementation of the com
  • close
    Tries to close all open components, clears the components map.
  • constructInternal
  • makeCacheKey
    Returns a unique string for the name and params
  • registerProvider
    Instantiates providers for the component.
  • registerProviders
    Registers all class that extend Providers

Popular in Java

  • Start an intent from android
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
  • startActivity (Activity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JButton (javax.swing)
  • JList (javax.swing)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now