adutra commented on code in PR #2481:
URL: https://github.com/apache/polaris/pull/2481#discussion_r2318180283


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/generic/CatalogGenericTableEventServiceDelegator.java:
##########
@@ -78,7 +108,19 @@ public Response loadGenericTable(
       String genericTable,
       RealmContext realmContext,
       SecurityContext securityContext) {
-    return delegate.loadGenericTable(
-        prefix, namespace, genericTable, realmContext, securityContext);
+    String catalogName = getCatalogFromPrefix(prefix, realmContext);
+    polarisEventListener.onBeforeLoadGenericTable(
+        new CatalogGenericTableServiceEvents.BeforeLoadGenericTableEvent(
+            catalogName, namespace, genericTable));
+    Response resp =
+        delegate.loadGenericTable(prefix, namespace, genericTable, 
realmContext, securityContext);
+    polarisEventListener.onAfterLoadGenericTable(
+        new CatalogGenericTableServiceEvents.AfterLoadGenericTableEvent(
+            catalogName, namespace, ((LoadGenericTableResponse) 
resp.getEntity()).getTable()));
+    return resp;
+  }
+
+  private String getCatalogFromPrefix(String prefix, RealmContext 
realmContext) {
+    return prefixParser.prefixToCatalogName(realmContext, prefix);

Review Comment:
   nit: inline (the method does nothing  more than `prefixToCatalogName`)



##########
runtime/service/src/main/java/org/apache/polaris/service/events/CatalogGenericTableServiceEvents.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.polaris.service.events;
+
+import org.apache.polaris.service.types.CreateGenericTableRequest;
+import org.apache.polaris.service.types.GenericTable;
+
+public class CatalogGenericTableServiceEvents {
+  public record BeforeCreateGenericTableEvent(

Review Comment:
   Same naming inconsistency with #2482.



-- 
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]

Reply via email to