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


##########
common/src/main/java/org/apache/gravitino/credential/CredentialProviderDelegator.java:
##########
@@ -0,0 +1,105 @@
+/*
+ * 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.credential;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.Map;
+
+/**
+ * An abstract base class for {@link CredentialProvider} implementations that 
delegate the actual
+ * credential generation to a {@link CredentialGenerator}. It handles the lazy 
and reflective
+ * loading of the generator to isolate heavy dependencies.
+ *
+ * @param <T> The type of credential generated by this provider.
+ */
+public abstract class CredentialProviderDelegator<T extends Credential>
+    implements CredentialProvider {
+
+  /** The properties used by the generator to generate the credential. */
+  protected Map<String, String> properties;
+
+  private volatile CredentialGenerator<T> generator;
+
+  /**
+   * Initializes the provider by storing properties and loading the associated 
{@link
+   * CredentialGenerator}.
+   *
+   * @param properties A map of configuration properties for the provider.
+   */
+  @Override
+  public void initialize(Map<String, String> properties) {
+    this.properties = properties;

Review Comment:
   Shall we use the immutable map? Also, do we have the threading issue in 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]

Reply via email to