xunliu commented on code in PR #4397:
URL: https://github.com/apache/gravitino/pull/4397#discussion_r1706296453
##########
clients/client-java/src/main/java/org/apache/gravitino/client/GravitinoMetalake.java:
##########
@@ -762,6 +771,55 @@ public Group revokeRolesFromGroup(List<String> roles,
String group)
return resp.getGroup();
}
+ /**
+ * Get the owner of a metadata object.
+ *
+ * @param object The metadata object
+ * @return The owner of the metadata object. If the metadata object doesn't
set the owner, it will
+ * return Optional.empty().
+ * @throws NotFoundException If the metadata object is not found.
+ */
+ public Optional<Owner> getOwner(MetadataObject object) throws
NotFoundException {
+ OwnerResponse resp =
+ restClient.get(
+ String.format(
+ API_METALAKES_OWNERS_PATH,
+ this.name(),
+ String.format(
+ "%s/%s", object.type().name().toLowerCase(Locale.ROOT),
object.fullName())),
+ OwnerResponse.class,
+ Collections.emptyMap(),
+ ErrorHandlers.ownerErrorHandler());
+ resp.validate();
+ return Optional.ofNullable(resp.getOwner());
+ }
+
+ /**
+ * Set the owner of a metadata object.
+ *
+ * @param object The metadata object.
+ * @param ownerName The name of the owner
+ * @param ownerType The type of the owner, The owner can be a user or a
group.
+ * @throws NotFoundException If the metadata object isn't found or the owner
is deleted.
+ */
+ public void setOwner(MetadataObject object, String ownerName, Owner.Type
ownerType)
+ throws NotFoundException {
Review Comment:
I can't found anywhere throws NotFoundException, and when I deleted `throws
NotFoundException` we can also compile success.
##########
clients/client-java/src/main/java/org/apache/gravitino/client/GravitinoMetalake.java:
##########
@@ -762,6 +771,55 @@ public Group revokeRolesFromGroup(List<String> roles,
String group)
return resp.getGroup();
}
+ /**
+ * Get the owner of a metadata object.
+ *
+ * @param object The metadata object
+ * @return The owner of the metadata object. If the metadata object doesn't
set the owner, it will
+ * return Optional.empty().
+ * @throws NotFoundException If the metadata object is not found.
+ */
+ public Optional<Owner> getOwner(MetadataObject object) throws
NotFoundException {
Review Comment:
I can't found anywhere throws NotFoundException, and when I deleted `throws
NotFoundException` we can also compile success.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]