org.elasticsearch.action.GenericAction Java Examples

The following examples show how to use org.elasticsearch.action.GenericAction. 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: TransportProxyClientInterceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public void onConstruct(EnhancedInstance objInst, Object[] allArguments) {
    Settings settings = (Settings) allArguments[0];
    String clusterName = settings.get("cluster.name");

    EnhancedInstance nodeService = (EnhancedInstance) allArguments[2];
    List<GenericAction> genericActions = (List<GenericAction>) allArguments[3];

    for (GenericAction action : genericActions) {
        if (action instanceof EnhancedInstance) {
            ElasticSearchEnhanceInfo elasticSearchEnhanceInfo = new ElasticSearchEnhanceInfo();
            elasticSearchEnhanceInfo.setClusterName(clusterName);
            parseRequestInfo(action, elasticSearchEnhanceInfo);
            elasticSearchEnhanceInfo.setTransportAddressHolder(nodeService);
            ((EnhancedInstance) action).setSkyWalkingDynamicField(elasticSearchEnhanceInfo);
        }
    }
}
 
Example #2
Source File: ReindexModule.java    From elasticsearch-inout-plugin with Apache License 2.0 6 votes vote down vote up
@Override
protected void configure() {
    bind(TransportReindexAction.class).asEagerSingleton();

    bind(ReindexParser.class).asEagerSingleton();

    MapBinder<GenericAction, TransportAction> transportActionsBinder =
            MapBinder.newMapBinder(
                    binder(), GenericAction.class, TransportAction.class);

    transportActionsBinder.addBinding(ReindexAction.INSTANCE).to(
            TransportReindexAction.class).asEagerSingleton();

    MapBinder<String, GenericAction> actionsBinder = MapBinder
            .newMapBinder(binder(), String.class, GenericAction.class);
    actionsBinder.addBinding(ReindexAction.NAME).toInstance(
            ReindexAction.INSTANCE);

}
 
Example #3
Source File: HttpInvoker.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public <Request extends ActionRequest, Response extends ActionResponse> void registerAction(GenericAction<Request, Response> action, Class<? extends HttpAction<Request, Response>> httpAction) {
    try {
        HttpAction<Request, Response> instance = httpAction.getDeclaredConstructor(Settings.class).newInstance(settings);
        actionMap.put(action.name(), new HttpElasticsearchClient.ActionEntry<>(action, instance));
    } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e ) {
        logger.error(e.getMessage(), e);
    }
}
 
Example #4
Source File: HttpElasticsearchClient.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public <Request extends ActionRequest, Response extends ActionResponse> void registerAction(GenericAction<Request, Response> action,
                                                                                            Class<? extends HttpAction<Request, Response>> httpAction) {
    try {
        HttpAction<Request, Response> instance = httpAction.getDeclaredConstructor(Settings.class).newInstance(settings);
        actionMap.put(action.name(), new ActionEntry<>(action, instance));
    } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e ) {
        logger.error(e.getMessage(), e);
    }
}
 
Example #5
Source File: ActionPlugin.java    From crate with Apache License 2.0 5 votes vote down vote up
/**
 * Create a record of an action, the {@linkplain TransportAction} that handles it, and any supporting {@linkplain TransportActions}
 * that are needed by that {@linkplain TransportAction}.
 */
public ActionHandler(GenericAction<Request, Response> action, Class<? extends TransportAction<Request, Response>> transportAction,
        Class<?>... supportTransportActions) {
    this.action = action;
    this.transportAction = transportAction;
    this.supportTransportActions = supportTransportActions;
}
 
Example #6
Source File: NodeClient.java    From crate with Apache License 2.0 5 votes vote down vote up
/**
 * Execute an {@link Action} locally, returning that {@link Task} used to track it, and linking an {@link ActionListener}. Prefer this
 * method if you don't need access to the task when listening for the response. This is the method used to implement the {@link Client}
 * interface.
 */
public <Request extends TransportRequest,
        Response extends TransportResponse> Task executeLocally(GenericAction<Request, Response> action,
                                                                Request request,
                                                                ActionListener<Response> listener) {
    return transportAction(action).execute(request, listener);
}
 
Example #7
Source File: TransportClient.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
@Inject
@SuppressWarnings("unchecked")
public ProxyActionMap(Settings settings, TransportService transportService, Map<String, GenericAction> actions) {
    MapBuilder<Action, TransportActionNodeProxy> actionsBuilder = new MapBuilder<>();
    for (GenericAction action : actions.values()) {
        if (action instanceof Action) {
            actionsBuilder.put((Action) action, new TransportActionNodeProxy(settings, action, transportService));
        }
    }
    this.proxies = actionsBuilder.immutableMap();
}
 
Example #8
Source File: ExportModule.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    bind(TransportExportAction.class).asEagerSingleton();

    bind(ExportParser.class).asEagerSingleton();
    bind(Exporter.class).asEagerSingleton();

    MapBinder<GenericAction, TransportAction> transportActionsBinder = MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class);

    transportActionsBinder.addBinding(ExportAction.INSTANCE).to(TransportExportAction.class).asEagerSingleton();

    MapBinder<String, GenericAction> actionsBinder = MapBinder.newMapBinder(binder(), String.class, GenericAction.class);
    actionsBinder.addBinding(ExportAction.NAME).toInstance(ExportAction.INSTANCE);
}
 
Example #9
Source File: SearchIntoModule.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    bind(TransportSearchIntoAction.class).asEagerSingleton();

    bind(SearchIntoParser.class).asEagerSingleton();

    MapBinder<GenericAction, TransportAction> transportActionsBinder =
            MapBinder.newMapBinder(
                    binder(), GenericAction.class, TransportAction.class);

    transportActionsBinder.addBinding(SearchIntoAction.INSTANCE).to(
            TransportSearchIntoAction.class).asEagerSingleton();

    MapBinder<String, GenericAction> actionsBinder = MapBinder
            .newMapBinder(binder(), String.class, GenericAction.class);
    actionsBinder.addBinding(SearchIntoAction.NAME).toInstance(
            SearchIntoAction.INSTANCE);


    MapBinder<String, WriterCollectorFactory> collectorBinder
            = MapBinder.newMapBinder(binder(),
            String.class, WriterCollectorFactory.class);

    collectorBinder.addBinding(BulkWriterCollector.NAME).toProvider(
            FactoryProvider
                    .newFactory(WriterCollectorFactory.class,
                            BulkWriterCollector.class));


}
 
Example #10
Source File: ImportModule.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    bind(TransportImportAction.class).asEagerSingleton();

    bind(ImportParser.class).asEagerSingleton();
    bind(Importer.class).asEagerSingleton();

    MapBinder<GenericAction, TransportAction> transportActionsBinder = MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class);
    transportActionsBinder.addBinding(ImportAction.INSTANCE).to(TransportImportAction.class).asEagerSingleton();

    MapBinder<String, GenericAction> actionsBinder = MapBinder.newMapBinder(binder(), String.class, GenericAction.class);
    actionsBinder.addBinding(ImportAction.NAME).toInstance(ImportAction.INSTANCE);

}
 
Example #11
Source File: HttpInvoker.java    From elasticsearch-helper with Apache License 2.0 4 votes vote down vote up
ActionEntry(GenericAction<Request, Response> action, HttpAction<Request, Response> httpAction) {
    this.action = action;
    this.httpAction = httpAction;
}
 
Example #12
Source File: ActionPlugin.java    From crate with Apache License 2.0 4 votes vote down vote up
public GenericAction<Request, Response> getAction() {
    return action;
}
 
Example #13
Source File: NodeClient.java    From crate with Apache License 2.0 4 votes vote down vote up
public void initialize(Map<GenericAction, TransportAction> actions) {
    this.actions = actions;
}
 
Example #14
Source File: HttpActionModule.java    From elasticsearch-helper with Apache License 2.0 4 votes vote down vote up
ActionEntry(GenericAction<Request, Response> action, Class<? extends HttpAction<Request, Response>> httpAction) {
    this.action = action;
    this.httpAction = httpAction;
}
 
Example #15
Source File: HttpElasticsearchClient.java    From elasticsearch-helper with Apache License 2.0 4 votes vote down vote up
ActionEntry(GenericAction<Request, Response> action, HttpAction<Request, Response> httpAction) {
    this.action = action;
    this.httpAction = httpAction;
}
 
Example #16
Source File: DumpModule.java    From elasticsearch-inout-plugin with Apache License 2.0 3 votes vote down vote up
@Override
protected void configure() {
    bind(TransportDumpAction.class).asEagerSingleton();

    bind(DumpParser.class).asEagerSingleton();

    MapBinder<GenericAction, TransportAction> transportActionsBinder = MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class);

    transportActionsBinder.addBinding(DumpAction.INSTANCE).to(TransportDumpAction.class).asEagerSingleton();

    MapBinder<String, GenericAction> actionsBinder = MapBinder.newMapBinder(binder(), String.class, GenericAction.class);
    actionsBinder.addBinding(DumpAction.NAME).toInstance(DumpAction.INSTANCE);
}
 
Example #17
Source File: RestoreModule.java    From elasticsearch-inout-plugin with Apache License 2.0 3 votes vote down vote up
@Override
protected void configure() {
    bind(TransportRestoreAction.class).asEagerSingleton();

    bind(RestoreParser.class).asEagerSingleton();

    MapBinder<GenericAction, TransportAction> transportActionsBinder = MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class);
    transportActionsBinder.addBinding(RestoreAction.INSTANCE).to(TransportRestoreAction.class).asEagerSingleton();

    MapBinder<String, GenericAction> actionsBinder = MapBinder.newMapBinder(binder(), String.class, GenericAction.class);
    actionsBinder.addBinding(RestoreAction.NAME).toInstance(RestoreAction.INSTANCE);

}
 
Example #18
Source File: ExtendedAnalyzeModule.java    From elasticsearch-extended-analyze with Apache License 2.0 3 votes vote down vote up
@Override
protected void configure() {
    bind(TransportExtendedAnalyzeAction.class).asEagerSingleton();

    MapBinder<GenericAction, TransportAction> transportActionsBinder =
        MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class);

    transportActionsBinder.addBinding(ExtendedAnalyzeAction.INSTANCE).to(TransportExtendedAnalyzeAction.class).asEagerSingleton();

    MapBinder<String, GenericAction> actionsBinder = MapBinder.newMapBinder(binder(), String.class, GenericAction.class);
    actionsBinder.addBinding(ExtendedAnalyzeAction.NAME).toInstance(ExtendedAnalyzeAction.INSTANCE);

}
 
Example #19
Source File: HttpActionModule.java    From elasticsearch-helper with Apache License 2.0 2 votes vote down vote up
/**
 * Registers an action.
 *
 * @param action                  The action type.
 * @param httpAction         The http action implementing the actual action.
 * @param <Request>               The request type.
 * @param <Response>              The response type.
 */
public <Request extends ActionRequest, Response extends ActionResponse> void registerAction(GenericAction<Request, Response> action,
                                                                                            Class<? extends HttpAction<Request, Response>> httpAction) {
    actions.put(action.name(), new ActionEntry<>(action, httpAction));
}