org.elasticsearch.plugins.PluginsService Java Examples

The following examples show how to use org.elasticsearch.plugins.PluginsService. 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: NodeService.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Inject
public NodeService(Settings settings, ThreadPool threadPool, MonitorService monitorService, Discovery discovery,
                   TransportService transportService, IndicesService indicesService,
                   PluginsService pluginService, CircuitBreakerService circuitBreakerService,
                   Version version) {
    super(settings);
    this.threadPool = threadPool;
    this.monitorService = monitorService;
    this.transportService = transportService;
    this.indicesService = indicesService;
    this.discovery = discovery;
    discovery.setNodeService(this);
    this.version = version;
    this.pluginService = pluginService;
    this.circuitBreakerService = circuitBreakerService;
}
 
Example #2
Source File: IndicesService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public IndicesService(Settings settings, IndicesLifecycle indicesLifecycle, IndicesAnalysisService indicesAnalysisService, Injector injector, NodeEnvironment nodeEnv) {
    super(settings);
    this.indicesLifecycle = (InternalIndicesLifecycle) indicesLifecycle;
    this.indicesAnalysisService = indicesAnalysisService;
    this.injector = injector;
    this.pluginsService = injector.getInstance(PluginsService.class);
    this.indicesLifecycle.addListener(oldShardsStats);
    this.nodeEnv = nodeEnv;
    this.shardsClosedTimeout = settings.getAsTime(INDICES_SHARDS_CLOSED_TIMEOUT, new TimeValue(1, TimeUnit.DAYS));
}
 
Example #3
Source File: IndexService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public IndexService(Injector injector, Index index, NodeEnvironment nodeEnv,
                    AnalysisService analysisService, MapperService mapperService, IndexQueryParserService queryParserService,
                    SimilarityService similarityService, IndexAliasesService aliasesService, IndexCache indexCache,
                    IndexSettingsService settingsService,
                    IndexFieldDataService indexFieldData, BitsetFilterCache bitSetFilterCache, IndicesService indicesServices) {

    super(index, settingsService.getSettings());
    this.injector = injector;
    this.analysisService = analysisService;
    this.mapperService = mapperService;
    this.queryParserService = queryParserService;
    this.similarityService = similarityService;
    this.aliasesService = aliasesService;
    this.indexCache = indexCache;
    this.indexFieldData = indexFieldData;
    this.settingsService = settingsService;
    this.bitsetFilterCache = bitSetFilterCache;

    this.pluginsService = injector.getInstance(PluginsService.class);
    this.indicesServices = indicesServices;
    this.indicesLifecycle = (InternalIndicesLifecycle) injector.getInstance(IndicesLifecycle.class);

    // inject workarounds for cyclic dep
    indexFieldData.setListener(new FieldDataCacheListener(this));
    bitSetFilterCache.setListener(new BitsetCacheListener(this));
    this.nodeEnv = nodeEnv;
}
 
Example #4
Source File: ImageIntegrationTests.java    From elasticsearch-image with Apache License 2.0 5 votes vote down vote up
@Override
protected Settings nodeSettings(int nodeOrdinal) {
    return ImmutableSettings.builder()
            .put(super.nodeSettings(nodeOrdinal))
            .put("plugins." + PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true)
            .build();
}
 
Example #5
Source File: OntologyUpdateIntegrationTests.java    From BioSolr with Apache License 2.0 5 votes vote down vote up
@Override
protected Settings nodeSettings(int nodeOrdinal) {
	return ImmutableSettings.builder()
			.put(super.nodeSettings(nodeOrdinal))
			.put("plugins." + PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true)
			.build();
}
 
Example #6
Source File: OLSOntologyUpdateIntegrationTests.java    From BioSolr with Apache License 2.0 5 votes vote down vote up
@Override
protected Settings nodeSettings(int nodeOrdinal) {
	return ImmutableSettings.builder()
			.put(super.nodeSettings(nodeOrdinal))
			.put("plugins." + PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true)
			.build();
}
 
Example #7
Source File: OntologyUpdateIntegrationTests.java    From BioSolr with Apache License 2.0 5 votes vote down vote up
@Override
protected Settings nodeSettings(int nodeOrdinal) {
	return ImmutableSettings.builder()
			.put(super.nodeSettings(nodeOrdinal))
			.put("plugins." + PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true)
			.build();
}
 
Example #8
Source File: OLSOntologyUpdateIntegrationTests.java    From BioSolr with Apache License 2.0 5 votes vote down vote up
@Override
protected Settings nodeSettings(int nodeOrdinal) {
	return ImmutableSettings.builder()
			.put(super.nodeSettings(nodeOrdinal))
			.put("plugins." + PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true)
			.build();
}
 
Example #9
Source File: OntologyUpdateIntegrationTests.java    From BioSolr with Apache License 2.0 5 votes vote down vote up
@Override
protected Settings nodeSettings(int nodeOrdinal) {
	return ImmutableSettings.builder()
			.put(super.nodeSettings(nodeOrdinal))
			.put("plugins." + PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true)
			.build();
}
 
Example #10
Source File: PluginLoaderTest.java    From crate with Apache License 2.0 5 votes vote down vote up
private PluginLoaderPlugin getCratePlugin(PluginsService pluginsService) {
    // find the PluginLoaderPlugin, should be the only one loaded
    List<PluginLoaderPlugin> pluginLoaderPlugins = pluginsService.filterPlugins(PluginLoaderPlugin.class);
    if (pluginLoaderPlugins.isEmpty()) {
        throw new IllegalStateException("Couldn't find PluginLoaderPlugin");
    }
    return pluginLoaderPlugins.get(0);
}
 
Example #11
Source File: TransportClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
/**
 * Builds a new instance of the transport client.
 */
public TransportClient build() {
    Settings settings = InternalSettingsPreparer.prepareSettings(this.settings);
    settings = settingsBuilder()
            .put(NettyTransport.PING_SCHEDULE, "5s") // enable by default the transport schedule ping interval
            .put(settings)
            .put("network.server", false)
            .put("node.client", true)
            .put(CLIENT_TYPE_SETTING, CLIENT_TYPE)
            .build();

    PluginsService pluginsService = new PluginsService(settings, null, null, pluginClasses);
    this.settings = pluginsService.updatedSettings();

    Version version = Version.CURRENT;

    final ThreadPool threadPool = new ThreadPool(settings);
    NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry();

    boolean success = false;
    try {
        ModulesBuilder modules = new ModulesBuilder();
        modules.add(new Version.Module(version));
        // plugin modules must be added here, before others or we can get crazy injection errors...
        for (Module pluginModule : pluginsService.nodeModules()) {
            modules.add(pluginModule);
        }
        modules.add(new PluginsModule(pluginsService));
        modules.add(new SettingsModule(this.settings));
        modules.add(new NetworkModule(namedWriteableRegistry));
        modules.add(new ClusterNameModule(this.settings));
        modules.add(new ThreadPoolModule(threadPool));
        modules.add(new TransportModule(this.settings, namedWriteableRegistry));
        modules.add(new SearchModule() {
            @Override
            protected void configure() {
                // noop
            }
        });
        modules.add(new ActionModule(true));
        modules.add(new ClientTransportModule());
        modules.add(new CircuitBreakerModule(this.settings));

        pluginsService.processModules(modules);

        Injector injector = modules.createInjector();
        final TransportService transportService = injector.getInstance(TransportService.class);
        transportService.start();
        transportService.acceptIncomingRequests();

        TransportClient transportClient = new TransportClient(injector);
        success = true;
        return transportClient;
    } finally {
        if (!success) {
            ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS);
        }
    }
}
 
Example #12
Source File: TransportClient.java    From elasticsearch-helper with Apache License 2.0 4 votes vote down vote up
public TransportClient build() {
    Settings settings = InternalSettingsPreparer.prepareSettings(this.settings);
    settings = settingsBuilder()
            .put("transport.ping.schedule", this.settings.get("ping.interval", "30s"))
            .put(settings)
            .put("network.server", false)
            .put("node.client", true)
            .put(CLIENT_TYPE_SETTING, CLIENT_TYPE)
            .build();
    PluginsService pluginsService = new PluginsService(settings, null, null, pluginClasses);
    this.settings = pluginsService.updatedSettings();
    Version version = Version.CURRENT;
    final ThreadPool threadPool = new ThreadPool(settings);
    final NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry();

    boolean success = false;
    try {
        ModulesBuilder modules = new ModulesBuilder();
        modules.add(new Version.Module(version));
        // plugin modules must be added here, before others or we can get crazy injection errors...
        for (Module pluginModule : pluginsService.nodeModules()) {
            modules.add(pluginModule);
        }
        modules.add(new PluginsModule(pluginsService));
        modules.add(new SettingsModule(this.settings));
        modules.add(new NetworkModule(namedWriteableRegistry));
        modules.add(new ClusterNameModule(this.settings));
        modules.add(new ThreadPoolModule(threadPool));
        modules.add(new TransportModule(this.settings, namedWriteableRegistry));
        modules.add(new SearchModule() {
            @Override
            protected void configure() {
                // noop
            }
        });
        modules.add(new ActionModule(true));
        modules.add(new ClientTransportModule(hostFailedListener));
        modules.add(new CircuitBreakerModule(this.settings));
        pluginsService.processModules(modules);
        Injector injector = modules.createInjector();
        injector.getInstance(TransportService.class).start();
        TransportClient transportClient = new TransportClient(injector);
        success = true;
        return transportClient;
    } finally {
        if (!success) {
            ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS);
        }
    }
}
 
Example #13
Source File: IndicesService.java    From crate with Apache License 2.0 4 votes vote down vote up
public IndicesService(Settings settings,
                      PluginsService pluginsService,
                      NodeEnvironment nodeEnv,
                      NamedXContentRegistry xContentRegistry,
                      AnalysisRegistry analysisRegistry,
                      MapperRegistry mapperRegistry,
                      NamedWriteableRegistry namedWriteableRegistry,
                      ThreadPool threadPool,
                      IndexScopedSettings indexScopedSettings,
                      CircuitBreakerService circuitBreakerService,
                      BigArrays bigArrays,
                      Client client,
                      MetaStateService metaStateService,
                      Collection<Function<IndexSettings, Optional<EngineFactory>>> engineFactoryProviders,
                      Map<String, Function<IndexSettings, IndexStore>> indexStoreFactories) {
    this.settings = settings;
    this.threadPool = threadPool;
    this.pluginsService = pluginsService;
    this.nodeEnv = nodeEnv;
    this.xContentRegistry = xContentRegistry;
    this.shardsClosedTimeout = settings.getAsTime(INDICES_SHARDS_CLOSED_TIMEOUT, new TimeValue(1, TimeUnit.DAYS));
    this.analysisRegistry = analysisRegistry;
    this.indicesQueryCache = new IndicesQueryCache(settings);
    this.mapperRegistry = mapperRegistry;
    this.namedWriteableRegistry = namedWriteableRegistry;
    indexingMemoryController = new IndexingMemoryController(
        settings,
        threadPool,
        // ensure we pull an iter with new shards - flatten makes a copy
        () -> Iterables.flatten(this).iterator()
    );
    this.indexScopedSettings = indexScopedSettings;
    this.circuitBreakerService = circuitBreakerService;
    this.bigArrays = bigArrays;
    this.client = client;
    this.metaStateService = metaStateService;
    this.engineFactoryProviders = engineFactoryProviders;

    // do not allow any plugin-provided index store type to conflict with a built-in type
    for (final String indexStoreType : indexStoreFactories.keySet()) {
        if (IndexModule.isBuiltinType(indexStoreType)) {
            throw new IllegalStateException("registered index store type [" + indexStoreType + "] conflicts with a built-in type");
        }
    }

    this.indexStoreFactories = indexStoreFactories;
}
 
Example #14
Source File: Node.java    From crate with Apache License 2.0 4 votes vote down vote up
/**
 * The {@link PluginsService} used to build this node's components.
 */
protected PluginsService getPluginsService() {
    return pluginsService;
}