Re: [PR] [#4236][FOLLOWUP] feat(core): Rework of post hook for dispatcher [gravitino]

2024-08-08 Thread via GitHub


jerqi closed pull request #4429: [#4236][FOLLOWUP] feat(core): Rework of post 
hook for dispatcher
URL: https://github.com/apache/gravitino/pull/4429


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



Re: [PR] [#4236][FOLLOWUP] feat(core): Rework of post hook for dispatcher [gravitino]

2024-08-08 Thread via GitHub


xunliu commented on code in PR #4429:
URL: https://github.com/apache/gravitino/pull/4429#discussion_r1709401985


##
core/src/main/java/org/apache/gravitino/GravitinoEnv.java:
##
@@ -348,28 +352,30 @@ private void initGravitinoServerComponents() {
 
 // Create and initialize metalake related modules
 MetalakeDispatcher metalakeManager = new MetalakeManager(entityStore, 
idGenerator);
+MetalakeHookDispatcher metalakeHookDispatcher = new 
MetalakeHookDispatcher(metalakeManager);
 MetalakeNormalizeDispatcher metalakeNormalizeDispatcher =
-new 
MetalakeNormalizeDispatcher(installDispatcherHooks(metalakeManager));
+new MetalakeNormalizeDispatcher(metalakeHookDispatcher);
 this.metalakeDispatcher = new MetalakeEventDispatcher(eventBus, 
metalakeNormalizeDispatcher);
 
 // Create and initialize Catalog related modules
 this.catalogManager = new CatalogManager(config, entityStore, idGenerator);
+CatalogHookDispatcher catalogHookDispatcher = new 
CatalogHookDispatcher(catalogManager);
 CatalogNormalizeDispatcher catalogNormalizeDispatcher =
-new 
CatalogNormalizeDispatcher(installDispatcherHooks((CatalogDispatcher) 
catalogManager));
+new CatalogNormalizeDispatcher(catalogHookDispatcher);

Review Comment:
   I also feel the current `Dispatcher` mechanism inelegant.
   I create a issue track it 
   - https://github.com/apache/gravitino/issues/4446



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



Re: [PR] [#4236][FOLLOWUP] feat(core): Rework of post hook for dispatcher [gravitino]

2024-08-08 Thread via GitHub


jerqi commented on code in PR #4429:
URL: https://github.com/apache/gravitino/pull/4429#discussion_r1709331840


##
core/src/main/java/org/apache/gravitino/GravitinoEnv.java:
##
@@ -348,28 +352,30 @@ private void initGravitinoServerComponents() {
 
 // Create and initialize metalake related modules
 MetalakeDispatcher metalakeManager = new MetalakeManager(entityStore, 
idGenerator);
+MetalakeHookDispatcher metalakeHookDispatcher = new 
MetalakeHookDispatcher(metalakeManager);
 MetalakeNormalizeDispatcher metalakeNormalizeDispatcher =
-new 
MetalakeNormalizeDispatcher(installDispatcherHooks(metalakeManager));
+new MetalakeNormalizeDispatcher(metalakeHookDispatcher);
 this.metalakeDispatcher = new MetalakeEventDispatcher(eventBus, 
metalakeNormalizeDispatcher);
 
 // Create and initialize Catalog related modules
 this.catalogManager = new CatalogManager(config, entityStore, idGenerator);
+CatalogHookDispatcher catalogHookDispatcher = new 
CatalogHookDispatcher(catalogManager);
 CatalogNormalizeDispatcher catalogNormalizeDispatcher =
-new 
CatalogNormalizeDispatcher(installDispatcherHooks((CatalogDispatcher) 
catalogManager));
+new CatalogNormalizeDispatcher(catalogHookDispatcher);

Review Comment:
   Maybe we can put normalizeDispatcher to HookDispatcher in the future.



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



Re: [PR] [#4236][FOLLOWUP] feat(core): Rework of post hook for dispatcher [gravitino]

2024-08-08 Thread via GitHub


jerqi commented on code in PR #4429:
URL: https://github.com/apache/gravitino/pull/4429#discussion_r1709324775


##
core/src/main/java/org/apache/gravitino/GravitinoEnv.java:
##
@@ -348,28 +352,30 @@ private void initGravitinoServerComponents() {
 
 // Create and initialize metalake related modules
 MetalakeDispatcher metalakeManager = new MetalakeManager(entityStore, 
idGenerator);
+MetalakeHookDispatcher metalakeHookDispatcher = new 
MetalakeHookDispatcher(metalakeManager);
 MetalakeNormalizeDispatcher metalakeNormalizeDispatcher =
-new 
MetalakeNormalizeDispatcher(installDispatcherHooks(metalakeManager));
+new MetalakeNormalizeDispatcher(metalakeHookDispatcher);
 this.metalakeDispatcher = new MetalakeEventDispatcher(eventBus, 
metalakeNormalizeDispatcher);
 
 // Create and initialize Catalog related modules
 this.catalogManager = new CatalogManager(config, entityStore, idGenerator);
+CatalogHookDispatcher catalogHookDispatcher = new 
CatalogHookDispatcher(catalogManager);
 CatalogNormalizeDispatcher catalogNormalizeDispatcher =
-new 
CatalogNormalizeDispatcher(installDispatcherHooks((CatalogDispatcher) 
catalogManager));
+new CatalogNormalizeDispatcher(catalogHookDispatcher);

Review Comment:
   Known issues. But we don't have better solution.



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



Re: [PR] [#4236][FOLLOWUP] feat(core): Rework of post hook for dispatcher [gravitino]

2024-08-08 Thread via GitHub


jerqi commented on code in PR #4429:
URL: https://github.com/apache/gravitino/pull/4429#discussion_r1709323732


##
core/src/main/java/org/apache/gravitino/hook/AccessControlHookDispatcher.java:
##
@@ -0,0 +1,150 @@
+/*
+ * 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.gravitino.hook;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.gravitino.Entity;
+import org.apache.gravitino.GravitinoEnv;
+import org.apache.gravitino.authorization.AccessControlDispatcher;
+import org.apache.gravitino.authorization.AuthorizationUtils;
+import org.apache.gravitino.authorization.Group;
+import org.apache.gravitino.authorization.Owner;
+import org.apache.gravitino.authorization.OwnerManager;
+import org.apache.gravitino.authorization.Role;
+import org.apache.gravitino.authorization.SecurableObject;
+import org.apache.gravitino.authorization.User;
+import org.apache.gravitino.exceptions.GroupAlreadyExistsException;
+import org.apache.gravitino.exceptions.NoSuchGroupException;
+import org.apache.gravitino.exceptions.NoSuchMetalakeException;
+import org.apache.gravitino.exceptions.NoSuchRoleException;
+import org.apache.gravitino.exceptions.NoSuchUserException;
+import org.apache.gravitino.exceptions.RoleAlreadyExistsException;
+import org.apache.gravitino.exceptions.UserAlreadyExistsException;
+import org.apache.gravitino.utils.NameIdentifierUtil;
+import org.apache.gravitino.utils.PrincipalUtils;
+
+/**
+ * {@code AccessControlHookDispatcher} is a decorator for {@link 
AccessControlDispatcher} that not
+ * only delegates access control operations to the underlying access control 
dispatcher but also
+ * executes some hook operations before or after the underlying operations.
+ */
+public class AccessControlHookDispatcher implements AccessControlDispatcher {

Review Comment:
   This class provide the hook operations for every dispatcher.



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



Re: [PR] [#4236][FOLLOWUP] feat(core): Rework of post hook for dispatcher [gravitino]

2024-08-08 Thread via GitHub


jerqi commented on code in PR #4429:
URL: https://github.com/apache/gravitino/pull/4429#discussion_r1709325389


##
api/src/main/java/org/apache/gravitino/authorization/SecurableObjects.java:
##
@@ -33,6 +33,17 @@ public class SecurableObjects {
 
   private static final Splitter DOT_SPLITTER = Splitter.on('.');
 
+  /**
+   * Create the metalake {@link SecurableObject} with the given metalake name.

Review Comment:
   OK. I can change it.



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



Re: [PR] [#4236][FOLLOWUP] feat(core): Rework of post hook for dispatcher [gravitino]

2024-08-08 Thread via GitHub


jerqi commented on code in PR #4429:
URL: https://github.com/apache/gravitino/pull/4429#discussion_r1709321806


##
core/src/main/java/org/apache/gravitino/hook/AccessControlHookDispatcher.java:
##
@@ -0,0 +1,150 @@
+/*
+ * 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.gravitino.hook;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.gravitino.Entity;
+import org.apache.gravitino.GravitinoEnv;
+import org.apache.gravitino.authorization.AccessControlDispatcher;
+import org.apache.gravitino.authorization.AuthorizationUtils;
+import org.apache.gravitino.authorization.Group;
+import org.apache.gravitino.authorization.Owner;
+import org.apache.gravitino.authorization.OwnerManager;
+import org.apache.gravitino.authorization.Role;
+import org.apache.gravitino.authorization.SecurableObject;
+import org.apache.gravitino.authorization.User;
+import org.apache.gravitino.exceptions.GroupAlreadyExistsException;
+import org.apache.gravitino.exceptions.NoSuchGroupException;
+import org.apache.gravitino.exceptions.NoSuchMetalakeException;
+import org.apache.gravitino.exceptions.NoSuchRoleException;
+import org.apache.gravitino.exceptions.NoSuchUserException;
+import org.apache.gravitino.exceptions.RoleAlreadyExistsException;
+import org.apache.gravitino.exceptions.UserAlreadyExistsException;
+import org.apache.gravitino.utils.NameIdentifierUtil;
+import org.apache.gravitino.utils.PrincipalUtils;
+
+/**
+ * {@code AccessControlHookDispatcher} is a decorator for {@link 
AccessControlDispatcher} that not

Review Comment:
   You can refer to decorator design pattern.



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



Re: [PR] [#4236][FOLLOWUP] feat(core): Rework of post hook for dispatcher [gravitino]

2024-08-08 Thread via GitHub


yuqi1129 commented on code in PR #4429:
URL: https://github.com/apache/gravitino/pull/4429#discussion_r1708959951


##
api/src/main/java/org/apache/gravitino/authorization/SecurableObjects.java:
##
@@ -33,6 +33,17 @@ public class SecurableObjects {
 
   private static final Splitter DOT_SPLITTER = Splitter.on('.');
 
+  /**
+   * Create the metalake {@link SecurableObject} with the given metalake name.

Review Comment:
   With the given metalake name and privileges?



##
core/src/main/java/org/apache/gravitino/hook/AccessControlHookDispatcher.java:
##
@@ -0,0 +1,150 @@
+/*
+ * 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.gravitino.hook;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.gravitino.Entity;
+import org.apache.gravitino.GravitinoEnv;
+import org.apache.gravitino.authorization.AccessControlDispatcher;
+import org.apache.gravitino.authorization.AuthorizationUtils;
+import org.apache.gravitino.authorization.Group;
+import org.apache.gravitino.authorization.Owner;
+import org.apache.gravitino.authorization.OwnerManager;
+import org.apache.gravitino.authorization.Role;
+import org.apache.gravitino.authorization.SecurableObject;
+import org.apache.gravitino.authorization.User;
+import org.apache.gravitino.exceptions.GroupAlreadyExistsException;
+import org.apache.gravitino.exceptions.NoSuchGroupException;
+import org.apache.gravitino.exceptions.NoSuchMetalakeException;
+import org.apache.gravitino.exceptions.NoSuchRoleException;
+import org.apache.gravitino.exceptions.NoSuchUserException;
+import org.apache.gravitino.exceptions.RoleAlreadyExistsException;
+import org.apache.gravitino.exceptions.UserAlreadyExistsException;
+import org.apache.gravitino.utils.NameIdentifierUtil;
+import org.apache.gravitino.utils.PrincipalUtils;
+
+/**
+ * {@code AccessControlHookDispatcher} is a decorator for {@link 
AccessControlDispatcher} that not
+ * only delegates access control operations to the underlying access control 
dispatcher but also
+ * executes some hook operations before or after the underlying operations.
+ */
+public class AccessControlHookDispatcher implements AccessControlDispatcher {

Review Comment:
   I can't get why do we name it `Hook` here? 



##
core/src/main/java/org/apache/gravitino/GravitinoEnv.java:
##
@@ -348,28 +352,30 @@ private void initGravitinoServerComponents() {
 
 // Create and initialize metalake related modules
 MetalakeDispatcher metalakeManager = new MetalakeManager(entityStore, 
idGenerator);
+MetalakeHookDispatcher metalakeHookDispatcher = new 
MetalakeHookDispatcher(metalakeManager);
 MetalakeNormalizeDispatcher metalakeNormalizeDispatcher =
-new 
MetalakeNormalizeDispatcher(installDispatcherHooks(metalakeManager));
+new MetalakeNormalizeDispatcher(metalakeHookDispatcher);
 this.metalakeDispatcher = new MetalakeEventDispatcher(eventBus, 
metalakeNormalizeDispatcher);
 
 // Create and initialize Catalog related modules
 this.catalogManager = new CatalogManager(config, entityStore, idGenerator);
+CatalogHookDispatcher catalogHookDispatcher = new 
CatalogHookDispatcher(catalogManager);
 CatalogNormalizeDispatcher catalogNormalizeDispatcher =
-new 
CatalogNormalizeDispatcher(installDispatcherHooks((CatalogDispatcher) 
catalogManager));
+new CatalogNormalizeDispatcher(catalogHookDispatcher);

Review Comment:
   It seems that we have wrapped the dispatcher too many times. 



##
core/src/main/java/org/apache/gravitino/hook/AccessControlHookDispatcher.java:
##
@@ -0,0 +1,150 @@
+/*
+ * 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 t

Re: [PR] [#4236][FOLLOWUP] feat(core): Rework of post hook for dispatcher [gravitino]

2024-08-08 Thread via GitHub


jerqi closed pull request #4429: [#4236][FOLLOWUP] feat(core): Rework of post 
hook for dispatcher
URL: https://github.com/apache/gravitino/pull/4429


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



Re: [PR] [#4236][FOLLOWUP] feat(core): Rework of post hook for dispatcher [gravitino]

2024-08-08 Thread via GitHub


jerqi commented on code in PR #4429:
URL: https://github.com/apache/gravitino/pull/4429#discussion_r1708841578


##
core/src/main/java/org/apache/gravitino/hook/CatalogHookDispatcher.java:
##
@@ -0,0 +1,101 @@
+/*
+ * 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.gravitino.hook;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import java.util.Map;
+import org.apache.gravitino.Catalog;
+import org.apache.gravitino.CatalogChange;
+import org.apache.gravitino.NameIdentifier;
+import org.apache.gravitino.Namespace;
+import org.apache.gravitino.catalog.CatalogDispatcher;
+import org.apache.gravitino.exceptions.CatalogAlreadyExistsException;
+import org.apache.gravitino.exceptions.NoSuchCatalogException;
+import org.apache.gravitino.exceptions.NoSuchMetalakeException;
+
+public class CatalogHookDispatcher implements CatalogDispatcher {
+  private final CatalogDispatcher dispatcher;
+  private final List createPostHooks;
+
+  public CatalogHookDispatcher(CatalogDispatcher dispatcher) {
+this.dispatcher = dispatcher;
+this.createPostHooks = Lists.newArrayList();
+  }
+
+  @Override
+  public NameIdentifier[] listCatalogs(Namespace namespace) throws 
NoSuchMetalakeException {
+return dispatcher.listCatalogs(namespace);
+  }
+
+  @Override
+  public Catalog[] listCatalogsInfo(Namespace namespace) throws 
NoSuchMetalakeException {
+return dispatcher.listCatalogsInfo(namespace);
+  }
+
+  @Override
+  public Catalog loadCatalog(NameIdentifier ident) throws 
NoSuchCatalogException {
+return dispatcher.loadCatalog(ident);
+  }
+
+  @Override
+  public Catalog createCatalog(
+  NameIdentifier ident,
+  Catalog.Type type,
+  String provider,
+  String comment,
+  Map properties)
+  throws NoSuchMetalakeException, CatalogAlreadyExistsException {
+Catalog catalog = dispatcher.createCatalog(ident, type, provider, comment, 
properties);
+for (CatalogCreatePostHook hook : createPostHooks) {
+  hook.execute(ident);
+}

Review Comment:
   I feel that we should extract the abstraction of the hook. It will be 
convenient to extend more post hooks.



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



Re: [PR] [#4236][FOLLOWUP] feat(core): Rework of post hook for dispatcher [gravitino]

2024-08-08 Thread via GitHub


xunliu commented on code in PR #4429:
URL: https://github.com/apache/gravitino/pull/4429#discussion_r1708798481


##
core/src/main/java/org/apache/gravitino/hook/CatalogHookDispatcher.java:
##
@@ -0,0 +1,101 @@
+/*
+ * 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.gravitino.hook;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import java.util.Map;
+import org.apache.gravitino.Catalog;
+import org.apache.gravitino.CatalogChange;
+import org.apache.gravitino.NameIdentifier;
+import org.apache.gravitino.Namespace;
+import org.apache.gravitino.catalog.CatalogDispatcher;
+import org.apache.gravitino.exceptions.CatalogAlreadyExistsException;
+import org.apache.gravitino.exceptions.NoSuchCatalogException;
+import org.apache.gravitino.exceptions.NoSuchMetalakeException;
+
+public class CatalogHookDispatcher implements CatalogDispatcher {
+  private final CatalogDispatcher dispatcher;
+  private final List createPostHooks;
+
+  public CatalogHookDispatcher(CatalogDispatcher dispatcher) {
+this.dispatcher = dispatcher;
+this.createPostHooks = Lists.newArrayList();
+  }
+
+  @Override
+  public NameIdentifier[] listCatalogs(Namespace namespace) throws 
NoSuchMetalakeException {
+return dispatcher.listCatalogs(namespace);
+  }
+
+  @Override
+  public Catalog[] listCatalogsInfo(Namespace namespace) throws 
NoSuchMetalakeException {
+return dispatcher.listCatalogsInfo(namespace);
+  }
+
+  @Override
+  public Catalog loadCatalog(NameIdentifier ident) throws 
NoSuchCatalogException {
+return dispatcher.loadCatalog(ident);
+  }
+
+  @Override
+  public Catalog createCatalog(
+  NameIdentifier ident,
+  Catalog.Type type,
+  String provider,
+  String comment,
+  Map properties)
+  throws NoSuchMetalakeException, CatalogAlreadyExistsException {
+Catalog catalog = dispatcher.createCatalog(ident, type, provider, comment, 
properties);
+for (CatalogCreatePostHook hook : createPostHooks) {
+  hook.execute(ident);
+}

Review Comment:
   I think we can directly execute the here, didn't need to call 
`hook.execute()`.
   ```
   ownerManager.setOwner(
   ident.name(),
   NameIdentifierUtil.toMetadataObject(ident, 
Entity.EntityType.METALAKE),
   PrincipalUtils.getCurrentUserName(),
   Owner.Type.USER);
   ```
   
   
   



##
core/src/main/java/org/apache/gravitino/authorization/AuthorizationHookRegistry.java:
##


Review Comment:
   I think we didn't need this class.



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