Skip to content

Commit

Permalink
Rebasing with feature/extensions
Browse files Browse the repository at this point in the history
Signed-off-by: Sarat Vemulapalli <[email protected]>
  • Loading branch information
saratvemulapalli committed Sep 13, 2022
1 parent 7aba611 commit 57d6e84
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
12 changes: 2 additions & 10 deletions server/src/main/java/org/opensearch/action/ActionModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,11 @@ public ActionModule(
}

public static class ActionRegistry extends NamedRegistry<ActionHandler<?, ?>> {
ActionRegistry() {
public ActionRegistry() {
super("action");
}

ActionRegistry(Map<String, ActionHandler<?, ?>> actions) {
public ActionRegistry(Map<String, ActionHandler<?, ?>> actions) {
super("action", actions);
}

Expand All @@ -530,14 +530,6 @@ public <Request extends ActionRequest, Response extends ActionResponse> void reg
) {
register(new ActionHandler<>(action, transportAction, supportTransportActions));
}

public <Request extends ActionRequest, Response extends ActionResponse> void register(
ActionType<Response> action,
Class<? extends TransportAction<Request, Response>> transportAction,
Class<?>... supportTransportActions
) {
register(new ActionHandler<>(action, transportAction, supportTransportActions));
}
}

static Map<String, ActionHandler<?, ?>> setupActions(List<ActionPlugin> actionPlugins) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ public NodeClient(Settings settings, ThreadPool threadPool) {
}

public void initialize(
Map<ActionType, TransportAction> actions,
ActionModule.ActionRegistry actionsRegistry,
Supplier<String> localNodeId,
RemoteClusterService remoteClusterService,
NamedWriteableRegistry namedWriteableRegistry
) {
this.actions = actions;
this.actionsRegistry = actionsRegistry;
this.localNodeId = localNodeId;
this.remoteClusterService = remoteClusterService;
Expand Down
7 changes: 5 additions & 2 deletions server/src/main/java/org/opensearch/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
import org.apache.logging.log4j.Logger;
import org.apache.lucene.util.Constants;
import org.apache.lucene.util.SetOnce;
import org.opensearch.action.ActionType;
import org.opensearch.action.support.TransportAction;
import org.opensearch.common.inject.Key;
import org.opensearch.common.util.FeatureFlags;
import org.opensearch.cluster.routing.allocation.AwarenessReplicaBalance;
import org.opensearch.extensions.action.ExtensionsAction;
Expand Down Expand Up @@ -1018,8 +1021,8 @@ protected Node(
resourcesToClose.addAll(pluginLifecycleComponents);
resourcesToClose.add(injector.getInstance(PeerRecoverySourceService.class));
this.pluginLifecycleComponents = Collections.unmodifiableList(pluginLifecycleComponents);
client.initialize(
injector.getInstance(ActionRegistry.class),
client.initialize(injector.getInstance(new Key<Map<ActionType, TransportAction>>() {
}), injector.getInstance(ActionRegistry.class),
() -> clusterService.localNode().getId(),
transportService.getRemoteClusterService(),
namedWriteableRegistry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

package org.opensearch.client.node;

import org.opensearch.action.ActionModule;
import org.opensearch.action.ActionType;
import org.opensearch.action.ActionListener;
import org.opensearch.action.ActionRequest;
Expand All @@ -57,7 +58,7 @@ protected Client buildClient(Settings headersSettings, ActionType[] testedAction
Settings settings = HEADER_SETTINGS;
Actions actions = new Actions(settings, threadPool, testedActions);
NodeClient client = new NodeClient(settings, threadPool);
client.initialize(actions, () -> "test", null, new NamedWriteableRegistry(Collections.emptyList()));
client.initialize(actions, null, () -> "test", null, new NamedWriteableRegistry(Collections.emptyList()));
return client;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected void doExecute(Task task, ActionRequest request, ActionListener listen
final Map<ActionType, TransportAction> actions = new HashMap<>();
actions.put(ValidateQueryAction.INSTANCE, transportAction);

client.initialize(actions, () -> "local", null, new NamedWriteableRegistry(Collections.emptyList()));
client.initialize(actions, null, () -> "local", null, new NamedWriteableRegistry(Collections.emptyList()));
controller.registerHandler(action);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.opensearch.ExceptionsHelper;
import org.opensearch.Version;
import org.opensearch.action.ActionListener;
import org.opensearch.action.ActionModule;
import org.opensearch.action.ActionType;
import org.opensearch.action.RequestValidators;
import org.opensearch.action.StepListener;
Expand Down Expand Up @@ -2148,6 +2149,7 @@ public void onFailure(final Exception e) {
);
client.initialize(
actions,
null,
() -> clusterService.localNode().getId(),
transportService.getRemoteClusterService(),
new NamedWriteableRegistry(Collections.emptyList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import org.opensearch.OpenSearchException;
import org.opensearch.action.ActionListener;
import org.opensearch.action.ActionModule;
import org.opensearch.action.ActionRequest;
import org.opensearch.action.ActionResponse;
import org.opensearch.action.ActionType;
Expand Down Expand Up @@ -87,6 +88,7 @@ public <Request extends ActionRequest, Response extends ActionResponse> void doE
@Override
public void initialize(
Map<ActionType, TransportAction> actions,
ActionModule.ActionRegistry actionRegistry,
Supplier<String> localNodeId,
RemoteClusterService remoteClusterService,
NamedWriteableRegistry namedWriteableRegistry
Expand Down

0 comments on commit 57d6e84

Please sign in to comment.