feat: add LicenseInfo and Feature domain model
- Feature enum with topology, lineage, correlation, debugger, replay - LicenseInfo record with tier, features, limits, issuedAt, expiresAt - Open mode factory method for standalone/dev usage
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
package com.cameleer3.server.core.license;
|
||||||
|
|
||||||
|
public enum Feature {
|
||||||
|
topology,
|
||||||
|
lineage,
|
||||||
|
correlation,
|
||||||
|
debugger,
|
||||||
|
replay
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.cameleer3.server.core.license;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public record LicenseInfo(
|
||||||
|
String tier,
|
||||||
|
Set<Feature> features,
|
||||||
|
Map<String, Integer> limits,
|
||||||
|
Instant issuedAt,
|
||||||
|
Instant expiresAt
|
||||||
|
) {
|
||||||
|
public boolean isExpired() {
|
||||||
|
return expiresAt != null && Instant.now().isAfter(expiresAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasFeature(Feature feature) {
|
||||||
|
return features.contains(feature);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLimit(String key, int defaultValue) {
|
||||||
|
return limits.getOrDefault(key, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Open license — all features enabled, no limits. Used when no license is configured. */
|
||||||
|
public static LicenseInfo open() {
|
||||||
|
return new LicenseInfo("open", Set.of(Feature.values()), Map.of(), Instant.now(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user