mchades commented on code in PR #13791:
URL: https://github.com/apache/gravitino/pull/13791#discussion_r4266903388


##########
core/src/main/java/org/apache/gravitino/listener/SemanticModelEventDispatcher.java:
##########
@@ -131,6 +140,54 @@ public SemanticModel createSemanticModel(
     }
   }
 
+  @Override
+  public SemanticModel importOssieDocument(
+      Namespace namespace,
+      OssieDocument document,
+      Consumer<SemanticModelDefinition> sourceValidator) {
+    String user = PrincipalUtils.getCurrentUserName();
+    OssieFormat format = document == null ? null : document.format();
+    try {
+      eventBus.dispatchEvent(new ImportSemanticModelPreEvent(user, namespace, 
format));
+      SemanticModel semanticModel =
+          dispatcher.importOssieDocument(namespace, document, sourceValidator);
+      eventBus.dispatchEvent(
+          new ImportSemanticModelEvent(
+              user,
+              NameIdentifier.of(namespace, semanticModel.name()),
+              format,
+              new SemanticModelInfo(semanticModel)));
+      return semanticModel;
+    } catch (Exception e) {
+      eventBus.dispatchEvent(new ImportSemanticModelFailureEvent(user, 
namespace, format, e));
+      throw e;
+    }
+  }
+
+  @Override
+  public SemanticModel importSemanticModel(
+      NameIdentifier ident,
+      @Nullable String comment,
+      SemanticModelDefinition definition,
+      Map<String, String> properties) {
+    throw new UnsupportedOperationException(

Review Comment:
   The internal dispatcher intentionally bypasses hooks and events for 
infrastructure operations, as its Javadoc already states. This is consistent 
with the other internal dispatchers, not a read-only contract. User-facing 
imports use the event chain with source validation, so I would keep the 
existing internal behavior.



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