當前位置: 首頁>>代碼示例>>Java>>正文


Java Action類代碼示例

本文整理匯總了Java中org.elasticsearch.action.Action的典型用法代碼示例。如果您正苦於以下問題:Java Action類的具體用法?Java Action怎麽用?Java Action使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Action類屬於org.elasticsearch.action包,在下文中一共展示了Action類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: validate

import org.elasticsearch.action.Action; //導入依賴的package包/類
@Override
public ActionRequestValidationException validate() {
    ActionRequestValidationException arve = null;
    if (store == null) {
        arve = addValidationError("store must be set", null);
    }
    if (!store.equals(IndexFeatureStore.DEFAULT_STORE) && !store.startsWith(IndexFeatureStore.STORE_PREFIX)) {
        arve = addValidationError("Store name [" + store + "] is invalid.", arve);
    }
    if (storableElement == null) {
        arve = addValidationError("storable element must be set", arve);
    }
    if (action == Action.UPDATE && !storableElement.updatable()) {
        arve = addValidationError("Elements of type [" + storableElement.type() + "] are not updatable.", arve);
    }
    if (updatedVersion != null && action != Action.UPDATE) {
        arve = addValidationError("Only UPDATE supports a version.", arve);
    }
    return arve;
}
 
開發者ID:o19s,項目名稱:elasticsearch-learning-to-rank,代碼行數:21,代碼來源:FeatureStoreAction.java

示例2: doExecute

import org.elasticsearch.action.Action; //導入依賴的package包/類
@Override
protected <Request extends ActionRequest,
                Response extends ActionResponse,
                RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>>
        void doExecute(Action<Request, Response, RequestBuilder> action, Request request, ActionListener<Response> listener) {
    listener.onResponse(null);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:8,代碼來源:NoOpClient.java

示例3: doExecute

import org.elasticsearch.action.Action; //導入依賴的package包/類
@Override
protected <     Request extends ActionRequest,
                Response extends ActionResponse,
                RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>
          > void doExecute(Action<Request, Response, RequestBuilder> action, Request request, ActionListener<Response> listener) {
    request.setParentTask(parentTask);
    super.doExecute(action, request, listener);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:9,代碼來源:ParentTaskAssigningClient.java

示例4: execute

import org.elasticsearch.action.Action; //導入依賴的package包/類
@Override
public final <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> ActionFuture<Response> execute(
        Action<Request, Response, RequestBuilder> action, Request request) {
    PlainActionFuture<Response> actionFuture = PlainActionFuture.newFuture();
    execute(action, request, actionFuture);
    return actionFuture;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:8,代碼來源:AbstractClient.java

示例5: filterWithHeader

import org.elasticsearch.action.Action; //導入依賴的package包/類
@Override
public Client filterWithHeader(Map<String, String> headers) {
    return new FilterClient(this) {
        @Override
        protected <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> void doExecute(Action<Request, Response, RequestBuilder> action, Request request, ActionListener<Response> listener) {
            ThreadContext threadContext = threadPool().getThreadContext();
            try (ThreadContext.StoredContext ctx = threadContext.stashAndMergeHeaders(headers)) {
                super.doExecute(action, request, listener);
            }
        }
    };
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:13,代碼來源:AbstractClient.java

示例6: TransportProxyClient

import org.elasticsearch.action.Action; //導入依賴的package包/類
TransportProxyClient(Settings settings, TransportService transportService,
                            TransportClientNodesService nodesService, List<GenericAction> actions) {
    this.nodesService = nodesService;
    Map<Action, TransportActionNodeProxy> proxies = new HashMap<>();
    for (GenericAction action : actions) {
        if (action instanceof Action) {
            proxies.put((Action) action, new TransportActionNodeProxy(settings, action, transportService));
        }
    }
    this.proxies = unmodifiableMap(proxies);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:12,代碼來源:TransportProxyClient.java

示例7: doExecute

import org.elasticsearch.action.Action; //導入依賴的package包/類
@Override
public <    Request extends ActionRequest,
            Response extends ActionResponse,
            RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>
        > void doExecute(Action<Request, Response, RequestBuilder> action, Request request, ActionListener<Response> listener) {
    // Discard the task because the Client interface doesn't use it.
    executeLocally(action, request, listener);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:9,代碼來源:NodeClient.java

示例8: startSlices

import org.elasticsearch.action.Action; //導入依賴的package包/類
public static <
            Request extends AbstractBulkByScrollRequest<Request>
        > void startSlices(Client client, TaskManager taskManager, Action<Request, BulkByScrollResponse, ?> action,
                String localNodeId, ParentBulkByScrollTask task, Request request, ActionListener<BulkByScrollResponse> listener) {
    TaskId parentTaskId = new TaskId(localNodeId, task.getId());
    for (final SearchRequest slice : sliceIntoSubRequests(request.getSearchRequest(), UidFieldMapper.NAME, request.getSlices())) {
        // TODO move the request to the correct node. maybe here or somehow do it as part of startup for reindex in general....
        Request requestForSlice = request.forSlice(parentTaskId, slice);
        ActionListener<BulkByScrollResponse> sliceListener = ActionListener.wrap(
                r -> task.onSliceResponse(listener, slice.source().slice().getId(), r),
                e -> task.onSliceFailure(listener, slice.source().slice().getId(), e));
        client.execute(action, requestForSlice, sliceListener);
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:15,代碼來源:BulkByScrollParallelizationHelper.java

示例9: testSetsParentId

import org.elasticsearch.action.Action; //導入依賴的package包/類
public void testSetsParentId() {
    TaskId[] parentTaskId = new TaskId[] {new TaskId(randomAsciiOfLength(3), randomLong())};

    // This mock will do nothing but verify that parentTaskId is set on all requests sent to it.
    NoOpClient mock = new NoOpClient(getTestName()) {
        @Override
        protected <     Request extends ActionRequest,
                        Response extends ActionResponse,
                        RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>
                    > void doExecute( Action<Request, Response, RequestBuilder> action, Request request,
                        ActionListener<Response> listener) {
            assertEquals(parentTaskId[0], request.getParentTask());
            super.doExecute(action, request, listener);
        }
    };
    try (ParentTaskAssigningClient client = new ParentTaskAssigningClient(mock, parentTaskId[0])) {
        // All of these should have the parentTaskId set
        client.bulk(new BulkRequest());
        client.search(new SearchRequest());
        client.clearScroll(new ClearScrollRequest());

        // Now lets verify that unwrapped calls don't have the parentTaskId set
        parentTaskId[0] = TaskId.EMPTY_TASK_ID;
        client.unwrap().bulk(new BulkRequest());
        client.unwrap().search(new SearchRequest());
        client.unwrap().clearScroll(new ClearScrollRequest());
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:29,代碼來源:ParentTaskAssigningClientTests.java

示例10: doExecute

import org.elasticsearch.action.Action; //導入依賴的package包/類
@Override
protected <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> void doExecute(
    Action<Request, Response, RequestBuilder> action, Request request,
    ActionListener<Response> listener) {
  Tracer.SpanBuilder spanBuilder = tracer.buildSpan(request.getClass().getSimpleName())
      .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT);

  Span span = spanBuilder.start();
  SpanDecorator.onRequest(span);

  ActionListener<Response> actionFuture = new TracingResponseListener<>(listener, span);
  super.doExecute(action, request, actionFuture);
}
 
開發者ID:opentracing-contrib,項目名稱:java-elasticsearch-client,代碼行數:14,代碼來源:TracingPreBuiltTransportClient.java

示例11: readFrom

import org.elasticsearch.action.Action; //導入依賴的package包/類
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    store = in.readString();
    routing = in.readOptionalString();
    action = Action.values()[in.readVInt()];
    storableElement = in.readNamedWriteable(StorableElement.class);
    validation = in.readOptionalWriteable(FeatureValidation::new);
}
 
開發者ID:o19s,項目名稱:elasticsearch-learning-to-rank,代碼行數:10,代碼來源:FeatureStoreAction.java

示例12: execute

import org.elasticsearch.action.Action; //導入依賴的package包/類
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> void execute(
		Action<Request, Response, RequestBuilder> action, Request request,
		ActionListener<Response> listener) {
	// TODO Auto-generated method stub

}
 
開發者ID:winterstein,項目名稱:elasticsearch-java-client,代碼行數:8,代碼來源:DummyClient.java

示例13: doExecute

import org.elasticsearch.action.Action; //導入依賴的package包/類
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public <R extends ActionRequest, T extends ActionResponse, B extends ActionRequestBuilder<R, T, B>>
void doExecute(Action<R, T, B> action, R request, ActionListener<T> listener) {
    HttpAction httpAction = actionMap.get(action);
    if (httpAction == null) {
        throw new IllegalStateException("failed to find http action [" + action + "] to execute");
    }
    try {
        HttpContext httpContext = new HttpContext(httpAction, listener, request);
        httpContext.httpRequest = httpAction.createHttpRequest(url, request);
        ChannelFuture future = bootstrap.connect(new InetSocketAddress(url.getHost(), url.getPort()));
        future.awaitUninterruptibly();
        if (!future.isSuccess()) {
            bootstrap.releaseExternalResources();
            logger.error("can't connect to {}", url);
        } else {
            Channel channel = future.getChannel();
            httpContext.setChannel(channel);
            httpContextMap.put(channel, httpContext);
            channel.getConfig().setConnectTimeoutMillis(settings.getAsInt("http.client.timeout", 5000));
            httpAction.execute(httpContext, listener);
        }
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
}
 
開發者ID:jprante,項目名稱:elasticsearch-client-http,代碼行數:28,代碼來源:HttpClient.java

示例14: execute

import org.elasticsearch.action.Action; //導入依賴的package包/類
@Override
public <RequestT extends ActionRequest, ResponseT extends ActionResponse,
    RequestBuilderT extends ActionRequestBuilder<RequestT, ResponseT, RequestBuilderT>> ActionFuture<ResponseT> execute(
    Action<RequestT, ResponseT, RequestBuilderT> action, RequestT request)
{
    return null;
}
 
開發者ID:FINRAOS,項目名稱:herd,代碼行數:8,代碼來源:ElasticsearchClientImpl.java

示例15: prepareExecute

import org.elasticsearch.action.Action; //導入依賴的package包/類
@Override
public <RequestT extends ActionRequest, ResponseT extends ActionResponse,
    RequestBuilderT extends ActionRequestBuilder<RequestT, ResponseT, RequestBuilderT>> RequestBuilderT prepareExecute(
    Action<RequestT, ResponseT, RequestBuilderT> action)
{
    return null;
}
 
開發者ID:FINRAOS,項目名稱:herd,代碼行數:8,代碼來源:ElasticsearchClientImpl.java


注:本文中的org.elasticsearch.action.Action類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。