jerryshao commented on code in PR #5908:
URL: https://github.com/apache/gravitino/pull/5908#discussion_r1891785095


##########
core/src/main/java/org/apache/gravitino/catalog/ModelOperationDispatcher.java:
##########
@@ -40,40 +49,131 @@ public ModelOperationDispatcher(
 
   @Override
   public NameIdentifier[] listModels(Namespace namespace) throws 
NoSuchSchemaException {
-    throw new UnsupportedOperationException("Not implemented");
+    return TreeLockUtils.doWithTreeLock(
+        NameIdentifier.of(namespace.levels()),
+        LockType.READ,
+        () ->
+            doWithCatalog(
+                getCatalogIdentifier(NameIdentifier.of(namespace.levels())),
+                c -> c.doWithModelOps(m -> m.listModels(namespace)),
+                NoSuchSchemaException.class));
   }
 
   @Override
   public Model getModel(NameIdentifier ident) throws NoSuchModelException {
-    throw new UnsupportedOperationException("Not implemented");
+    NameIdentifier catalogIdent = getCatalogIdentifier(ident);
+    Model model =
+        TreeLockUtils.doWithTreeLock(
+            ident,
+            LockType.READ,
+            () ->
+                doWithCatalog(
+                    catalogIdent,
+                    c -> c.doWithModelOps(m -> m.getModel(ident)),
+                    NoSuchModelException.class));
+
+    return EntityCombinedModel.of(model)
+        .withHiddenPropertiesSet(
+            getHiddenPropertyNames(
+                catalogIdent, HasPropertyMetadata::modelPropertiesMetadata, 
model.properties()));
   }
 
   @Override
   public Model registerModel(NameIdentifier ident, String comment, Map<String, 
String> properties)
       throws NoSuchModelException, ModelAlreadyExistsException {
-    throw new UnsupportedOperationException("Not implemented");
+    NameIdentifier catalogIdent = getCatalogIdentifier(ident);
+    TreeLockUtils.doWithTreeLock(

Review Comment:
   It is a catalog operation, so I think we need to lock the catalog identifier 
to avoid deleting by others.



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