Java Code Examples for org.elasticsearch.common.inject.Inject

The following examples show how to use org.elasticsearch.common.inject.Inject. These examples are extracted from open source projects. 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 Project: crate   Source File: IndicesClusterStateService.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public IndicesClusterStateService(Settings settings,
                                  IndicesService indicesService,
                                  ClusterService clusterService,
                                  ThreadPool threadPool,
                                  PeerRecoveryTargetService recoveryTargetService,
                                  ShardStateAction shardStateAction,
                                  NodeMappingRefreshAction nodeMappingRefreshAction,
                                  RepositoriesService repositoriesService,
                                  SyncedFlushService syncedFlushService,
                                  PeerRecoverySourceService peerRecoverySourceService,
                                  SnapshotShardsService snapshotShardsService,
                                  PrimaryReplicaSyncer primaryReplicaSyncer,
                                  GlobalCheckpointSyncAction globalCheckpointSyncAction) {
    this(settings, (AllocatedIndices<? extends Shard, ? extends AllocatedIndex<? extends Shard>>) indicesService,
            clusterService, threadPool, recoveryTargetService, shardStateAction,
            nodeMappingRefreshAction, repositoriesService, syncedFlushService, peerRecoverySourceService,
            snapshotShardsService, primaryReplicaSyncer, globalCheckpointSyncAction::updateGlobalCheckpointForShard);
}
 
Example 2
Source Project: anomaly-detection   Source File: ProfileTransportAction.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Constructor
 *
 * @param threadPool ThreadPool to use
 * @param clusterService ClusterService
 * @param transportService TransportService
 * @param actionFilters Action Filters
 * @param modelManager model manager object
 * @param featureManager feature manager object
 */
@Inject
public ProfileTransportAction(
    ThreadPool threadPool,
    ClusterService clusterService,
    TransportService transportService,
    ActionFilters actionFilters,
    ModelManager modelManager,
    FeatureManager featureManager
) {
    super(
        ProfileAction.NAME,
        threadPool,
        clusterService,
        transportService,
        actionFilters,
        ProfileRequest::new,
        ProfileNodeRequest::new,
        ThreadPool.Names.MANAGEMENT,
        ProfileNodeResponse.class
    );
    this.modelManager = modelManager;
    this.featureManager = featureManager;
}
 
Example 3
@Inject
public ReindexRestAction(final Settings settings, final Client client,
        final RestController restController,
        final ReindexingService reindexingService) {
    super(settings, restController, client);
    this.reindexingService = reindexingService;

    restController.registerHandler(RestRequest.Method.GET,
            "/_reindex", this);
    restController.registerHandler(RestRequest.Method.GET,
            "/_reindex/{name}", this);

    restController.registerHandler(RestRequest.Method.POST,
            "/{index}/{type}/_reindex/{toindex}/{totype}", this);
    restController.registerHandler(RestRequest.Method.POST,
            "/{index}/{type}/_reindex/{toindex}", this);
    restController.registerHandler(RestRequest.Method.POST,
            "/{index}/_reindex/{toindex}/{totype}", this);
    restController.registerHandler(RestRequest.Method.POST,
            "/{index}/_reindex/{toindex}", this);

    restController.registerHandler(RestRequest.Method.DELETE,
            "/_reindex/{name}", this);
}
 
Example 4
Source Project: Elasticsearch   Source File: TransportClientNodesService.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public TransportClientNodesService(Settings settings, ClusterName clusterName, TransportService transportService,
                                   ThreadPool threadPool, Headers headers, Version version) {
    super(settings);
    this.clusterName = clusterName;
    this.transportService = transportService;
    this.threadPool = threadPool;
    this.minCompatibilityVersion = version.minimumCompatibilityVersion();
    this.headers = headers;

    this.nodesSamplerInterval = this.settings.getAsTime("client.transport.nodes_sampler_interval", timeValueSeconds(5));
    this.pingTimeout = this.settings.getAsTime("client.transport.ping_timeout", timeValueSeconds(5)).millis();
    this.ignoreClusterName = this.settings.getAsBoolean("client.transport.ignore_cluster_name", false);

    if (logger.isDebugEnabled()) {
        logger.debug("node_sampler_interval[" + nodesSamplerInterval + "]");
    }

    if (this.settings.getAsBoolean("client.transport.sniff", false)) {
        this.nodesSampler = new SniffNodesSampler();
    } else {
        this.nodesSampler = new SimpleNodeSampler();
    }
    this.nodesSamplerFuture = threadPool.schedule(nodesSamplerInterval, ThreadPool.Names.GENERIC, new ScheduledNodeSampler());
}
 
Example 5
Source Project: Elasticsearch   Source File: DLDiscovery.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public DLDiscovery(Settings settings, ClusterName clusterName, ThreadPool threadPool,
        TransportService transportService, final ClusterService clusterService, 
        DiscoverySettings discoverySettings, Environment nodeEnvironment) {
    super(settings);
    this.clusterService = clusterService;
    this.clusterName = clusterName;
    this.discoverySettings = discoverySettings;
    this.threadPool = threadPool;
    this.nodeEnvironment = nodeEnvironment;
    this.transportService = transportService;
    this.clusterStateOpLog = null;
    this.publishClusterStateVersionAction = null;
    this.joinClusterAction = null;
    this.nodesFailureDetectionService = null;
}
 
Example 6
Source Project: Elasticsearch   Source File: TransportCancelTasksAction.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public TransportCancelTasksAction(Settings settings, ClusterName clusterName, ThreadPool threadPool, ClusterService clusterService,
                                  TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver
                                      indexNameExpressionResolver) {
    super(settings, CancelTasksAction.NAME, clusterName, threadPool, clusterService, transportService, actionFilters,
        indexNameExpressionResolver, new Callable<CancelTasksRequest>() {
            @Override
            public CancelTasksRequest call() throws Exception {
                return new CancelTasksRequest();
            }
        }, ThreadPool.Names.MANAGEMENT);
    transportService.registerRequestHandler(BAN_PARENT_ACTION_NAME, new Callable<BanParentTaskRequest>() {
        @Override
        public BanParentTaskRequest call() throws Exception {
            return new BanParentTaskRequest();
        }
    }, ThreadPool.Names.SAME, new
        BanParentRequestHandler());
}
 
Example 7
Source Project: Elasticsearch   Source File: RestSearchAction.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public RestSearchAction(Settings settings, RestController controller, Client client) {
    super(settings, controller, client);
    controller.registerHandler(GET, "/_search", this);
    controller.registerHandler(POST, "/_search", this);
    controller.registerHandler(GET, "/{index}/_search", this);
    controller.registerHandler(POST, "/{index}/_search", this);
    controller.registerHandler(GET, "/{index}/{type}/_search", this);
    controller.registerHandler(POST, "/{index}/{type}/_search", this);
    controller.registerHandler(GET, "/_search/template", this);
    controller.registerHandler(POST, "/_search/template", this);
    controller.registerHandler(GET, "/{index}/_search/template", this);
    controller.registerHandler(POST, "/{index}/_search/template", this);
    controller.registerHandler(GET, "/{index}/{type}/_search/template", this);
    controller.registerHandler(POST, "/{index}/{type}/_search/template", this);

    RestExistsAction restExistsAction = new RestExistsAction(settings, controller, client);
    controller.registerHandler(GET, "/_search/exists", restExistsAction);
    controller.registerHandler(POST, "/_search/exists", restExistsAction);
    controller.registerHandler(GET, "/{index}/_search/exists", restExistsAction);
    controller.registerHandler(POST, "/{index}/_search/exists", restExistsAction);
    controller.registerHandler(GET, "/{index}/{type}/_search/exists", restExistsAction);
    controller.registerHandler(POST, "/{index}/{type}/_search/exists", restExistsAction);
}
 
Example 8
Source Project: crate   Source File: SnapshotShardsService.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public SnapshotShardsService(Settings settings, ClusterService clusterService, RepositoriesService repositoriesService,
                             ThreadPool threadPool, TransportService transportService, IndicesService indicesService,
                             IndexNameExpressionResolver indexNameExpressionResolver) {
    this.indicesService = indicesService;
    this.repositoriesService = repositoriesService;
    this.transportService = transportService;
    this.clusterService = clusterService;
    this.threadPool = threadPool;
    if (DiscoveryNode.isDataNode(settings)) {
        // this is only useful on the nodes that can hold data
        clusterService.addListener(this);
    }

    // The constructor of UpdateSnapshotStatusAction will register itself to the TransportService.
    this.updateSnapshotStatusHandler =
        new UpdateSnapshotStatusAction(transportService, clusterService, threadPool, indexNameExpressionResolver);
}
 
Example 9
Source Project: Elasticsearch   Source File: ShardCollectSource.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public ShardCollectSource(Settings settings,
                          IndexNameExpressionResolver indexNameExpressionResolver,
                          IndicesService indicesService,
                          Functions functions,
                          ClusterService clusterService,
                          ThreadPool threadPool,
                          TransportActionProvider transportActionProvider,
                          BulkRetryCoordinatorPool bulkRetryCoordinatorPool,
                          RemoteCollectorFactory remoteCollectorFactory,
                          SystemCollectSource systemCollectSource,
                          NodeSysExpression nodeSysExpression) {
    this.settings = settings;
    this.indexNameExpressionResolver = indexNameExpressionResolver;
    this.indicesService = indicesService;
    this.functions = functions;
    this.clusterService = clusterService;
    this.threadPool = threadPool;
    this.remoteCollectorFactory = remoteCollectorFactory;
    this.systemCollectSource = systemCollectSource;
    this.executor = MoreExecutors.listeningDecorator((ExecutorService) threadPool.executor(ThreadPool.Names.SEARCH));
    this.transportActionProvider = transportActionProvider;
    this.bulkRetryCoordinatorPool = bulkRetryCoordinatorPool;
    this.nodeSysExpression = nodeSysExpression;
}
 
Example 10
Source Project: crate   Source File: InjectionPoint.java    License: Apache License 2.0 6 votes vote down vote up
private static <M extends Member & AnnotatedElement> void addInjectorsForMembers(
        TypeLiteral<?> typeLiteral, Factory<M> factory, boolean statics,
        Collection<InjectionPoint> injectionPoints, Errors errors) {
    for (M member : factory.getMembers(getRawType(typeLiteral.getType()))) {
        if (isStatic(member) != statics) {
            continue;
        }

        Inject inject = member.getAnnotation(Inject.class);
        if (inject == null) {
            continue;
        }

        try {
            injectionPoints.add(factory.create(typeLiteral, member, errors));
        } catch (ConfigurationException ignorable) {
            if (!inject.optional()) {
                errors.merge(ignorable.getErrorMessages());
            }
        }
    }
}
 
Example 11
Source Project: Elasticsearch   Source File: DiscoverySettings.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public DiscoverySettings(Settings settings, NodeSettingsService nodeSettingsService) {
    super(settings);
    nodeSettingsService.addListener(new ApplySettings());
    this.noMasterBlock = parseNoMasterBlock(settings.get(NO_MASTER_BLOCK, DEFAULT_NO_MASTER_BLOCK));
    this.publishTimeout = settings.getAsTime(PUBLISH_TIMEOUT, publishTimeout);
    this.publishDiff = settings.getAsBoolean(PUBLISH_DIFF_ENABLE, DEFAULT_PUBLISH_DIFF_ENABLE);
}
 
Example 12
Source Project: Elasticsearch   Source File: RestIndexAction.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public RestIndexAction(Settings settings, RestController controller, Client client) {
    super(settings, controller, client);
    controller.registerHandler(POST, "/{index}/{type}", this); // auto id creation
    controller.registerHandler(PUT, "/{index}/{type}/{id}", this);
    controller.registerHandler(POST, "/{index}/{type}/{id}", this);
    CreateHandler createHandler = new CreateHandler(settings, controller, client);
    controller.registerHandler(PUT, "/{index}/{type}/{id}/_create", createHandler);
    controller.registerHandler(POST, "/{index}/{type}/{id}/_create", createHandler);
}
 
Example 13
@Inject
public TransportFieldStatsTransportAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                                          TransportService transportService, ActionFilters actionFilters,
                                          IndexNameExpressionResolver indexNameExpressionResolver, IndicesService indicesService) {
    super(settings, FieldStatsAction.NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver, FieldStatsRequest.class, FieldStatsShardRequest.class, ThreadPool.Names.MANAGEMENT);
    this.indicesService = indicesService;
}
 
Example 14
Source Project: Elasticsearch   Source File: RestGetSettingsAction.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public RestGetSettingsAction(Settings settings, RestController controller, Client client) {
    super(settings, controller, client);
    controller.registerHandler(GET, "/{index}/_settings/{name}", this);
    controller.registerHandler(GET, "/_settings/{name}", this);
    controller.registerHandler(GET, "/{index}/_setting/{name}", this);
}
 
Example 15
Source Project: Elasticsearch   Source File: HungarianAnalyzerProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public HungarianAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new HungarianAnalyzer(Analysis.parseStopWords(env, settings, HungarianAnalyzer.getDefaultStopSet()),
                                     Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    analyzer.setVersion(version);
}
 
Example 16
Source Project: Elasticsearch   Source File: HindiAnalyzerProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public HindiAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new HindiAnalyzer(Analysis.parseStopWords(env, settings, HindiAnalyzer.getDefaultStopSet()),
                                 Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    analyzer.setVersion(version);
}
 
Example 17
Source Project: Elasticsearch   Source File: IndicesService.java    License: 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 18
Source Project: crate   Source File: NodeStatsContextFieldResolver.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
@SuppressWarnings("unused")
public NodeStatsContextFieldResolver(ClusterService clusterService,
                                     NodeService nodeService,
                                     @Nullable HttpServerTransport httpServerTransport,
                                     TransportService transportService,
                                     ThreadPool threadPool,
                                     ExtendedNodeInfo extendedNodeInfo,
                                     PostgresNetty postgresNetty) {
    this(
        clusterService::localNode,
        nodeService.getMonitorService(),
        () -> httpServerTransport == null ? null : httpServerTransport.info().getAddress().publishAddress(),
        () -> httpServerTransport == null ? null : httpServerTransport.stats(),
        threadPool,
        extendedNodeInfo,
        () -> new ConnectionStats(postgresNetty.openConnections(), postgresNetty.totalConnections()),
        () -> {
            BoundTransportAddress boundTransportAddress = postgresNetty.boundAddress();
            if (boundTransportAddress == null) {
                return null;
            }
            return boundTransportAddress.publishAddress();
        },
        () -> transportService.stats().getServerOpen(),
        () -> clusterService.state().version()
    );
}
 
Example 19
Source Project: Elasticsearch   Source File: TransportNodesInfoAction.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public TransportNodesInfoAction(Settings settings, ClusterName clusterName, ThreadPool threadPool,
                                ClusterService clusterService, TransportService transportService,
                                NodeService nodeService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, NodesInfoAction.NAME, clusterName, threadPool, clusterService, transportService, actionFilters,
            indexNameExpressionResolver, NodesInfoRequest.class, NodeInfoRequest.class, ThreadPool.Names.MANAGEMENT);
    this.nodeService = nodeService;
}
 
Example 20
Source Project: Elasticsearch   Source File: NodeIndexDeletedAction.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public NodeIndexDeletedAction(Settings settings, ThreadPool threadPool, TransportService transportService, IndicesService indicesService) {
    super(settings);
    this.threadPool = threadPool;
    this.transportService = transportService;
    transportService.registerRequestHandler(INDEX_DELETED_ACTION_NAME, NodeIndexDeletedMessage.class, ThreadPool.Names.SAME, new NodeIndexDeletedTransportHandler());
    transportService.registerRequestHandler(INDEX_STORE_DELETED_ACTION_NAME, NodeIndexStoreDeletedMessage.class, ThreadPool.Names.SAME, new NodeIndexStoreDeletedTransportHandler());
    this.indicesService = indicesService;
}
 
Example 21
Source Project: Elasticsearch   Source File: TransportClusterStatsAction.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public TransportClusterStatsAction(Settings settings, ClusterName clusterName, ThreadPool threadPool,
                                   ClusterService clusterService, TransportService transportService,
                                   NodeService nodeService, IndicesService indicesService,
                                   ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, ClusterStatsAction.NAME, clusterName, threadPool, clusterService, transportService, actionFilters,
            indexNameExpressionResolver, ClusterStatsRequest.class, ClusterStatsNodeRequest.class, ThreadPool.Names.MANAGEMENT);
    this.nodeService = nodeService;
    this.indicesService = indicesService;
}
 
Example 22
Source Project: Elasticsearch   Source File: RestNodesStatsAction.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public RestNodesStatsAction(Settings settings, RestController controller, Client client) {
    super(settings, controller, client);
    controller.registerHandler(GET, "/_nodes/stats", this);
    controller.registerHandler(GET, "/_nodes/{nodeId}/stats", this);

    controller.registerHandler(GET, "/_nodes/stats/{metric}", this);
    controller.registerHandler(GET, "/_nodes/{nodeId}/stats/{metric}", this);

    controller.registerHandler(GET, "/_nodes/stats/{metric}/{indexMetric}", this);

    controller.registerHandler(GET, "/_nodes/{nodeId}/stats/{metric}/{indexMetric}", this);
}
 
Example 23
@Inject
public BlobStoreIndexShardRepository(Settings settings, RepositoryName repositoryName, IndicesService indicesService, ClusterService clusterService) {
    super(settings);
    this.parseFieldMatcher = new ParseFieldMatcher(settings);
    this.repositoryName = repositoryName.name();
    this.indicesService = indicesService;
    this.clusterService = clusterService;
}
 
Example 24
@Inject
public TransportPutIndexTemplateAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                       ThreadPool threadPool, MetaDataIndexTemplateService indexTemplateService,
                                       ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, PutIndexTemplateAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, PutIndexTemplateRequest.class);
    this.indexTemplateService = indexTemplateService;
}
 
Example 25
@Inject
public TransportIndexShardStatsAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                                   TransportService transportService, IndicesService indicesService,
                                   ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, IndexShardStatsAction.NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver,
            IndexShardStatsRequest.class, ThreadPool.Names.MANAGEMENT);
    this.indicesService = indicesService;
}
 
Example 26
Source Project: crate   Source File: TransportCreateIndexAction.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public TransportCreateIndexAction(TransportService transportService,
                                  ClusterService clusterService,
                                  ThreadPool threadPool,
                                  MetaDataCreateIndexService createIndexService,
                                  IndexNameExpressionResolver indexNameExpressionResolver) {
    super(CreateIndexAction.NAME, transportService, clusterService, threadPool, CreateIndexRequest::new, indexNameExpressionResolver);
    this.createIndexService = createIndexService;
}
 
Example 27
@Inject
public TransportDumpAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                           TransportService transportService, IndicesService indicesService,
                           ScriptService scriptService, CacheRecycler cacheRecycler,
                           DumpParser dumpParser, Exporter exporter, NodeEnvironment nodeEnv) {
    super(settings, threadPool, clusterService, transportService, indicesService, scriptService,
        cacheRecycler, dumpParser, exporter, nodeEnv);
}
 
Example 28
Source Project: crate   Source File: FileCollectSource.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public FileCollectSource(Functions functions, ClusterService clusterService, Map<String, FileInputFactory> fileInputFactoryMap) {
    this.fileInputFactoryMap = fileInputFactoryMap;
    this.functions = functions;
    this.inputFactory = new InputFactory(functions);
    this.clusterService = clusterService;
}
 
Example 29
Source Project: Elasticsearch   Source File: TransportExplainAction.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public TransportExplainAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                              TransportService transportService, IndicesService indicesService,
                              ScriptService scriptService, PageCacheRecycler pageCacheRecycler,
                              BigArrays bigArrays, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, ExplainAction.NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver,
            ExplainRequest.class, ThreadPool.Names.GET);
    this.indicesService = indicesService;
    this.scriptService = scriptService;
    this.pageCacheRecycler = pageCacheRecycler;
    this.bigArrays = bigArrays;
}
 
Example 30
Source Project: Elasticsearch   Source File: BlobIndex.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public BlobIndex(Index index, IndexSettingsService indexSettingsService,
          OperationRouting operationRouting, ClusterService clusterService) {
    super(index, indexSettingsService.getSettings());
    this.operationRouting = operationRouting;
    this.clusterService = clusterService;
}