Package org.apache.gravitino.credential
Class CredentialProviderDelegator<T extends Credential>
java.lang.Object
org.apache.gravitino.credential.CredentialProviderDelegator<T>
- Type Parameters:
T- The type of credential generated by this provider.
- All Implemented Interfaces:
Closeable,AutoCloseable,CredentialProvider
public abstract class CredentialProviderDelegator<T extends Credential>
extends Object
implements CredentialProvider
An abstract base class for
CredentialProvider implementations that delegate the actual
credential generation to a CredentialGenerator. It handles the lazy and reflective
loading of the generator to isolate heavy dependencies.-
Field Summary
FieldsModifier and TypeFieldDescriptionThe properties used by the generator to generate the credential. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getCredential(CredentialContext context) Delegates the credential generation to the loadedCredentialGenerator.protected abstract StringReturns the fully qualified class name of theCredentialGeneratorimplementation.voidinitialize(Map<String, String> properties) Initializes the provider by storing properties and loading the associatedCredentialGenerator.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.gravitino.credential.CredentialProvider
credentialType
-
Field Details
-
properties
The properties used by the generator to generate the credential.
-
-
Constructor Details
-
CredentialProviderDelegator
public CredentialProviderDelegator()
-
-
Method Details
-
initialize
Initializes the provider by storing properties and loading the associatedCredentialGenerator.- Specified by:
initializein interfaceCredentialProvider- Parameters:
properties- A map of configuration properties for the provider.
-
getCredential
Delegates the credential generation to the loadedCredentialGenerator.- Specified by:
getCredentialin interfaceCredentialProvider- Parameters:
context- The context containing information required for credential retrieval.- Returns:
- A
Credentialobject. - Throws:
RuntimeException- if credential generation fails.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getGeneratorClassName
Returns the fully qualified class name of theCredentialGeneratorimplementation. This generator will be loaded via reflection to perform the actual credential creation.- Returns:
- The class name of the credential generator.
-