-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate transport actions dynamically
Signed-off-by: Daniel Widdis <widdis@gmail.com>
- Loading branch information
Showing
7 changed files
with
109 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
server/src/main/java/org/opensearch/extensions/action/ExtensionAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.extensions.action; | ||
|
||
import org.opensearch.action.ActionType; | ||
|
||
/** | ||
* An {@link ActionType} to be used in extension action transport handlers. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class ExtensionAction extends ActionType<ExtensionActionResponse> { | ||
|
||
private final String uniqueId; | ||
|
||
/** | ||
* Create an instance of this action to register in the dynamic actions map. | ||
* | ||
* @param uniqueId The uniqueId of the extension which will run this action. | ||
* @param name The fully qualified class name of the extension's action to execute. | ||
*/ | ||
ExtensionAction(String uniqueId, String name) { | ||
super(name, ExtensionActionResponse::new); | ||
this.uniqueId = uniqueId; | ||
} | ||
|
||
/** | ||
* Gets the uniqueId of the extension which will run this action. | ||
* | ||
* @return the uniqueId | ||
*/ | ||
public String getUniqueId() { | ||
return this.uniqueId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters