Class TrialOnlyLicenseManager
java.lang.Object
io.confluent.license.TrialOnlyLicenseManager
- All Implemented Interfaces:
AddOnLicenseManager
License manager for managing only trial licenses in Confluent Platform.
The manager uses a delegate pattern internally, delegating most operations to a
LicenseManager configured specifically for trial only license management with
PRIMARY purpose.
-
Constructor Summary
ConstructorsConstructorDescriptionTrialOnlyLicenseManager(ConfluentLicenseStore store, org.apache.kafka.common.utils.Time time) Create a new trial only license manager for testing purposes using a pre-configured license store and time source.TrialOnlyLicenseManager(String topic, Map<String, Object> producerConfig, Map<String, Object> consumerConfig, Map<String, Object> topicConfig, String licenseGuid) Create a new trial only license manager that uses the specified topic for trial licenses, with configurations for an admin client, producer, and consumer to create, write to, and read from that topic in a Kafka cluster. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddListener(Consumer<LicenseChanged> listener) registerOrValidateAddOnLicense(String license) Register or validate only a trial license.voidstart()voidstop()
-
Constructor Details
-
TrialOnlyLicenseManager
public TrialOnlyLicenseManager(String topic, Map<String, Object> producerConfig, Map<String, Object> consumerConfig, Map<String, Object> topicConfig, String licenseGuid) Create a new trial only license manager that uses the specified topic for trial licenses, with configurations for an admin client, producer, and consumer to create, write to, and read from that topic in a Kafka cluster.The trial only license store will be automatically started as part of construction.
Multiple components can use this manager with different
licenseGuidvalues to maintain separate trial licenses in the same Kafka topic. The GUID acts as a partition key for license isolation.- Parameters:
topic- the name of the topic where only trial licenses are persisted; may not be nullproducerConfig- the configuration for the producer used to write to the license topic; may not be nullconsumerConfig- the configuration for the consumer used to read from the license topic; may not be nulltopicConfig- the configuration for the admin client to create the license topic if required; may not be nulllicenseGuid- the unique identifier for the license; may not be null
-
TrialOnlyLicenseManager
public TrialOnlyLicenseManager(ConfluentLicenseStore store, org.apache.kafka.common.utils.Time time) Create a new trial only license manager for testing purposes using a pre-configured license store and time source.This constructor is intended for unit testing and allows injection of mock dependencies to control behavior in tests.
- Parameters:
store- the pre-configured license store to use; may not be nulltime- the time source to use for license validation; may not be null
-
-
Method Details
-
registerOrValidateAddOnLicense
Register or validate only a trial license. If the provided license string is empty or null, this will attempt to load an existing trial license from storage, or generate a new trial license if none exists.- Specified by:
registerOrValidateAddOnLicensein interfaceAddOnLicenseManager- Parameters:
license- the trial license string to validate, or empty/null to use stored license- Returns:
- the validated trial license; never null
- Throws:
InvalidLicenseException- if the license is invalid, expired, or cannot be processed
-
start
public void start()- Specified by:
startin interfaceAddOnLicenseManager
-
stop
public void stop()- Specified by:
stopin interfaceAddOnLicenseManager
-
addListener
- Specified by:
addListenerin interfaceAddOnLicenseManager
-