Share common readFrom/writeTo code in AcknowledgeResponse (#30983)

The majority of Responses inheriting from AcknowledgeResponse implement
the readFrom and writeTo serialization method in the same way. Moving this
as a default into AcknowledgeResponse and letting the few exceptions that
need a slightly different implementation handle this themselves saves a lot
of duplication.
This commit is contained in:
Christoph Büscher 2018-06-04 15:10:02 +02:00 committed by GitHub
parent ccb78c2fdf
commit 11b11f6f4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 111 additions and 484 deletions

View File

@ -20,14 +20,9 @@
package org.elasticsearch.action.admin.cluster.repositories.delete;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContentParser;
import java.io.IOException;
/**
* Unregister repository response
*/
@ -47,18 +42,6 @@ public class DeleteRepositoryResponse extends AcknowledgedResponse {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
public static DeleteRepositoryResponse fromXContent(XContentParser parser) {
return PARSER.apply(parser, null);
}

View File

@ -20,13 +20,9 @@
package org.elasticsearch.action.admin.cluster.repositories.put;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.XContentParser;
import java.io.IOException;
/**
* Register repository response
*/
@ -46,18 +42,6 @@ public class PutRepositoryResponse extends AcknowledgedResponse {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
public static PutRepositoryResponse fromXContent(XContentParser parser) {
return PARSER.apply(parser, null);
}

View File

@ -63,22 +63,32 @@ public class ClusterRerouteResponse extends AcknowledgedResponse implements ToXC
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
state = ClusterState.readFrom(in, null);
readAcknowledged(in);
explanations = RoutingExplanations.readFrom(in);
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
super.readFrom(in);
state = ClusterState.readFrom(in, null);
explanations = RoutingExplanations.readFrom(in);
} else {
state = ClusterState.readFrom(in, null);
acknowledged = in.readBoolean();
explanations = RoutingExplanations.readFrom(in);
}
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
if (out.getVersion().onOrAfter(Version.V_6_3_0)) {
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
super.writeTo(out);
state.writeTo(out);
RoutingExplanations.writeTo(explanations, out);
} else {
ClusterModule.filterCustomsForPre63Clients(state).writeTo(out);
if (out.getVersion().onOrAfter(Version.V_6_3_0)) {
state.writeTo(out);
} else {
ClusterModule.filterCustomsForPre63Clients(state).writeTo(out);
}
out.writeBoolean(acknowledged);
RoutingExplanations.writeTo(explanations, out);
}
writeAcknowledged(out);
RoutingExplanations.writeTo(explanations, out);
}
@Override

View File

@ -19,6 +19,7 @@
package org.elasticsearch.action.admin.cluster.settings;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.io.stream.StreamInput;
@ -67,10 +68,15 @@ public class ClusterUpdateSettingsResponse extends AcknowledgedResponse {
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
transientSettings = Settings.readSettingsFromStream(in);
persistentSettings = Settings.readSettingsFromStream(in);
readAcknowledged(in);
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
super.readFrom(in);
transientSettings = Settings.readSettingsFromStream(in);
persistentSettings = Settings.readSettingsFromStream(in);
} else {
transientSettings = Settings.readSettingsFromStream(in);
persistentSettings = Settings.readSettingsFromStream(in);
acknowledged = in.readBoolean();
}
}
public Settings getTransientSettings() {
@ -83,10 +89,15 @@ public class ClusterUpdateSettingsResponse extends AcknowledgedResponse {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
Settings.writeSettingsToStream(transientSettings, out);
Settings.writeSettingsToStream(persistentSettings, out);
writeAcknowledged(out);
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
super.writeTo(out);
Settings.writeSettingsToStream(transientSettings, out);
Settings.writeSettingsToStream(persistentSettings, out);
} else {
Settings.writeSettingsToStream(transientSettings, out);
Settings.writeSettingsToStream(persistentSettings, out);
out.writeBoolean(acknowledged);
}
}
@Override

View File

@ -20,10 +20,6 @@
package org.elasticsearch.action.admin.cluster.snapshots.delete;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
/**
* Delete snapshot response
@ -36,17 +32,4 @@ public class DeleteSnapshotResponse extends AcknowledgedResponse {
DeleteSnapshotResponse(boolean acknowledged) {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}

View File

@ -20,10 +20,6 @@
package org.elasticsearch.action.admin.cluster.storedscripts;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
public class DeleteStoredScriptResponse extends AcknowledgedResponse {
@ -33,16 +29,4 @@ public class DeleteStoredScriptResponse extends AcknowledgedResponse {
public DeleteStoredScriptResponse(boolean acknowledged) {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}

View File

@ -20,10 +20,6 @@
package org.elasticsearch.action.admin.cluster.storedscripts;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
public class PutStoredScriptResponse extends AcknowledgedResponse {
@ -34,16 +30,4 @@ public class PutStoredScriptResponse extends AcknowledgedResponse {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}

View File

@ -20,13 +20,9 @@
package org.elasticsearch.action.admin.indices.alias;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.XContentParser;
import java.io.IOException;
/**
* A response for a add/remove alias action.
*/
@ -45,18 +41,6 @@ public class IndicesAliasesResponse extends AcknowledgedResponse {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
public static IndicesAliasesResponse fromXContent(XContentParser parser) {
return PARSER.apply(parser, null);
}

View File

@ -20,13 +20,9 @@
package org.elasticsearch.action.admin.indices.close;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.XContentParser;
import java.io.IOException;
/**
* A response for a close index action.
*/
@ -45,18 +41,6 @@ public class CloseIndexResponse extends AcknowledgedResponse {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
public static CloseIndexResponse fromXContent(XContentParser parser) {
return PARSER.apply(parser, null);
}

View File

@ -66,7 +66,6 @@ public class CreateIndexResponse extends ShardsAcknowledgedResponse {
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
readShardsAcknowledged(in);
if (in.getVersion().onOrAfter(Version.V_5_6_0)) {
index = in.readString();
@ -76,7 +75,6 @@ public class CreateIndexResponse extends ShardsAcknowledgedResponse {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
writeShardsAcknowledged(out);
if (out.getVersion().onOrAfter(Version.V_5_6_0)) {
out.writeString(index);

View File

@ -20,14 +20,9 @@
package org.elasticsearch.action.admin.indices.delete;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import java.io.IOException;
/**
* A response for a delete index action.
*/
@ -47,18 +42,6 @@ public class DeleteIndexResponse extends AcknowledgedResponse {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
public static DeleteIndexResponse fromXContent(XContentParser parser) {
return PARSER.apply(parser, null);
}

View File

@ -20,13 +20,9 @@
package org.elasticsearch.action.admin.indices.mapping.put;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.XContentParser;
import java.io.IOException;
/**
* The response of put mapping operation.
*/
@ -47,18 +43,6 @@ public class PutMappingResponse extends AcknowledgedResponse {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
public static PutMappingResponse fromXContent(XContentParser parser) {
return PARSER.apply(parser, null);
}

View File

@ -21,11 +21,9 @@ package org.elasticsearch.action.admin.indices.open;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.master.ShardsAcknowledgedResponse;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import java.io.IOException;
@ -52,7 +50,6 @@ public class OpenIndexResponse extends ShardsAcknowledgedResponse {
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
if (in.getVersion().onOrAfter(Version.V_6_1_0)) {
readShardsAcknowledged(in);
}
@ -61,7 +58,6 @@ public class OpenIndexResponse extends ShardsAcknowledgedResponse {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
if (out.getVersion().onOrAfter(Version.V_6_1_0)) {
writeShardsAcknowledged(out);
}

View File

@ -19,6 +19,7 @@
package org.elasticsearch.action.admin.indices.rollover;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.master.ShardsAcknowledgedResponse;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.io.stream.StreamInput;
@ -114,34 +115,60 @@ public final class RolloverResponse extends ShardsAcknowledgedResponse implement
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
oldIndex = in.readString();
newIndex = in.readString();
int conditionSize = in.readVInt();
conditionStatus = new HashMap<>(conditionSize);
for (int i = 0; i < conditionSize; i++) {
conditionStatus.put(in.readString(), in.readBoolean());
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
super.readFrom(in);
oldIndex = in.readString();
newIndex = in.readString();
int conditionSize = in.readVInt();
conditionStatus = new HashMap<>(conditionSize);
for (int i = 0; i < conditionSize; i++) {
conditionStatus.put(in.readString(), in.readBoolean());
}
dryRun = in.readBoolean();
rolledOver = in.readBoolean();
readShardsAcknowledged(in);
} else {
oldIndex = in.readString();
newIndex = in.readString();
int conditionSize = in.readVInt();
conditionStatus = new HashMap<>(conditionSize);
for (int i = 0; i < conditionSize; i++) {
conditionStatus.put(in.readString(), in.readBoolean());
}
dryRun = in.readBoolean();
rolledOver = in.readBoolean();
acknowledged = in.readBoolean();
readShardsAcknowledged(in);
}
dryRun = in.readBoolean();
rolledOver = in.readBoolean();
readAcknowledged(in);
readShardsAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeString(oldIndex);
out.writeString(newIndex);
out.writeVInt(conditionStatus.size());
for (Map.Entry<String, Boolean> entry : conditionStatus.entrySet()) {
out.writeString(entry.getKey());
out.writeBoolean(entry.getValue());
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
super.writeTo(out);
out.writeString(oldIndex);
out.writeString(newIndex);
out.writeVInt(conditionStatus.size());
for (Map.Entry<String, Boolean> entry : conditionStatus.entrySet()) {
out.writeString(entry.getKey());
out.writeBoolean(entry.getValue());
}
out.writeBoolean(dryRun);
out.writeBoolean(rolledOver);
writeShardsAcknowledged(out);
} else {
out.writeString(oldIndex);
out.writeString(newIndex);
out.writeVInt(conditionStatus.size());
for (Map.Entry<String, Boolean> entry : conditionStatus.entrySet()) {
out.writeString(entry.getKey());
out.writeBoolean(entry.getValue());
}
out.writeBoolean(dryRun);
out.writeBoolean(rolledOver);
out.writeBoolean(acknowledged);
writeShardsAcknowledged(out);
}
out.writeBoolean(dryRun);
out.writeBoolean(rolledOver);
writeAcknowledged(out);
writeShardsAcknowledged(out);
}
@Override

View File

@ -20,13 +20,9 @@
package org.elasticsearch.action.admin.indices.settings.put;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.XContentParser;
import java.io.IOException;
/**
* A response for an update index settings action
*/
@ -46,18 +42,6 @@ public class UpdateSettingsResponse extends AcknowledgedResponse {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
public static UpdateSettingsResponse fromXContent(XContentParser parser) {
return PARSER.apply(parser, null);
}

View File

@ -19,10 +19,6 @@
package org.elasticsearch.action.admin.indices.template.delete;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
/**
* A response for a delete index template.
@ -35,16 +31,4 @@ public class DeleteIndexTemplateResponse extends AcknowledgedResponse {
protected DeleteIndexTemplateResponse(boolean acknowledged) {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}

View File

@ -19,13 +19,9 @@
package org.elasticsearch.action.admin.indices.template.put;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.XContentParser;
import java.io.IOException;
/**
* A response for a put index template action.
*/
@ -38,18 +34,6 @@ public class PutIndexTemplateResponse extends AcknowledgedResponse {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
private static final ConstructingObjectParser<PutIndexTemplateResponse, Void> PARSER;
static {
PARSER = new ConstructingObjectParser<>("put_index_template", true, args -> new PutIndexTemplateResponse((boolean) args[0]));

View File

@ -20,10 +20,6 @@
package org.elasticsearch.action.admin.indices.upgrade.post;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
/**
* A response for an update index settings action
@ -36,16 +32,4 @@ public class UpgradeSettingsResponse extends AcknowledgedResponse {
UpgradeSettingsResponse(boolean acknowledged) {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}

View File

@ -20,14 +20,10 @@
package org.elasticsearch.action.ingest;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContentParser;
import java.io.IOException;
public class WritePipelineResponse extends AcknowledgedResponse implements ToXContentObject {
private static final ConstructingObjectParser<WritePipelineResponse, Void> PARSER = new ConstructingObjectParser<>(
@ -45,18 +41,6 @@ public class WritePipelineResponse extends AcknowledgedResponse implements ToXCo
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
public static WritePipelineResponse fromXContent(XContentParser parser) {
return PARSER.apply(parser, null);
}

View File

@ -45,7 +45,7 @@ public abstract class AcknowledgedResponse extends ActionResponse implements ToX
ObjectParser.ValueType.BOOLEAN);
}
private boolean acknowledged;
protected boolean acknowledged;
protected AcknowledgedResponse() {
@ -63,17 +63,15 @@ public abstract class AcknowledgedResponse extends ActionResponse implements ToX
return acknowledged;
}
/**
* Reads the acknowledged value
*/
protected void readAcknowledged(StreamInput in) throws IOException {
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
acknowledged = in.readBoolean();
}
/**
* Writes the acknowledged value
*/
protected void writeAcknowledged(StreamOutput out) throws IOException {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeBoolean(acknowledged);
}

View File

@ -19,13 +19,16 @@
package org.elasticsearch.action.admin.cluster.settings;
import org.elasticsearch.Version;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.Settings.Builder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
import org.elasticsearch.test.VersionUtils;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
@ -96,4 +99,9 @@ public class ClusterUpdateSettingsResponseTests extends AbstractStreamableXConte
protected ClusterUpdateSettingsResponse createBlankInstance() {
return new ClusterUpdateSettingsResponse();
}
public void testOldSerialisation() throws IOException {
ClusterUpdateSettingsResponse original = createTestInstance();
assertSerialization(original, VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, Version.V_7_0_0_alpha1));
}
}

View File

@ -19,10 +19,13 @@
package org.elasticsearch.action.admin.indices.rollover;
import org.elasticsearch.Version;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
import org.elasticsearch.test.VersionUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -126,4 +129,9 @@ public class RolloverResponseTests extends AbstractStreamableXContentTestCase<Ro
throw new UnsupportedOperationException();
}
}
public void testOldSerialisation() throws IOException {
RolloverResponse original = createTestInstance();
assertSerialization(original, VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, Version.V_7_0_0_alpha1));
}
}

View File

@ -6,10 +6,6 @@
package org.elasticsearch.license;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
public class DeleteLicenseResponse extends AcknowledgedResponse {
@ -19,17 +15,4 @@ public class DeleteLicenseResponse extends AcknowledgedResponse {
DeleteLicenseResponse(boolean acknowledged) {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}

View File

@ -74,7 +74,6 @@ class PostStartBasicResponse extends AcknowledgedResponse {
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
status = in.readEnum(Status.class);
acknowledgeMessage = in.readOptionalString();
int size = in.readVInt();
@ -94,7 +93,6 @@ class PostStartBasicResponse extends AcknowledgedResponse {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
out.writeEnum(status);
out.writeOptionalString(acknowledgeMessage);
out.writeVInt(acknowledgeMessages.size());

View File

@ -52,7 +52,6 @@ public class PutLicenseResponse extends AcknowledgedResponse {
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
status = LicensesStatus.fromId(in.readVInt());
acknowledgeHeader = in.readOptionalString();
int size = in.readVInt();
@ -72,7 +71,6 @@ public class PutLicenseResponse extends AcknowledgedResponse {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
out.writeVInt(status.id());
out.writeOptionalString(acknowledgeHeader);
out.writeVInt(acknowledgeMessages.size());

View File

@ -96,17 +96,5 @@ public class DeleteCalendarAction extends Action<DeleteCalendarAction.Request, D
}
public Response() {}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}
}

View File

@ -103,17 +103,5 @@ public class DeleteCalendarEventAction extends Action<DeleteCalendarEventAction.
}
private Response() {}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}
}

View File

@ -121,18 +121,6 @@ public class DeleteDatafeedAction extends Action<DeleteDatafeedAction.Request, D
public Response(boolean acknowledged) {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}
}

View File

@ -98,18 +98,6 @@ public class DeleteFilterAction extends Action<DeleteFilterAction.Request, Delet
}
public Response() {}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}
}

View File

@ -125,18 +125,6 @@ public class DeleteJobAction extends Action<DeleteJobAction.Request, DeleteJobAc
}
public Response() {}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}
}

View File

@ -81,19 +81,6 @@ public class DeleteModelSnapshotAction extends Action<DeleteModelSnapshotAction.
}
public Response() {}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}
public static class RequestBuilder extends ActionRequestBuilder<Request, Response> {

View File

@ -79,18 +79,6 @@ public class FinalizeJobExecutionAction extends Action<FinalizeJobExecutionActio
public Response() {
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}
}

View File

@ -22,6 +22,7 @@ import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.persistent.PersistentTaskParams;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.xpack.core.XPackPlugin;
import org.elasticsearch.xpack.core.ml.MachineLearningField;
@ -253,16 +254,6 @@ public class OpenJobAction extends Action<OpenJobAction.Request, OpenJobAction.R
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
writeAcknowledged(out);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;

View File

@ -120,18 +120,5 @@ public class PutFilterAction extends Action<PutFilterAction.Request, PutFilterAc
public Response() {
super(true);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}
}

View File

@ -288,16 +288,6 @@ public class StartDatafeedAction extends Action<StartDatafeedAction.Request, Sta
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
writeAcknowledged(out);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;

View File

@ -115,18 +115,6 @@ public class ValidateDetectorAction extends Action<ValidateDetectorAction.Reques
public Response(boolean acknowledged) {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}
}

View File

@ -121,18 +121,6 @@ public class ValidateJobConfigAction extends Action<ValidateJobConfigAction.Requ
public Response(boolean acknowledged) {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}
}

View File

@ -106,17 +106,5 @@ public class DeleteRollupJobAction extends Action<DeleteRollupJobAction.Request,
public Response(boolean acknowledged) {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}
}

View File

@ -144,17 +144,5 @@ public class PutRollupJobAction extends Action<PutRollupJobAction.Request, PutRo
public Response(boolean acknowledged) {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}
}

View File

@ -6,10 +6,6 @@
package org.elasticsearch.xpack.core.watcher.transport.actions.service;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
public class WatcherServiceResponse extends AcknowledgedResponse {
@ -19,16 +15,4 @@ public class WatcherServiceResponse extends AcknowledgedResponse {
public WatcherServiceResponse(boolean acknowledged) {
super(acknowledged);
}
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out);
}
}