From 6ed408577617d9a864deca73024bbc6bdf96f7fa Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Mon, 3 Apr 2023 13:59:01 -0700 Subject: [PATCH 01/18] Moving ExtensionRequest to Proto Signed-off-by: Sarat Vemulapalli --- plugins/repository-gcs/build.gradle | 3 +- plugins/repository-hdfs/build.gradle | 1 - server/build.gradle | 4 + .../extensions/ExtensionRequest.java | 36 +- .../extensions/ExtensionsManager.java | 7 +- .../extensions/proto/ExtensionRequest.proto | 19 + .../proto/ExtensionRequestOuterClass.java | 890 ++++++++++++++++++ .../allocation/BalanceConfigurationTests.java | 2 +- .../extensions/ExtensionsManagerTests.java | 19 +- 9 files changed, 944 insertions(+), 37 deletions(-) create mode 100644 server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto create mode 100644 server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java diff --git a/plugins/repository-gcs/build.gradle b/plugins/repository-gcs/build.gradle index 561119e9e2c30..7350f8b509929 100644 --- a/plugins/repository-gcs/build.gradle +++ b/plugins/repository-gcs/build.gradle @@ -65,8 +65,7 @@ dependencies { api 'com.google.api:api-common:1.8.1' api 'com.google.api:gax:2.17.0' api 'org.threeten:threetenbp:1.4.4' - api 'com.google.protobuf:protobuf-java-util:3.20.0' - api 'com.google.protobuf:protobuf-java:3.21.7' + //api 'com.google.protobuf:protobuf-java:3.21.7' api 'com.google.code.gson:gson:2.9.0' api 'com.google.api.grpc:proto-google-common-protos:2.10.0' api 'com.google.api.grpc:proto-google-iam-v1:0.12.0' diff --git a/plugins/repository-hdfs/build.gradle b/plugins/repository-hdfs/build.gradle index 05b992904e6dd..722b2dd53c4fa 100644 --- a/plugins/repository-hdfs/build.gradle +++ b/plugins/repository-hdfs/build.gradle @@ -69,7 +69,6 @@ dependencies { api 'org.apache.avro:avro:1.11.1' api 'com.google.code.gson:gson:2.10.1' runtimeOnly "com.google.guava:guava:${versions.guava}" - api 'com.google.protobuf:protobuf-java:3.22.2' api "commons-logging:commons-logging:${versions.commonslogging}" api 'commons-cli:commons-cli:1.5.0' api "commons-codec:commons-codec:${versions.commonscodec}" diff --git a/server/build.gradle b/server/build.gradle index 2eea312699798..1f1ccbcac0ac9 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -136,6 +136,10 @@ dependencies { // jna api "net.java.dev.jna:jna:${versions.jna}" + // protobuf + api 'com.google.protobuf:protobuf-java:3.22.2' + + testImplementation(project(":test:framework")) { // tests use the locally compiled version of server exclude group: 'org.opensearch', module: 'server' diff --git a/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java b/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java index bfe53bee27cd6..ba5f43f4a2bbb 100644 --- a/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java +++ b/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java @@ -13,6 +13,7 @@ import org.opensearch.common.Nullable; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.extensions.proto.ExtensionRequestOuterClass; import org.opensearch.transport.TransportRequest; import java.io.IOException; @@ -26,42 +27,41 @@ */ public class ExtensionRequest extends TransportRequest { private static final Logger logger = LogManager.getLogger(ExtensionRequest.class); - private final ExtensionsManager.RequestType requestType; - private final Optional uniqueId; + private final ExtensionRequestOuterClass.ExtensionRequest request; - public ExtensionRequest(ExtensionsManager.RequestType requestType) { + public ExtensionRequest(ExtensionRequestOuterClass.RequestType requestType) { this(requestType, null); } - public ExtensionRequest(ExtensionsManager.RequestType requestType, @Nullable String uniqueId) { - this.requestType = requestType; - this.uniqueId = uniqueId == null ? Optional.empty() : Optional.of(uniqueId); + public ExtensionRequest(ExtensionRequestOuterClass.RequestType requestType, @Nullable String uniqueId) { + ExtensionRequestOuterClass.ExtensionRequest.Builder builder = ExtensionRequestOuterClass.ExtensionRequest.newBuilder(); + if (uniqueId != null) { + builder.setUniqiueId(uniqueId); + } + this.request = builder.setRequestType(requestType).build(); } public ExtensionRequest(StreamInput in) throws IOException { super(in); - this.requestType = in.readEnum(ExtensionsManager.RequestType.class); - String id = in.readOptionalString(); - this.uniqueId = id == null ? Optional.empty() : Optional.of(id); + this.request = ExtensionRequestOuterClass.ExtensionRequest.parseFrom(in.readByteArray()); } @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); - out.writeEnum(requestType); - out.writeOptionalString(uniqueId.orElse(null)); + out.writeByteArray(request.toByteArray()); } - public ExtensionsManager.RequestType getRequestType() { - return this.requestType; + public ExtensionRequestOuterClass.RequestType getRequestType() { + return this.request.getRequestType(); } - public Optional getUniqueId() { - return uniqueId; + public String getUniqueId() { + return request.getUniqiueId(); } public String toString() { - return "ExtensionRequest{" + "requestType=" + requestType + "uniqueId=" + uniqueId + '}'; + return "ExtensionRequest{" + request.toString() + '}'; } @Override @@ -69,11 +69,11 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ExtensionRequest that = (ExtensionRequest) o; - return Objects.equals(requestType, that.requestType) && Objects.equals(uniqueId, that.uniqueId); + return Objects.equals(request.getRequestType(), that.request.getRequestType()) && Objects.equals(request.getUniqiueId(), that.request.getUniqiueId()); } @Override public int hashCode() { - return Objects.hash(requestType, uniqueId); + return Objects.hash(request.getRequestType(), request.getUniqiueId()); } } diff --git a/server/src/main/java/org/opensearch/extensions/ExtensionsManager.java b/server/src/main/java/org/opensearch/extensions/ExtensionsManager.java index 8488743051b6b..954f87011578e 100644 --- a/server/src/main/java/org/opensearch/extensions/ExtensionsManager.java +++ b/server/src/main/java/org/opensearch/extensions/ExtensionsManager.java @@ -89,7 +89,6 @@ public class ExtensionsManager { public static final String REQUEST_EXTENSION_REGISTER_CUSTOM_SETTINGS = "internal:discovery/registercustomsettings"; public static final String REQUEST_EXTENSION_REGISTER_REST_ACTIONS = "internal:discovery/registerrestactions"; public static final String REQUEST_EXTENSION_REGISTER_TRANSPORT_ACTIONS = "internal:discovery/registertransportactions"; - public static final String REQUEST_OPENSEARCH_PARSE_NAMED_WRITEABLE = "internal:discovery/parsenamedwriteable"; public static final String REQUEST_REST_EXECUTE_ON_EXTENSION_ACTION = "internal:extensions/restexecuteonextensiontaction"; public static final String REQUEST_EXTENSION_HANDLE_TRANSPORT_ACTION = "internal:extensions/handle-transportaction"; public static final String REQUEST_EXTENSION_HANDLE_REMOTE_TRANSPORT_ACTION = "internal:extensions/handle-remote-transportaction"; @@ -443,7 +442,7 @@ TransportResponse handleExtensionRequest(ExtensionRequest extensionRequest) thro case REQUEST_EXTENSION_ENVIRONMENT_SETTINGS: return new EnvironmentSettingsResponse(this.environmentSettings); case REQUEST_EXTENSION_DEPENDENCY_INFORMATION: - String uniqueId = extensionRequest.getUniqueId().orElse(null); + String uniqueId = extensionRequest.getUniqueId(); if (uniqueId == null) { return new ExtensionDependencyResponse(extensions); } else { @@ -686,10 +685,6 @@ public static String getRequestExtensionRegisterRestActions() { return REQUEST_EXTENSION_REGISTER_REST_ACTIONS; } - public static String getRequestOpensearchParseNamedWriteable() { - return REQUEST_OPENSEARCH_PARSE_NAMED_WRITEABLE; - } - public static String getRequestRestExecuteOnExtensionAction() { return REQUEST_REST_EXECUTE_ON_EXTENSION_ACTION; } diff --git a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto new file mode 100644 index 0000000000000..82c6399ee0043 --- /dev/null +++ b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; +package org.opensearch.extensions.proto; + +enum RequestType { + REQUEST_EXTENSION_CLUSTER_STATE = 0; + REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; + REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; + REQUEST_EXTENSION_REGISTER_SETTINGS = 3; + REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; + REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; + CREATE_COMPONENT = 6; + ON_INDEX_MODULE = 7; + GET_SETTINGS = 8; +} + +message ExtensionRequest { + RequestType requestType = 1; + string uniqiueId = 2; +} diff --git a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java new file mode 100644 index 0000000000000..d66c24f10ed3b --- /dev/null +++ b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java @@ -0,0 +1,890 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto + +package org.opensearch.extensions.proto; + +public final class ExtensionRequestOuterClass { + private ExtensionRequestOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + /** + * Protobuf enum {@code org.opensearch.extensions.proto.RequestType} + */ + public enum RequestType + implements com.google.protobuf.ProtocolMessageEnum { + /** + * REQUEST_EXTENSION_CLUSTER_STATE = 0; + */ + REQUEST_EXTENSION_CLUSTER_STATE(0), + /** + * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; + */ + REQUEST_EXTENSION_CLUSTER_SETTINGS(1), + /** + * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; + */ + REQUEST_EXTENSION_REGISTER_REST_ACTIONS(2), + /** + * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; + */ + REQUEST_EXTENSION_REGISTER_SETTINGS(3), + /** + * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; + */ + REQUEST_EXTENSION_ENVIRONMENT_SETTINGS(4), + /** + * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; + */ + REQUEST_EXTENSION_DEPENDENCY_INFORMATION(5), + /** + * CREATE_COMPONENT = 6; + */ + CREATE_COMPONENT(6), + /** + * ON_INDEX_MODULE = 7; + */ + ON_INDEX_MODULE(7), + /** + * GET_SETTINGS = 8; + */ + GET_SETTINGS(8), + UNRECOGNIZED(-1), + ; + + /** + * REQUEST_EXTENSION_CLUSTER_STATE = 0; + */ + public static final int REQUEST_EXTENSION_CLUSTER_STATE_VALUE = 0; + /** + * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; + */ + public static final int REQUEST_EXTENSION_CLUSTER_SETTINGS_VALUE = 1; + /** + * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; + */ + public static final int REQUEST_EXTENSION_REGISTER_REST_ACTIONS_VALUE = 2; + /** + * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; + */ + public static final int REQUEST_EXTENSION_REGISTER_SETTINGS_VALUE = 3; + /** + * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; + */ + public static final int REQUEST_EXTENSION_ENVIRONMENT_SETTINGS_VALUE = 4; + /** + * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; + */ + public static final int REQUEST_EXTENSION_DEPENDENCY_INFORMATION_VALUE = 5; + /** + * CREATE_COMPONENT = 6; + */ + public static final int CREATE_COMPONENT_VALUE = 6; + /** + * ON_INDEX_MODULE = 7; + */ + public static final int ON_INDEX_MODULE_VALUE = 7; + /** + * GET_SETTINGS = 8; + */ + public static final int GET_SETTINGS_VALUE = 8; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static RequestType valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static RequestType forNumber(int value) { + switch (value) { + case 0: return REQUEST_EXTENSION_CLUSTER_STATE; + case 1: return REQUEST_EXTENSION_CLUSTER_SETTINGS; + case 2: return REQUEST_EXTENSION_REGISTER_REST_ACTIONS; + case 3: return REQUEST_EXTENSION_REGISTER_SETTINGS; + case 4: return REQUEST_EXTENSION_ENVIRONMENT_SETTINGS; + case 5: return REQUEST_EXTENSION_DEPENDENCY_INFORMATION; + case 6: return CREATE_COMPONENT; + case 7: return ON_INDEX_MODULE; + case 8: return GET_SETTINGS; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + RequestType> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public RequestType findValueByNumber(int number) { + return RequestType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.getDescriptor().getEnumTypes().get(0); + } + + private static final RequestType[] VALUES = values(); + + public static RequestType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private RequestType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:org.opensearch.extensions.proto.RequestType) + } + + public interface ExtensionRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:org.opensearch.extensions.proto.ExtensionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The enum numeric value on the wire for requestType. + */ + int getRequestTypeValue(); + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The requestType. + */ + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType(); + + /** + * string uniqiueId = 2; + * @return The uniqiueId. + */ + java.lang.String getUniqiueId(); + /** + * string uniqiueId = 2; + * @return The bytes for uniqiueId. + */ + com.google.protobuf.ByteString + getUniqiueIdBytes(); + } + /** + * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} + */ + public static final class ExtensionRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:org.opensearch.extensions.proto.ExtensionRequest) + ExtensionRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExtensionRequest.newBuilder() to construct. + private ExtensionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ExtensionRequest() { + requestType_ = 0; + uniqiueId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ExtensionRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class); + } + + public static final int REQUESTTYPE_FIELD_NUMBER = 1; + private int requestType_ = 0; + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The enum numeric value on the wire for requestType. + */ + @java.lang.Override public int getRequestTypeValue() { + return requestType_; + } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The requestType. + */ + @java.lang.Override public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); + return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; + } + + public static final int UNIQIUEID_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object uniqiueId_ = ""; + /** + * string uniqiueId = 2; + * @return The uniqiueId. + */ + @java.lang.Override + public java.lang.String getUniqiueId() { + java.lang.Object ref = uniqiueId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uniqiueId_ = s; + return s; + } + } + /** + * string uniqiueId = 2; + * @return The bytes for uniqiueId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUniqiueIdBytes() { + java.lang.Object ref = uniqiueId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + uniqiueId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE.getNumber()) { + output.writeEnum(1, requestType_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uniqiueId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uniqiueId_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, requestType_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uniqiueId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uniqiueId_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest)) { + return super.equals(obj); + } + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other = (org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) obj; + + if (requestType_ != other.requestType_) return false; + if (!getUniqiueId() + .equals(other.getUniqiueId())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + REQUESTTYPE_FIELD_NUMBER; + hash = (53 * hash) + requestType_; + hash = (37 * hash) + UNIQIUEID_FIELD_NUMBER; + hash = (53 * hash) + getUniqiueId().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:org.opensearch.extensions.proto.ExtensionRequest) + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class); + } + + // Construct using org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + requestType_ = 0; + uniqiueId_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest build() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest buildPartial() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.requestType_ = requestType_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.uniqiueId_ = uniqiueId_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) { + return mergeFrom((org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other) { + if (other == org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance()) return this; + if (other.requestType_ != 0) { + setRequestTypeValue(other.getRequestTypeValue()); + } + if (!other.getUniqiueId().isEmpty()) { + uniqiueId_ = other.uniqiueId_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + requestType_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: { + uniqiueId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private int requestType_ = 0; + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The enum numeric value on the wire for requestType. + */ + @java.lang.Override public int getRequestTypeValue() { + return requestType_; + } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @param value The enum numeric value on the wire for requestType to set. + * @return This builder for chaining. + */ + public Builder setRequestTypeValue(int value) { + requestType_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The requestType. + */ + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); + return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; + } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @param value The requestType to set. + * @return This builder for chaining. + */ + public Builder setRequestType(org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + requestType_ = value.getNumber(); + onChanged(); + return this; + } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return This builder for chaining. + */ + public Builder clearRequestType() { + bitField0_ = (bitField0_ & ~0x00000001); + requestType_ = 0; + onChanged(); + return this; + } + + private java.lang.Object uniqiueId_ = ""; + /** + * string uniqiueId = 2; + * @return The uniqiueId. + */ + public java.lang.String getUniqiueId() { + java.lang.Object ref = uniqiueId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uniqiueId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string uniqiueId = 2; + * @return The bytes for uniqiueId. + */ + public com.google.protobuf.ByteString + getUniqiueIdBytes() { + java.lang.Object ref = uniqiueId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + uniqiueId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string uniqiueId = 2; + * @param value The uniqiueId to set. + * @return This builder for chaining. + */ + public Builder setUniqiueId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + uniqiueId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * string uniqiueId = 2; + * @return This builder for chaining. + */ + public Builder clearUniqiueId() { + uniqiueId_ = getDefaultInstance().getUniqiueId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * string uniqiueId = 2; + * @param value The bytes for uniqiueId to set. + * @return This builder for chaining. + */ + public Builder setUniqiueIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + uniqiueId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:org.opensearch.extensions.proto.ExtensionRequest) + } + + // @@protoc_insertion_point(class_scope:org.opensearch.extensions.proto.ExtensionRequest) + private static final org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ExtensionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\nKserver/src/main/java/org/opensearch/ex" + + "tensions/proto/ExtensionRequest.proto\022\037o" + + "rg.opensearch.extensions.proto\"h\n\020Extens" + + "ionRequest\022A\n\013requestType\030\001 \001(\0162,.org.op" + + "ensearch.extensions.proto.RequestType\022\021\n" + + "\tuniqiueId\030\002 \001(\t*\307\002\n\013RequestType\022#\n\037REQU" + + "EST_EXTENSION_CLUSTER_STATE\020\000\022&\n\"REQUEST" + + "_EXTENSION_CLUSTER_SETTINGS\020\001\022+\n\'REQUEST" + + "_EXTENSION_REGISTER_REST_ACTIONS\020\002\022\'\n#RE" + + "QUEST_EXTENSION_REGISTER_SETTINGS\020\003\022*\n&R" + + "EQUEST_EXTENSION_ENVIRONMENT_SETTINGS\020\004\022" + + ",\n(REQUEST_EXTENSION_DEPENDENCY_INFORMAT" + + "ION\020\005\022\024\n\020CREATE_COMPONENT\020\006\022\023\n\017ON_INDEX_" + + "MODULE\020\007\022\020\n\014GET_SETTINGS\020\010b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor, + new java.lang.String[] { "RequestType", "UniqiueId", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/BalanceConfigurationTests.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/BalanceConfigurationTests.java index e1f5eba735904..7bef00edd18d2 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/BalanceConfigurationTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/BalanceConfigurationTests.java @@ -364,7 +364,7 @@ public void testPrimaryBalanceWithContrainstBreaching() { /** * This test verifies global balance by creating indices iteratively and verify primary shards do not pile up on one - * node. + * @throws Exception generic exception */ public void testGlobalPrimaryBalance() throws Exception { AllocationService strategy = createAllocationService(getSettingsBuilderForPrimaryBalance().build(), new TestGatewayAllocator()); diff --git a/server/src/test/java/org/opensearch/extensions/ExtensionsManagerTests.java b/server/src/test/java/org/opensearch/extensions/ExtensionsManagerTests.java index 040c799efce2a..d7031bb96346d 100644 --- a/server/src/test/java/org/opensearch/extensions/ExtensionsManagerTests.java +++ b/server/src/test/java/org/opensearch/extensions/ExtensionsManagerTests.java @@ -68,6 +68,7 @@ import org.opensearch.common.util.concurrent.ThreadContext; import org.opensearch.env.Environment; import org.opensearch.env.TestEnvironment; +import org.opensearch.extensions.proto.ExtensionRequestOuterClass; import org.opensearch.extensions.rest.RegisterRestActionsRequest; import org.opensearch.extensions.settings.RegisterCustomSettingsRequest; import org.opensearch.index.IndexModule; @@ -524,18 +525,18 @@ public void testHandleExtensionRequest() throws Exception { ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir); initialize(extensionsManager); - ExtensionRequest clusterStateRequest = new ExtensionRequest(ExtensionsManager.RequestType.REQUEST_EXTENSION_CLUSTER_STATE); + ExtensionRequest clusterStateRequest = new ExtensionRequest(ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE); assertEquals(ClusterStateResponse.class, extensionsManager.handleExtensionRequest(clusterStateRequest).getClass()); - ExtensionRequest clusterSettingRequest = new ExtensionRequest(ExtensionsManager.RequestType.REQUEST_EXTENSION_CLUSTER_SETTINGS); + ExtensionRequest clusterSettingRequest = new ExtensionRequest(ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_SETTINGS); assertEquals(ClusterSettingsResponse.class, extensionsManager.handleExtensionRequest(clusterSettingRequest).getClass()); ExtensionRequest environmentSettingsRequest = new ExtensionRequest( - ExtensionsManager.RequestType.REQUEST_EXTENSION_ENVIRONMENT_SETTINGS + ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_ENVIRONMENT_SETTINGS ); assertEquals(EnvironmentSettingsResponse.class, extensionsManager.handleExtensionRequest(environmentSettingsRequest).getClass()); - ExtensionRequest exceptionRequest = new ExtensionRequest(ExtensionsManager.RequestType.GET_SETTINGS); + ExtensionRequest exceptionRequest = new ExtensionRequest(ExtensionRequestOuterClass.RequestType.GET_SETTINGS); Exception exception = expectThrows( IllegalArgumentException.class, () -> extensionsManager.handleExtensionRequest(exceptionRequest) @@ -544,13 +545,13 @@ public void testHandleExtensionRequest() throws Exception { } public void testExtensionRequest() throws Exception { - ExtensionsManager.RequestType expectedRequestType = ExtensionsManager.RequestType.REQUEST_EXTENSION_DEPENDENCY_INFORMATION; + ExtensionRequestOuterClass.RequestType expectedRequestType = ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_DEPENDENCY_INFORMATION; // Test ExtensionRequest 2 arg constructor String expectedUniqueId = "test uniqueid"; ExtensionRequest extensionRequest = new ExtensionRequest(expectedRequestType, expectedUniqueId); assertEquals(expectedRequestType, extensionRequest.getRequestType()); - assertEquals(Optional.of(expectedUniqueId), extensionRequest.getUniqueId()); + assertEquals(expectedUniqueId, extensionRequest.getUniqueId()); // Test ExtensionRequest StreamInput constructor try (BytesStreamOutput out = new BytesStreamOutput()) { @@ -559,14 +560,14 @@ public void testExtensionRequest() throws Exception { try (BytesStreamInput in = new BytesStreamInput(BytesReference.toBytes(out.bytes()))) { extensionRequest = new ExtensionRequest(in); assertEquals(expectedRequestType, extensionRequest.getRequestType()); - assertEquals(Optional.of(expectedUniqueId), extensionRequest.getUniqueId()); + assertEquals(expectedUniqueId, extensionRequest.getUniqueId()); } } // Test ExtensionRequest 1 arg constructor extensionRequest = new ExtensionRequest(expectedRequestType); assertEquals(expectedRequestType, extensionRequest.getRequestType()); - assertEquals(Optional.empty(), extensionRequest.getUniqueId()); + assertTrue(extensionRequest.getUniqueId().isEmpty()); // Test ExtensionRequest StreamInput constructor try (BytesStreamOutput out = new BytesStreamOutput()) { @@ -575,7 +576,7 @@ public void testExtensionRequest() throws Exception { try (BytesStreamInput in = new BytesStreamInput(BytesReference.toBytes(out.bytes()))) { extensionRequest = new ExtensionRequest(in); assertEquals(expectedRequestType, extensionRequest.getRequestType()); - assertEquals(Optional.empty(), extensionRequest.getUniqueId()); + assertTrue(extensionRequest.getUniqueId().isEmpty()); } } } From 6c0f1a274c28f179867f2acb593ba151dfeec5cb Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Mon, 3 Apr 2023 14:20:22 -0700 Subject: [PATCH 02/18] Adding spotless changes Signed-off-by: Sarat Vemulapalli --- .../extensions/ExtensionRequest.java | 4 +- .../proto/ExtensionRequestOuterClass.java | 1700 +++++++++-------- .../extensions/proto/package-info.java | 10 + .../extensions/ExtensionsManagerTests.java | 8 +- 4 files changed, 880 insertions(+), 842 deletions(-) create mode 100644 server/src/main/java/org/opensearch/extensions/proto/package-info.java diff --git a/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java b/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java index ba5f43f4a2bbb..07e2f981198a6 100644 --- a/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java +++ b/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java @@ -18,7 +18,6 @@ import java.io.IOException; import java.util.Objects; -import java.util.Optional; /** * CLusterService Request for Extensibility @@ -69,7 +68,8 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ExtensionRequest that = (ExtensionRequest) o; - return Objects.equals(request.getRequestType(), that.request.getRequestType()) && Objects.equals(request.getUniqiueId(), that.request.getUniqiueId()); + return Objects.equals(request.getRequestType(), that.request.getRequestType()) + && Objects.equals(request.getUniqiueId(), that.request.getUniqiueId()); } @Override diff --git a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java index d66c24f10ed3b..ce5ead9fb9b75 100644 --- a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java +++ b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java @@ -3,888 +3,914 @@ package org.opensearch.extensions.proto; -public final class ExtensionRequestOuterClass { - private ExtensionRequestOuterClass() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - /** - * Protobuf enum {@code org.opensearch.extensions.proto.RequestType} - */ - public enum RequestType - implements com.google.protobuf.ProtocolMessageEnum { - /** - * REQUEST_EXTENSION_CLUSTER_STATE = 0; - */ - REQUEST_EXTENSION_CLUSTER_STATE(0), - /** - * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; - */ - REQUEST_EXTENSION_CLUSTER_SETTINGS(1), - /** - * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; - */ - REQUEST_EXTENSION_REGISTER_REST_ACTIONS(2), - /** - * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; - */ - REQUEST_EXTENSION_REGISTER_SETTINGS(3), - /** - * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; - */ - REQUEST_EXTENSION_ENVIRONMENT_SETTINGS(4), - /** - * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; - */ - REQUEST_EXTENSION_DEPENDENCY_INFORMATION(5), - /** - * CREATE_COMPONENT = 6; - */ - CREATE_COMPONENT(6), - /** - * ON_INDEX_MODULE = 7; - */ - ON_INDEX_MODULE(7), - /** - * GET_SETTINGS = 8; - */ - GET_SETTINGS(8), - UNRECOGNIZED(-1), - ; +/** + * ExtensionRequest class autogenerated from ExtensionRequest.proto + */ - /** - * REQUEST_EXTENSION_CLUSTER_STATE = 0; - */ - public static final int REQUEST_EXTENSION_CLUSTER_STATE_VALUE = 0; - /** - * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; - */ - public static final int REQUEST_EXTENSION_CLUSTER_SETTINGS_VALUE = 1; - /** - * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; - */ - public static final int REQUEST_EXTENSION_REGISTER_REST_ACTIONS_VALUE = 2; - /** - * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; - */ - public static final int REQUEST_EXTENSION_REGISTER_SETTINGS_VALUE = 3; - /** - * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; - */ - public static final int REQUEST_EXTENSION_ENVIRONMENT_SETTINGS_VALUE = 4; - /** - * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; - */ - public static final int REQUEST_EXTENSION_DEPENDENCY_INFORMATION_VALUE = 5; - /** - * CREATE_COMPONENT = 6; - */ - public static final int CREATE_COMPONENT_VALUE = 6; - /** - * ON_INDEX_MODULE = 7; - */ - public static final int ON_INDEX_MODULE_VALUE = 7; - /** - * GET_SETTINGS = 8; - */ - public static final int GET_SETTINGS_VALUE = 8; +public final class ExtensionRequestOuterClass { + private ExtensionRequestOuterClass() {} + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); } /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. + * Protobuf enum {@code org.opensearch.extensions.proto.RequestType} */ - @java.lang.Deprecated - public static RequestType valueOf(int value) { - return forNumber(value); - } + public enum RequestType implements com.google.protobuf.ProtocolMessageEnum { + /** + * REQUEST_EXTENSION_CLUSTER_STATE = 0; + */ + REQUEST_EXTENSION_CLUSTER_STATE(0), + /** + * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; + */ + REQUEST_EXTENSION_CLUSTER_SETTINGS(1), + /** + * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; + */ + REQUEST_EXTENSION_REGISTER_REST_ACTIONS(2), + /** + * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; + */ + REQUEST_EXTENSION_REGISTER_SETTINGS(3), + /** + * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; + */ + REQUEST_EXTENSION_ENVIRONMENT_SETTINGS(4), + /** + * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; + */ + REQUEST_EXTENSION_DEPENDENCY_INFORMATION(5), + /** + * CREATE_COMPONENT = 6; + */ + CREATE_COMPONENT(6), + /** + * ON_INDEX_MODULE = 7; + */ + ON_INDEX_MODULE(7), + /** + * GET_SETTINGS = 8; + */ + GET_SETTINGS(8), + UNRECOGNIZED(-1),; + + /** + * REQUEST_EXTENSION_CLUSTER_STATE = 0; + */ + public static final int REQUEST_EXTENSION_CLUSTER_STATE_VALUE = 0; + /** + * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; + */ + public static final int REQUEST_EXTENSION_CLUSTER_SETTINGS_VALUE = 1; + /** + * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; + */ + public static final int REQUEST_EXTENSION_REGISTER_REST_ACTIONS_VALUE = 2; + /** + * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; + */ + public static final int REQUEST_EXTENSION_REGISTER_SETTINGS_VALUE = 3; + /** + * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; + */ + public static final int REQUEST_EXTENSION_ENVIRONMENT_SETTINGS_VALUE = 4; + /** + * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; + */ + public static final int REQUEST_EXTENSION_DEPENDENCY_INFORMATION_VALUE = 5; + /** + * CREATE_COMPONENT = 6; + */ + public static final int CREATE_COMPONENT_VALUE = 6; + /** + * ON_INDEX_MODULE = 7; + */ + public static final int ON_INDEX_MODULE_VALUE = 7; + /** + * GET_SETTINGS = 8; + */ + public static final int GET_SETTINGS_VALUE = 8; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException("Can't get the number of an unknown enum value."); + } + return value; + } - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static RequestType forNumber(int value) { - switch (value) { - case 0: return REQUEST_EXTENSION_CLUSTER_STATE; - case 1: return REQUEST_EXTENSION_CLUSTER_SETTINGS; - case 2: return REQUEST_EXTENSION_REGISTER_REST_ACTIONS; - case 3: return REQUEST_EXTENSION_REGISTER_SETTINGS; - case 4: return REQUEST_EXTENSION_ENVIRONMENT_SETTINGS; - case 5: return REQUEST_EXTENSION_DEPENDENCY_INFORMATION; - case 6: return CREATE_COMPONENT; - case 7: return ON_INDEX_MODULE; - case 8: return GET_SETTINGS; - default: return null; - } - } + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static RequestType valueOf(int value) { + return forNumber(value); + } - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static final com.google.protobuf.Internal.EnumLiteMap< - RequestType> internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public RequestType findValueByNumber(int number) { - return RequestType.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.getDescriptor().getEnumTypes().get(0); - } + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static RequestType forNumber(int value) { + switch (value) { + case 0: + return REQUEST_EXTENSION_CLUSTER_STATE; + case 1: + return REQUEST_EXTENSION_CLUSTER_SETTINGS; + case 2: + return REQUEST_EXTENSION_REGISTER_REST_ACTIONS; + case 3: + return REQUEST_EXTENSION_REGISTER_SETTINGS; + case 4: + return REQUEST_EXTENSION_ENVIRONMENT_SETTINGS; + case 5: + return REQUEST_EXTENSION_DEPENDENCY_INFORMATION; + case 6: + return CREATE_COMPONENT; + case 7: + return ON_INDEX_MODULE; + case 8: + return GET_SETTINGS; + default: + return null; + } + } - private static final RequestType[] VALUES = values(); - - public static RequestType valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } - private final int value; + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public RequestType findValueByNumber(int number) { + return RequestType.forNumber(number); + } + }; - private RequestType(int value) { - this.value = value; - } + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException("Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } - // @@protoc_insertion_point(enum_scope:org.opensearch.extensions.proto.RequestType) - } + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } - public interface ExtensionRequestOrBuilder extends - // @@protoc_insertion_point(interface_extends:org.opensearch.extensions.proto.ExtensionRequest) - com.google.protobuf.MessageOrBuilder { + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.getDescriptor().getEnumTypes().get(0); + } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The enum numeric value on the wire for requestType. - */ - int getRequestTypeValue(); - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The requestType. - */ - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType(); + private static final RequestType[] VALUES = values(); - /** - * string uniqiueId = 2; - * @return The uniqiueId. - */ - java.lang.String getUniqiueId(); - /** - * string uniqiueId = 2; - * @return The bytes for uniqiueId. - */ - com.google.protobuf.ByteString - getUniqiueIdBytes(); - } - /** - * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} - */ - public static final class ExtensionRequest extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:org.opensearch.extensions.proto.ExtensionRequest) - ExtensionRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use ExtensionRequest.newBuilder() to construct. - private ExtensionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private ExtensionRequest() { - requestType_ = 0; - uniqiueId_ = ""; - } + public static RequestType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new ExtensionRequest(); - } + private final int value; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - } + private RequestType(int value) { + this.value = value; + } - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class); + // @@protoc_insertion_point(enum_scope:org.opensearch.extensions.proto.RequestType) } - public static final int REQUESTTYPE_FIELD_NUMBER = 1; - private int requestType_ = 0; - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The enum numeric value on the wire for requestType. - */ - @java.lang.Override public int getRequestTypeValue() { - return requestType_; - } /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The requestType. + * Interface for ExtensionRequest builder */ - @java.lang.Override public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); - return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; + public interface ExtensionRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:org.opensearch.extensions.proto.ExtensionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The enum numeric value on the wire for requestType. + */ + int getRequestTypeValue(); + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The requestType. + */ + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType(); + + /** + * string uniqiueId = 2; + * @return The uniqiueId. + */ + java.lang.String getUniqiueId(); + + /** + * string uniqiueId = 2; + * @return The bytes for uniqiueId. + */ + com.google.protobuf.ByteString getUniqiueIdBytes(); } - public static final int UNIQIUEID_FIELD_NUMBER = 2; - @SuppressWarnings("serial") - private volatile java.lang.Object uniqiueId_ = ""; /** - * string uniqiueId = 2; - * @return The uniqiueId. - */ - @java.lang.Override - public java.lang.String getUniqiueId() { - java.lang.Object ref = uniqiueId_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uniqiueId_ = s; - return s; - } - } - /** - * string uniqiueId = 2; - * @return The bytes for uniqiueId. + * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} */ - @java.lang.Override - public com.google.protobuf.ByteString - getUniqiueIdBytes() { - java.lang.Object ref = uniqiueId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - uniqiueId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } + public static final class ExtensionRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:org.opensearch.extensions.proto.ExtensionRequest) + ExtensionRequestOrBuilder { + private static final long serialVersionUID = 0L; + + // Use ExtensionRequest.newBuilder() to construct. + private ExtensionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; + private ExtensionRequest() { + requestType_ = 0; + uniqiueId_ = ""; + } - memoizedIsInitialized = 1; - return true; - } + @java.lang.Override + @SuppressWarnings({ "unused" }) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ExtensionRequest(); + } - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE.getNumber()) { - output.writeEnum(1, requestType_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uniqiueId_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uniqiueId_); - } - getUnknownFields().writeTo(output); - } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE.getNumber()) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, requestType_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uniqiueId_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uniqiueId_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + } - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest)) { - return super.equals(obj); - } - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other = (org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) obj; - - if (requestType_ != other.requestType_) return false; - if (!getUniqiueId() - .equals(other.getUniqiueId())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class + ); + } - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + REQUESTTYPE_FIELD_NUMBER; - hash = (53 * hash) + requestType_; - hash = (37 * hash) + UNIQIUEID_FIELD_NUMBER; - hash = (53 * hash) + getUniqiueId().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } + public static final int REQUESTTYPE_FIELD_NUMBER = 1; + private int requestType_ = 0; - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The enum numeric value on the wire for requestType. + */ + @java.lang.Override + public int getRequestTypeValue() { + return requestType_; + } - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The requestType. + */ + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); + return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; + } - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:org.opensearch.extensions.proto.ExtensionRequest) - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class); - } - - // Construct using org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.newBuilder() - private Builder() { - - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - - } - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - requestType_ = 0; - uniqiueId_ = ""; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - } - - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance(); - } - - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest build() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest buildPartial() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(this); - if (bitField0_ != 0) { buildPartial0(result); } - onBuilt(); - return result; - } - - private void buildPartial0(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.requestType_ = requestType_; - } - if (((from_bitField0_ & 0x00000002) != 0)) { - result.uniqiueId_ = uniqiueId_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) { - return mergeFrom((org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other) { - if (other == org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance()) return this; - if (other.requestType_ != 0) { - setRequestTypeValue(other.getRequestTypeValue()); - } - if (!other.getUniqiueId().isEmpty()) { - uniqiueId_ = other.uniqiueId_; - bitField0_ |= 0x00000002; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - requestType_ = input.readEnum(); + public static final int UNIQIUEID_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object uniqiueId_ = ""; + + /** + * string uniqiueId = 2; + * @return The uniqiueId. + */ + @java.lang.Override + public java.lang.String getUniqiueId() { + java.lang.Object ref = uniqiueId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uniqiueId_ = s; + return s; + } + } + + /** + * string uniqiueId = 2; + * @return The bytes for uniqiueId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUniqiueIdBytes() { + java.lang.Object ref = uniqiueId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uniqiueId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE + .getNumber()) { + output.writeEnum(1, requestType_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uniqiueId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uniqiueId_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, requestType_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uniqiueId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uniqiueId_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest)) { + return super.equals(obj); + } + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other = + (org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) obj; + + if (requestType_ != other.requestType_) return false; + if (!getUniqiueId().equals(other.getUniqiueId())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + REQUESTTYPE_FIELD_NUMBER; + hash = (53 * hash) + requestType_; + hash = (37 * hash) + UNIQIUEID_FIELD_NUMBER; + hash = (53 * hash) + getUniqiueId().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.ByteString data + ) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom( + java.io.InputStream input + ) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.CodedInputStream input + ) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:org.opensearch.extensions.proto.ExtensionRequest) + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class + ); + } + + // Construct using org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.newBuilder() + private Builder() { + + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + requestType_ = 0; + uniqiueId_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest build() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest buildPartial() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = + new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.requestType_ = requestType_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.uniqiueId_ = uniqiueId_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) { + return mergeFrom((org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other) { + if (other == org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance()) return this; + if (other.requestType_ != 0) { + setRequestTypeValue(other.getRequestTypeValue()); + } + if (!other.getUniqiueId().isEmpty()) { + uniqiueId_ = other.uniqiueId_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + requestType_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: { + uniqiueId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int requestType_ = 0; + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The enum numeric value on the wire for requestType. + */ + @java.lang.Override + public int getRequestTypeValue() { + return requestType_; + } + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @param value The enum numeric value on the wire for requestType to set. + * @return This builder for chaining. + */ + public Builder setRequestTypeValue(int value) { + requestType_ = value; bitField0_ |= 0x00000001; - break; - } // case 8 - case 18: { - uniqiueId_ = input.readStringRequireUtf8(); + onChanged(); + return this; + } + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The requestType. + */ + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); + return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; + } + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @param value The requestType to set. + * @return This builder for chaining. + */ + public Builder setRequestType(org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + requestType_ = value.getNumber(); + onChanged(); + return this; + } + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return This builder for chaining. + */ + public Builder clearRequestType() { + bitField0_ = (bitField0_ & ~0x00000001); + requestType_ = 0; + onChanged(); + return this; + } + + private java.lang.Object uniqiueId_ = ""; + + /** + * string uniqiueId = 2; + * @return The uniqiueId. + */ + public java.lang.String getUniqiueId() { + java.lang.Object ref = uniqiueId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uniqiueId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * string uniqiueId = 2; + * @return The bytes for uniqiueId. + */ + public com.google.protobuf.ByteString getUniqiueIdBytes() { + java.lang.Object ref = uniqiueId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uniqiueId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * string uniqiueId = 2; + * @param value The uniqiueId to set. + * @return This builder for chaining. + */ + public Builder setUniqiueId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + uniqiueId_ = value; bitField0_ |= 0x00000002; - break; - } // case 18 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag + onChanged(); + return this; + } + + /** + * string uniqiueId = 2; + * @return This builder for chaining. + */ + public Builder clearUniqiueId() { + uniqiueId_ = getDefaultInstance().getUniqiueId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * string uniqiueId = 2; + * @param value The bytes for uniqiueId to set. + * @return This builder for chaining. + */ + public Builder setUniqiueIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - private int bitField0_; - - private int requestType_ = 0; - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The enum numeric value on the wire for requestType. - */ - @java.lang.Override public int getRequestTypeValue() { - return requestType_; - } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @param value The enum numeric value on the wire for requestType to set. - * @return This builder for chaining. - */ - public Builder setRequestTypeValue(int value) { - requestType_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The requestType. - */ - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); - return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; - } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @param value The requestType to set. - * @return This builder for chaining. - */ - public Builder setRequestType(org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - requestType_ = value.getNumber(); - onChanged(); - return this; - } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return This builder for chaining. - */ - public Builder clearRequestType() { - bitField0_ = (bitField0_ & ~0x00000001); - requestType_ = 0; - onChanged(); - return this; - } - - private java.lang.Object uniqiueId_ = ""; - /** - * string uniqiueId = 2; - * @return The uniqiueId. - */ - public java.lang.String getUniqiueId() { - java.lang.Object ref = uniqiueId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uniqiueId_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string uniqiueId = 2; - * @return The bytes for uniqiueId. - */ - public com.google.protobuf.ByteString - getUniqiueIdBytes() { - java.lang.Object ref = uniqiueId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - uniqiueId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string uniqiueId = 2; - * @param value The uniqiueId to set. - * @return This builder for chaining. - */ - public Builder setUniqiueId( - java.lang.String value) { - if (value == null) { throw new NullPointerException(); } - uniqiueId_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - /** - * string uniqiueId = 2; - * @return This builder for chaining. - */ - public Builder clearUniqiueId() { - uniqiueId_ = getDefaultInstance().getUniqiueId(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - /** - * string uniqiueId = 2; - * @param value The bytes for uniqiueId to set. - * @return This builder for chaining. - */ - public Builder setUniqiueIdBytes( - com.google.protobuf.ByteString value) { - if (value == null) { throw new NullPointerException(); } - checkByteStringIsUtf8(value); - uniqiueId_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:org.opensearch.extensions.proto.ExtensionRequest) - } + checkByteStringIsUtf8(value); + uniqiueId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } - // @@protoc_insertion_point(class_scope:org.opensearch.extensions.proto.ExtensionRequest) - private static final org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(); - } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ExtensionRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } + // @@protoc_insertion_point(builder_scope:org.opensearch.extensions.proto.ExtensionRequest) + } + + // @@protoc_insertion_point(class_scope:org.opensearch.extensions.proto.ExtensionRequest) + private static final org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser< + ExtensionRequest>() { + @java.lang.Override + public ExtensionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; } - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; + private static final com.google.protobuf.Descriptors.Descriptor internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; } - } - - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\nKserver/src/main/java/org/opensearch/ex" + - "tensions/proto/ExtensionRequest.proto\022\037o" + - "rg.opensearch.extensions.proto\"h\n\020Extens" + - "ionRequest\022A\n\013requestType\030\001 \001(\0162,.org.op" + - "ensearch.extensions.proto.RequestType\022\021\n" + - "\tuniqiueId\030\002 \001(\t*\307\002\n\013RequestType\022#\n\037REQU" + - "EST_EXTENSION_CLUSTER_STATE\020\000\022&\n\"REQUEST" + - "_EXTENSION_CLUSTER_SETTINGS\020\001\022+\n\'REQUEST" + - "_EXTENSION_REGISTER_REST_ACTIONS\020\002\022\'\n#RE" + - "QUEST_EXTENSION_REGISTER_SETTINGS\020\003\022*\n&R" + - "EQUEST_EXTENSION_ENVIRONMENT_SETTINGS\020\004\022" + - ",\n(REQUEST_EXTENSION_DEPENDENCY_INFORMAT" + - "ION\020\005\022\024\n\020CREATE_COMPONENT\020\006\022\023\n\017ON_INDEX_" + - "MODULE\020\007\022\020\n\014GET_SETTINGS\020\010b\006proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }); - internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor, - new java.lang.String[] { "RequestType", "UniqiueId", }); - } - - // @@protoc_insertion_point(outer_class_scope) + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + static { + java.lang.String[] descriptorData = { + "\nKserver/src/main/java/org/opensearch/ex" + + "tensions/proto/ExtensionRequest.proto\022\037o" + + "rg.opensearch.extensions.proto\"h\n\020Extens" + + "ionRequest\022A\n\013requestType\030\001 \001(\0162,.org.op" + + "ensearch.extensions.proto.RequestType\022\021\n" + + "\tuniqiueId\030\002 \001(\t*\307\002\n\013RequestType\022#\n\037REQU" + + "EST_EXTENSION_CLUSTER_STATE\020\000\022&\n\"REQUEST" + + "_EXTENSION_CLUSTER_SETTINGS\020\001\022+\n\'REQUEST" + + "_EXTENSION_REGISTER_REST_ACTIONS\020\002\022\'\n#RE" + + "QUEST_EXTENSION_REGISTER_SETTINGS\020\003\022*\n&R" + + "EQUEST_EXTENSION_ENVIRONMENT_SETTINGS\020\004\022" + + ",\n(REQUEST_EXTENSION_DEPENDENCY_INFORMAT" + + "ION\020\005\022\024\n\020CREATE_COMPONENT\020\006\022\023\n\017ON_INDEX_" + + "MODULE\020\007\022\020\n\014GET_SETTINGS\020\010b\006proto3" }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] {} + ); + internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor = getDescriptor().getMessageTypes().get(0); + internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor, + new java.lang.String[] { "RequestType", "UniqiueId", } + ); + } + + // @@protoc_insertion_point(outer_class_scope) } diff --git a/server/src/main/java/org/opensearch/extensions/proto/package-info.java b/server/src/main/java/org/opensearch/extensions/proto/package-info.java new file mode 100644 index 0000000000000..ff3084f133d5b --- /dev/null +++ b/server/src/main/java/org/opensearch/extensions/proto/package-info.java @@ -0,0 +1,10 @@ +/* + * 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. + */ + +/** OpenSearch extensions protobuf package. This package defines message contracts between OpenSearch and extensions.*/ +package org.opensearch.extensions.proto; diff --git a/server/src/test/java/org/opensearch/extensions/ExtensionsManagerTests.java b/server/src/test/java/org/opensearch/extensions/ExtensionsManagerTests.java index d7031bb96346d..afeafeb48e33b 100644 --- a/server/src/test/java/org/opensearch/extensions/ExtensionsManagerTests.java +++ b/server/src/test/java/org/opensearch/extensions/ExtensionsManagerTests.java @@ -32,7 +32,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; -import java.util.Optional; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -528,7 +527,9 @@ public void testHandleExtensionRequest() throws Exception { ExtensionRequest clusterStateRequest = new ExtensionRequest(ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE); assertEquals(ClusterStateResponse.class, extensionsManager.handleExtensionRequest(clusterStateRequest).getClass()); - ExtensionRequest clusterSettingRequest = new ExtensionRequest(ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_SETTINGS); + ExtensionRequest clusterSettingRequest = new ExtensionRequest( + ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_SETTINGS + ); assertEquals(ClusterSettingsResponse.class, extensionsManager.handleExtensionRequest(clusterSettingRequest).getClass()); ExtensionRequest environmentSettingsRequest = new ExtensionRequest( @@ -545,7 +546,8 @@ public void testHandleExtensionRequest() throws Exception { } public void testExtensionRequest() throws Exception { - ExtensionRequestOuterClass.RequestType expectedRequestType = ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_DEPENDENCY_INFORMATION; + ExtensionRequestOuterClass.RequestType expectedRequestType = + ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_DEPENDENCY_INFORMATION; // Test ExtensionRequest 2 arg constructor String expectedUniqueId = "test uniqueid"; From 65dfbb9d3ae7d7c4044ce465952b15a68af4ca1b Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Mon, 3 Apr 2023 15:00:26 -0700 Subject: [PATCH 03/18] Fixing licenses Signed-off-by: Sarat Vemulapalli --- modules/transport-netty4/build.gradle | 8 - plugins/repository-gcs/build.gradle | 12 +- .../licenses/protobuf-java-3.21.7.jar.sha1 | 1 - .../protobuf-java-util-3.20.0.jar.sha1 | 1 - plugins/repository-hdfs/build.gradle | 9 +- .../licenses/protobuf-java-LICENSE.txt | 10 - .../licenses/protobuf-java-NOTICE.txt | 2 - plugins/transport-nio/build.gradle | 8 - protobuf-java-NOTICE.txt | 0 .../licenses/protobuf-java-3.22.2.jar.sha1 | 0 .../licenses/protobuf-java-LICENSE.txt | 0 .../licenses/protobuf-java-NOTICE.txt | 0 .../extensions/proto/ExtensionRequest.proto | 2 +- .../proto/ExtensionRequestOuterClass.java | 1731 +++++++++-------- 14 files changed, 875 insertions(+), 909 deletions(-) delete mode 100644 plugins/repository-gcs/licenses/protobuf-java-3.21.7.jar.sha1 delete mode 100644 plugins/repository-gcs/licenses/protobuf-java-util-3.20.0.jar.sha1 delete mode 100644 plugins/repository-hdfs/licenses/protobuf-java-LICENSE.txt delete mode 100644 plugins/repository-hdfs/licenses/protobuf-java-NOTICE.txt create mode 100644 protobuf-java-NOTICE.txt rename {plugins/repository-hdfs => server}/licenses/protobuf-java-3.22.2.jar.sha1 (100%) rename plugins/repository-gcs/licenses/protobuf-LICENSE.txt => server/licenses/protobuf-java-LICENSE.txt (100%) rename plugins/repository-gcs/licenses/protobuf-NOTICE.txt => server/licenses/protobuf-java-NOTICE.txt (100%) diff --git a/modules/transport-netty4/build.gradle b/modules/transport-netty4/build.gradle index 124f0a4fef3a8..e90d624ee8b8e 100644 --- a/modules/transport-netty4/build.gradle +++ b/modules/transport-netty4/build.gradle @@ -131,12 +131,6 @@ thirdPartyAudit { 'com.aayushatharva.brotli4j.encoder.Encoder$Parameters', // classes are missing - // from io.netty.handler.codec.protobuf.ProtobufDecoder (netty) - 'com.google.protobuf.ExtensionRegistry', - 'com.google.protobuf.MessageLite$Builder', - 'com.google.protobuf.MessageLite', - 'com.google.protobuf.Parser', - // from io.netty.logging.CommonsLoggerFactory (netty) 'org.apache.commons.logging.Log', 'org.apache.commons.logging.LogFactory', @@ -191,8 +185,6 @@ thirdPartyAudit { 'org.slf4j.spi.LocationAwareLogger', 'com.github.luben.zstd.Zstd', - 'com.google.protobuf.ExtensionRegistryLite', - 'com.google.protobuf.MessageLiteOrBuilder', 'com.google.protobuf.nano.CodedOutputByteBufferNano', 'com.google.protobuf.nano.MessageNano', 'com.jcraft.jzlib.Deflater', diff --git a/plugins/repository-gcs/build.gradle b/plugins/repository-gcs/build.gradle index 7350f8b509929..8ed235af6cab9 100644 --- a/plugins/repository-gcs/build.gradle +++ b/plugins/repository-gcs/build.gradle @@ -65,7 +65,6 @@ dependencies { api 'com.google.api:api-common:1.8.1' api 'com.google.api:gax:2.17.0' api 'org.threeten:threetenbp:1.4.4' - //api 'com.google.protobuf:protobuf-java:3.21.7' api 'com.google.code.gson:gson:2.9.0' api 'com.google.api.grpc:proto-google-common-protos:2.10.0' api 'com.google.api.grpc:proto-google-iam-v1:0.12.0' @@ -104,13 +103,6 @@ tasks.named("dependencyLicenses").configure { thirdPartyAudit { ignoreViolations( // uses internal java api: sun.misc.Unsafe - 'com.google.protobuf.UnsafeUtil', - 'com.google.protobuf.UnsafeUtil$1', - 'com.google.protobuf.UnsafeUtil$JvmMemoryAccessor', - 'com.google.protobuf.UnsafeUtil$MemoryAccessor', - 'com.google.protobuf.MessageSchema', - 'com.google.protobuf.UnsafeUtil$Android32MemoryAccessor', - 'com.google.protobuf.UnsafeUtil$Android64MemoryAccessor', 'com.google.common.cache.Striped64', 'com.google.common.cache.Striped64$1', 'com.google.common.cache.Striped64$Cell', @@ -150,6 +142,10 @@ thirdPartyAudit { 'com.google.appengine.api.urlfetch.URLFetchService', 'com.google.appengine.api.urlfetch.URLFetchServiceFactory', 'com.oracle.svm.core.configure.ResourcesRegistry', + 'com.google.protobuf.util.JsonFormat', + 'com.google.protobuf.util.JsonFormat$Parser', + 'com.google.protobuf.util.JsonFormat$Printer', + 'com.google.protobuf.util.Timestamps', // commons-logging optional dependencies 'org.apache.avalon.framework.logger.Logger', 'org.apache.log.Hierarchy', diff --git a/plugins/repository-gcs/licenses/protobuf-java-3.21.7.jar.sha1 b/plugins/repository-gcs/licenses/protobuf-java-3.21.7.jar.sha1 deleted file mode 100644 index faa673a23ef41..0000000000000 --- a/plugins/repository-gcs/licenses/protobuf-java-3.21.7.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -96cfc7147192f1de72c3d7d06972155ffb7d180c \ No newline at end of file diff --git a/plugins/repository-gcs/licenses/protobuf-java-util-3.20.0.jar.sha1 b/plugins/repository-gcs/licenses/protobuf-java-util-3.20.0.jar.sha1 deleted file mode 100644 index 1e9d00d8d5c03..0000000000000 --- a/plugins/repository-gcs/licenses/protobuf-java-util-3.20.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -ee4496b296418283cbe7ae784984347fc4717a9a \ No newline at end of file diff --git a/plugins/repository-hdfs/build.gradle b/plugins/repository-hdfs/build.gradle index 722b2dd53c4fa..141290f46f897 100644 --- a/plugins/repository-hdfs/build.gradle +++ b/plugins/repository-hdfs/build.gradle @@ -115,14 +115,7 @@ tasks.named("dependencyLicenses").configure { thirdPartyAudit { ignoreViolations( - // uses internal java api: sun.misc.Unsafe - 'com.google.protobuf.MessageSchema', - 'com.google.protobuf.UnsafeUtil', - 'com.google.protobuf.UnsafeUtil$1', - 'com.google.protobuf.UnsafeUtil$Android32MemoryAccessor', - 'com.google.protobuf.UnsafeUtil$Android64MemoryAccessor', - 'com.google.protobuf.UnsafeUtil$JvmMemoryAccessor', - 'com.google.protobuf.UnsafeUtil$MemoryAccessor' + ) } diff --git a/plugins/repository-hdfs/licenses/protobuf-java-LICENSE.txt b/plugins/repository-hdfs/licenses/protobuf-java-LICENSE.txt deleted file mode 100644 index 49e7019ac5a1b..0000000000000 --- a/plugins/repository-hdfs/licenses/protobuf-java-LICENSE.txt +++ /dev/null @@ -1,10 +0,0 @@ -Copyright (c) , -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/plugins/repository-hdfs/licenses/protobuf-java-NOTICE.txt b/plugins/repository-hdfs/licenses/protobuf-java-NOTICE.txt deleted file mode 100644 index 139597f9cb07c..0000000000000 --- a/plugins/repository-hdfs/licenses/protobuf-java-NOTICE.txt +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/plugins/transport-nio/build.gradle b/plugins/transport-nio/build.gradle index 8a6a6a334e1a9..0aae487d6995a 100644 --- a/plugins/transport-nio/build.gradle +++ b/plugins/transport-nio/build.gradle @@ -66,12 +66,6 @@ thirdPartyAudit { 'com.aayushatharva.brotli4j.encoder.Encoder$Mode', 'com.aayushatharva.brotli4j.encoder.Encoder$Parameters', - // from io.netty.handler.codec.protobuf.ProtobufDecoder (netty) - 'com.google.protobuf.ExtensionRegistry', - 'com.google.protobuf.MessageLite$Builder', - 'com.google.protobuf.MessageLite', - 'com.google.protobuf.Parser', - // from io.netty.logging.CommonsLoggerFactory (netty) 'org.apache.commons.logging.Log', 'org.apache.commons.logging.LogFactory', @@ -118,8 +112,6 @@ thirdPartyAudit { 'org.slf4j.spi.LocationAwareLogger', 'com.github.luben.zstd.Zstd', - 'com.google.protobuf.ExtensionRegistryLite', - 'com.google.protobuf.MessageLiteOrBuilder', 'com.google.protobuf.nano.CodedOutputByteBufferNano', 'com.google.protobuf.nano.MessageNano', 'com.jcraft.jzlib.Deflater', diff --git a/protobuf-java-NOTICE.txt b/protobuf-java-NOTICE.txt new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/plugins/repository-hdfs/licenses/protobuf-java-3.22.2.jar.sha1 b/server/licenses/protobuf-java-3.22.2.jar.sha1 similarity index 100% rename from plugins/repository-hdfs/licenses/protobuf-java-3.22.2.jar.sha1 rename to server/licenses/protobuf-java-3.22.2.jar.sha1 diff --git a/plugins/repository-gcs/licenses/protobuf-LICENSE.txt b/server/licenses/protobuf-java-LICENSE.txt similarity index 100% rename from plugins/repository-gcs/licenses/protobuf-LICENSE.txt rename to server/licenses/protobuf-java-LICENSE.txt diff --git a/plugins/repository-gcs/licenses/protobuf-NOTICE.txt b/server/licenses/protobuf-java-NOTICE.txt similarity index 100% rename from plugins/repository-gcs/licenses/protobuf-NOTICE.txt rename to server/licenses/protobuf-java-NOTICE.txt diff --git a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto index 82c6399ee0043..70f03d52bc283 100644 --- a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto +++ b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto @@ -15,5 +15,5 @@ enum RequestType { message ExtensionRequest { RequestType requestType = 1; - string uniqiueId = 2; + optional string uniqiueId = 2; } diff --git a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java index ce5ead9fb9b75..4ded39f1a9115 100644 --- a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java +++ b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java @@ -4,913 +4,920 @@ package org.opensearch.extensions.proto; /** - * ExtensionRequest class autogenerated from ExtensionRequest.proto - */ - + - * ExtensionRequest class autogenerated from ExtensionRequest.proto + - */ public final class ExtensionRequestOuterClass { - private ExtensionRequestOuterClass() {} - - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} - - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); - } - + private ExtensionRequestOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + /** + * Protobuf enum {@code org.opensearch.extensions.proto.RequestType} + */ + public enum RequestType + implements com.google.protobuf.ProtocolMessageEnum { /** - * Protobuf enum {@code org.opensearch.extensions.proto.RequestType} + * REQUEST_EXTENSION_CLUSTER_STATE = 0; */ - public enum RequestType implements com.google.protobuf.ProtocolMessageEnum { - /** - * REQUEST_EXTENSION_CLUSTER_STATE = 0; - */ - REQUEST_EXTENSION_CLUSTER_STATE(0), - /** - * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; - */ - REQUEST_EXTENSION_CLUSTER_SETTINGS(1), - /** - * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; - */ - REQUEST_EXTENSION_REGISTER_REST_ACTIONS(2), - /** - * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; - */ - REQUEST_EXTENSION_REGISTER_SETTINGS(3), - /** - * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; - */ - REQUEST_EXTENSION_ENVIRONMENT_SETTINGS(4), - /** - * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; - */ - REQUEST_EXTENSION_DEPENDENCY_INFORMATION(5), - /** - * CREATE_COMPONENT = 6; - */ - CREATE_COMPONENT(6), - /** - * ON_INDEX_MODULE = 7; - */ - ON_INDEX_MODULE(7), - /** - * GET_SETTINGS = 8; - */ - GET_SETTINGS(8), - UNRECOGNIZED(-1),; - - /** - * REQUEST_EXTENSION_CLUSTER_STATE = 0; - */ - public static final int REQUEST_EXTENSION_CLUSTER_STATE_VALUE = 0; - /** - * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; - */ - public static final int REQUEST_EXTENSION_CLUSTER_SETTINGS_VALUE = 1; - /** - * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; - */ - public static final int REQUEST_EXTENSION_REGISTER_REST_ACTIONS_VALUE = 2; - /** - * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; - */ - public static final int REQUEST_EXTENSION_REGISTER_SETTINGS_VALUE = 3; - /** - * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; - */ - public static final int REQUEST_EXTENSION_ENVIRONMENT_SETTINGS_VALUE = 4; - /** - * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; - */ - public static final int REQUEST_EXTENSION_DEPENDENCY_INFORMATION_VALUE = 5; - /** - * CREATE_COMPONENT = 6; - */ - public static final int CREATE_COMPONENT_VALUE = 6; - /** - * ON_INDEX_MODULE = 7; - */ - public static final int ON_INDEX_MODULE_VALUE = 7; - /** - * GET_SETTINGS = 8; - */ - public static final int GET_SETTINGS_VALUE = 8; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException("Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static RequestType valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static RequestType forNumber(int value) { - switch (value) { - case 0: - return REQUEST_EXTENSION_CLUSTER_STATE; - case 1: - return REQUEST_EXTENSION_CLUSTER_SETTINGS; - case 2: - return REQUEST_EXTENSION_REGISTER_REST_ACTIONS; - case 3: - return REQUEST_EXTENSION_REGISTER_SETTINGS; - case 4: - return REQUEST_EXTENSION_ENVIRONMENT_SETTINGS; - case 5: - return REQUEST_EXTENSION_DEPENDENCY_INFORMATION; - case 6: - return CREATE_COMPONENT; - case 7: - return ON_INDEX_MODULE; - case 8: - return GET_SETTINGS; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public RequestType findValueByNumber(int number) { - return RequestType.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException("Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.getDescriptor().getEnumTypes().get(0); - } - - private static final RequestType[] VALUES = values(); - - public static RequestType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } + REQUEST_EXTENSION_CLUSTER_STATE(0), + /** + * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; + */ + REQUEST_EXTENSION_CLUSTER_SETTINGS(1), + /** + * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; + */ + REQUEST_EXTENSION_REGISTER_REST_ACTIONS(2), + /** + * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; + */ + REQUEST_EXTENSION_REGISTER_SETTINGS(3), + /** + * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; + */ + REQUEST_EXTENSION_ENVIRONMENT_SETTINGS(4), + /** + * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; + */ + REQUEST_EXTENSION_DEPENDENCY_INFORMATION(5), + /** + * CREATE_COMPONENT = 6; + */ + CREATE_COMPONENT(6), + /** + * ON_INDEX_MODULE = 7; + */ + ON_INDEX_MODULE(7), + /** + * GET_SETTINGS = 8; + */ + GET_SETTINGS(8), + UNRECOGNIZED(-1), + ; - private final int value; + /** + * REQUEST_EXTENSION_CLUSTER_STATE = 0; + */ + public static final int REQUEST_EXTENSION_CLUSTER_STATE_VALUE = 0; + /** + * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; + */ + public static final int REQUEST_EXTENSION_CLUSTER_SETTINGS_VALUE = 1; + /** + * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; + */ + public static final int REQUEST_EXTENSION_REGISTER_REST_ACTIONS_VALUE = 2; + /** + * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; + */ + public static final int REQUEST_EXTENSION_REGISTER_SETTINGS_VALUE = 3; + /** + * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; + */ + public static final int REQUEST_EXTENSION_ENVIRONMENT_SETTINGS_VALUE = 4; + /** + * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; + */ + public static final int REQUEST_EXTENSION_DEPENDENCY_INFORMATION_VALUE = 5; + /** + * CREATE_COMPONENT = 6; + */ + public static final int CREATE_COMPONENT_VALUE = 6; + /** + * ON_INDEX_MODULE = 7; + */ + public static final int ON_INDEX_MODULE_VALUE = 7; + /** + * GET_SETTINGS = 8; + */ + public static final int GET_SETTINGS_VALUE = 8; - private RequestType(int value) { - this.value = value; - } - // @@protoc_insertion_point(enum_scope:org.opensearch.extensions.proto.RequestType) + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; } /** - * Interface for ExtensionRequest builder + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. */ - public interface ExtensionRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:org.opensearch.extensions.proto.ExtensionRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The enum numeric value on the wire for requestType. - */ - int getRequestTypeValue(); - - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The requestType. - */ - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType(); - - /** - * string uniqiueId = 2; - * @return The uniqiueId. - */ - java.lang.String getUniqiueId(); - - /** - * string uniqiueId = 2; - * @return The bytes for uniqiueId. - */ - com.google.protobuf.ByteString getUniqiueIdBytes(); + @java.lang.Deprecated + public static RequestType valueOf(int value) { + return forNumber(value); } /** - * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. */ - public static final class ExtensionRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:org.opensearch.extensions.proto.ExtensionRequest) - ExtensionRequestOrBuilder { - private static final long serialVersionUID = 0L; - - // Use ExtensionRequest.newBuilder() to construct. - private ExtensionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ExtensionRequest() { - requestType_ = 0; - uniqiueId_ = ""; - } - - @java.lang.Override - @SuppressWarnings({ "unused" }) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ExtensionRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class - ); - } - - public static final int REQUESTTYPE_FIELD_NUMBER = 1; - private int requestType_ = 0; - - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The enum numeric value on the wire for requestType. - */ - @java.lang.Override - public int getRequestTypeValue() { - return requestType_; - } - - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The requestType. - */ - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); - return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; - } - - public static final int UNIQIUEID_FIELD_NUMBER = 2; - @SuppressWarnings("serial") - private volatile java.lang.Object uniqiueId_ = ""; - - /** - * string uniqiueId = 2; - * @return The uniqiueId. - */ - @java.lang.Override - public java.lang.String getUniqiueId() { - java.lang.Object ref = uniqiueId_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uniqiueId_ = s; - return s; - } - } - - /** - * string uniqiueId = 2; - * @return The bytes for uniqiueId. - */ - @java.lang.Override - public com.google.protobuf.ByteString getUniqiueIdBytes() { - java.lang.Object ref = uniqiueId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - uniqiueId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE - .getNumber()) { - output.writeEnum(1, requestType_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uniqiueId_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uniqiueId_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE - .getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, requestType_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uniqiueId_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uniqiueId_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest)) { - return super.equals(obj); - } - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other = - (org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) obj; - - if (requestType_ != other.requestType_) return false; - if (!getUniqiueId().equals(other.getUniqiueId())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + REQUESTTYPE_FIELD_NUMBER; - hash = (53 * hash) + requestType_; - hash = (37 * hash) + UNIQIUEID_FIELD_NUMBER; - hash = (53 * hash) + getUniqiueId().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.ByteString data - ) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom( - java.io.InputStream input - ) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.CodedInputStream input - ) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** - * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:org.opensearch.extensions.proto.ExtensionRequest) - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class - ); - } - - // Construct using org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.newBuilder() - private Builder() { - - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - - } + public static RequestType forNumber(int value) { + switch (value) { + case 0: return REQUEST_EXTENSION_CLUSTER_STATE; + case 1: return REQUEST_EXTENSION_CLUSTER_SETTINGS; + case 2: return REQUEST_EXTENSION_REGISTER_REST_ACTIONS; + case 3: return REQUEST_EXTENSION_REGISTER_SETTINGS; + case 4: return REQUEST_EXTENSION_ENVIRONMENT_SETTINGS; + case 5: return REQUEST_EXTENSION_DEPENDENCY_INFORMATION; + case 6: return CREATE_COMPONENT; + case 7: return ON_INDEX_MODULE; + case 8: return GET_SETTINGS; + default: return null; + } + } - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - requestType_ = 0; - uniqiueId_ = ""; - return this; - } + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + RequestType> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public RequestType findValueByNumber(int number) { + return RequestType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.getDescriptor().getEnumTypes().get(0); + } - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - } + private static final RequestType[] VALUES = values(); + + public static RequestType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance(); - } + private final int value; - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest build() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } + private RequestType(int value) { + this.value = value; + } - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest buildPartial() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = - new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } + // @@protoc_insertion_point(enum_scope:org.opensearch.extensions.proto.RequestType) + } - private void buildPartial0(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.requestType_ = requestType_; - } - if (((from_bitField0_ & 0x00000002) != 0)) { - result.uniqiueId_ = uniqiueId_; - } - } + public interface ExtensionRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:org.opensearch.extensions.proto.ExtensionRequest) + com.google.protobuf.MessageOrBuilder { - @java.lang.Override - public Builder clone() { - return super.clone(); - } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The enum numeric value on the wire for requestType. + */ + int getRequestTypeValue(); + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The requestType. + */ + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType(); - @java.lang.Override - public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } + /** + * optional string uniqiueId = 2; + * @return Whether the uniqiueId field is set. + */ + boolean hasUniqiueId(); + /** + * optional string uniqiueId = 2; + * @return The uniqiueId. + */ + java.lang.String getUniqiueId(); + /** + * optional string uniqiueId = 2; + * @return The bytes for uniqiueId. + */ + com.google.protobuf.ByteString + getUniqiueIdBytes(); + } + /** + * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} + */ + public static final class ExtensionRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:org.opensearch.extensions.proto.ExtensionRequest) + ExtensionRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExtensionRequest.newBuilder() to construct. + private ExtensionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ExtensionRequest() { + requestType_ = 0; + uniqiueId_ = ""; + } - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ExtensionRequest(); + } - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + } - @java.lang.Override - public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class); + } - @java.lang.Override - public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } + private int bitField0_; + public static final int REQUESTTYPE_FIELD_NUMBER = 1; + private int requestType_ = 0; + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The enum numeric value on the wire for requestType. + */ + @java.lang.Override public int getRequestTypeValue() { + return requestType_; + } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The requestType. + */ + @java.lang.Override public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); + return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; + } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) { - return mergeFrom((org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } + public static final int UNIQIUEID_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object uniqiueId_ = ""; + /** + * optional string uniqiueId = 2; + * @return Whether the uniqiueId field is set. + */ + @java.lang.Override + public boolean hasUniqiueId() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * optional string uniqiueId = 2; + * @return The uniqiueId. + */ + @java.lang.Override + public java.lang.String getUniqiueId() { + java.lang.Object ref = uniqiueId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uniqiueId_ = s; + return s; + } + } + /** + * optional string uniqiueId = 2; + * @return The bytes for uniqiueId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUniqiueIdBytes() { + java.lang.Object ref = uniqiueId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + uniqiueId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } - public Builder mergeFrom(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other) { - if (other == org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance()) return this; - if (other.requestType_ != 0) { - setRequestTypeValue(other.getRequestTypeValue()); - } - if (!other.getUniqiueId().isEmpty()) { - uniqiueId_ = other.uniqiueId_; - bitField0_ |= 0x00000002; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; - @java.lang.Override - public final boolean isInitialized() { - return true; - } + memoizedIsInitialized = 1; + return true; + } - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - requestType_ = input.readEnum(); - bitField0_ |= 0x00000001; - break; - } // case 8 - case 18: { - uniqiueId_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000002; - break; - } // case 18 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE.getNumber()) { + output.writeEnum(1, requestType_); + } + if (((bitField0_ & 0x00000001) != 0)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uniqiueId_); + } + getUnknownFields().writeTo(output); + } - private int bitField0_; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, requestType_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uniqiueId_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } - private int requestType_ = 0; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest)) { + return super.equals(obj); + } + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other = (org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) obj; + + if (requestType_ != other.requestType_) return false; + if (hasUniqiueId() != other.hasUniqiueId()) return false; + if (hasUniqiueId()) { + if (!getUniqiueId() + .equals(other.getUniqiueId())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The enum numeric value on the wire for requestType. - */ - @java.lang.Override - public int getRequestTypeValue() { - return requestType_; - } + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + REQUESTTYPE_FIELD_NUMBER; + hash = (53 * hash) + requestType_; + if (hasUniqiueId()) { + hash = (37 * hash) + UNIQIUEID_FIELD_NUMBER; + hash = (53 * hash) + getUniqiueId().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @param value The enum numeric value on the wire for requestType to set. - * @return This builder for chaining. - */ - public Builder setRequestTypeValue(int value) { - requestType_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The requestType. - */ - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); - return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; - } + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @param value The requestType to set. - * @return This builder for chaining. - */ - public Builder setRequestType(org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType value) { - if (value == null) { - throw new NullPointerException(); - } + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:org.opensearch.extensions.proto.ExtensionRequest) + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class); + } + + // Construct using org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + requestType_ = 0; + uniqiueId_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest build() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest buildPartial() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.requestType_ = requestType_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.uniqiueId_ = uniqiueId_; + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) { + return mergeFrom((org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other) { + if (other == org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance()) return this; + if (other.requestType_ != 0) { + setRequestTypeValue(other.getRequestTypeValue()); + } + if (other.hasUniqiueId()) { + uniqiueId_ = other.uniqiueId_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + requestType_ = input.readEnum(); bitField0_ |= 0x00000001; - requestType_ = value.getNumber(); - onChanged(); - return this; - } - - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return This builder for chaining. - */ - public Builder clearRequestType() { - bitField0_ = (bitField0_ & ~0x00000001); - requestType_ = 0; - onChanged(); - return this; - } - - private java.lang.Object uniqiueId_ = ""; - - /** - * string uniqiueId = 2; - * @return The uniqiueId. - */ - public java.lang.String getUniqiueId() { - java.lang.Object ref = uniqiueId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uniqiueId_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * string uniqiueId = 2; - * @return The bytes for uniqiueId. - */ - public com.google.protobuf.ByteString getUniqiueIdBytes() { - java.lang.Object ref = uniqiueId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - uniqiueId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * string uniqiueId = 2; - * @param value The uniqiueId to set. - * @return This builder for chaining. - */ - public Builder setUniqiueId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - uniqiueId_ = value; + break; + } // case 8 + case 18: { + uniqiueId_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - /** - * string uniqiueId = 2; - * @return This builder for chaining. - */ - public Builder clearUniqiueId() { - uniqiueId_ = getDefaultInstance().getUniqiueId(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - - /** - * string uniqiueId = 2; - * @param value The bytes for uniqiueId to set. - * @return This builder for chaining. - */ - public Builder setUniqiueIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag } - checkByteStringIsUtf8(value); - uniqiueId_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:org.opensearch.extensions.proto.ExtensionRequest) - } - - // @@protoc_insertion_point(class_scope:org.opensearch.extensions.proto.ExtensionRequest) - private static final org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser< - ExtensionRequest>() { - @java.lang.Override - public ExtensionRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private int requestType_ = 0; + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The enum numeric value on the wire for requestType. + */ + @java.lang.Override public int getRequestTypeValue() { + return requestType_; + } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @param value The enum numeric value on the wire for requestType to set. + * @return This builder for chaining. + */ + public Builder setRequestTypeValue(int value) { + requestType_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The requestType. + */ + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); + return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; + } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @param value The requestType to set. + * @return This builder for chaining. + */ + public Builder setRequestType(org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + requestType_ = value.getNumber(); + onChanged(); + return this; + } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return This builder for chaining. + */ + public Builder clearRequestType() { + bitField0_ = (bitField0_ & ~0x00000001); + requestType_ = 0; + onChanged(); + return this; + } + + private java.lang.Object uniqiueId_ = ""; + /** + * optional string uniqiueId = 2; + * @return Whether the uniqiueId field is set. + */ + public boolean hasUniqiueId() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * optional string uniqiueId = 2; + * @return The uniqiueId. + */ + public java.lang.String getUniqiueId() { + java.lang.Object ref = uniqiueId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uniqiueId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string uniqiueId = 2; + * @return The bytes for uniqiueId. + */ + public com.google.protobuf.ByteString + getUniqiueIdBytes() { + java.lang.Object ref = uniqiueId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + uniqiueId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string uniqiueId = 2; + * @param value The uniqiueId to set. + * @return This builder for chaining. + */ + public Builder setUniqiueId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + uniqiueId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * optional string uniqiueId = 2; + * @return This builder for chaining. + */ + public Builder clearUniqiueId() { + uniqiueId_ = getDefaultInstance().getUniqiueId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * optional string uniqiueId = 2; + * @param value The bytes for uniqiueId to set. + * @return This builder for chaining. + */ + public Builder setUniqiueIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + uniqiueId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:org.opensearch.extensions.proto.ExtensionRequest) + } - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } + // @@protoc_insertion_point(class_scope:org.opensearch.extensions.proto.ExtensionRequest) + private static final org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(); + } - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ExtensionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; } - private static final com.google.protobuf.Descriptors.Descriptor internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable; + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } - public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { - return descriptor; + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; } - private static com.google.protobuf.Descriptors.FileDescriptor descriptor; - static { - java.lang.String[] descriptorData = { - "\nKserver/src/main/java/org/opensearch/ex" - + "tensions/proto/ExtensionRequest.proto\022\037o" - + "rg.opensearch.extensions.proto\"h\n\020Extens" - + "ionRequest\022A\n\013requestType\030\001 \001(\0162,.org.op" - + "ensearch.extensions.proto.RequestType\022\021\n" - + "\tuniqiueId\030\002 \001(\t*\307\002\n\013RequestType\022#\n\037REQU" - + "EST_EXTENSION_CLUSTER_STATE\020\000\022&\n\"REQUEST" - + "_EXTENSION_CLUSTER_SETTINGS\020\001\022+\n\'REQUEST" - + "_EXTENSION_REGISTER_REST_ACTIONS\020\002\022\'\n#RE" - + "QUEST_EXTENSION_REGISTER_SETTINGS\020\003\022*\n&R" - + "EQUEST_EXTENSION_ENVIRONMENT_SETTINGS\020\004\022" - + ",\n(REQUEST_EXTENSION_DEPENDENCY_INFORMAT" - + "ION\020\005\022\024\n\020CREATE_COMPONENT\020\006\022\023\n\017ON_INDEX_" - + "MODULE\020\007\022\020\n\014GET_SETTINGS\020\010b\006proto3" }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( - descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] {} - ); - internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor = getDescriptor().getMessageTypes().get(0); - internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor, - new java.lang.String[] { "RequestType", "UniqiueId", } - ); - } - - // @@protoc_insertion_point(outer_class_scope) + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\nKserver/src/main/java/org/opensearch/ex" + + "tensions/proto/ExtensionRequest.proto\022\037o" + + "rg.opensearch.extensions.proto\"{\n\020Extens" + + "ionRequest\022A\n\013requestType\030\001 \001(\0162,.org.op" + + "ensearch.extensions.proto.RequestType\022\026\n" + + "\tuniqiueId\030\002 \001(\tH\000\210\001\001B\014\n\n_uniqiueId*\307\002\n\013" + + "RequestType\022#\n\037REQUEST_EXTENSION_CLUSTER" + + "_STATE\020\000\022&\n\"REQUEST_EXTENSION_CLUSTER_SE" + + "TTINGS\020\001\022+\n\'REQUEST_EXTENSION_REGISTER_R" + + "EST_ACTIONS\020\002\022\'\n#REQUEST_EXTENSION_REGIS" + + "TER_SETTINGS\020\003\022*\n&REQUEST_EXTENSION_ENVI" + + "RONMENT_SETTINGS\020\004\022,\n(REQUEST_EXTENSION_" + + "DEPENDENCY_INFORMATION\020\005\022\024\n\020CREATE_COMPO" + + "NENT\020\006\022\023\n\017ON_INDEX_MODULE\020\007\022\020\n\014GET_SETTI" + + "NGS\020\010b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor, + new java.lang.String[] { "RequestType", "UniqiueId", "UniqiueId", }); + } + + // @@protoc_insertion_point(outer_class_scope) } From 4b4c9e2ed61c5bccefed8ee067ff238bf8442862 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Mon, 3 Apr 2023 17:05:39 -0700 Subject: [PATCH 04/18] Fixing precommit Signed-off-by: Sarat Vemulapalli --- server/build.gradle | 9 + .../extensions/proto/ExtensionRequest.proto | 11 + .../proto/ExtensionRequestOuterClass.java | 1771 +++++++++-------- 3 files changed, 922 insertions(+), 869 deletions(-) diff --git a/server/build.gradle b/server/build.gradle index 1f1ccbcac0ac9..74db50735766c 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -307,6 +307,15 @@ tasks.named("thirdPartyAudit").configure { 'com.google.common.geometry.S2$Metric', 'com.google.common.geometry.S2LatLng' ) + ignoreViolations( + 'com.google.protobuf.MessageSchema', + 'com.google.protobuf.UnsafeUtil', + 'com.google.protobuf.UnsafeUtil$1', + 'com.google.protobuf.UnsafeUtil$Android32MemoryAccessor', + 'com.google.protobuf.UnsafeUtil$Android64MemoryAccessor', + 'com.google.protobuf.UnsafeUtil$JvmMemoryAccessor', + 'com.google.protobuf.UnsafeUtil$MemoryAccessor' + ) } tasks.named("dependencyLicenses").configure { diff --git a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto index 70f03d52bc283..08e50d7e721fc 100644 --- a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto +++ b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto @@ -1,3 +1,14 @@ +/* + * 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. + * + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + syntax = "proto3"; package org.opensearch.extensions.proto; diff --git a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java index 4ded39f1a9115..b2db588ce7154 100644 --- a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java +++ b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java @@ -1,3 +1,14 @@ +/* + * 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. + * + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + // Generated by the protocol buffer compiler. DO NOT EDIT! // source: server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto @@ -7,917 +18,939 @@ - * ExtensionRequest class autogenerated from ExtensionRequest.proto - */ public final class ExtensionRequestOuterClass { - private ExtensionRequestOuterClass() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - /** - * Protobuf enum {@code org.opensearch.extensions.proto.RequestType} - */ - public enum RequestType - implements com.google.protobuf.ProtocolMessageEnum { - /** - * REQUEST_EXTENSION_CLUSTER_STATE = 0; - */ - REQUEST_EXTENSION_CLUSTER_STATE(0), - /** - * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; - */ - REQUEST_EXTENSION_CLUSTER_SETTINGS(1), - /** - * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; - */ - REQUEST_EXTENSION_REGISTER_REST_ACTIONS(2), - /** - * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; - */ - REQUEST_EXTENSION_REGISTER_SETTINGS(3), - /** - * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; - */ - REQUEST_EXTENSION_ENVIRONMENT_SETTINGS(4), - /** - * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; - */ - REQUEST_EXTENSION_DEPENDENCY_INFORMATION(5), - /** - * CREATE_COMPONENT = 6; - */ - CREATE_COMPONENT(6), - /** - * ON_INDEX_MODULE = 7; - */ - ON_INDEX_MODULE(7), - /** - * GET_SETTINGS = 8; - */ - GET_SETTINGS(8), - UNRECOGNIZED(-1), - ; - - /** - * REQUEST_EXTENSION_CLUSTER_STATE = 0; - */ - public static final int REQUEST_EXTENSION_CLUSTER_STATE_VALUE = 0; - /** - * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; - */ - public static final int REQUEST_EXTENSION_CLUSTER_SETTINGS_VALUE = 1; - /** - * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; - */ - public static final int REQUEST_EXTENSION_REGISTER_REST_ACTIONS_VALUE = 2; - /** - * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; - */ - public static final int REQUEST_EXTENSION_REGISTER_SETTINGS_VALUE = 3; - /** - * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; - */ - public static final int REQUEST_EXTENSION_ENVIRONMENT_SETTINGS_VALUE = 4; - /** - * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; - */ - public static final int REQUEST_EXTENSION_DEPENDENCY_INFORMATION_VALUE = 5; - /** - * CREATE_COMPONENT = 6; - */ - public static final int CREATE_COMPONENT_VALUE = 6; - /** - * ON_INDEX_MODULE = 7; - */ - public static final int ON_INDEX_MODULE_VALUE = 7; - /** - * GET_SETTINGS = 8; - */ - public static final int GET_SETTINGS_VALUE = 8; + private ExtensionRequestOuterClass() {} + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); } /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. + * Protobuf enum {@code org.opensearch.extensions.proto.RequestType} */ - @java.lang.Deprecated - public static RequestType valueOf(int value) { - return forNumber(value); - } + public enum RequestType implements com.google.protobuf.ProtocolMessageEnum { + /** + * REQUEST_EXTENSION_CLUSTER_STATE = 0; + */ + REQUEST_EXTENSION_CLUSTER_STATE(0), + /** + * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; + */ + REQUEST_EXTENSION_CLUSTER_SETTINGS(1), + /** + * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; + */ + REQUEST_EXTENSION_REGISTER_REST_ACTIONS(2), + /** + * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; + */ + REQUEST_EXTENSION_REGISTER_SETTINGS(3), + /** + * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; + */ + REQUEST_EXTENSION_ENVIRONMENT_SETTINGS(4), + /** + * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; + */ + REQUEST_EXTENSION_DEPENDENCY_INFORMATION(5), + /** + * CREATE_COMPONENT = 6; + */ + CREATE_COMPONENT(6), + /** + * ON_INDEX_MODULE = 7; + */ + ON_INDEX_MODULE(7), + /** + * GET_SETTINGS = 8; + */ + GET_SETTINGS(8), + UNRECOGNIZED(-1),; + + /** + * REQUEST_EXTENSION_CLUSTER_STATE = 0; + */ + public static final int REQUEST_EXTENSION_CLUSTER_STATE_VALUE = 0; + /** + * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; + */ + public static final int REQUEST_EXTENSION_CLUSTER_SETTINGS_VALUE = 1; + /** + * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; + */ + public static final int REQUEST_EXTENSION_REGISTER_REST_ACTIONS_VALUE = 2; + /** + * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; + */ + public static final int REQUEST_EXTENSION_REGISTER_SETTINGS_VALUE = 3; + /** + * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; + */ + public static final int REQUEST_EXTENSION_ENVIRONMENT_SETTINGS_VALUE = 4; + /** + * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; + */ + public static final int REQUEST_EXTENSION_DEPENDENCY_INFORMATION_VALUE = 5; + /** + * CREATE_COMPONENT = 6; + */ + public static final int CREATE_COMPONENT_VALUE = 6; + /** + * ON_INDEX_MODULE = 7; + */ + public static final int ON_INDEX_MODULE_VALUE = 7; + /** + * GET_SETTINGS = 8; + */ + public static final int GET_SETTINGS_VALUE = 8; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException("Can't get the number of an unknown enum value."); + } + return value; + } - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static RequestType forNumber(int value) { - switch (value) { - case 0: return REQUEST_EXTENSION_CLUSTER_STATE; - case 1: return REQUEST_EXTENSION_CLUSTER_SETTINGS; - case 2: return REQUEST_EXTENSION_REGISTER_REST_ACTIONS; - case 3: return REQUEST_EXTENSION_REGISTER_SETTINGS; - case 4: return REQUEST_EXTENSION_ENVIRONMENT_SETTINGS; - case 5: return REQUEST_EXTENSION_DEPENDENCY_INFORMATION; - case 6: return CREATE_COMPONENT; - case 7: return ON_INDEX_MODULE; - case 8: return GET_SETTINGS; - default: return null; - } - } + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static RequestType valueOf(int value) { + return forNumber(value); + } - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static final com.google.protobuf.Internal.EnumLiteMap< - RequestType> internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public RequestType findValueByNumber(int number) { - return RequestType.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.getDescriptor().getEnumTypes().get(0); - } + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static RequestType forNumber(int value) { + switch (value) { + case 0: + return REQUEST_EXTENSION_CLUSTER_STATE; + case 1: + return REQUEST_EXTENSION_CLUSTER_SETTINGS; + case 2: + return REQUEST_EXTENSION_REGISTER_REST_ACTIONS; + case 3: + return REQUEST_EXTENSION_REGISTER_SETTINGS; + case 4: + return REQUEST_EXTENSION_ENVIRONMENT_SETTINGS; + case 5: + return REQUEST_EXTENSION_DEPENDENCY_INFORMATION; + case 6: + return CREATE_COMPONENT; + case 7: + return ON_INDEX_MODULE; + case 8: + return GET_SETTINGS; + default: + return null; + } + } - private static final RequestType[] VALUES = values(); - - public static RequestType valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } - private final int value; + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public RequestType findValueByNumber(int number) { + return RequestType.forNumber(number); + } + }; - private RequestType(int value) { - this.value = value; - } + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException("Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } - // @@protoc_insertion_point(enum_scope:org.opensearch.extensions.proto.RequestType) - } + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } - public interface ExtensionRequestOrBuilder extends - // @@protoc_insertion_point(interface_extends:org.opensearch.extensions.proto.ExtensionRequest) - com.google.protobuf.MessageOrBuilder { + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.getDescriptor().getEnumTypes().get(0); + } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The enum numeric value on the wire for requestType. - */ - int getRequestTypeValue(); - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The requestType. - */ - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType(); + private static final RequestType[] VALUES = values(); - /** - * optional string uniqiueId = 2; - * @return Whether the uniqiueId field is set. - */ - boolean hasUniqiueId(); - /** - * optional string uniqiueId = 2; - * @return The uniqiueId. - */ - java.lang.String getUniqiueId(); - /** - * optional string uniqiueId = 2; - * @return The bytes for uniqiueId. - */ - com.google.protobuf.ByteString - getUniqiueIdBytes(); - } - /** - * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} - */ - public static final class ExtensionRequest extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:org.opensearch.extensions.proto.ExtensionRequest) - ExtensionRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use ExtensionRequest.newBuilder() to construct. - private ExtensionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private ExtensionRequest() { - requestType_ = 0; - uniqiueId_ = ""; - } + public static RequestType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new ExtensionRequest(); - } + private final int value; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - } + private RequestType(int value) { + this.value = value; + } - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class); + // @@protoc_insertion_point(enum_scope:org.opensearch.extensions.proto.RequestType) } - private int bitField0_; - public static final int REQUESTTYPE_FIELD_NUMBER = 1; - private int requestType_ = 0; - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The enum numeric value on the wire for requestType. - */ - @java.lang.Override public int getRequestTypeValue() { - return requestType_; - } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The requestType. - */ - @java.lang.Override public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); - return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; - } + public interface ExtensionRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:org.opensearch.extensions.proto.ExtensionRequest) + com.google.protobuf.MessageOrBuilder { - public static final int UNIQIUEID_FIELD_NUMBER = 2; - @SuppressWarnings("serial") - private volatile java.lang.Object uniqiueId_ = ""; - /** - * optional string uniqiueId = 2; - * @return Whether the uniqiueId field is set. - */ - @java.lang.Override - public boolean hasUniqiueId() { - return ((bitField0_ & 0x00000001) != 0); - } - /** - * optional string uniqiueId = 2; - * @return The uniqiueId. - */ - @java.lang.Override - public java.lang.String getUniqiueId() { - java.lang.Object ref = uniqiueId_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uniqiueId_ = s; - return s; - } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The enum numeric value on the wire for requestType. + */ + int getRequestTypeValue(); + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The requestType. + */ + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType(); + + /** + * optional string uniqiueId = 2; + * @return Whether the uniqiueId field is set. + */ + boolean hasUniqiueId(); + + /** + * optional string uniqiueId = 2; + * @return The uniqiueId. + */ + java.lang.String getUniqiueId(); + + /** + * optional string uniqiueId = 2; + * @return The bytes for uniqiueId. + */ + com.google.protobuf.ByteString getUniqiueIdBytes(); } + /** - * optional string uniqiueId = 2; - * @return The bytes for uniqiueId. + * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} */ - @java.lang.Override - public com.google.protobuf.ByteString - getUniqiueIdBytes() { - java.lang.Object ref = uniqiueId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - uniqiueId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } + public static final class ExtensionRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:org.opensearch.extensions.proto.ExtensionRequest) + ExtensionRequestOrBuilder { + private static final long serialVersionUID = 0L; + + // Use ExtensionRequest.newBuilder() to construct. + private ExtensionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; + private ExtensionRequest() { + requestType_ = 0; + uniqiueId_ = ""; + } - memoizedIsInitialized = 1; - return true; - } + @java.lang.Override + @SuppressWarnings({ "unused" }) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ExtensionRequest(); + } - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE.getNumber()) { - output.writeEnum(1, requestType_); - } - if (((bitField0_ & 0x00000001) != 0)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uniqiueId_); - } - getUnknownFields().writeTo(output); - } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE.getNumber()) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, requestType_); - } - if (((bitField0_ & 0x00000001) != 0)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uniqiueId_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + } - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest)) { - return super.equals(obj); - } - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other = (org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) obj; - - if (requestType_ != other.requestType_) return false; - if (hasUniqiueId() != other.hasUniqiueId()) return false; - if (hasUniqiueId()) { - if (!getUniqiueId() - .equals(other.getUniqiueId())) return false; - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class + ); + } - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + REQUESTTYPE_FIELD_NUMBER; - hash = (53 * hash) + requestType_; - if (hasUniqiueId()) { - hash = (37 * hash) + UNIQIUEID_FIELD_NUMBER; - hash = (53 * hash) + getUniqiueId().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } + private int bitField0_; + public static final int REQUESTTYPE_FIELD_NUMBER = 1; + private int requestType_ = 0; + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The enum numeric value on the wire for requestType. + */ + @java.lang.Override + public int getRequestTypeValue() { + return requestType_; + } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The requestType. + */ + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); + return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; + } - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } + public static final int UNIQIUEID_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object uniqiueId_ = ""; + + /** + * optional string uniqiueId = 2; + * @return Whether the uniqiueId field is set. + */ + @java.lang.Override + public boolean hasUniqiueId() { + return ((bitField0_ & 0x00000001) != 0); + } - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:org.opensearch.extensions.proto.ExtensionRequest) - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class); - } - - // Construct using org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.newBuilder() - private Builder() { - - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - - } - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - requestType_ = 0; - uniqiueId_ = ""; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - } - - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance(); - } - - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest build() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest buildPartial() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(this); - if (bitField0_ != 0) { buildPartial0(result); } - onBuilt(); - return result; - } - - private void buildPartial0(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.requestType_ = requestType_; - } - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000002) != 0)) { - result.uniqiueId_ = uniqiueId_; - to_bitField0_ |= 0x00000001; - } - result.bitField0_ |= to_bitField0_; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) { - return mergeFrom((org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other) { - if (other == org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance()) return this; - if (other.requestType_ != 0) { - setRequestTypeValue(other.getRequestTypeValue()); - } - if (other.hasUniqiueId()) { - uniqiueId_ = other.uniqiueId_; - bitField0_ |= 0x00000002; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - requestType_ = input.readEnum(); + /** + * optional string uniqiueId = 2; + * @return The uniqiueId. + */ + @java.lang.Override + public java.lang.String getUniqiueId() { + java.lang.Object ref = uniqiueId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uniqiueId_ = s; + return s; + } + } + + /** + * optional string uniqiueId = 2; + * @return The bytes for uniqiueId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUniqiueIdBytes() { + java.lang.Object ref = uniqiueId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uniqiueId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE + .getNumber()) { + output.writeEnum(1, requestType_); + } + if (((bitField0_ & 0x00000001) != 0)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uniqiueId_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, requestType_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uniqiueId_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest)) { + return super.equals(obj); + } + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other = + (org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) obj; + + if (requestType_ != other.requestType_) return false; + if (hasUniqiueId() != other.hasUniqiueId()) return false; + if (hasUniqiueId()) { + if (!getUniqiueId().equals(other.getUniqiueId())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + REQUESTTYPE_FIELD_NUMBER; + hash = (53 * hash) + requestType_; + if (hasUniqiueId()) { + hash = (37 * hash) + UNIQIUEID_FIELD_NUMBER; + hash = (53 * hash) + getUniqiueId().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.ByteString data + ) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom( + java.io.InputStream input + ) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.CodedInputStream input + ) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:org.opensearch.extensions.proto.ExtensionRequest) + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class + ); + } + + // Construct using org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.newBuilder() + private Builder() { + + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + requestType_ = 0; + uniqiueId_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { + return org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest build() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest buildPartial() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = + new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.requestType_ = requestType_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.uniqiueId_ = uniqiueId_; + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) { + return mergeFrom((org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other) { + if (other == org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance()) return this; + if (other.requestType_ != 0) { + setRequestTypeValue(other.getRequestTypeValue()); + } + if (other.hasUniqiueId()) { + uniqiueId_ = other.uniqiueId_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + requestType_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: { + uniqiueId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int requestType_ = 0; + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The enum numeric value on the wire for requestType. + */ + @java.lang.Override + public int getRequestTypeValue() { + return requestType_; + } + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @param value The enum numeric value on the wire for requestType to set. + * @return This builder for chaining. + */ + public Builder setRequestTypeValue(int value) { + requestType_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return The requestType. + */ + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = + org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); + return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; + } + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @param value The requestType to set. + * @return This builder for chaining. + */ + public Builder setRequestType(org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType value) { + if (value == null) { + throw new NullPointerException(); + } bitField0_ |= 0x00000001; - break; - } // case 8 - case 18: { - uniqiueId_ = input.readStringRequireUtf8(); + requestType_ = value.getNumber(); + onChanged(); + return this; + } + + /** + * .org.opensearch.extensions.proto.RequestType requestType = 1; + * @return This builder for chaining. + */ + public Builder clearRequestType() { + bitField0_ = (bitField0_ & ~0x00000001); + requestType_ = 0; + onChanged(); + return this; + } + + private java.lang.Object uniqiueId_ = ""; + + /** + * optional string uniqiueId = 2; + * @return Whether the uniqiueId field is set. + */ + public boolean hasUniqiueId() { + return ((bitField0_ & 0x00000002) != 0); + } + + /** + * optional string uniqiueId = 2; + * @return The uniqiueId. + */ + public java.lang.String getUniqiueId() { + java.lang.Object ref = uniqiueId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uniqiueId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * optional string uniqiueId = 2; + * @return The bytes for uniqiueId. + */ + public com.google.protobuf.ByteString getUniqiueIdBytes() { + java.lang.Object ref = uniqiueId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uniqiueId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * optional string uniqiueId = 2; + * @param value The uniqiueId to set. + * @return This builder for chaining. + */ + public Builder setUniqiueId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + uniqiueId_ = value; bitField0_ |= 0x00000002; - break; - } // case 18 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag + onChanged(); + return this; + } + + /** + * optional string uniqiueId = 2; + * @return This builder for chaining. + */ + public Builder clearUniqiueId() { + uniqiueId_ = getDefaultInstance().getUniqiueId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * optional string uniqiueId = 2; + * @param value The bytes for uniqiueId to set. + * @return This builder for chaining. + */ + public Builder setUniqiueIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - private int bitField0_; - - private int requestType_ = 0; - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The enum numeric value on the wire for requestType. - */ - @java.lang.Override public int getRequestTypeValue() { - return requestType_; - } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @param value The enum numeric value on the wire for requestType to set. - * @return This builder for chaining. - */ - public Builder setRequestTypeValue(int value) { - requestType_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The requestType. - */ - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); - return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; - } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @param value The requestType to set. - * @return This builder for chaining. - */ - public Builder setRequestType(org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - requestType_ = value.getNumber(); - onChanged(); - return this; - } - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return This builder for chaining. - */ - public Builder clearRequestType() { - bitField0_ = (bitField0_ & ~0x00000001); - requestType_ = 0; - onChanged(); - return this; - } - - private java.lang.Object uniqiueId_ = ""; - /** - * optional string uniqiueId = 2; - * @return Whether the uniqiueId field is set. - */ - public boolean hasUniqiueId() { - return ((bitField0_ & 0x00000002) != 0); - } - /** - * optional string uniqiueId = 2; - * @return The uniqiueId. - */ - public java.lang.String getUniqiueId() { - java.lang.Object ref = uniqiueId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uniqiueId_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * optional string uniqiueId = 2; - * @return The bytes for uniqiueId. - */ - public com.google.protobuf.ByteString - getUniqiueIdBytes() { - java.lang.Object ref = uniqiueId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - uniqiueId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string uniqiueId = 2; - * @param value The uniqiueId to set. - * @return This builder for chaining. - */ - public Builder setUniqiueId( - java.lang.String value) { - if (value == null) { throw new NullPointerException(); } - uniqiueId_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - /** - * optional string uniqiueId = 2; - * @return This builder for chaining. - */ - public Builder clearUniqiueId() { - uniqiueId_ = getDefaultInstance().getUniqiueId(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - /** - * optional string uniqiueId = 2; - * @param value The bytes for uniqiueId to set. - * @return This builder for chaining. - */ - public Builder setUniqiueIdBytes( - com.google.protobuf.ByteString value) { - if (value == null) { throw new NullPointerException(); } - checkByteStringIsUtf8(value); - uniqiueId_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:org.opensearch.extensions.proto.ExtensionRequest) - } + checkByteStringIsUtf8(value); + uniqiueId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } - // @@protoc_insertion_point(class_scope:org.opensearch.extensions.proto.ExtensionRequest) - private static final org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(); - } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ExtensionRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } + // @@protoc_insertion_point(builder_scope:org.opensearch.extensions.proto.ExtensionRequest) + } + + // @@protoc_insertion_point(class_scope:org.opensearch.extensions.proto.ExtensionRequest) + private static final org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(); + } + + public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser< + ExtensionRequest>() { + @java.lang.Override + public ExtensionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry + ) throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; } - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; + private static final com.google.protobuf.Descriptors.Descriptor internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; + private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; } - } - - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\nKserver/src/main/java/org/opensearch/ex" + - "tensions/proto/ExtensionRequest.proto\022\037o" + - "rg.opensearch.extensions.proto\"{\n\020Extens" + - "ionRequest\022A\n\013requestType\030\001 \001(\0162,.org.op" + - "ensearch.extensions.proto.RequestType\022\026\n" + - "\tuniqiueId\030\002 \001(\tH\000\210\001\001B\014\n\n_uniqiueId*\307\002\n\013" + - "RequestType\022#\n\037REQUEST_EXTENSION_CLUSTER" + - "_STATE\020\000\022&\n\"REQUEST_EXTENSION_CLUSTER_SE" + - "TTINGS\020\001\022+\n\'REQUEST_EXTENSION_REGISTER_R" + - "EST_ACTIONS\020\002\022\'\n#REQUEST_EXTENSION_REGIS" + - "TER_SETTINGS\020\003\022*\n&REQUEST_EXTENSION_ENVI" + - "RONMENT_SETTINGS\020\004\022,\n(REQUEST_EXTENSION_" + - "DEPENDENCY_INFORMATION\020\005\022\024\n\020CREATE_COMPO" + - "NENT\020\006\022\023\n\017ON_INDEX_MODULE\020\007\022\020\n\014GET_SETTI" + - "NGS\020\010b\006proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }); - internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor, - new java.lang.String[] { "RequestType", "UniqiueId", "UniqiueId", }); - } - - // @@protoc_insertion_point(outer_class_scope) + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + static { + java.lang.String[] descriptorData = { + "\nKserver/src/main/java/org/opensearch/ex" + + "tensions/proto/ExtensionRequest.proto\022\037o" + + "rg.opensearch.extensions.proto\"{\n\020Extens" + + "ionRequest\022A\n\013requestType\030\001 \001(\0162,.org.op" + + "ensearch.extensions.proto.RequestType\022\026\n" + + "\tuniqiueId\030\002 \001(\tH\000\210\001\001B\014\n\n_uniqiueId*\307\002\n\013" + + "RequestType\022#\n\037REQUEST_EXTENSION_CLUSTER" + + "_STATE\020\000\022&\n\"REQUEST_EXTENSION_CLUSTER_SE" + + "TTINGS\020\001\022+\n\'REQUEST_EXTENSION_REGISTER_R" + + "EST_ACTIONS\020\002\022\'\n#REQUEST_EXTENSION_REGIS" + + "TER_SETTINGS\020\003\022*\n&REQUEST_EXTENSION_ENVI" + + "RONMENT_SETTINGS\020\004\022,\n(REQUEST_EXTENSION_" + + "DEPENDENCY_INFORMATION\020\005\022\024\n\020CREATE_COMPO" + + "NENT\020\006\022\023\n\017ON_INDEX_MODULE\020\007\022\020\n\014GET_SETTI" + + "NGS\020\010b\006proto3" }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] {} + ); + internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor = getDescriptor().getMessageTypes().get(0); + internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor, + new java.lang.String[] { "RequestType", "UniqiueId", "UniqiueId", } + ); + } + + // @@protoc_insertion_point(outer_class_scope) } From f1940e074e3cb546f9e7cb1176a18c1e721d5eb8 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Mon, 3 Apr 2023 17:10:37 -0700 Subject: [PATCH 05/18] Adding Changelog Signed-off-by: Sarat Vemulapalli --- CHANGELOG.md | 1 + server/build.gradle | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0ded8bd0fe36..152b14d77f0d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,6 +88,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Enable sort optimization for all NumericTypes ([#6464](https://github.com/opensearch-project/OpenSearch/pull/6464) - Remove 'cluster_manager' role attachment when using 'node.master' deprecated setting ([#6331](https://github.com/opensearch-project/OpenSearch/pull/6331)) - Add new cluster settings to ignore weighted round-robin routing and fallback to default behaviour. ([#6834](https://github.com/opensearch-project/OpenSearch/pull/6834)) +- [Extensions] Moving Extensions APIs to protobuf serialization. ([#6960](https://github.com/opensearch-project/OpenSearch/pull/6960)) ### Dependencies - Bump `org.apache.logging.log4j:log4j-core` from 2.18.0 to 2.20.0 ([#6490](https://github.com/opensearch-project/OpenSearch/pull/6490)) diff --git a/server/build.gradle b/server/build.gradle index 74db50735766c..ea0cf65bdf40c 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -139,7 +139,6 @@ dependencies { // protobuf api 'com.google.protobuf:protobuf-java:3.22.2' - testImplementation(project(":test:framework")) { // tests use the locally compiled version of server exclude group: 'org.opensearch', module: 'server' From 49a937a3148f7547253f2162bcb43996f1ffb5cc Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Mon, 3 Apr 2023 17:19:01 -0700 Subject: [PATCH 06/18] Removing old implementation Signed-off-by: Sarat Vemulapalli --- .../extensions/ExtensionsManager.java | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/server/src/main/java/org/opensearch/extensions/ExtensionsManager.java b/server/src/main/java/org/opensearch/extensions/ExtensionsManager.java index 954f87011578e..33ed6a2aa682b 100644 --- a/server/src/main/java/org/opensearch/extensions/ExtensionsManager.java +++ b/server/src/main/java/org/opensearch/extensions/ExtensionsManager.java @@ -94,26 +94,8 @@ public class ExtensionsManager { public static final String REQUEST_EXTENSION_HANDLE_REMOTE_TRANSPORT_ACTION = "internal:extensions/handle-remote-transportaction"; public static final String TRANSPORT_ACTION_REQUEST_FROM_EXTENSION = "internal:extensions/request-transportaction-from-extension"; public static final int EXTENSION_REQUEST_WAIT_TIMEOUT = 10; - private static final Logger logger = LogManager.getLogger(ExtensionsManager.class); - /** - * Enum for Extension Requests - * - * @opensearch.internal - */ - public static enum RequestType { - REQUEST_EXTENSION_CLUSTER_STATE, - REQUEST_EXTENSION_CLUSTER_SETTINGS, - REQUEST_EXTENSION_REGISTER_REST_ACTIONS, - REQUEST_EXTENSION_REGISTER_SETTINGS, - REQUEST_EXTENSION_ENVIRONMENT_SETTINGS, - REQUEST_EXTENSION_DEPENDENCY_INFORMATION, - CREATE_COMPONENT, - ON_INDEX_MODULE, - GET_SETTINGS - }; - /** * Enum for OpenSearch Requests * @@ -429,7 +411,7 @@ public String executor() { /** * Handles an {@link ExtensionRequest}. * - * @param extensionRequest The request to handle, of a type defined in the {@link RequestType} enum. + * @param extensionRequest The request to handle, of a type defined in the {@link org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType} enum. * @return an Response matching the request. * @throws Exception if the request is not handled properly. */ From cdc57189a48e227ed3adaab714cbedfab2d7316c Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Tue, 4 Apr 2023 16:54:58 -0700 Subject: [PATCH 07/18] Adding protobuf gradle plugin to generate classes during build Signed-off-by: Sarat Vemulapalli --- server/build.gradle | 4 + .../extensions/ExtensionRequest.java | 22 +- .../extensions/ExtensionsManager.java | 2 +- .../proto/ExtensionRequestOuterClass.java | 956 ------------------ .../extensions/proto/package-info.java | 10 - .../extensions/ExtensionRequestProto.proto} | 4 +- .../extensions/ExtensionsManagerTests.java | 15 +- 7 files changed, 25 insertions(+), 988 deletions(-) delete mode 100644 server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java delete mode 100644 server/src/main/java/org/opensearch/extensions/proto/package-info.java rename server/src/main/{java/org/opensearch/extensions/proto/ExtensionRequest.proto => proto/extensions/ExtensionRequestProto.proto} (89%) diff --git a/server/build.gradle b/server/build.gradle index ea0cf65bdf40c..129c6ac71f48c 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -30,6 +30,10 @@ import org.opensearch.gradle.info.BuildParams +plugins { + id('com.google.protobuf') version '0.8.19' +} + apply plugin: 'opensearch.build' apply plugin: 'com.netflix.nebula.optional-base' apply plugin: 'opensearch.publish' diff --git a/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java b/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java index 07e2f981198a6..07d055bf54d97 100644 --- a/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java +++ b/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java @@ -13,7 +13,7 @@ import org.opensearch.common.Nullable; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; -import org.opensearch.extensions.proto.ExtensionRequestOuterClass; +import org.opensearch.extensions.proto.ExtensionRequestProto; import org.opensearch.transport.TransportRequest; import java.io.IOException; @@ -26,23 +26,23 @@ */ public class ExtensionRequest extends TransportRequest { private static final Logger logger = LogManager.getLogger(ExtensionRequest.class); - private final ExtensionRequestOuterClass.ExtensionRequest request; + private final ExtensionRequestProto.ExtensionRequest request; - public ExtensionRequest(ExtensionRequestOuterClass.RequestType requestType) { + public ExtensionRequest(ExtensionRequestProto.RequestType requestType) { this(requestType, null); } - public ExtensionRequest(ExtensionRequestOuterClass.RequestType requestType, @Nullable String uniqueId) { - ExtensionRequestOuterClass.ExtensionRequest.Builder builder = ExtensionRequestOuterClass.ExtensionRequest.newBuilder(); + public ExtensionRequest(ExtensionRequestProto.RequestType requestType, @Nullable String uniqueId) { + ExtensionRequestProto.ExtensionRequest.Builder builder = ExtensionRequestProto.ExtensionRequest.newBuilder(); if (uniqueId != null) { - builder.setUniqiueId(uniqueId); + builder.setUniqueId(uniqueId); } this.request = builder.setRequestType(requestType).build(); } public ExtensionRequest(StreamInput in) throws IOException { super(in); - this.request = ExtensionRequestOuterClass.ExtensionRequest.parseFrom(in.readByteArray()); + this.request = ExtensionRequestProto.ExtensionRequest.parseFrom(in.readByteArray()); } @Override @@ -51,12 +51,12 @@ public void writeTo(StreamOutput out) throws IOException { out.writeByteArray(request.toByteArray()); } - public ExtensionRequestOuterClass.RequestType getRequestType() { + public ExtensionRequestProto.RequestType getRequestType() { return this.request.getRequestType(); } public String getUniqueId() { - return request.getUniqiueId(); + return request.getUniqueId(); } public String toString() { @@ -69,11 +69,11 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; ExtensionRequest that = (ExtensionRequest) o; return Objects.equals(request.getRequestType(), that.request.getRequestType()) - && Objects.equals(request.getUniqiueId(), that.request.getUniqiueId()); + && Objects.equals(request.getUniqueId(), that.request.getUniqueId()); } @Override public int hashCode() { - return Objects.hash(request.getRequestType(), request.getUniqiueId()); + return Objects.hash(request.getRequestType(), request.getUniqueId()); } } diff --git a/server/src/main/java/org/opensearch/extensions/ExtensionsManager.java b/server/src/main/java/org/opensearch/extensions/ExtensionsManager.java index 33ed6a2aa682b..2d432f28bd014 100644 --- a/server/src/main/java/org/opensearch/extensions/ExtensionsManager.java +++ b/server/src/main/java/org/opensearch/extensions/ExtensionsManager.java @@ -411,7 +411,7 @@ public String executor() { /** * Handles an {@link ExtensionRequest}. * - * @param extensionRequest The request to handle, of a type defined in the {@link org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType} enum. + * @param extensionRequest The request to handle, of a type defined in the {@link org.opensearch.extensions.proto.ExtensionRequestProto.RequestType} enum. * @return an Response matching the request. * @throws Exception if the request is not handled properly. */ diff --git a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java b/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java deleted file mode 100644 index b2db588ce7154..0000000000000 --- a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequestOuterClass.java +++ /dev/null @@ -1,956 +0,0 @@ -/* - * 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. - * - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto - -package org.opensearch.extensions.proto; - -/** - - * ExtensionRequest class autogenerated from ExtensionRequest.proto - - */ -public final class ExtensionRequestOuterClass { - private ExtensionRequestOuterClass() {} - - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} - - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); - } - - /** - * Protobuf enum {@code org.opensearch.extensions.proto.RequestType} - */ - public enum RequestType implements com.google.protobuf.ProtocolMessageEnum { - /** - * REQUEST_EXTENSION_CLUSTER_STATE = 0; - */ - REQUEST_EXTENSION_CLUSTER_STATE(0), - /** - * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; - */ - REQUEST_EXTENSION_CLUSTER_SETTINGS(1), - /** - * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; - */ - REQUEST_EXTENSION_REGISTER_REST_ACTIONS(2), - /** - * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; - */ - REQUEST_EXTENSION_REGISTER_SETTINGS(3), - /** - * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; - */ - REQUEST_EXTENSION_ENVIRONMENT_SETTINGS(4), - /** - * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; - */ - REQUEST_EXTENSION_DEPENDENCY_INFORMATION(5), - /** - * CREATE_COMPONENT = 6; - */ - CREATE_COMPONENT(6), - /** - * ON_INDEX_MODULE = 7; - */ - ON_INDEX_MODULE(7), - /** - * GET_SETTINGS = 8; - */ - GET_SETTINGS(8), - UNRECOGNIZED(-1),; - - /** - * REQUEST_EXTENSION_CLUSTER_STATE = 0; - */ - public static final int REQUEST_EXTENSION_CLUSTER_STATE_VALUE = 0; - /** - * REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; - */ - public static final int REQUEST_EXTENSION_CLUSTER_SETTINGS_VALUE = 1; - /** - * REQUEST_EXTENSION_REGISTER_REST_ACTIONS = 2; - */ - public static final int REQUEST_EXTENSION_REGISTER_REST_ACTIONS_VALUE = 2; - /** - * REQUEST_EXTENSION_REGISTER_SETTINGS = 3; - */ - public static final int REQUEST_EXTENSION_REGISTER_SETTINGS_VALUE = 3; - /** - * REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = 4; - */ - public static final int REQUEST_EXTENSION_ENVIRONMENT_SETTINGS_VALUE = 4; - /** - * REQUEST_EXTENSION_DEPENDENCY_INFORMATION = 5; - */ - public static final int REQUEST_EXTENSION_DEPENDENCY_INFORMATION_VALUE = 5; - /** - * CREATE_COMPONENT = 6; - */ - public static final int CREATE_COMPONENT_VALUE = 6; - /** - * ON_INDEX_MODULE = 7; - */ - public static final int ON_INDEX_MODULE_VALUE = 7; - /** - * GET_SETTINGS = 8; - */ - public static final int GET_SETTINGS_VALUE = 8; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException("Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static RequestType valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static RequestType forNumber(int value) { - switch (value) { - case 0: - return REQUEST_EXTENSION_CLUSTER_STATE; - case 1: - return REQUEST_EXTENSION_CLUSTER_SETTINGS; - case 2: - return REQUEST_EXTENSION_REGISTER_REST_ACTIONS; - case 3: - return REQUEST_EXTENSION_REGISTER_SETTINGS; - case 4: - return REQUEST_EXTENSION_ENVIRONMENT_SETTINGS; - case 5: - return REQUEST_EXTENSION_DEPENDENCY_INFORMATION; - case 6: - return CREATE_COMPONENT; - case 7: - return ON_INDEX_MODULE; - case 8: - return GET_SETTINGS; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public RequestType findValueByNumber(int number) { - return RequestType.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException("Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.getDescriptor().getEnumTypes().get(0); - } - - private static final RequestType[] VALUES = values(); - - public static RequestType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private RequestType(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:org.opensearch.extensions.proto.RequestType) - } - - public interface ExtensionRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:org.opensearch.extensions.proto.ExtensionRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The enum numeric value on the wire for requestType. - */ - int getRequestTypeValue(); - - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The requestType. - */ - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType(); - - /** - * optional string uniqiueId = 2; - * @return Whether the uniqiueId field is set. - */ - boolean hasUniqiueId(); - - /** - * optional string uniqiueId = 2; - * @return The uniqiueId. - */ - java.lang.String getUniqiueId(); - - /** - * optional string uniqiueId = 2; - * @return The bytes for uniqiueId. - */ - com.google.protobuf.ByteString getUniqiueIdBytes(); - } - - /** - * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} - */ - public static final class ExtensionRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:org.opensearch.extensions.proto.ExtensionRequest) - ExtensionRequestOrBuilder { - private static final long serialVersionUID = 0L; - - // Use ExtensionRequest.newBuilder() to construct. - private ExtensionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ExtensionRequest() { - requestType_ = 0; - uniqiueId_ = ""; - } - - @java.lang.Override - @SuppressWarnings({ "unused" }) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ExtensionRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class - ); - } - - private int bitField0_; - public static final int REQUESTTYPE_FIELD_NUMBER = 1; - private int requestType_ = 0; - - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The enum numeric value on the wire for requestType. - */ - @java.lang.Override - public int getRequestTypeValue() { - return requestType_; - } - - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The requestType. - */ - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); - return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; - } - - public static final int UNIQIUEID_FIELD_NUMBER = 2; - @SuppressWarnings("serial") - private volatile java.lang.Object uniqiueId_ = ""; - - /** - * optional string uniqiueId = 2; - * @return Whether the uniqiueId field is set. - */ - @java.lang.Override - public boolean hasUniqiueId() { - return ((bitField0_ & 0x00000001) != 0); - } - - /** - * optional string uniqiueId = 2; - * @return The uniqiueId. - */ - @java.lang.Override - public java.lang.String getUniqiueId() { - java.lang.Object ref = uniqiueId_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uniqiueId_ = s; - return s; - } - } - - /** - * optional string uniqiueId = 2; - * @return The bytes for uniqiueId. - */ - @java.lang.Override - public com.google.protobuf.ByteString getUniqiueIdBytes() { - java.lang.Object ref = uniqiueId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - uniqiueId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE - .getNumber()) { - output.writeEnum(1, requestType_); - } - if (((bitField0_ & 0x00000001) != 0)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uniqiueId_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (requestType_ != org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE - .getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, requestType_); - } - if (((bitField0_ & 0x00000001) != 0)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uniqiueId_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest)) { - return super.equals(obj); - } - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other = - (org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) obj; - - if (requestType_ != other.requestType_) return false; - if (hasUniqiueId() != other.hasUniqiueId()) return false; - if (hasUniqiueId()) { - if (!getUniqiueId().equals(other.getUniqiueId())) return false; - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + REQUESTTYPE_FIELD_NUMBER; - hash = (53 * hash) + requestType_; - if (hasUniqiueId()) { - hash = (37 * hash) + UNIQIUEID_FIELD_NUMBER; - hash = (53 * hash) + getUniqiueId().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.ByteString data - ) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom( - java.io.InputStream input - ) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.CodedInputStream input - ) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** - * Protobuf type {@code org.opensearch.extensions.proto.ExtensionRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:org.opensearch.extensions.proto.ExtensionRequest) - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.class, - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.Builder.class - ); - } - - // Construct using org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.newBuilder() - private Builder() { - - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - requestType_ = 0; - uniqiueId_ = ""; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - } - - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { - return org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance(); - } - - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest build() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest buildPartial() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result = - new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartial0(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.requestType_ = requestType_; - } - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000002) != 0)) { - result.uniqiueId_ = uniqiueId_; - to_bitField0_ |= 0x00000001; - } - result.bitField0_ |= to_bitField0_; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) { - return mergeFrom((org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest other) { - if (other == org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest.getDefaultInstance()) return this; - if (other.requestType_ != 0) { - setRequestTypeValue(other.getRequestTypeValue()); - } - if (other.hasUniqiueId()) { - uniqiueId_ = other.uniqiueId_; - bitField0_ |= 0x00000002; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - requestType_ = input.readEnum(); - bitField0_ |= 0x00000001; - break; - } // case 8 - case 18: { - uniqiueId_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000002; - break; - } // case 18 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private int requestType_ = 0; - - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The enum numeric value on the wire for requestType. - */ - @java.lang.Override - public int getRequestTypeValue() { - return requestType_; - } - - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @param value The enum numeric value on the wire for requestType to set. - * @return This builder for chaining. - */ - public Builder setRequestTypeValue(int value) { - requestType_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return The requestType. - */ - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType getRequestType() { - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType result = - org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.forNumber(requestType_); - return result == null ? org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType.UNRECOGNIZED : result; - } - - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @param value The requestType to set. - * @return This builder for chaining. - */ - public Builder setRequestType(org.opensearch.extensions.proto.ExtensionRequestOuterClass.RequestType value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - requestType_ = value.getNumber(); - onChanged(); - return this; - } - - /** - * .org.opensearch.extensions.proto.RequestType requestType = 1; - * @return This builder for chaining. - */ - public Builder clearRequestType() { - bitField0_ = (bitField0_ & ~0x00000001); - requestType_ = 0; - onChanged(); - return this; - } - - private java.lang.Object uniqiueId_ = ""; - - /** - * optional string uniqiueId = 2; - * @return Whether the uniqiueId field is set. - */ - public boolean hasUniqiueId() { - return ((bitField0_ & 0x00000002) != 0); - } - - /** - * optional string uniqiueId = 2; - * @return The uniqiueId. - */ - public java.lang.String getUniqiueId() { - java.lang.Object ref = uniqiueId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uniqiueId_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string uniqiueId = 2; - * @return The bytes for uniqiueId. - */ - public com.google.protobuf.ByteString getUniqiueIdBytes() { - java.lang.Object ref = uniqiueId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - uniqiueId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string uniqiueId = 2; - * @param value The uniqiueId to set. - * @return This builder for chaining. - */ - public Builder setUniqiueId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - uniqiueId_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - /** - * optional string uniqiueId = 2; - * @return This builder for chaining. - */ - public Builder clearUniqiueId() { - uniqiueId_ = getDefaultInstance().getUniqiueId(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - - /** - * optional string uniqiueId = 2; - * @param value The bytes for uniqiueId to set. - * @return This builder for chaining. - */ - public Builder setUniqiueIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - uniqiueId_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:org.opensearch.extensions.proto.ExtensionRequest) - } - - // @@protoc_insertion_point(class_scope:org.opensearch.extensions.proto.ExtensionRequest) - private static final org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest(); - } - - public static org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser< - ExtensionRequest>() { - @java.lang.Override - public ExtensionRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry - ) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public org.opensearch.extensions.proto.ExtensionRequestOuterClass.ExtensionRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - private static final com.google.protobuf.Descriptors.Descriptor internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor; - private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { - return descriptor; - } - - private static com.google.protobuf.Descriptors.FileDescriptor descriptor; - static { - java.lang.String[] descriptorData = { - "\nKserver/src/main/java/org/opensearch/ex" - + "tensions/proto/ExtensionRequest.proto\022\037o" - + "rg.opensearch.extensions.proto\"{\n\020Extens" - + "ionRequest\022A\n\013requestType\030\001 \001(\0162,.org.op" - + "ensearch.extensions.proto.RequestType\022\026\n" - + "\tuniqiueId\030\002 \001(\tH\000\210\001\001B\014\n\n_uniqiueId*\307\002\n\013" - + "RequestType\022#\n\037REQUEST_EXTENSION_CLUSTER" - + "_STATE\020\000\022&\n\"REQUEST_EXTENSION_CLUSTER_SE" - + "TTINGS\020\001\022+\n\'REQUEST_EXTENSION_REGISTER_R" - + "EST_ACTIONS\020\002\022\'\n#REQUEST_EXTENSION_REGIS" - + "TER_SETTINGS\020\003\022*\n&REQUEST_EXTENSION_ENVI" - + "RONMENT_SETTINGS\020\004\022,\n(REQUEST_EXTENSION_" - + "DEPENDENCY_INFORMATION\020\005\022\024\n\020CREATE_COMPO" - + "NENT\020\006\022\023\n\017ON_INDEX_MODULE\020\007\022\020\n\014GET_SETTI" - + "NGS\020\010b\006proto3" }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( - descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] {} - ); - internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor = getDescriptor().getMessageTypes().get(0); - internal_static_org_opensearch_extensions_proto_ExtensionRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_org_opensearch_extensions_proto_ExtensionRequest_descriptor, - new java.lang.String[] { "RequestType", "UniqiueId", "UniqiueId", } - ); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/server/src/main/java/org/opensearch/extensions/proto/package-info.java b/server/src/main/java/org/opensearch/extensions/proto/package-info.java deleted file mode 100644 index ff3084f133d5b..0000000000000 --- a/server/src/main/java/org/opensearch/extensions/proto/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -/* - * 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. - */ - -/** OpenSearch extensions protobuf package. This package defines message contracts between OpenSearch and extensions.*/ -package org.opensearch.extensions.proto; diff --git a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto b/server/src/main/proto/extensions/ExtensionRequestProto.proto similarity index 89% rename from server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto rename to server/src/main/proto/extensions/ExtensionRequestProto.proto index 08e50d7e721fc..d88d68d542187 100644 --- a/server/src/main/java/org/opensearch/extensions/proto/ExtensionRequest.proto +++ b/server/src/main/proto/extensions/ExtensionRequestProto.proto @@ -12,6 +12,8 @@ syntax = "proto3"; package org.opensearch.extensions.proto; +option java_outer_classname = "ExtensionRequestProto"; + enum RequestType { REQUEST_EXTENSION_CLUSTER_STATE = 0; REQUEST_EXTENSION_CLUSTER_SETTINGS = 1; @@ -26,5 +28,5 @@ enum RequestType { message ExtensionRequest { RequestType requestType = 1; - optional string uniqiueId = 2; + optional string uniqueId = 2; } diff --git a/server/src/test/java/org/opensearch/extensions/ExtensionsManagerTests.java b/server/src/test/java/org/opensearch/extensions/ExtensionsManagerTests.java index afeafeb48e33b..30bbb324af295 100644 --- a/server/src/test/java/org/opensearch/extensions/ExtensionsManagerTests.java +++ b/server/src/test/java/org/opensearch/extensions/ExtensionsManagerTests.java @@ -67,7 +67,7 @@ import org.opensearch.common.util.concurrent.ThreadContext; import org.opensearch.env.Environment; import org.opensearch.env.TestEnvironment; -import org.opensearch.extensions.proto.ExtensionRequestOuterClass; +import org.opensearch.extensions.proto.ExtensionRequestProto; import org.opensearch.extensions.rest.RegisterRestActionsRequest; import org.opensearch.extensions.settings.RegisterCustomSettingsRequest; import org.opensearch.index.IndexModule; @@ -524,20 +524,18 @@ public void testHandleExtensionRequest() throws Exception { ExtensionsManager extensionsManager = new ExtensionsManager(settings, extensionDir); initialize(extensionsManager); - ExtensionRequest clusterStateRequest = new ExtensionRequest(ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_STATE); + ExtensionRequest clusterStateRequest = new ExtensionRequest(ExtensionRequestProto.RequestType.REQUEST_EXTENSION_CLUSTER_STATE); assertEquals(ClusterStateResponse.class, extensionsManager.handleExtensionRequest(clusterStateRequest).getClass()); - ExtensionRequest clusterSettingRequest = new ExtensionRequest( - ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_CLUSTER_SETTINGS - ); + ExtensionRequest clusterSettingRequest = new ExtensionRequest(ExtensionRequestProto.RequestType.REQUEST_EXTENSION_CLUSTER_SETTINGS); assertEquals(ClusterSettingsResponse.class, extensionsManager.handleExtensionRequest(clusterSettingRequest).getClass()); ExtensionRequest environmentSettingsRequest = new ExtensionRequest( - ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_ENVIRONMENT_SETTINGS + ExtensionRequestProto.RequestType.REQUEST_EXTENSION_ENVIRONMENT_SETTINGS ); assertEquals(EnvironmentSettingsResponse.class, extensionsManager.handleExtensionRequest(environmentSettingsRequest).getClass()); - ExtensionRequest exceptionRequest = new ExtensionRequest(ExtensionRequestOuterClass.RequestType.GET_SETTINGS); + ExtensionRequest exceptionRequest = new ExtensionRequest(ExtensionRequestProto.RequestType.GET_SETTINGS); Exception exception = expectThrows( IllegalArgumentException.class, () -> extensionsManager.handleExtensionRequest(exceptionRequest) @@ -546,8 +544,7 @@ public void testHandleExtensionRequest() throws Exception { } public void testExtensionRequest() throws Exception { - ExtensionRequestOuterClass.RequestType expectedRequestType = - ExtensionRequestOuterClass.RequestType.REQUEST_EXTENSION_DEPENDENCY_INFORMATION; + ExtensionRequestProto.RequestType expectedRequestType = ExtensionRequestProto.RequestType.REQUEST_EXTENSION_DEPENDENCY_INFORMATION; // Test ExtensionRequest 2 arg constructor String expectedUniqueId = "test uniqueid"; From f6a21704568c03aa3048699d8fabda71a9a54f15 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Mon, 10 Apr 2023 12:47:51 -0700 Subject: [PATCH 08/18] Adding protoc compiler in gradle Signed-off-by: Sarat Vemulapalli --- server/build.gradle | 6 ++++++ .../src/main/proto/extensions/ExtensionRequestProto.proto | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/build.gradle b/server/build.gradle index 129c6ac71f48c..4e0641e33a18a 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -210,6 +210,12 @@ def generatePluginsList = tasks.register("generatePluginsList") { } } +protobuf { + protoc { + artifact = "com.google.protobuf:protoc:3.22.2" + } +} + tasks.named("processResources").configure { dependsOn generateModulesList, generatePluginsList } diff --git a/server/src/main/proto/extensions/ExtensionRequestProto.proto b/server/src/main/proto/extensions/ExtensionRequestProto.proto index d88d68d542187..a49e413d37ca9 100644 --- a/server/src/main/proto/extensions/ExtensionRequestProto.proto +++ b/server/src/main/proto/extensions/ExtensionRequestProto.proto @@ -28,5 +28,5 @@ enum RequestType { message ExtensionRequest { RequestType requestType = 1; - optional string uniqueId = 2; + string uniqueId = 2; } From f65a19daba1e593e2dd2af8c73e92c2c6dfbbdc4 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Mon, 10 Apr 2023 12:52:07 -0700 Subject: [PATCH 09/18] Updating licenses Signed-off-by: Sarat Vemulapalli --- plugins/repository-gcs/licenses/protobuf-java-3.22.2.jar.sha1 | 1 - .../repository-gcs/licenses/protobuf-java-util-3.22.2.jar.sha1 | 1 - 2 files changed, 2 deletions(-) delete mode 100644 plugins/repository-gcs/licenses/protobuf-java-3.22.2.jar.sha1 delete mode 100644 plugins/repository-gcs/licenses/protobuf-java-util-3.22.2.jar.sha1 diff --git a/plugins/repository-gcs/licenses/protobuf-java-3.22.2.jar.sha1 b/plugins/repository-gcs/licenses/protobuf-java-3.22.2.jar.sha1 deleted file mode 100644 index 80feeec023e7b..0000000000000 --- a/plugins/repository-gcs/licenses/protobuf-java-3.22.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -fdee98b8f6abab73f146a4edb4c09e56f8278d03 \ No newline at end of file diff --git a/plugins/repository-gcs/licenses/protobuf-java-util-3.22.2.jar.sha1 b/plugins/repository-gcs/licenses/protobuf-java-util-3.22.2.jar.sha1 deleted file mode 100644 index 2a5707254b8cf..0000000000000 --- a/plugins/repository-gcs/licenses/protobuf-java-util-3.22.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -749cd4fe8ab52f37bc186193802ba19f5b284647 \ No newline at end of file From c91bb9cc58235de3773a0122cafd3e2b335493a5 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Wed, 12 Apr 2023 11:09:10 -0700 Subject: [PATCH 10/18] Adding sourceset for generated protos for javadocs Signed-off-by: Sarat Vemulapalli --- server/build.gradle | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/build.gradle b/server/build.gradle index 4e0641e33a18a..04f1614e5f028 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -49,6 +49,13 @@ publishing { archivesBaseName = 'opensearch' +sourceSets { + main { + java { + srcDir "${buildDir}/generated/source/proto/main/java" + } + } +} // we want to keep the JDKs in our IDEs set to JDK 8 until minimum JDK is bumped to 11 so we do not include this source set in our IDEs if (!isEclipse) { sourceSets { From b6af3af4ae6ebffae8ffbdc6ed1dd697a329be04 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Wed, 19 Apr 2023 11:33:37 -0700 Subject: [PATCH 11/18] Ignoring generated code for java docs Signed-off-by: Sarat Vemulapalli --- server/build.gradle | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/build.gradle b/server/build.gradle index 04f1614e5f028..325ff324e729b 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -344,6 +344,17 @@ tasks.named("dependencyLicenses").configure { } } +tasks.named("missingJavadoc").configure { + /* + * Generated code doesn't follow javadocs formats. + */ + javadocMissingIgnore = [ + "org.opensearch.extensions.proto.ExtensionRequestProto", + "org.opensearch.extensions.proto.ExtensionRequestProto.ExtensionRequestOrBuilder", + "org.opensearch.extensions.proto" + ] +} + tasks.named("licenseHeaders").configure { // Ignore our vendored version of Google Guice excludes << 'org/opensearch/common/inject/**/*' From 08b76badda978b7eeb6c4048d928492eba0c5274 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Wed, 19 Apr 2023 14:20:15 -0700 Subject: [PATCH 12/18] Adding explicit dependencies for proto Signed-off-by: Sarat Vemulapalli --- server/build.gradle | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/build.gradle b/server/build.gradle index c6b97a09da12d..3404d883490bf 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -348,8 +348,9 @@ tasks.named("missingJavadoc").configure { /* * Generated code doesn't follow javadocs formats. * Unfortunately the missingJavadoc task doesnt take *. - * TODO: Add support to missingJavadoc task to ignore all generated source codeß + * TODO: Add support to missingJavadoc task to ignore all generated source code */ + dependsOn("generateProto") javadocMissingIgnore = [ "org.opensearch.extensions.proto.ExtensionRequestProto", "org.opensearch.extensions.proto.ExtensionRequestProto.ExtensionRequestOrBuilder", @@ -357,6 +358,10 @@ tasks.named("missingJavadoc").configure { ] } +tasks.named("filepermissions").configure { + mustRunAfter("generateProto") +} + tasks.named("licenseHeaders").configure { // Ignore our vendored version of Google Guice excludes << 'org/opensearch/common/inject/**/*' From 96a157ab9b21bfcee12c17892b4d0e0748e88c4d Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Wed, 19 Apr 2023 14:52:43 -0700 Subject: [PATCH 13/18] Adding somemore Signed-off-by: Sarat Vemulapalli --- server/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/build.gradle b/server/build.gradle index 3404d883490bf..09e8ccfd114f2 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -171,6 +171,7 @@ tasks.named("internalClusterTest").configure { } tasks.named("forbiddenPatterns").configure { + dependsOn("generateProto") exclude '**/*.json' exclude '**/*.jmx' exclude '**/*.dic' @@ -363,6 +364,7 @@ tasks.named("filepermissions").configure { } tasks.named("licenseHeaders").configure { + dependsOn("generateProto") // Ignore our vendored version of Google Guice excludes << 'org/opensearch/common/inject/**/*' // Ignore temporary copies of impending 8.7 Lucene classes From 2c4032965a0f53275c456b75ec95578968ab9100 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Wed, 19 Apr 2023 15:11:04 -0700 Subject: [PATCH 14/18] Ignoring license headers for generated code Signed-off-by: Sarat Vemulapalli --- server/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/server/build.gradle b/server/build.gradle index 09e8ccfd114f2..f9c0325a4b29a 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -371,6 +371,7 @@ tasks.named("licenseHeaders").configure { excludes << 'org/apache/lucene/search/RegExp87*' excludes << 'org/apache/lucene/search/RegexpQuery87*' excludes << 'org/opensearch/client/documentation/placeholder.txt' + excludes << 'org/opensearch/extensions/proto/*' } tasks.test { From 84019a7551429286d8563a1ed11fdca6f8bc359e Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Thu, 20 Apr 2023 15:11:16 -0700 Subject: [PATCH 15/18] Addressing comments Signed-off-by: Sarat Vemulapalli --- CHANGELOG.md | 15 --------------- buildSrc/version.properties | 1 + server/build.gradle | 14 +++++++------- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3b7e8fd74fea..79ee28aaf7d20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,22 +80,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased 2.x] ### Added -- Add GeoTile and GeoHash Grid aggregations on GeoShapes. ([#5589](https://github.com/opensearch-project/OpenSearch/pull/5589)) -- Disallow multiple data paths for search nodes ([#6427](https://github.com/opensearch-project/OpenSearch/pull/6427)) -- [Segment Replication] Allocation and rebalancing based on average primary shard count per index ([#6422](https://github.com/opensearch-project/OpenSearch/pull/6422)) -- The truncation limit of the OpenSearchJsonLayout logger is now configurable ([#6569](https://github.com/opensearch-project/OpenSearch/pull/6569)) -- Add 'base_path' setting to File System Repository ([#6558](https://github.com/opensearch-project/OpenSearch/pull/6558)) -- Return success on DeletePits when no PITs exist. ([#6544](https://github.com/opensearch-project/OpenSearch/pull/6544)) -- Add node repurpose command for search nodes ([#6517](https://github.com/opensearch-project/OpenSearch/pull/6517)) -- Add wait_for_completion parameter to resize, open, and forcemerge APIs ([#6434](https://github.com/opensearch-project/OpenSearch/pull/6434)) -- [Segment Replication] Apply backpressure when replicas fall behind ([#6563](https://github.com/opensearch-project/OpenSearch/pull/6563)) -- [Remote Store] Integrate remote segment store in peer recovery flow ([#6664](https://github.com/opensearch-project/OpenSearch/pull/6664)) -- Enable sort optimization for all NumericTypes ([#6464](https://github.com/opensearch-project/OpenSearch/pull/6464) -- Remove 'cluster_manager' role attachment when using 'node.master' deprecated setting ([#6331](https://github.com/opensearch-project/OpenSearch/pull/6331)) -- Add new cluster settings to ignore weighted round-robin routing and fallback to default behaviour. ([#6834](https://github.com/opensearch-project/OpenSearch/pull/6834)) - [Extensions] Moving Extensions APIs to protobuf serialization. ([#6960](https://github.com/opensearch-project/OpenSearch/pull/6960)) -- Add experimental support for ZSTD compression. ([#3577](https://github.com/opensearch-project/OpenSearch/pull/3577)) -- [Segment Replication] Add point in time and scroll query compatibility. ([#6644](https://github.com/opensearch-project/OpenSearch/pull/6644)) ### Dependencies diff --git a/buildSrc/version.properties b/buildSrc/version.properties index 1562a5aecfd35..fc8d64f6f07dc 100644 --- a/buildSrc/version.properties +++ b/buildSrc/version.properties @@ -22,6 +22,7 @@ woodstox = 6.4.0 kotlin = 1.7.10 antlr4 = 4.11.1 guava = 31.1-jre +protobuf = 3.22.2 # when updating the JNA version, also update the version in buildSrc/build.gradle jna = 5.5.0 diff --git a/server/build.gradle b/server/build.gradle index f9c0325a4b29a..f74362fc3835e 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -31,14 +31,13 @@ import org.opensearch.gradle.info.BuildParams plugins { - id('com.google.protobuf') version '0.8.19' + id('com.google.protobuf') version 'latest.release' + id('opensearch.build') + id('com.netflix.nebula.optional-base') + id('opensearch.publish') + id('opensearch.internal-cluster-test') } -apply plugin: 'opensearch.build' -apply plugin: 'com.netflix.nebula.optional-base' -apply plugin: 'opensearch.publish' -apply plugin: 'opensearch.internal-cluster-test' - publishing { publications { nebula(MavenPublication) { @@ -220,7 +219,7 @@ def generatePluginsList = tasks.register("generatePluginsList") { protobuf { protoc { - artifact = "com.google.protobuf:protoc:3.22.2" + artifact = "com.google.protobuf:protoc:${versions.protobuf}" } } @@ -371,6 +370,7 @@ tasks.named("licenseHeaders").configure { excludes << 'org/apache/lucene/search/RegExp87*' excludes << 'org/apache/lucene/search/RegexpQuery87*' excludes << 'org/opensearch/client/documentation/placeholder.txt' + // Ignore for generated code excludes << 'org/opensearch/extensions/proto/*' } From b71ec2973721264e9386fefdec00cc4461daf640 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Thu, 20 Apr 2023 15:15:05 -0700 Subject: [PATCH 16/18] Moving to central versioning Signed-off-by: Sarat Vemulapalli --- server/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/build.gradle b/server/build.gradle index f74362fc3835e..8205edcafa95a 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -147,7 +147,7 @@ dependencies { api "net.java.dev.jna:jna:${versions.jna}" // protobuf - api 'com.google.protobuf:protobuf-java:3.22.2' + api "com.google.protobuf:protobuf-java:${versions.protobuf}" testImplementation(project(":test:framework")) { // tests use the locally compiled version of server From 33e500ad762e4b8a841a76a892b16043dc44e45f Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Thu, 20 Apr 2023 16:40:31 -0700 Subject: [PATCH 17/18] Addressing comments Signed-off-by: Sarat Vemulapalli --- server/build.gradle | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/build.gradle b/server/build.gradle index 8205edcafa95a..235570d1778ff 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -349,6 +349,7 @@ tasks.named("missingJavadoc").configure { * Generated code doesn't follow javadocs formats. * Unfortunately the missingJavadoc task doesnt take *. * TODO: Add support to missingJavadoc task to ignore all generated source code + * https://github.com/opensearch-project/OpenSearch/issues/7264 */ dependsOn("generateProto") javadocMissingIgnore = [ @@ -370,7 +371,7 @@ tasks.named("licenseHeaders").configure { excludes << 'org/apache/lucene/search/RegExp87*' excludes << 'org/apache/lucene/search/RegexpQuery87*' excludes << 'org/opensearch/client/documentation/placeholder.txt' - // Ignore for generated code + // Ignore for protobuf generated code excludes << 'org/opensearch/extensions/proto/*' } @@ -379,3 +380,10 @@ tasks.test { jvmArgs += ["--add-opens", "java.base/java.nio.file=ALL-UNNAMED"] } } + +tasks.named("sourcesJar").configure { + // Ignore duplicates for protobuf generated code (main and generatedSources). + filesMatching("**/proto/*") { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } +} From 1089388d84ba042be4d3188fb34f811d58fb5b70 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Thu, 20 Apr 2023 17:01:23 -0700 Subject: [PATCH 18/18] Removing thirdpartyaudit from hdfs Signed-off-by: Sarat Vemulapalli --- plugins/repository-hdfs/build.gradle | 6 ------ 1 file changed, 6 deletions(-) diff --git a/plugins/repository-hdfs/build.gradle b/plugins/repository-hdfs/build.gradle index 92e3ae7fa4772..7318a602c555a 100644 --- a/plugins/repository-hdfs/build.gradle +++ b/plugins/repository-hdfs/build.gradle @@ -113,12 +113,6 @@ tasks.named("dependencyLicenses").configure { mapping from: /hadoop-.*/, to: 'hadoop' } -thirdPartyAudit { - ignoreViolations( - - ) -} - tasks.named("integTest").configure { it.dependsOn(project.tasks.named("bundlePlugin")) }