KeyManagementServices
Factory for creating KeyManagementService instances.
Provides a simple API that hides ServiceLoader complexity and makes it easy to create KMS instances by provider name.
Instance Caching: KMS instances are cached based on provider name and configuration. This means calling create() with the same provider and configuration will return the same instance, avoiding expensive client initialization overhead.
Resource Management: Cached instances that implement AutoCloseable are automatically closed when shutdown is called or when the JVM shuts down. Call shutdown explicitly to ensure proper cleanup of resources.
Example with Typed Configuration:
import org.trustweave.awskms.awsKmsOptions
val kms = KeyManagementServices.create("aws", awsKmsOptions {
region = "us-east-1"
})Example with Map Configuration:
val kms = KeyManagementServices.create("aws", mapOf(
"region" to "us-east-1"
))Functions
Gets all available provider names.
Clears the instance cache.
Creates a KeyManagementService instance for the specified provider (Map-based).
Creates a KeyManagementService instance for the specified provider.
Gets the current cache size (for testing/debugging).
Gets a provider by name (for advanced use cases).
Checks if the factory has been shut down.
Resets the shutdown state for testing purposes only. This method should not be used in production code.