diff --git a/src/main/java/org/opensearch/flowframework/FlowFrameworkPlugin.java b/src/main/java/org/opensearch/flowframework/FlowFrameworkPlugin.java index 1f88ae29c..dac37ea98 100644 --- a/src/main/java/org/opensearch/flowframework/FlowFrameworkPlugin.java +++ b/src/main/java/org/opensearch/flowframework/FlowFrameworkPlugin.java @@ -28,7 +28,12 @@ import org.opensearch.flowframework.rest.RestCreateWorkflowAction; import org.opensearch.flowframework.rest.RestProvisionWorkflowAction; import org.opensearch.flowframework.rest.RestSearchWorkflowAction; -import org.opensearch.flowframework.transport.*; +import org.opensearch.flowframework.transport.CreateWorkflowAction; +import org.opensearch.flowframework.transport.CreateWorkflowTransportAction; +import org.opensearch.flowframework.transport.ProvisionWorkflowAction; +import org.opensearch.flowframework.transport.ProvisionWorkflowTransportAction; +import org.opensearch.flowframework.transport.SearchWorkflowAction; +import org.opensearch.flowframework.transport.SearchWorkflowTransportAction; import org.opensearch.flowframework.workflow.WorkflowProcessSorter; import org.opensearch.flowframework.workflow.WorkflowStepFactory; import org.opensearch.ml.client.MachineLearningNodeClient; diff --git a/src/main/java/org/opensearch/flowframework/rest/AbstractSearchWorkflowAction.java b/src/main/java/org/opensearch/flowframework/rest/AbstractSearchWorkflowAction.java index 53675462a..bc7fc9d62 100644 --- a/src/main/java/org/opensearch/flowframework/rest/AbstractSearchWorkflowAction.java +++ b/src/main/java/org/opensearch/flowframework/rest/AbstractSearchWorkflowAction.java @@ -29,6 +29,9 @@ import static org.opensearch.core.xcontent.ToXContent.EMPTY_PARAMS; import static org.opensearch.flowframework.util.RestHandlerUtils.getSourceContext; +/** + * Abstract class to handle search request. + */ public class AbstractSearchWorkflowAction extends BaseRestHandler { protected final List urlPaths; @@ -36,6 +39,13 @@ public class AbstractSearchWorkflowAction extends Ba protected final Class clazz; protected final ActionType actionType; + /** + * Instantiates a new AbstractSearchWorkflowAction + * @param urlPaths urlPaths to create routes + * @param index index the search should be done on + * @param clazz model class + * @param actionType from which action abstract class is called + */ public AbstractSearchWorkflowAction(List urlPaths, String index, Class clazz, ActionType actionType) { this.urlPaths = urlPaths; this.index = index; @@ -58,6 +68,12 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli return channel -> client.execute(actionType, searchRequest, search(channel)); } + /** + * Builds the action response for the Search Request + * + * @param channel the REST channel + * @return the action response + */ protected RestResponseListener search(RestChannel channel) { return new RestResponseListener(channel) { @Override diff --git a/src/main/java/org/opensearch/flowframework/rest/RestCreateWorkflowAction.java b/src/main/java/org/opensearch/flowframework/rest/RestCreateWorkflowAction.java index b5400e247..90c0e5d12 100644 --- a/src/main/java/org/opensearch/flowframework/rest/RestCreateWorkflowAction.java +++ b/src/main/java/org/opensearch/flowframework/rest/RestCreateWorkflowAction.java @@ -41,7 +41,7 @@ public class RestCreateWorkflowAction extends BaseRestHandler { private static final String CREATE_WORKFLOW_ACTION = "create_workflow_action"; /** - * Intantiates a new RestCreateWorkflowAction + * Instantiates a new RestCreateWorkflowAction */ public RestCreateWorkflowAction() {} diff --git a/src/main/java/org/opensearch/flowframework/rest/RestSearchWorkflowAction.java b/src/main/java/org/opensearch/flowframework/rest/RestSearchWorkflowAction.java index 876c38451..98455db10 100644 --- a/src/main/java/org/opensearch/flowframework/rest/RestSearchWorkflowAction.java +++ b/src/main/java/org/opensearch/flowframework/rest/RestSearchWorkflowAction.java @@ -15,11 +15,17 @@ import static org.opensearch.flowframework.common.CommonValue.GLOBAL_CONTEXT_INDEX; import static org.opensearch.flowframework.common.CommonValue.WORKFLOW_URI; +/** + * Rest Action to facilitate requests to search workflows + */ public class RestSearchWorkflowAction extends AbstractSearchWorkflowAction