org.elasticsearch.node.InternalSettingsPreparer Java Examples

The following examples show how to use org.elasticsearch.node.InternalSettingsPreparer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NodeSettingsTest.java    From crate with Apache License 2.0 6 votes vote down vote up
@Before
public void doSetup() throws Exception {
    tmp.create();
    Path configPath = createConfigPath();
    Map<String, String> settings = new HashMap<>();
    settings.put("node.name", "node-test");
    settings.put("node.data", "true");
    settings.put(PATH_HOME_SETTING.getKey(), configPath.toString());
    // Avoid connecting to other test nodes
    settings.put("discovery.type", "single-node");

    Environment environment = InternalSettingsPreparer.prepareEnvironment(Settings.EMPTY, settings, configPath, () -> "node-test");
    node = new CrateNode(environment);
    node.start();
    sqlOperations = node.injector().getInstance(SQLOperations.class);
}
 
Example #2
Source File: CrateDB.java    From crate with Apache License 2.0 6 votes vote down vote up
@Override
protected Environment createEnv(Map<String, String> cmdLineSettings) throws UserException {
    // 1) Check that path.home is set on the command-line (mandatory)
    String crateHomePath = cmdLineSettings.get("path.home");
    if (crateHomePath == null) {
        throw new IllegalArgumentException("Please set the environment variable CRATE_HOME or " +
                                           "use -Cpath.home on the command-line.");
    }
    // 2) Remove path.conf from command-line settings but use it as a conf path if exists
    //    We need to remove it, because it was removed in ES6, but we want to keep the ability
    //    to set it as CLI argument and keep backwards compatibility.
    String confPathCLI = cmdLineSettings.remove("path.conf");
    final Path confPath;
    if (confPathCLI != null) {
        confPath = Paths.get(confPathCLI);
    } else {
        confPath = Paths.get(crateHomePath, "config");
    }
    return InternalSettingsPreparer.prepareEnvironment(Settings.EMPTY, cmdLineSettings, confPath, NodeNames::randomNodeName);
}
 
Example #3
Source File: EmbeddedElasticsearchNode.java    From immutables with Apache License 2.0 6 votes vote down vote up
private LocalNode(Settings settings, Collection<Class<? extends Plugin>> classpathPlugins) {
  super(
          InternalSettingsPreparer.prepareEnvironment(settings, emptyMap(),
                  null, () -> "default_node_name"),
          classpathPlugins,
          false);
}
 
Example #4
Source File: ElasticsearchBaseIT.java    From datacollector with Apache License 2.0 5 votes vote down vote up
TestNode(Settings settings) {
  super(
      InternalSettingsPreparer.prepareEnvironment(settings, null),
      // To enable an http port in integration tests, the following plugin must be loaded.
      Collections.singletonList(Netty4Plugin.class)
  );
}
 
Example #5
Source File: EnvironmentAwareCommand.java    From crate with Apache License 2.0 5 votes vote down vote up
/** Create an {@link Environment} for the command to use. Overrideable for tests. */
protected Environment createEnv(final Map<String, String> settings) throws UserException {
    String esPathConf = System.getProperty("es.path.conf");
    if (esPathConf == null) {
        esPathConf = settings.get("path.conf");
    }
    if (esPathConf == null) {
        throw new UserException(ExitCodes.CONFIG, "the system property [es.path.conf] must be set. Specify with -Cpath.conf=<path>");
    }
    return InternalSettingsPreparer.prepareEnvironment(Settings.EMPTY, settings,
                                                       getConfigPath(esPathConf),
                                                       NodeNames::randomNodeName);
}
 
Example #6
Source File: EmbeddedElasticsearchNode.java    From calcite with Apache License 2.0 5 votes vote down vote up
private LocalNode(Settings settings, Collection<Class<? extends Plugin>> classpathPlugins) {
  super(
      InternalSettingsPreparer.prepareEnvironment(settings, emptyMap(),
        null, () -> "default_node_name"),
      classpathPlugins,
      false);
}
 
Example #7
Source File: EmbeddedElasticSearchV6.java    From conductor with Apache License 2.0 5 votes vote down vote up
public PluginConfigurableNode(Settings preparedSettings, Collection<Class<? extends Plugin>> classpathPlugins) {
    super(InternalSettingsPreparer.prepareEnvironment(preparedSettings, null), classpathPlugins, false);
}
 
Example #8
Source File: EmbeddedElasticSearch.java    From jetlinks-community with Apache License 2.0 5 votes vote down vote up
@SneakyThrows
public EmbeddedElasticSearch(EmbeddedElasticSearchProperties properties) {
    super(InternalSettingsPreparer.prepareEnvironment(
        properties.applySetting(
            Settings.builder()
                .put("node.name", "test")
                .put("discovery.type", "single-node")
                .put("transport.type", "netty4")
                .put("http.type", "netty4")
                .put("network.host", "0.0.0.0")
                .put("http.port", 9200)
        ).build(), null),
        Collections.singleton(Netty4Plugin.class), false);
}
 
Example #9
Source File: EmbeddedElasticsearchNodeEnvironmentImpl.java    From flink with Apache License 2.0 4 votes vote down vote up
public PluginNode(Settings settings) {
	super(InternalSettingsPreparer.prepareEnvironment(settings, null), Collections.<Class<? extends Plugin>>singletonList(Netty3Plugin.class));
}
 
Example #10
Source File: EmbeddedElasticsearchNodeEnvironmentImpl.java    From flink with Apache License 2.0 4 votes vote down vote up
public PluginNode(Settings settings) {
	super(InternalSettingsPreparer.prepareEnvironment(settings, null), Collections.<Class<? extends Plugin>>singletonList(Netty4Plugin.class));
}
 
Example #11
Source File: EmbeddedElasticsearchNode.java    From Quicksql with MIT License 4 votes vote down vote up
private LocalNode(Settings settings, Collection<Class<? extends Plugin>> classpathPlugins) {
  super(InternalSettingsPreparer.prepareEnvironment(settings, null),
      classpathPlugins);
}
 
Example #12
Source File: EmbeddedElasticsearchNode.java    From Quicksql with MIT License 4 votes vote down vote up
private LocalNode(Settings settings, Collection<Class<? extends Plugin>> classpathPlugins) {
    super(InternalSettingsPreparer.prepareEnvironment(settings, null), classpathPlugins);
}
 
Example #13
Source File: IndexerTest.java    From elasticactors with Apache License 2.0 4 votes vote down vote up
PluginConfigurableNode(Settings settings, Collection<Class<? extends Plugin>> classpathPlugins) {
    super(InternalSettingsPreparer.prepareEnvironment(settings, null), classpathPlugins, false);
}
 
Example #14
Source File: ElasticsearchServerServlet.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
private static Environment prepareEnvironment(Settings preparedSettings) {
    Environment env = InternalSettingsPreparer.prepareEnvironment(preparedSettings, new HashMap<>(), null, defaultNodeName());
    return env;
}
 
Example #15
Source File: ElasticsearchTransportClientTest.java    From java-specialagent with Apache License 2.0 4 votes vote down vote up
public PluginConfigurableNode(final Settings settings, final Collection<Class<? extends Plugin>> classpathPlugins) {
  super(InternalSettingsPreparer.prepareEnvironment(settings, null), classpathPlugins);
}
 
Example #16
Source File: EmbeddedElasticsearchNodeEnvironmentImpl.java    From flink with Apache License 2.0 4 votes vote down vote up
public PluginNode(Settings settings) {
	super(InternalSettingsPreparer.prepareEnvironment(settings, null), Collections.<Class<? extends Plugin>>singletonList(Netty4Plugin.class));
}
 
Example #17
Source File: NodeExt.java    From fast-elasticsearch-vector-scoring with Apache License 2.0 4 votes vote down vote up
public NodeExt(Settings preparedSettings, Collection<Class<? extends Plugin>> classpathPlugins) {
    super(InternalSettingsPreparer.prepareEnvironment(preparedSettings, null),
            classpathPlugins);
}
 
Example #18
Source File: EmbeddedElasticsearchNodeEnvironmentImpl.java    From flink with Apache License 2.0 4 votes vote down vote up
public PluginNode(Settings settings) {
	super(InternalSettingsPreparer.prepareEnvironment(settings, Collections.emptyMap(), null, () -> "node1"), Collections.<Class<? extends Plugin>>singletonList(Netty4Plugin.class), true);
}
 
Example #19
Source File: ElasticSearchComponent.java    From metron with Apache License 2.0 4 votes vote down vote up
private TestNode(Settings preparedSettings,
    Collection<Class<? extends Plugin>> classpathPlugins) {
  super(InternalSettingsPreparer.prepareEnvironment(preparedSettings, null), classpathPlugins);
}
 
Example #20
Source File: EmbeddedElasticsearchNodeEnvironmentImpl.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public PluginNode(Settings settings) {
	super(InternalSettingsPreparer.prepareEnvironment(settings, null), Collections.<Class<? extends Plugin>>singletonList(Netty4Plugin.class));
}
 
Example #21
Source File: EmbeddedElasticsearch5.java    From baleen with Apache License 2.0 4 votes vote down vote up
PluginConfigurableNode(
    Settings settings, Collection<Class<? extends Plugin>> classpathPlugins) {
  super(InternalSettingsPreparer.prepareEnvironment(settings, null), classpathPlugins);
}
 
Example #22
Source File: EsEmbeddedServer.java    From datashare with GNU Affero General Public License v3.0 4 votes vote down vote up
public PluginConfigurableNode(Settings settings, Collection<Class<? extends Plugin>> classpathPlugins) {
    super(InternalSettingsPreparer.prepareEnvironment(settings, null), classpathPlugins, true);
}
 
Example #23
Source File: ElasticsearchRestClientTest.java    From java-specialagent with Apache License 2.0 4 votes vote down vote up
public PluginConfigurableNode(final Settings settings, final Collection<Class<? extends Plugin>> classpathPlugins) {
  super(InternalSettingsPreparer.prepareEnvironment(settings, null), classpathPlugins);
}
 
Example #24
Source File: EmbeddedElasticSearchV5.java    From conductor with Apache License 2.0 4 votes vote down vote up
public PluginConfigurableNode(Settings preparedSettings, Collection<Class<? extends Plugin>> classpathPlugins) {
    super(InternalSettingsPreparer.prepareEnvironment(preparedSettings, null), classpathPlugins);
}