org.elasticsearch.common.settings.Settings.getAsClass()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.elasticsearch.common.settings.Settings.getAsClass()方法的一些代码示例,展示了Settings.getAsClass()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.getAsClass()方法的具体详情如下:
包路径:org.elasticsearch.common.settings.Settings
类名称:Settings
方法名:getAsClass

Settings.getAsClass介绍

暂无

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch-cloud-aws

public static Class<? extends AwsS3Service> getS3ServiceClass(Settings settings) {
  return settings.getAsClass(S3_SERVICE_TYPE_KEY, InternalAwsS3Service.class);
}

代码示例来源:origin: jprante/elasticsearch-transport-websocket

@Override
public Iterable<? extends Module> spawnModules() {
  return ImmutableList.of(Modules.createModule(settings.getAsClass("websocket.type", NettyWebSocketServerTransportModule.class, "org.xbib.elasticsearch.websocket.http.", "HttpServerTransportModule"), settings));
}

代码示例来源:origin: org.fusesource.insight/insight-elasticsearch

@Override
public Iterable<? extends Module> spawnModules() {
  return ImmutableList.of(Modules.createModule(settings.getAsClass("http.type", NettyHttpServerTransportModule.class, "org.elasticsearch.http.", "HttpServerTransportModule"), settings));
}

代码示例来源:origin: sonian/elasticsearch-jetty

private void configureFilters() {
    MapBinder<String, FilterHttpServerAdapterFactory> filterBinder
        = MapBinder.newMapBinder(binder(), String.class, FilterHttpServerAdapterFactory.class);
    Map<String, Settings> filtersSettings = componentSettings.getGroups("http_filter");

    for (Map.Entry<String, Settings> entry : filtersSettings.entrySet()) {
      String filterName = entry.getKey();
      Settings filterSettings = entry.getValue();

      Class<? extends FilterHttpServerAdapter> type = null;
      try {
        type = filterSettings.getAsClass("type", null, "com.sonian.elasticsearch.http.filter.", "FilterHttpServerAdapter");
      } catch (NoClassSettingsException e) {
        // Ignore
      }
      if (type == null) {
        throw new ElasticsearchIllegalArgumentException("Http Filter [" + filterName + "] must have a type associated with it");
      }
      filterBinder.addBinding(filterName)
          .toProvider(FactoryProvider.newFactory(FilterHttpServerAdapterFactory.class, type))
          .in(Scopes.SINGLETON);
    }
  }
}

代码示例来源:origin: sonian/elasticsearch-jetty

@Override
protected void configure() {
  bind(HttpServerTransport.class)
      .to(FilterHttpServerTransport.class).asEagerSingleton();
  Class<? extends HttpServerTransport> transport;
  // This is a hack for debugging. It allows switching back to NettyHttpServer if needed.
  // HttpServerTransportModule should be loaded instead of just binding HttpServerTransport
  // directly. Unfortunately, it's not possible to override annotation then.
  transport = componentSettings.getAsClass("transport_type", JettyHttpServerTransport.class,
      "org.elasticsearch.http.", "HttpServerTransport");
  bind(HttpServerTransport.class)
      .annotatedWith(FilteredHttpServerTransport.class)
      .to(transport).asEagerSingleton();
  bind(ESLoggerWrapper.class).asEagerSingleton();
  configureFilters();
}

代码示例来源:origin: com.floragunn/search-guard

final Class<? extends NonCachingAuthorizator> defaultNonCachingAuthorizator = SettingsBasedAuthorizator.class;
final Class<? extends NonCachingAuthenticationBackend> authenticationBackend = settings.getAsClass(
    ConfigConstants.SEARCHGUARD_AUTHENTICATION_AUTHENTICATION_BACKEND, defaultNonCachingAuthenticationBackend);
final Class<? extends HTTPAuthenticator> httpAuthenticator = settings.getAsClass(
    ConfigConstants.SEARCHGUARD_AUTHENTICATION_HTTP_AUTHENTICATOR, defaultHTTPAuthenticator);
bind(HTTPAuthenticator.class).to(httpAuthenticator).asEagerSingleton();
final Class<? extends NonCachingAuthorizator> authorizator = settings.getAsClass(
    ConfigConstants.SEARCHGUARD_AUTHENTICATION_AUTHORIZER, defaultNonCachingAuthorizator);
    settings.getAsClass(ConfigConstants.SEARCHGUARD_WAFFLE_WINDOWS_AUTH_PROVIDER_IMPL, WindowsAuthProviderImpl.class))
    .asEagerSingleton();

相关文章