diff --git a/CHANGELOG.md b/CHANGELOG.md index 19ab5f2d..f0cf9fe2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,3 +28,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) ### Maintenance ### Refactoring +- Use string-based version parsing to improve portability ([#1067](https://github.com/opensearch-project/flow-framework/pull/1067)) diff --git a/src/main/java/org/opensearch/flowframework/transport/ReprovisionWorkflowRequest.java b/src/main/java/org/opensearch/flowframework/transport/ReprovisionWorkflowRequest.java index e8760fdf..b9647e17 100644 --- a/src/main/java/org/opensearch/flowframework/transport/ReprovisionWorkflowRequest.java +++ b/src/main/java/org/opensearch/flowframework/transport/ReprovisionWorkflowRequest.java @@ -8,12 +8,12 @@ */ package org.opensearch.flowframework.transport; -import org.opensearch.Version; import org.opensearch.action.ActionRequest; import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.unit.TimeValue; import org.opensearch.core.common.io.stream.StreamInput; import org.opensearch.core.common.io.stream.StreamOutput; +import org.opensearch.flowframework.common.CommonValue; import org.opensearch.flowframework.model.Template; import java.io.IOException; @@ -70,7 +70,7 @@ public ReprovisionWorkflowRequest(StreamInput in) throws IOException { this.workflowId = in.readString(); this.originalTemplate = Template.parse(in.readString()); this.updatedTemplate = Template.parse(in.readString()); - if (in.getVersion().onOrAfter(Version.V_2_19_0)) { + if (in.getVersion().onOrAfter(CommonValue.VERSION_2_19_0)) { this.waitForCompletionTimeout = in.readTimeValue(); } @@ -82,7 +82,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeString(workflowId); out.writeString(originalTemplate.toJson()); out.writeString(updatedTemplate.toJson()); - if (out.getVersion().onOrAfter(Version.V_2_19_0)) { + if (out.getVersion().onOrAfter(CommonValue.VERSION_2_19_0)) { out.writeTimeValue(waitForCompletionTimeout); } } diff --git a/src/main/java/org/opensearch/flowframework/transport/WorkflowRequest.java b/src/main/java/org/opensearch/flowframework/transport/WorkflowRequest.java index fe5912c2..6fc34d7e 100644 --- a/src/main/java/org/opensearch/flowframework/transport/WorkflowRequest.java +++ b/src/main/java/org/opensearch/flowframework/transport/WorkflowRequest.java @@ -8,13 +8,13 @@ */ package org.opensearch.flowframework.transport; -import org.opensearch.Version; import org.opensearch.action.ActionRequest; import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.Nullable; import org.opensearch.common.unit.TimeValue; import org.opensearch.core.common.io.stream.StreamInput; import org.opensearch.core.common.io.stream.StreamOutput; +import org.opensearch.flowframework.common.CommonValue; import org.opensearch.flowframework.model.Template; import java.io.IOException; @@ -187,7 +187,7 @@ public WorkflowRequest(StreamInput in) throws IOException { this.params = Collections.emptyMap(); } this.reprovision = !provision && Boolean.parseBoolean(params.get(REPROVISION_WORKFLOW)); - if (in.getVersion().onOrAfter(Version.V_2_19_0)) { + if (in.getVersion().onOrAfter(CommonValue.VERSION_2_19_0)) { this.waitForCompletionTimeout = in.readOptionalTimeValue(); } @@ -274,7 +274,7 @@ public void writeTo(StreamOutput out) throws IOException { } else if (reprovision) { out.writeMap(Map.of(REPROVISION_WORKFLOW, "true"), StreamOutput::writeString, StreamOutput::writeString); } - if (out.getVersion().onOrAfter(Version.V_2_19_0)) { + if (out.getVersion().onOrAfter(CommonValue.VERSION_2_19_0)) { out.writeOptionalTimeValue(waitForCompletionTimeout); } } diff --git a/src/main/java/org/opensearch/flowframework/transport/WorkflowResponse.java b/src/main/java/org/opensearch/flowframework/transport/WorkflowResponse.java index 20d7f475..0c0912ed 100644 --- a/src/main/java/org/opensearch/flowframework/transport/WorkflowResponse.java +++ b/src/main/java/org/opensearch/flowframework/transport/WorkflowResponse.java @@ -8,13 +8,13 @@ */ package org.opensearch.flowframework.transport; -import org.opensearch.Version; import org.opensearch.common.Nullable; import org.opensearch.core.action.ActionResponse; import org.opensearch.core.common.io.stream.StreamInput; import org.opensearch.core.common.io.stream.StreamOutput; import org.opensearch.core.xcontent.ToXContentObject; import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.flowframework.common.CommonValue; import org.opensearch.flowframework.model.WorkflowState; import java.io.IOException; @@ -49,7 +49,7 @@ public WorkflowResponse(String workflowId) { public WorkflowResponse(StreamInput in) throws IOException { super(in); this.workflowId = in.readString(); - if (in.getVersion().onOrAfter(Version.V_2_19_0)) { + if (in.getVersion().onOrAfter(CommonValue.VERSION_2_19_0)) { this.workflowState = in.readOptionalWriteable(WorkflowState::new); } @@ -94,7 +94,7 @@ public WorkflowResponse(String workflowId, WorkflowState workflowState) { @Override public void writeTo(StreamOutput out) throws IOException { out.writeString(workflowId); - if (out.getVersion().onOrAfter(Version.V_2_19_0)) { + if (out.getVersion().onOrAfter(CommonValue.VERSION_2_19_0)) { out.writeOptionalWriteable(workflowState); } }