aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anderson <ejona@google.com>2024-03-05 10:51:17 -0800
committerEric Anderson <ejona@google.com>2024-03-05 11:30:35 -0800
commit27824469bffbe9c56e1f3b8107eb861904041f0d (patch)
treeab06a0b4b565c09d90f0798973fcce99d657acf3
parent8feb919167e51713a4fb9c1250c0546635bb1f04 (diff)
downloadgrpc-grpc-java-27824469bffbe9c56e1f3b8107eb861904041f0d.tar.gz
xds: Provide default XdsResourceType.extractResourceName impl
This method is only needed sometimes, and with time will be needed less and less. Don't require new types to implement it, instead relying on control planes to use the new approach.
-rw-r--r--xds/src/main/java/io/grpc/xds/client/XdsResourceType.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/xds/src/main/java/io/grpc/xds/client/XdsResourceType.java b/xds/src/main/java/io/grpc/xds/client/XdsResourceType.java
index f034fe6b8..6a1a5d7db 100644
--- a/xds/src/main/java/io/grpc/xds/client/XdsResourceType.java
+++ b/xds/src/main/java/io/grpc/xds/client/XdsResourceType.java
@@ -65,8 +65,18 @@ public abstract class XdsResourceType<T extends ResourceUpdate> {
protected static final String TYPE_URL_TYPED_STRUCT =
"type.googleapis.com/xds.type.v3.TypedStruct";
+ /**
+ * Extract the resource name from an older resource type that included the name within the
+ * resource contents itself. The newer approach has resources wrapped with {@code
+ * envoy.service.discovery.v3.Resource} which then provides the name. This method is only called
+ * for the old approach.
+ *
+ * @return the resource's name, or {@code null} if name is not stored within the resource contents
+ */
@Nullable
- protected abstract String extractResourceName(Message unpackedResource);
+ protected String extractResourceName(Message unpackedResource) {
+ return null;
+ }
protected abstract Class<? extends com.google.protobuf.Message> unpackedClassName();