From 2b1cd58648d0a050b96bc870e1a727d7723b4e73 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Mon, 8 Jul 2019 17:27:05 -0700 Subject: [PATCH] Remove ActionResponse uses from HLRC (#44091) The rest client does not communicate over the transport protocol. However, in the move to make all apis supported in the HLRC, some response classes were copied with extending ActionResponse, which is meant strictly for the transport protocol. This commit removes uses of that base class from HLRC. --- .../elasticsearch/client/GetAliasesResponse.java | 3 +-- .../elasticsearch/client/SyncedFlushResponse.java | 3 +-- .../elasticsearch/client/core/CountResponse.java | 3 +-- .../client/graph/GraphExploreRequest.java | 13 ------------- .../client/ml/AbstractResultResponse.java | 3 +-- .../elasticsearch/client/ml/CloseJobResponse.java | 3 +-- .../client/ml/DeleteExpiredDataResponse.java | 3 +-- .../elasticsearch/client/ml/DeleteJobResponse.java | 3 +-- .../elasticsearch/client/ml/FlushJobResponse.java | 3 +-- .../client/ml/ForecastJobResponse.java | 3 +-- .../elasticsearch/client/ml/OpenJobResponse.java | 3 +-- .../client/ml/PostCalendarEventResponse.java | 3 +-- .../elasticsearch/client/ml/PostDataResponse.java | 3 +-- .../client/ml/PreviewDatafeedResponse.java | 3 +-- .../client/ml/RevertModelSnapshotResponse.java | 4 +--- .../client/ml/StartDatafeedResponse.java | 3 +-- .../client/ml/StopDatafeedResponse.java | 3 +-- .../client/ml/UpdateModelSnapshotResponse.java | 3 +-- .../client/tasks/TaskSubmissionResponse.java | 3 +-- 19 files changed, 18 insertions(+), 50 deletions(-) diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/GetAliasesResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/GetAliasesResponse.java index 26bdcd2d267..12791884d1a 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/GetAliasesResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/GetAliasesResponse.java @@ -20,7 +20,6 @@ package org.elasticsearch.client; import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.cluster.metadata.AliasMetaData; import org.elasticsearch.common.xcontent.StatusToXContentObject; import org.elasticsearch.common.xcontent.ToXContent; @@ -47,7 +46,7 @@ import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpect * We would usually throw such exception, but we configure the client to not throw for 404 to support the case above, hence we also not * throw in case an index is not found, although it is a hard error that doesn't come back with aliases. */ -public class GetAliasesResponse extends ActionResponse implements StatusToXContentObject { +public class GetAliasesResponse implements StatusToXContentObject { private final RestStatus status; private final String error; diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/SyncedFlushResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/SyncedFlushResponse.java index ba42914d6ad..303e8328d08 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/SyncedFlushResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/SyncedFlushResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.xcontent.ConstructingObjectParser; @@ -40,7 +39,7 @@ import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constru import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg; import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; -public class SyncedFlushResponse extends ActionResponse implements ToXContentObject { +public class SyncedFlushResponse implements ToXContentObject { public static final String SHARDS_FIELD = "_shards"; diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/core/CountResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/core/CountResponse.java index f97f79127e6..9c309772e3d 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/core/CountResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/core/CountResponse.java @@ -19,7 +19,6 @@ package org.elasticsearch.client.core; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.search.ShardSearchFailure; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.XContentParser; @@ -35,7 +34,7 @@ import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpect /** * A response to _count API request. */ -public final class CountResponse extends ActionResponse { +public final class CountResponse { static final ParseField COUNT = new ParseField("count"); static final ParseField TERMINATED_EARLY = new ParseField("terminated_early"); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/GraphExploreRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/GraphExploreRequest.java index 3040b8a121c..5a0a4c2a920 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/GraphExploreRequest.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/GraphExploreRequest.java @@ -23,8 +23,6 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.Validatable; import org.elasticsearch.client.ValidationException; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContentObject; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -313,17 +311,6 @@ public class GraphExploreRequest implements IndicesRequest.Replaceable, ToXConte public float getBoost() { return boost; } - - void readFrom(StreamInput in) throws IOException { - this.term = in.readString(); - this.boost = in.readFloat(); - } - - void writeTo(StreamOutput out) throws IOException { - out.writeString(term); - out.writeFloat(boost); - } - } @Override diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/AbstractResultResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/AbstractResultResponse.java index 1b609797dd6..8fff53adfa7 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/AbstractResultResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/AbstractResultResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client.ml; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContentObject; @@ -32,7 +31,7 @@ import java.util.Objects; /** * Abstract class that provides a list of results and their count. */ -public abstract class AbstractResultResponse extends ActionResponse implements ToXContentObject { +public abstract class AbstractResultResponse implements ToXContentObject { public static final ParseField COUNT = new ParseField("count"); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/CloseJobResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/CloseJobResponse.java index 2ac1e0faee3..a30a0a4b15f 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/CloseJobResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/CloseJobResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client.ml; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ToXContentObject; @@ -31,7 +30,7 @@ import java.util.Objects; /** * Response indicating if the Job(s) closed or not */ -public class CloseJobResponse extends ActionResponse implements ToXContentObject { +public class CloseJobResponse implements ToXContentObject { private static final ParseField CLOSED = new ParseField("closed"); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/DeleteExpiredDataResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/DeleteExpiredDataResponse.java index 7a9ecbde325..3917982c1fd 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/DeleteExpiredDataResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/DeleteExpiredDataResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client.ml; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ToXContent; @@ -33,7 +32,7 @@ import java.util.Objects; /** * A response acknowledging the deletion of expired data */ -public class DeleteExpiredDataResponse extends ActionResponse implements ToXContentObject { +public class DeleteExpiredDataResponse implements ToXContentObject { private static final ParseField DELETED = new ParseField("deleted"); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/DeleteJobResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/DeleteJobResponse.java index f1487c8c276..7b284f84dd6 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/DeleteJobResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/DeleteJobResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client.ml; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ConstructingObjectParser; @@ -35,7 +34,7 @@ import java.util.Objects; * Response object that contains the acknowledgement or the task id * depending on whether the delete job action was requested to wait for completion. */ -public class DeleteJobResponse extends ActionResponse implements ToXContentObject { +public class DeleteJobResponse implements ToXContentObject { private static final ParseField ACKNOWLEDGED = new ParseField("acknowledged"); private static final ParseField TASK = new ParseField("task"); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/FlushJobResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/FlushJobResponse.java index 048b07b504a..f680359a938 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/FlushJobResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/FlushJobResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client.ml; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ConstructingObjectParser; @@ -33,7 +32,7 @@ import java.util.Objects; /** * Response object containing flush acknowledgement and additional data */ -public class FlushJobResponse extends ActionResponse implements ToXContentObject { +public class FlushJobResponse implements ToXContentObject { public static final ParseField FLUSHED = new ParseField("flushed"); public static final ParseField LAST_FINALIZED_BUCKET_END = new ParseField("last_finalized_bucket_end"); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/ForecastJobResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/ForecastJobResponse.java index b45275c5e59..418f5fb2d0c 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/ForecastJobResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/ForecastJobResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client.ml; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ToXContentObject; @@ -31,7 +30,7 @@ import java.util.Objects; /** * Forecast response object */ -public class ForecastJobResponse extends ActionResponse implements ToXContentObject { +public class ForecastJobResponse implements ToXContentObject { public static final ParseField ACKNOWLEDGED = new ParseField("acknowledged"); public static final ParseField FORECAST_ID = new ParseField("forecast_id"); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/OpenJobResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/OpenJobResponse.java index 2536aeeaf78..61ce6b1544e 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/OpenJobResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/OpenJobResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client.ml; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ToXContentObject; @@ -31,7 +30,7 @@ import java.util.Objects; /** * Response indicating if the Machine Learning Job is now opened or not */ -public class OpenJobResponse extends ActionResponse implements ToXContentObject { +public class OpenJobResponse implements ToXContentObject { private static final ParseField OPENED = new ParseField("opened"); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/PostCalendarEventResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/PostCalendarEventResponse.java index 56e3cdce24f..95d6a3bc711 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/PostCalendarEventResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/PostCalendarEventResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client.ml; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.client.ml.calendars.ScheduledEvent; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ConstructingObjectParser; @@ -33,7 +32,7 @@ import java.util.Objects; /** * Response to adding ScheduledEvent(s) to a Machine Learning calendar */ -public class PostCalendarEventResponse extends ActionResponse implements ToXContentObject { +public class PostCalendarEventResponse implements ToXContentObject { private final List scheduledEvents; public static final ParseField EVENTS = new ParseField("events"); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/PostDataResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/PostDataResponse.java index ce99316e90c..c93035570b2 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/PostDataResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/PostDataResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client.ml; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.client.ml.job.process.DataCounts; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContentObject; @@ -31,7 +30,7 @@ import java.util.Objects; /** * Response object when posting data to a Machine Learning Job */ -public class PostDataResponse extends ActionResponse implements ToXContentObject { +public class PostDataResponse implements ToXContentObject { private DataCounts dataCounts; diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/PreviewDatafeedResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/PreviewDatafeedResponse.java index ca96f153c60..5a16040cb5e 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/PreviewDatafeedResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/PreviewDatafeedResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client.ml; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.stream.StreamInput; @@ -41,7 +40,7 @@ import java.util.stream.Collectors; /** * Response containing a datafeed preview in JSON format */ -public class PreviewDatafeedResponse extends ActionResponse implements ToXContentObject { +public class PreviewDatafeedResponse implements ToXContentObject { private BytesReference preview; diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/RevertModelSnapshotResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/RevertModelSnapshotResponse.java index 575f38043b3..93699b0531f 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/RevertModelSnapshotResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/RevertModelSnapshotResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client.ml; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.client.ml.job.process.ModelSnapshot; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ConstructingObjectParser; @@ -27,13 +26,12 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import java.io.IOException; - import java.util.Objects; /** * A response containing the reverted model snapshot */ -public class RevertModelSnapshotResponse extends ActionResponse implements ToXContentObject { +public class RevertModelSnapshotResponse implements ToXContentObject { private static final ParseField MODEL = new ParseField("model"); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/StartDatafeedResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/StartDatafeedResponse.java index d4ed46c5316..aec83636115 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/StartDatafeedResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/StartDatafeedResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client.ml; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ToXContentObject; @@ -31,7 +30,7 @@ import java.util.Objects; /** * Response indicating if the Machine Learning Datafeed is now started or not */ -public class StartDatafeedResponse extends ActionResponse implements ToXContentObject { +public class StartDatafeedResponse implements ToXContentObject { private static final ParseField STARTED = new ParseField("started"); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/StopDatafeedResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/StopDatafeedResponse.java index c370d7d9d0b..6f649bd3589 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/StopDatafeedResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/StopDatafeedResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client.ml; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ToXContentObject; @@ -31,7 +30,7 @@ import java.util.Objects; /** * Response indicating if the Machine Learning Datafeed is now stopped or not */ -public class StopDatafeedResponse extends ActionResponse implements ToXContentObject { +public class StopDatafeedResponse implements ToXContentObject { private static final ParseField STOPPED = new ParseField("stopped"); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/UpdateModelSnapshotResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/UpdateModelSnapshotResponse.java index 049a24c02d1..9f545f4aba4 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/UpdateModelSnapshotResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/UpdateModelSnapshotResponse.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.client.ml; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.client.ml.job.process.ModelSnapshot; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ConstructingObjectParser; @@ -33,7 +32,7 @@ import java.util.Objects; /** * A response acknowledging the update of information for an existing model snapshot for a given job */ -public class UpdateModelSnapshotResponse extends ActionResponse implements ToXContentObject { +public class UpdateModelSnapshotResponse implements ToXContentObject { private static final ParseField ACKNOWLEDGED = new ParseField("acknowledged"); private static final ParseField MODEL = new ParseField("model"); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskSubmissionResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskSubmissionResponse.java index 7bc104c9bbf..011be514d13 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskSubmissionResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskSubmissionResponse.java @@ -19,7 +19,6 @@ package org.elasticsearch.client.tasks; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.XContentParser; @@ -27,7 +26,7 @@ import org.elasticsearch.common.xcontent.XContentParser; import java.io.IOException; import java.util.Objects; -public class TaskSubmissionResponse extends ActionResponse { +public class TaskSubmissionResponse { private static final ParseField TASK = new ParseField("task");