114 lines
3.0 KiB
Java
114 lines
3.0 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* javax.baja.nre.util.TextUtil
|
|
*/
|
|
package com.tridium.sys.license;
|
|
|
|
import com.tridium.sys.license.LicenseUtil;
|
|
import java.util.Properties;
|
|
import javax.baja.license.Feature;
|
|
import javax.baja.license.FeatureLicenseExpiredException;
|
|
import javax.baja.license.FeatureNotLicensedException;
|
|
import javax.baja.nre.util.TextUtil;
|
|
import javax.baja.sys.Clock;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public class NFeature
|
|
implements Feature {
|
|
static Properties noProps = new Properties();
|
|
final String key;
|
|
final String vendorName;
|
|
final String featureName;
|
|
long expiration;
|
|
Properties props;
|
|
|
|
public String getVendorName() {
|
|
return this.vendorName;
|
|
}
|
|
|
|
public String getFeatureName() {
|
|
return this.featureName;
|
|
}
|
|
|
|
public boolean isExpired() {
|
|
boolean bl = false;
|
|
if (this.expiration < Clock.millis()) {
|
|
bl = true;
|
|
}
|
|
return bl;
|
|
}
|
|
|
|
public void check() throws FeatureNotLicensedException {
|
|
if (this.isExpired()) {
|
|
throw new FeatureLicenseExpiredException(this.toString());
|
|
}
|
|
}
|
|
|
|
public long getExpiration() {
|
|
return this.expiration;
|
|
}
|
|
|
|
public String[] list() {
|
|
return this.props.keySet().toArray(new String[this.props.size()]);
|
|
}
|
|
|
|
public String get(String string) {
|
|
return this.props.getProperty(string);
|
|
}
|
|
|
|
public String get(String string, String string2) {
|
|
return this.props.getProperty(string, string2);
|
|
}
|
|
|
|
public boolean getb(String string, boolean bl) {
|
|
String string2 = this.props.getProperty(string);
|
|
if (string2 == null) {
|
|
return bl;
|
|
}
|
|
if ((string2 = TextUtil.toLowerCase((String)string2)).equals("true")) {
|
|
return true;
|
|
}
|
|
if (string2.equals("false")) {
|
|
return false;
|
|
}
|
|
throw new IllegalStateException("Invalid boolean " + string2);
|
|
}
|
|
|
|
public int geti(String string, int n) {
|
|
String string2 = this.props.getProperty(string);
|
|
if (string2 == null) {
|
|
return n;
|
|
}
|
|
return Integer.parseInt(string2);
|
|
}
|
|
|
|
public String toString() {
|
|
String string = this.expiration == Long.MAX_VALUE ? "never" : LicenseUtil.formatDate(this.expiration);
|
|
if (this.isExpired()) {
|
|
return this.key + " [EXPIRED: " + string + ']';
|
|
}
|
|
return this.key + " [expires: " + string + ']';
|
|
}
|
|
|
|
void merge(NFeature nFeature) {
|
|
this.expiration = Math.max(this.expiration, nFeature.expiration);
|
|
}
|
|
|
|
private final /* synthetic */ void this() {
|
|
this.props = noProps;
|
|
}
|
|
|
|
NFeature(String string, String string2, long l) {
|
|
this.this();
|
|
this.key = LicenseUtil.toKey(string, string2);
|
|
this.vendorName = string;
|
|
this.featureName = string2;
|
|
this.expiration = l;
|
|
}
|
|
}
|
|
|