link start!
This commit is contained in:
@@ -0,0 +1,273 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.nre.util.TextUtil
|
||||
* javax.baja.xml.XWriter
|
||||
*/
|
||||
package com.tridium.sys.license.dom;
|
||||
|
||||
import com.tridium.sys.license.dom.CertificateSet;
|
||||
import com.tridium.sys.license.dom.VendorCertificate;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.xml.XWriter;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class CertificateDatabase
|
||||
extends CertificateSet {
|
||||
public static final CertificateDatabase LOCAL_INSTANCE = new LocalCertificateDatabase();
|
||||
protected BDirectory certDbRoot;
|
||||
static /* synthetic */ Class class$com$tridium$sys$license$dom$VendorCertificate;
|
||||
static /* synthetic */ Class class$java$lang$String;
|
||||
|
||||
public VendorCertificate[] getCertificates() throws Exception {
|
||||
Class clazz = class$com$tridium$sys$license$dom$VendorCertificate;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$sys$license$dom$VendorCertificate = CertificateDatabase.class("[Lcom.tridium.sys.license.dom.VendorCertificate;", false);
|
||||
}
|
||||
Array array = new Array(clazz);
|
||||
BDirectory bDirectory = (BDirectory)this.getSpace().findFile(this.getRootPath());
|
||||
if (bDirectory != null) {
|
||||
BIFile[] bIFileArray = bDirectory.listFiles();
|
||||
int n = 0;
|
||||
while (n < bIFileArray.length) {
|
||||
if ("certificate".equals(bIFileArray[n].getExtension())) {
|
||||
array.add((Object)VendorCertificate.make(bIFileArray[n]));
|
||||
break;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
return (VendorCertificate[])array.trim();
|
||||
}
|
||||
|
||||
public boolean add(VendorCertificate vendorCertificate) throws Exception {
|
||||
VendorCertificate vendorCertificate2 = this.getCertificate(vendorCertificate.getVendor());
|
||||
if (vendorCertificate2 == null || vendorCertificate.getGenerated() >= vendorCertificate2.getGenerated()) {
|
||||
BIFile bIFile = this.getSpace().makeFile(this.getFilePath(vendorCertificate.getVendor()));
|
||||
OutputStream outputStream = bIFile.getOutputStream();
|
||||
this.writeCertificate(vendorCertificate, outputStream);
|
||||
try {
|
||||
outputStream.close();
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
boolean bl = false;
|
||||
if (vendorCertificate2 != null) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean remove(VendorCertificate vendorCertificate) throws Exception {
|
||||
return this.removeCertificate(vendorCertificate.getVendor());
|
||||
}
|
||||
|
||||
public void clear() throws Exception {
|
||||
BDirectory bDirectory = this.getSpace().makeDir(this.getRootPath(), null);
|
||||
BIFile[] bIFileArray = bDirectory.listFiles();
|
||||
int n = 0;
|
||||
while (n < bIFileArray.length) {
|
||||
if ("certificate".equals(bIFileArray[n].getExtension())) {
|
||||
bIFileArray[n].delete();
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public String[] getVendors() {
|
||||
this.init();
|
||||
Class clazz = class$java$lang$String;
|
||||
if (clazz == null) {
|
||||
clazz = class$java$lang$String = CertificateDatabase.class("[Ljava.lang.String;", false);
|
||||
}
|
||||
Array array = new Array(clazz);
|
||||
BDirectory bDirectory = (BDirectory)this.getSpace().findFile(this.getRootPath());
|
||||
if (bDirectory != null) {
|
||||
BIFile[] bIFileArray = bDirectory.listFiles();
|
||||
int n = 0;
|
||||
while (n < bIFileArray.length) {
|
||||
if ("certificate".equals(bIFileArray[n].getExtension())) {
|
||||
array.add((Object)bIFileArray[n].getFileName());
|
||||
break;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
return (String[])array.trim();
|
||||
}
|
||||
|
||||
public VendorCertificate getCertificate(String string) throws Exception {
|
||||
this.init();
|
||||
BIFile bIFile = this.getSpace().findFile(this.getFilePath(string));
|
||||
return bIFile == null ? null : VendorCertificate.make(bIFile);
|
||||
}
|
||||
|
||||
public boolean removeCertificate(String string) throws Exception {
|
||||
this.init();
|
||||
BIFile bIFile = this.getSpace().findFile(this.getFilePath(string));
|
||||
if (bIFile == null) {
|
||||
return false;
|
||||
}
|
||||
bIFile.delete();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void importFile(BIFile bIFile) throws Exception {
|
||||
if ("lar".equals(bIFile.getExtension())) {
|
||||
this.importCertificates(bIFile);
|
||||
} else if ("certificate".equals(bIFile.getExtension())) {
|
||||
this.add(VendorCertificate.make(bIFile));
|
||||
} else {
|
||||
throw new IllegalArgumentException("importFile argument must be a certificate file or license archive");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void importCertificates(BIFile bIFile) throws Exception {
|
||||
InputStream inputStream = bIFile.getInputStream();
|
||||
try {
|
||||
this.importLicenses(inputStream);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var4_4 = null;
|
||||
try {
|
||||
inputStream.close();
|
||||
throw throwable;
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var4_5 = null;
|
||||
}
|
||||
try {}
|
||||
catch (Exception exception) {
|
||||
return;
|
||||
}
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
/*
|
||||
* Exception decompiling
|
||||
*/
|
||||
public void importLicenses(InputStream var1_1) throws Exception {
|
||||
/*
|
||||
* This method has failed to decompile. When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
|
||||
*
|
||||
* org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 2[TRYBLOCK] [2 : 101->105)] java.lang.Throwable
|
||||
* at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
|
||||
* at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
|
||||
* at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
|
||||
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
|
||||
* at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
|
||||
* at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
|
||||
* at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
|
||||
* at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
|
||||
* at org.benf.cfr.reader.Main.main(Main.java:54)
|
||||
*/
|
||||
throw new IllegalStateException("Decompilation failed");
|
||||
}
|
||||
|
||||
/*
|
||||
* Exception decompiling
|
||||
*/
|
||||
public void exportLicenses(OutputStream var1_1) throws Exception {
|
||||
/*
|
||||
* This method has failed to decompile. When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
|
||||
*
|
||||
* org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 2[TRYBLOCK] [3 : 187->191)] java.lang.Throwable
|
||||
* at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
|
||||
* at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
|
||||
* at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
|
||||
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
|
||||
* at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
|
||||
* at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
|
||||
* at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
|
||||
* at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
|
||||
* at org.benf.cfr.reader.Main.main(Main.java:54)
|
||||
*/
|
||||
throw new IllegalStateException("Decompilation failed");
|
||||
}
|
||||
|
||||
protected BFileSpace getSpace() {
|
||||
return this.certDbRoot.getFileSpace();
|
||||
}
|
||||
|
||||
protected FilePath getRootPath() {
|
||||
return this.certDbRoot.getFilePath();
|
||||
}
|
||||
|
||||
protected FilePath getFilePath(String string) {
|
||||
return this.getRootPath().merge(TextUtil.capitalize((String)string) + ".certificate");
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
}
|
||||
|
||||
protected void writeCertificate(VendorCertificate vendorCertificate, OutputStream outputStream) throws Exception {
|
||||
XWriter xWriter = new XWriter(outputStream);
|
||||
vendorCertificate.save(xWriter);
|
||||
xWriter.flush();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public CertificateDatabase(BDirectory bDirectory) {
|
||||
this.certDbRoot = bDirectory;
|
||||
}
|
||||
|
||||
protected CertificateDatabase() {
|
||||
}
|
||||
|
||||
private static class LocalCertificateDatabase
|
||||
extends CertificateDatabase {
|
||||
public LocalCertificateDatabase() {
|
||||
try {
|
||||
this.certDbRoot = BFileSystem.INSTANCE.makeDir(new FilePath("!certificates"));
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException(exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.TextUtil
|
||||
*/
|
||||
package com.tridium.sys.license.dom;
|
||||
|
||||
import com.tridium.sys.license.dom.VendorCertificate;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class CertificateSet {
|
||||
private ArrayList list;
|
||||
|
||||
public VendorCertificate[] getCertificates() throws Exception {
|
||||
VendorCertificate[] vendorCertificateArray = new VendorCertificate[this.list.size()];
|
||||
this.list.toArray(vendorCertificateArray);
|
||||
return vendorCertificateArray;
|
||||
}
|
||||
|
||||
public boolean add(VendorCertificate vendorCertificate) throws Exception {
|
||||
this.list.add(vendorCertificate);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean remove(VendorCertificate vendorCertificate) throws Exception {
|
||||
return this.list.remove(vendorCertificate);
|
||||
}
|
||||
|
||||
public void clear() throws Exception {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
public void load(BDirectory bDirectory) {
|
||||
BIFile[] bIFileArray = bDirectory.listFiles();
|
||||
int n = 0;
|
||||
while (bIFileArray != null && n < bIFileArray.length) {
|
||||
BIFile bIFile = bIFileArray[n];
|
||||
if (!bIFile.isDirectory() && "certificate".equals(bIFile.getExtension())) {
|
||||
try {
|
||||
this.add(VendorCertificate.make(bIFile));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
System.out.println("ERROR: Cannot read \"" + bIFile + '\"');
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public void dump() throws Exception {
|
||||
this.dump(new PrintWriter(System.out));
|
||||
}
|
||||
|
||||
public void dump(PrintWriter printWriter) throws Exception {
|
||||
printWriter.println(TextUtil.getClassName(this.getClass()));
|
||||
Iterator iterator = this.list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
((VendorCertificate)iterator.next()).dump(printWriter);
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.list = new ArrayList();
|
||||
}
|
||||
|
||||
public CertificateSet() {
|
||||
this.this();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.nre.util.TextUtil
|
||||
* javax.baja.xml.XElem
|
||||
* javax.baja.xml.XException
|
||||
*/
|
||||
package com.tridium.sys.license.dom;
|
||||
|
||||
import com.tridium.sys.license.LicenseUtil;
|
||||
import com.tridium.sys.license.dom.VendorLicense;
|
||||
import java.io.PrintWriter;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.xml.XElem;
|
||||
import javax.baja.xml.XException;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class Feature
|
||||
implements Comparable {
|
||||
private final VendorLicense parent;
|
||||
private final String name;
|
||||
private final String key;
|
||||
private XElem xml;
|
||||
static /* synthetic */ Class class$java$lang$String;
|
||||
|
||||
static Feature make(VendorLicense vendorLicense, String string) {
|
||||
if (string.equalsIgnoreCase("brand")) {
|
||||
return new Brand(vendorLicense);
|
||||
}
|
||||
return new Feature(vendorLicense, string);
|
||||
}
|
||||
|
||||
static String toKey(String string) {
|
||||
return TextUtil.toLowerCase((String)string);
|
||||
}
|
||||
|
||||
public VendorLicense getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean isExpired() {
|
||||
boolean bl = false;
|
||||
if (Clock.millis() > this.getExpiration() || this.parent.isExpired()) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public long getExpiration() {
|
||||
String string = this.xml.get("expiration", null);
|
||||
return string == null ? Long.MAX_VALUE : LicenseUtil.parseDate(string);
|
||||
}
|
||||
|
||||
public void setExpiration(long l) {
|
||||
this.modify();
|
||||
this.xml.setAttr("expiration", LicenseUtil.formatDate(l));
|
||||
}
|
||||
|
||||
public int compareTo(Object object) {
|
||||
String string = ((Feature)object).name;
|
||||
if (this.name.equals("about")) {
|
||||
return -1;
|
||||
}
|
||||
if (this.name.equals("brand")) {
|
||||
return string.equals("about") ? 1 : -1;
|
||||
}
|
||||
return this.name.compareTo(string);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.parent.getVendor() + ':' + this.getName();
|
||||
}
|
||||
|
||||
public String get(String string) {
|
||||
return this.xml.get(string, null);
|
||||
}
|
||||
|
||||
public String get(String string, String string2) {
|
||||
return this.xml.get(string, string2);
|
||||
}
|
||||
|
||||
public boolean getb(String string, boolean bl) {
|
||||
return this.xml.getb(string, bl);
|
||||
}
|
||||
|
||||
public int geti(String string, int n) {
|
||||
return this.xml.geti(string, n);
|
||||
}
|
||||
|
||||
public String[] list() {
|
||||
Class clazz = class$java$lang$String;
|
||||
if (clazz == null) {
|
||||
clazz = class$java$lang$String = Feature.class("[Ljava.lang.String;", false);
|
||||
}
|
||||
Array array = new Array(clazz, this.xml.attrSize());
|
||||
int n = 0;
|
||||
while (n < this.xml.attrSize()) {
|
||||
String string = this.xml.attrName(n);
|
||||
if (!string.equals("name") && !string.equals("expiration")) {
|
||||
array.add((Object)string);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return (String[])array.trim();
|
||||
}
|
||||
|
||||
public void set(String string, String string2) {
|
||||
this.xml.setAttr(string, string2);
|
||||
}
|
||||
|
||||
public final void set(String string, boolean bl) {
|
||||
this.set(string, String.valueOf(bl));
|
||||
}
|
||||
|
||||
public final void set(String string, int n) {
|
||||
this.set(string, String.valueOf(n));
|
||||
}
|
||||
|
||||
public final void remove(String string) {
|
||||
this.xml.removeAttr(string);
|
||||
}
|
||||
|
||||
void load(XElem xElem) throws Exception {
|
||||
if (!xElem.qname().equals("feature")) {
|
||||
throw new XException("Root element must be <feature> element", xElem);
|
||||
}
|
||||
this.xml = xElem.copy();
|
||||
}
|
||||
|
||||
XElem save() {
|
||||
return this.xml.copy();
|
||||
}
|
||||
|
||||
public void dump(PrintWriter printWriter) {
|
||||
printWriter.println(" " + this.name);
|
||||
printWriter.println(" expiration: " + LicenseUtil.formatDate(this.getExpiration()));
|
||||
String[] stringArray = this.list();
|
||||
int n = 0;
|
||||
while (n < stringArray.length) {
|
||||
printWriter.println(" " + TextUtil.pad((String)(stringArray[n] + ": "), (int)20) + this.get(stringArray[n]));
|
||||
++n;
|
||||
}
|
||||
printWriter.flush();
|
||||
}
|
||||
|
||||
public void modify() {
|
||||
this.getParent().modify();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private Feature(VendorLicense vendorLicense, String string) {
|
||||
if (vendorLicense == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
this.parent = vendorLicense;
|
||||
this.name = string;
|
||||
this.key = Feature.toKey(string);
|
||||
this.xml = new XElem("feature");
|
||||
this.xml.setAttr("name", string);
|
||||
}
|
||||
|
||||
public static class Brand
|
||||
extends Feature {
|
||||
public String getBrandId() {
|
||||
return this.get("brandId");
|
||||
}
|
||||
|
||||
public String getStationIn() {
|
||||
return this.get("accept.station.in");
|
||||
}
|
||||
|
||||
public String getStationOut() {
|
||||
return this.get("accept.station.out");
|
||||
}
|
||||
|
||||
public String getWbIn() {
|
||||
return this.get("accept.wb.in");
|
||||
}
|
||||
|
||||
public String getWbOut() {
|
||||
return this.get("accept.wb.out");
|
||||
}
|
||||
|
||||
Brand(VendorLicense vendorLicense) {
|
||||
super(vendorLicense, "brand");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.sys.license.dom;
|
||||
|
||||
import com.tridium.sys.license.dom.Feature;
|
||||
import com.tridium.sys.license.dom.LicenseSet;
|
||||
import com.tridium.sys.license.dom.VendorLicense;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class HostLicenseSet
|
||||
extends LicenseSet {
|
||||
public String getHostId() throws Exception {
|
||||
Iterator iterator = this.iterator();
|
||||
return iterator.hasNext() ? ((VendorLicense)iterator.next()).getHostId() : null;
|
||||
}
|
||||
|
||||
public VendorLicense getVendorLicense(String string) throws Exception {
|
||||
Iterator iterator = this.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
VendorLicense vendorLicense = (VendorLicense)iterator.next();
|
||||
if (!string.equalsIgnoreCase(vendorLicense.getVendor())) continue;
|
||||
return vendorLicense;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public VendorLicense getTridiumLicense() throws Exception {
|
||||
return this.getVendorLicense("tridium");
|
||||
}
|
||||
|
||||
public Feature.Brand getBrandFeature() throws Exception {
|
||||
return this.getTridiumLicense().getBrandFeature();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,579 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.xml.XWriter
|
||||
*/
|
||||
package com.tridium.sys.license.dom;
|
||||
|
||||
import com.tridium.sys.license.dom.HostLicenseSet;
|
||||
import com.tridium.sys.license.dom.LicenseSet;
|
||||
import com.tridium.sys.license.dom.VendorLicense;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.xml.XWriter;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class LicenseDatabase
|
||||
extends LicenseSet {
|
||||
public static final LicenseDatabase LOCAL_INSTANCE = new LocalLicenseDatabase();
|
||||
protected BDirectory licenseDbRoot;
|
||||
static /* synthetic */ Class class$java$lang$String;
|
||||
static /* synthetic */ Class class$com$tridium$sys$license$dom$VendorLicense;
|
||||
|
||||
public Iterator iterator() throws Exception {
|
||||
return new LicenseDatabaseIterator();
|
||||
}
|
||||
|
||||
public boolean add(VendorLicense vendorLicense) throws Exception {
|
||||
if (vendorLicense.getHostId().equals("*")) {
|
||||
return false;
|
||||
}
|
||||
VendorLicense vendorLicense2 = this.getLicense(vendorLicense.getHostId(), vendorLicense.getVendor(), vendorLicense.getBrandId());
|
||||
if (vendorLicense2 == null || vendorLicense.getGenerated() >= vendorLicense2.getGenerated()) {
|
||||
BDirectory bDirectory = this.makeHostDirectory(vendorLicense.getHostId());
|
||||
BIFile bIFile = this.getSpace().makeFile(bDirectory.getFilePath().merge(vendorLicense.getLicenseName() + ".license"));
|
||||
OutputStream outputStream = bIFile.getOutputStream();
|
||||
this.writeLicense(vendorLicense, outputStream);
|
||||
try {
|
||||
outputStream.close();
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean remove(VendorLicense vendorLicense) throws Exception {
|
||||
return this.removeLicense(vendorLicense.getHostId(), vendorLicense.getVendor(), vendorLicense.getBrandId());
|
||||
}
|
||||
|
||||
public void clear() throws Exception {
|
||||
BDirectory bDirectory = this.getSpace().makeDir(this.getRootPath(), null);
|
||||
BIFile[] bIFileArray = bDirectory.listFiles();
|
||||
int n = 0;
|
||||
while (n < bIFileArray.length) {
|
||||
if (bIFileArray[n] instanceof BDirectory) {
|
||||
BIFile[] bIFileArray2 = ((BDirectory)bIFileArray[n]).listFiles();
|
||||
boolean bl = true;
|
||||
int n2 = 0;
|
||||
while (n2 < bIFileArray2.length) {
|
||||
if ("license".equals(bIFileArray2[n2].getExtension())) {
|
||||
bIFileArray2[n2].delete();
|
||||
} else {
|
||||
bl = false;
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
if (bl) {
|
||||
bIFileArray[n].delete();
|
||||
}
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public HostLicenseSet toHostLicenseSet(String string, String string2) throws Exception {
|
||||
HostLicenseSet hostLicenseSet = null;
|
||||
this.init();
|
||||
BDirectory bDirectory = this.getHostDirectory(string);
|
||||
if (bDirectory != null) {
|
||||
BIFile[] bIFileArray = bDirectory.listFiles();
|
||||
int n = 0;
|
||||
while (n < bIFileArray.length) {
|
||||
if ("license".equals(bIFileArray[n].getExtension())) {
|
||||
VendorLicense vendorLicense = VendorLicense.make(bIFileArray[n]);
|
||||
if (string2 == null || vendorLicense.getBrandId() == null || vendorLicense.getBrandId().equals(string2)) {
|
||||
if (hostLicenseSet == null) {
|
||||
hostLicenseSet = new HostLicenseSet();
|
||||
}
|
||||
if (hostLicenseSet.getVendorLicense(vendorLicense.getVendor()) != null) {
|
||||
throw new RuntimeException("Duplicate licenses for same hostId and vendor: " + vendorLicense.getVendor());
|
||||
}
|
||||
hostLicenseSet.add(vendorLicense);
|
||||
}
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
return hostLicenseSet;
|
||||
}
|
||||
|
||||
public String[] getHostIds() {
|
||||
this.init();
|
||||
Class clazz = class$java$lang$String;
|
||||
if (clazz == null) {
|
||||
clazz = class$java$lang$String = LicenseDatabase.class("[Ljava.lang.String;", false);
|
||||
}
|
||||
Array array = new Array(clazz);
|
||||
BDirectory bDirectory = (BDirectory)this.getSpace().findFile(this.getRootPath());
|
||||
if (bDirectory != null) {
|
||||
BIFile[] bIFileArray = bDirectory.listFiles();
|
||||
int n = 0;
|
||||
while (n < bIFileArray.length) {
|
||||
if (bIFileArray[n] instanceof BDirectory) {
|
||||
BIFile[] bIFileArray2 = ((BDirectory)bIFileArray[n]).listFiles();
|
||||
int n2 = 0;
|
||||
while (n2 < bIFileArray2.length) {
|
||||
if ("license".equals(bIFileArray2[n2].getExtension())) {
|
||||
array.add((Object)bIFileArray[n].getFileName());
|
||||
break;
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
return (String[])array.trim();
|
||||
}
|
||||
|
||||
public VendorLicense[] getLicenses(String string) {
|
||||
return this.getLicenses(string, null);
|
||||
}
|
||||
|
||||
public VendorLicense[] getLicenses(String string, String string2) {
|
||||
this.init();
|
||||
String string3 = string2;
|
||||
Class clazz = class$com$tridium$sys$license$dom$VendorLicense;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$sys$license$dom$VendorLicense = LicenseDatabase.class("[Lcom.tridium.sys.license.dom.VendorLicense;", false);
|
||||
}
|
||||
Array array = new Array(clazz);
|
||||
BDirectory bDirectory = this.getHostDirectory(string);
|
||||
if (bDirectory != null) {
|
||||
BIFile[] bIFileArray = bDirectory.listFiles();
|
||||
int n = 0;
|
||||
while (n < bIFileArray.length) {
|
||||
if ("license".equals(bIFileArray[n].getExtension())) {
|
||||
try {
|
||||
VendorLicense vendorLicense = VendorLicense.make(bIFileArray[n]);
|
||||
if (string3 == null || vendorLicense.getBrandId() == null || string3.equals(vendorLicense.getBrandId())) {
|
||||
array.add((Object)vendorLicense);
|
||||
string3 = vendorLicense.getBrandId();
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
return (VendorLicense[])array.trim();
|
||||
}
|
||||
|
||||
public VendorLicense getLicense(String string, String string2, String string3) {
|
||||
this.init();
|
||||
BDirectory bDirectory = this.getHostDirectory(string);
|
||||
if (bDirectory != null) {
|
||||
String string4 = "tridium".equalsIgnoreCase(string2) && string3 != null ? string3 : string2;
|
||||
BIFile bIFile = (BIFile)bDirectory.getNavChild(string4 + ".license");
|
||||
try {
|
||||
return bIFile == null ? null : VendorLicense.make(bIFile);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean removeLicense(String string, String string2, String string3) throws Exception {
|
||||
String string4;
|
||||
BIFile bIFile;
|
||||
BDirectory bDirectory = this.getHostDirectory(string);
|
||||
if (bDirectory != null && (bIFile = (BIFile)bDirectory.getNavChild((string4 = "tridium".equalsIgnoreCase(string2) && string3 != null ? string3 : string2) + ".license")) != null) {
|
||||
bIFile.delete();
|
||||
if (bDirectory.listFiles().length == 0) {
|
||||
bDirectory.delete();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void importFile(BIFile bIFile) throws Exception {
|
||||
if ("lar".equals(bIFile.getExtension())) {
|
||||
this.importLicenses(bIFile);
|
||||
} else if ("license".equals(bIFile.getExtension())) {
|
||||
this.add(VendorLicense.make(bIFile));
|
||||
} else {
|
||||
throw new IllegalArgumentException("importFile argument must be a license file or license archive");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void importLicenses(BIFile bIFile) throws Exception {
|
||||
InputStream inputStream = bIFile.getInputStream();
|
||||
try {
|
||||
this.importLicenses(inputStream);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var4_4 = null;
|
||||
try {
|
||||
inputStream.close();
|
||||
throw throwable;
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var4_5 = null;
|
||||
}
|
||||
try {}
|
||||
catch (Exception exception) {
|
||||
return;
|
||||
}
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
/*
|
||||
* Exception decompiling
|
||||
*/
|
||||
public void importLicenses(InputStream var1_1) throws Exception {
|
||||
/*
|
||||
* This method has failed to decompile. When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
|
||||
*
|
||||
* org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 2[TRYBLOCK] [2 : 101->105)] java.lang.Throwable
|
||||
* at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
|
||||
* at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
|
||||
* at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
|
||||
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
|
||||
* at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
|
||||
* at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
|
||||
* at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
|
||||
* at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
|
||||
* at org.benf.cfr.reader.Main.main(Main.java:54)
|
||||
*/
|
||||
throw new IllegalStateException("Decompilation failed");
|
||||
}
|
||||
|
||||
/*
|
||||
* Exception decompiling
|
||||
*/
|
||||
public void exportLicenses(OutputStream var1_1) throws Exception {
|
||||
/*
|
||||
* This method has failed to decompile. When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
|
||||
*
|
||||
* org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 2[TRYBLOCK] [3 : 239->243)] java.lang.Throwable
|
||||
* at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
|
||||
* at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
|
||||
* at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
|
||||
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
|
||||
* at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
|
||||
* at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
|
||||
* at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
|
||||
* at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
|
||||
* at org.benf.cfr.reader.Main.main(Main.java:54)
|
||||
*/
|
||||
throw new IllegalStateException("Decompilation failed");
|
||||
}
|
||||
|
||||
/*
|
||||
* Exception decompiling
|
||||
*/
|
||||
public void exportLicenses(String[] var1_1, OutputStream var2_2) throws Exception {
|
||||
/*
|
||||
* This method has failed to decompile. When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
|
||||
*
|
||||
* org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 2[TRYBLOCK] [3 : 235->239)] java.lang.Throwable
|
||||
* at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
|
||||
* at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
|
||||
* at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
|
||||
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
|
||||
* at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
|
||||
* at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
|
||||
* at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
|
||||
* at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
|
||||
* at org.benf.cfr.reader.Main.main(Main.java:54)
|
||||
*/
|
||||
throw new IllegalStateException("Decompilation failed");
|
||||
}
|
||||
|
||||
protected BDirectory getHostDirectory(String string) {
|
||||
return (BDirectory)this.getSpace().findFile(this.getRootPath().merge(string));
|
||||
}
|
||||
|
||||
protected BDirectory makeHostDirectory(String string) throws Exception {
|
||||
return this.getSpace().makeDir(this.getRootPath().merge(string));
|
||||
}
|
||||
|
||||
protected BFileSpace getSpace() {
|
||||
return this.licenseDbRoot.getFileSpace();
|
||||
}
|
||||
|
||||
protected FilePath getRootPath() {
|
||||
return this.licenseDbRoot.getFilePath();
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
}
|
||||
|
||||
protected void writeLicense(VendorLicense vendorLicense, OutputStream outputStream) throws Exception {
|
||||
XWriter xWriter = new XWriter(outputStream);
|
||||
vendorLicense.save(xWriter);
|
||||
xWriter.flush();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public LicenseDatabase(BDirectory bDirectory) {
|
||||
this.licenseDbRoot = bDirectory;
|
||||
}
|
||||
|
||||
protected LicenseDatabase() {
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class LicenseDatabaseIterator
|
||||
implements Iterator {
|
||||
private String[] hostIds;
|
||||
private int hostIdx;
|
||||
private VendorLicense[] licensesForHost;
|
||||
private int licenseIdx;
|
||||
|
||||
/*
|
||||
* Unable to fully structure code
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public boolean hasNext() {
|
||||
try {
|
||||
while (true) {
|
||||
if (this.licensesForHost != null) ** GOTO lbl13
|
||||
if (this.hostIdx + 1 >= this.hostIds.length) {
|
||||
this.licensesForHost = null;
|
||||
this.licenseIdx = -1;
|
||||
return false;
|
||||
}
|
||||
++this.hostIdx;
|
||||
this.licensesForHost = LicenseDatabase.this.getLicenses(this.hostIds[this.hostIdx]);
|
||||
this.licenseIdx = 0;
|
||||
continue;
|
||||
lbl13:
|
||||
// 1 sources
|
||||
|
||||
if (this.licenseIdx < this.licensesForHost.length) {
|
||||
return true;
|
||||
}
|
||||
this.licensesForHost = null;
|
||||
this.licenseIdx = -1;
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (RuntimeException var1_1) {
|
||||
throw var1_1;
|
||||
}
|
||||
catch (Exception var1_2) {
|
||||
throw new BajaRuntimeException(var1_2);
|
||||
}
|
||||
}
|
||||
|
||||
public Object next() {
|
||||
if (this.hasNext()) {
|
||||
VendorLicense vendorLicense = this.licensesForHost[this.licenseIdx];
|
||||
++this.licenseIdx;
|
||||
return vendorLicense;
|
||||
}
|
||||
throw new IllegalStateException("Called next() when hasNext==false");
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public LicenseDatabaseIterator() throws Exception {
|
||||
this.hostIds = LicenseDatabase.this.getHostIds();
|
||||
this.hostIdx = -1;
|
||||
this.licensesForHost = null;
|
||||
this.licenseIdx = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private static class LocalLicenseDatabase
|
||||
extends LicenseDatabase {
|
||||
private boolean initialized;
|
||||
private String brandId;
|
||||
private ArrayList copyList;
|
||||
|
||||
protected void init() {
|
||||
if (this.initialized) {
|
||||
return;
|
||||
}
|
||||
this.initialized = true;
|
||||
Log log = Log.getLog("sys.license");
|
||||
try {
|
||||
this.brandId = this.getBrand();
|
||||
this.importDir(BFileSystem.INSTANCE.makeDir(new FilePath("!licenses")), false);
|
||||
this.importDir(BFileSystem.INSTANCE.makeDir(new FilePath("!licenses/inbox")), true);
|
||||
this.exportNewLicenses();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("Error initializing local license database", exception);
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Exception decompiling
|
||||
*/
|
||||
private final String getBrand() {
|
||||
/*
|
||||
* This method has failed to decompile. When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
|
||||
*
|
||||
* org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 3[TRYBLOCK] [4 : 96->99)] java.lang.Throwable
|
||||
* at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
|
||||
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
|
||||
* at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
|
||||
* at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
|
||||
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
|
||||
* at org.benf.cfr.reader.entities.ClassFile.analyseInnerClassesPass1(ClassFile.java:923)
|
||||
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1035)
|
||||
* at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
|
||||
* at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
|
||||
* at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
|
||||
* at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
|
||||
* at org.benf.cfr.reader.Main.main(Main.java:54)
|
||||
*/
|
||||
throw new IllegalStateException("Decompilation failed");
|
||||
}
|
||||
|
||||
protected void importDir(BDirectory bDirectory, boolean bl) throws Exception {
|
||||
Log log = Log.getLog("sys.license");
|
||||
BIFile[] bIFileArray = bDirectory.listFiles();
|
||||
int n = 0;
|
||||
while (n < bIFileArray.length) {
|
||||
if ("license".equals(bIFileArray[n].getExtension())) {
|
||||
VendorLicense vendorLicense = VendorLicense.make(bIFileArray[n]);
|
||||
this.add(vendorLicense);
|
||||
if (bl || !vendorLicense.getHostId().equals(Sys.getHostId()) && !"*".equals(vendorLicense.getHostId())) {
|
||||
try {
|
||||
bIFileArray[n].delete();
|
||||
log.message("moved " + bIFileArray[n]);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.warning("error deleting " + bIFileArray[n], exception);
|
||||
}
|
||||
}
|
||||
} else if ("lar".equals(bIFileArray[n].getExtension())) {
|
||||
this.importFile(bIFileArray[n]);
|
||||
try {
|
||||
bIFileArray[n].delete();
|
||||
log.message("imported and removed license archive " + bIFileArray[n]);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.warning("error deleting " + bIFileArray[n], exception);
|
||||
}
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean add(VendorLicense vendorLicense) throws Exception {
|
||||
boolean bl = super.add(vendorLicense);
|
||||
if (!bl) {
|
||||
return bl;
|
||||
}
|
||||
String string = vendorLicense.getSource();
|
||||
if (Sys.getHostId().equals(vendorLicense.getHostId()) && ("lar".equals(string) || string.indexOf("licenses/inbox/") > 0)) {
|
||||
this.copyList.add(vendorLicense);
|
||||
}
|
||||
if (this.brandId == null && Sys.getHostId().equals(vendorLicense.getHostId()) && vendorLicense.getBrandId() != null) {
|
||||
this.brandId = vendorLicense.getBrandId();
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
private final void exportNewLicenses() {
|
||||
Log log = Log.getLog("sys.license");
|
||||
if (this.brandId == null) {
|
||||
log.error("Could not determine brand");
|
||||
return;
|
||||
}
|
||||
Iterator iterator = this.copyList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
VendorLicense vendorLicense = (VendorLicense)iterator.next();
|
||||
if (vendorLicense.getBrandId() != null && !vendorLicense.getBrandId().equals(this.brandId)) continue;
|
||||
try {
|
||||
FilePath filePath = new FilePath("!licenses/" + vendorLicense.getLicenseName() + ".license");
|
||||
BIFile bIFile = BFileSystem.INSTANCE.makeFile(filePath);
|
||||
log.message("LicenseDatabase is exporting new license to " + bIFile);
|
||||
vendorLicense.save(bIFile);
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
log.error("LicenseDatabase could not copy license file to !licenses", iOException);
|
||||
}
|
||||
}
|
||||
this.copyList.clear();
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.initialized = false;
|
||||
this.copyList = new ArrayList();
|
||||
}
|
||||
|
||||
public LocalLicenseDatabase() {
|
||||
this.this();
|
||||
try {
|
||||
this.licenseDbRoot = BFileSystem.INSTANCE.makeDir(new FilePath("!licenses/db"));
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException(exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.TextUtil
|
||||
*/
|
||||
package com.tridium.sys.license.dom;
|
||||
|
||||
import com.tridium.sys.license.dom.HostLicenseSet;
|
||||
import com.tridium.sys.license.dom.VendorLicense;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class LicenseSet {
|
||||
private ArrayList list;
|
||||
|
||||
public Iterator iterator() throws Exception {
|
||||
return this.list.iterator();
|
||||
}
|
||||
|
||||
public boolean add(VendorLicense vendorLicense) throws Exception {
|
||||
this.list.add(vendorLicense);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean remove(VendorLicense vendorLicense) throws Exception {
|
||||
return this.list.remove(vendorLicense);
|
||||
}
|
||||
|
||||
public void clear() throws Exception {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
public HostLicenseSet toHostLicenseSet(String string) throws Exception {
|
||||
return this.toHostLicenseSet(string, null);
|
||||
}
|
||||
|
||||
public HostLicenseSet toHostLicenseSet(String string, String string2) throws Exception {
|
||||
HostLicenseSet hostLicenseSet = null;
|
||||
Iterator iterator = this.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
VendorLicense vendorLicense = (VendorLicense)iterator.next();
|
||||
if (!string.equals(vendorLicense.getHostId()) || string2 != null && vendorLicense.getBrandId() != null && !vendorLicense.getBrandId().equals(string2)) continue;
|
||||
if (hostLicenseSet == null) {
|
||||
hostLicenseSet = new HostLicenseSet();
|
||||
}
|
||||
if (hostLicenseSet.getVendorLicense(vendorLicense.getVendor()) != null) {
|
||||
throw new RuntimeException("Duplicate licenses for same hostId and vendor: " + vendorLicense.getVendor());
|
||||
}
|
||||
hostLicenseSet.add(vendorLicense);
|
||||
}
|
||||
return hostLicenseSet;
|
||||
}
|
||||
|
||||
public void load(BDirectory bDirectory) {
|
||||
BIFile[] bIFileArray = bDirectory.listFiles();
|
||||
int n = 0;
|
||||
while (bIFileArray != null && n < bIFileArray.length) {
|
||||
BIFile bIFile = bIFileArray[n];
|
||||
if (!bIFile.isDirectory() && "license".equals(bIFile.getExtension())) {
|
||||
try {
|
||||
this.add(VendorLicense.make(bIFile));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
System.out.println("ERROR: Cannot read \"" + bIFile + '\"');
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public void dump() throws Exception {
|
||||
this.dump(new PrintWriter(System.out));
|
||||
}
|
||||
|
||||
public void dump(PrintWriter printWriter) throws Exception {
|
||||
printWriter.println(TextUtil.getClassName(this.getClass()));
|
||||
Iterator iterator = this.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
((VendorLicense)iterator.next()).dump(printWriter);
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.list = new ArrayList();
|
||||
}
|
||||
|
||||
public LicenseSet() {
|
||||
this.this();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.xml.XWriter
|
||||
*/
|
||||
package com.tridium.sys.license.dom;
|
||||
|
||||
import com.tridium.sys.NreLib;
|
||||
import com.tridium.sys.license.dom.Feature;
|
||||
import com.tridium.sys.license.dom.HostLicenseSet;
|
||||
import com.tridium.sys.license.dom.LicenseSet;
|
||||
import com.tridium.sys.license.dom.VendorLicense;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.util.Version;
|
||||
import javax.baja.xml.XWriter;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class LicenseTest {
|
||||
static final long NEVER = Long.MAX_VALUE;
|
||||
int verifies;
|
||||
VendorLicense trid;
|
||||
|
||||
public static void main(String[] stringArray) throws Exception {
|
||||
LicenseTest licenseTest = new LicenseTest();
|
||||
licenseTest.readTridium();
|
||||
licenseTest.fromScratch();
|
||||
licenseTest.licenseSet();
|
||||
System.out.println("ALL TESTS PASSED [" + licenseTest.verifies + ']');
|
||||
}
|
||||
|
||||
public void readTridium() throws Exception {
|
||||
BIFile bIFile = BFileSystem.INSTANCE.findFile(new FilePath("!licenses/Tridium.license"));
|
||||
if (bIFile == null) {
|
||||
bIFile = BFileSystem.INSTANCE.findFile(new FilePath("!licenses/Vykon.license"));
|
||||
}
|
||||
VendorLicense vendorLicense = this.trid = new VendorLicense();
|
||||
vendorLicense.load(bIFile);
|
||||
boolean bl = false;
|
||||
if (vendorLicense.getExpiration() == Long.MAX_VALUE) {
|
||||
bl = true;
|
||||
}
|
||||
this.verify(bl);
|
||||
this.verify(vendorLicense.getHostId().equals(NreLib.getHostId()));
|
||||
this.verify(vendorLicense.getVendor().equals("Tridium"));
|
||||
boolean bl2 = false;
|
||||
if (vendorLicense.getVersion() != null) {
|
||||
bl2 = true;
|
||||
}
|
||||
this.verify(bl2);
|
||||
Feature feature = vendorLicense.getFeature("about");
|
||||
boolean bl3 = false;
|
||||
if (feature == vendorLicense.getFeature("AbOuT")) {
|
||||
bl3 = true;
|
||||
}
|
||||
this.verify(bl3);
|
||||
this.verify(feature.getName().equals("about"));
|
||||
this.verify(feature.getKey().equals("about"));
|
||||
boolean bl4 = false;
|
||||
if (feature.getExpiration() == Long.MAX_VALUE) {
|
||||
bl4 = true;
|
||||
}
|
||||
this.verify(bl4);
|
||||
boolean bl5 = false;
|
||||
if (feature.get("owner") != null) {
|
||||
bl5 = true;
|
||||
}
|
||||
this.verify(bl5);
|
||||
boolean bl6 = false;
|
||||
if (feature.get("project") != null) {
|
||||
bl6 = true;
|
||||
}
|
||||
this.verify(bl6);
|
||||
boolean bl7 = false;
|
||||
if (feature.get("foobar") == null) {
|
||||
bl7 = true;
|
||||
}
|
||||
this.verify(bl7);
|
||||
boolean bl8 = false;
|
||||
if (feature.get("foobar", "rocking") == "rocking") {
|
||||
bl8 = true;
|
||||
}
|
||||
this.verify(bl8);
|
||||
Feature.Brand brand = vendorLicense.getBrandFeature();
|
||||
this.verifyEq(brand.getStationIn(), "*");
|
||||
this.verifyEq(brand.getStationOut(), "*");
|
||||
this.verifyEq(brand.getWbIn(), "*");
|
||||
this.verifyEq(brand.getWbOut(), "*");
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
vendorLicense.save(byteArrayOutputStream);
|
||||
this.roundRobinIO(this.trid);
|
||||
}
|
||||
|
||||
public void fromScratch() throws Exception {
|
||||
VendorLicense vendorLicense = new VendorLicense();
|
||||
vendorLicense.setVendor("brianco");
|
||||
vendorLicense.setVersion(new Version("3.2"));
|
||||
vendorLicense.setHostId("win-host-id");
|
||||
vendorLicense.setSignature("abcdefghijklmnopqrstuvwxyz");
|
||||
this.roundRobinIO(vendorLicense);
|
||||
Feature feature = vendorLicense.addFeature("kickIt");
|
||||
boolean bl = false;
|
||||
if (vendorLicense.getFeature("KickIt") == feature) {
|
||||
bl = true;
|
||||
}
|
||||
this.verify(bl);
|
||||
boolean bl2 = false;
|
||||
if (feature.getParent() == vendorLicense) {
|
||||
bl2 = true;
|
||||
}
|
||||
this.verify(bl2);
|
||||
this.verify(feature.getName().equals("kickIt"));
|
||||
boolean bl3 = false;
|
||||
if (feature.list().length == 0) {
|
||||
bl3 = true;
|
||||
}
|
||||
this.verify(bl3);
|
||||
this.roundRobinIO(vendorLicense);
|
||||
feature.set("alpha", "bravo");
|
||||
feature.set("charlie", "delta");
|
||||
feature.set("bool", false);
|
||||
feature.set("int", 77);
|
||||
boolean bl4 = false;
|
||||
if (feature.list().length == 4) {
|
||||
bl4 = true;
|
||||
}
|
||||
this.verify(bl4);
|
||||
this.verifyEq(feature.get("alpha"), "bravo");
|
||||
this.verifyEq(feature.get("charlie"), "delta");
|
||||
this.verify(feature.getb("bool", true) ^ true);
|
||||
boolean bl5 = false;
|
||||
if (feature.geti("int", 99) == 77) {
|
||||
bl5 = true;
|
||||
}
|
||||
this.verify(bl5);
|
||||
this.roundRobinIO(vendorLicense);
|
||||
vendorLicense.removeFeature("kickIt");
|
||||
boolean bl6 = false;
|
||||
if (vendorLicense.getFeature("KickIt") == null) {
|
||||
bl6 = true;
|
||||
}
|
||||
this.verify(bl6);
|
||||
this.roundRobinIO(vendorLicense);
|
||||
}
|
||||
|
||||
public void licenseSet() throws Exception {
|
||||
BDirectory bDirectory = BFileSystem.INSTANCE.makeDir(new FilePath("!licenses/test"), null);
|
||||
VendorLicense vendorLicense = this.makeLic(bDirectory, "A", "tridium", "vykon", null);
|
||||
VendorLicense vendorLicense2 = this.makeLic(bDirectory, "A", "acme", null, null);
|
||||
VendorLicense vendorLicense3 = this.makeLic(bDirectory, "B", "tridium", "vykon", null);
|
||||
VendorLicense vendorLicense4 = this.makeLic(bDirectory, "C", "tridium", "vykon", "C-tridium-1.license");
|
||||
VendorLicense vendorLicense5 = this.makeLic(bDirectory, "C", "tridium", "vykon", "C-tridium-2.license");
|
||||
VendorLicense vendorLicense6 = this.makeLic(bDirectory, "D", "tridium", "tridium", "D-tridium-1.license");
|
||||
VendorLicense vendorLicense7 = this.makeLic(bDirectory, "D", "tridium", "vykon", "D-tridium-2.license");
|
||||
LicenseSet licenseSet = new LicenseSet();
|
||||
licenseSet.load(bDirectory);
|
||||
HostLicenseSet hostLicenseSet = licenseSet.toHostLicenseSet("no way", "vykon");
|
||||
boolean bl = false;
|
||||
if (hostLicenseSet == null) {
|
||||
bl = true;
|
||||
}
|
||||
this.verify(bl);
|
||||
hostLicenseSet = licenseSet.toHostLicenseSet("A", "vykon");
|
||||
this.verifyEq(hostLicenseSet.getHostId(), "A");
|
||||
this.verifyEq(hostLicenseSet.getVendorLicense("acme"), vendorLicense2);
|
||||
this.verifyEq(hostLicenseSet.getVendorLicense("tridium"), vendorLicense);
|
||||
this.verifyEq(hostLicenseSet.getTridiumLicense(), vendorLicense);
|
||||
this.verifyEq(hostLicenseSet.getBrandFeature().getBrandId(), "vykon");
|
||||
hostLicenseSet = licenseSet.toHostLicenseSet("B", "vykon");
|
||||
this.verifyEq(hostLicenseSet.getHostId(), "B");
|
||||
this.verifyEq(hostLicenseSet.getTridiumLicense(), vendorLicense3);
|
||||
this.verifyEq(hostLicenseSet.getBrandFeature().getBrandId(), "vykon");
|
||||
Exception exception = null;
|
||||
try {
|
||||
hostLicenseSet = licenseSet.toHostLicenseSet("C", "vykon");
|
||||
}
|
||||
catch (Exception exception2) {
|
||||
exception = exception2;
|
||||
}
|
||||
boolean bl2 = false;
|
||||
if (exception != null) {
|
||||
bl2 = true;
|
||||
}
|
||||
this.verify(bl2);
|
||||
hostLicenseSet = licenseSet.toHostLicenseSet("D", "tridium");
|
||||
this.verifyEq(hostLicenseSet.getHostId(), "D");
|
||||
this.verifyEq(hostLicenseSet.getTridiumLicense(), vendorLicense6);
|
||||
this.verifyEq(hostLicenseSet.getBrandFeature().getBrandId(), "tridium");
|
||||
hostLicenseSet = licenseSet.toHostLicenseSet("D", "vykon");
|
||||
this.verifyEq(hostLicenseSet.getHostId(), "D");
|
||||
this.verifyEq(hostLicenseSet.getTridiumLicense(), vendorLicense7);
|
||||
this.verifyEq(hostLicenseSet.getBrandFeature().getBrandId(), "vykon");
|
||||
}
|
||||
|
||||
VendorLicense makeLic(BIFile bIFile, String string, String string2, String string3, String string4) throws Exception {
|
||||
VendorLicense vendorLicense = new VendorLicense();
|
||||
vendorLicense.setHostId(string);
|
||||
vendorLicense.setVendor(string2);
|
||||
vendorLicense.setVersion(new Version("3.3"));
|
||||
vendorLicense.setSignature("sig");
|
||||
if (string2.equals("tridium")) {
|
||||
Feature feature = vendorLicense.addFeature("brand");
|
||||
feature.set("brandId", string3 == null ? "vykon" : string3);
|
||||
}
|
||||
if (string4 == null) {
|
||||
string4 = string + '-' + string2 + ".license";
|
||||
}
|
||||
vendorLicense.save(BFileSystem.INSTANCE.makeFile(bIFile.getFilePath().merge(string4), null));
|
||||
return vendorLicense;
|
||||
}
|
||||
|
||||
public void roundRobinIO(VendorLicense vendorLicense) throws Exception {
|
||||
byte[] byArray = this.saveToBuf(vendorLicense);
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byArray);
|
||||
VendorLicense vendorLicense2 = new VendorLicense();
|
||||
vendorLicense2.load(vendorLicense.getSource(), byteArrayInputStream);
|
||||
this.verifyEq(vendorLicense, vendorLicense2);
|
||||
}
|
||||
|
||||
public void verifyEq(VendorLicense vendorLicense, VendorLicense vendorLicense2) throws Exception {
|
||||
this.verifyEq(vendorLicense.getVendor(), vendorLicense2.getVendor());
|
||||
this.verifyEq(vendorLicense.getExpiration(), vendorLicense2.getExpiration());
|
||||
this.verifyEq(vendorLicense.getHostId(), vendorLicense2.getHostId());
|
||||
Feature[] featureArray = vendorLicense.getFeatures();
|
||||
Feature[] featureArray2 = vendorLicense2.getFeatures();
|
||||
boolean bl = false;
|
||||
if (featureArray.length == featureArray2.length) {
|
||||
bl = true;
|
||||
}
|
||||
this.verify(bl);
|
||||
int n = 0;
|
||||
while (n < featureArray.length) {
|
||||
this.verifyEq(featureArray[n], featureArray2[n]);
|
||||
++n;
|
||||
}
|
||||
this.verifyEq(this.saveToBuf(vendorLicense), this.saveToBuf(vendorLicense2));
|
||||
}
|
||||
|
||||
public void verifyEq(Feature feature, Feature feature2) {
|
||||
this.verifyEq(feature.getName(), feature2.getName());
|
||||
this.verifyEq(feature.getExpiration(), feature2.getExpiration());
|
||||
String[] stringArray = feature.list();
|
||||
String[] stringArray2 = feature2.list();
|
||||
boolean bl = false;
|
||||
if (stringArray.length == stringArray2.length) {
|
||||
bl = true;
|
||||
}
|
||||
this.verify(bl);
|
||||
int n = 0;
|
||||
while (n < stringArray.length) {
|
||||
this.verifyEq(stringArray[n], stringArray2[n]);
|
||||
this.verifyEq(feature.get(stringArray[n]), feature2.get(stringArray2[n]));
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public void verifyEq(String string, String string2) {
|
||||
if (string == null) {
|
||||
boolean bl = false;
|
||||
if (string2 == null) {
|
||||
bl = true;
|
||||
}
|
||||
this.verify(bl);
|
||||
} else {
|
||||
this.verify(string.equals(string2));
|
||||
}
|
||||
}
|
||||
|
||||
public void verifyEq(long l, long l2) {
|
||||
boolean bl = false;
|
||||
if (l == l2) {
|
||||
bl = true;
|
||||
}
|
||||
this.verify(bl);
|
||||
}
|
||||
|
||||
public void verifyEq(byte[] byArray, byte[] byArray2) {
|
||||
boolean bl = false;
|
||||
if (byArray.length == byArray2.length) {
|
||||
bl = true;
|
||||
}
|
||||
this.verify(bl);
|
||||
boolean bl2 = true;
|
||||
int n = 0;
|
||||
while (n < byArray.length) {
|
||||
if (byArray[n] != byArray2[n]) {
|
||||
bl2 = false;
|
||||
break;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
this.verify(bl2);
|
||||
}
|
||||
|
||||
public void verify(boolean bl) {
|
||||
if (bl) {
|
||||
++this.verifies;
|
||||
} else {
|
||||
throw new RuntimeException("Test failed");
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] saveToBuf(VendorLicense vendorLicense) throws Exception {
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
XWriter xWriter = new XWriter((OutputStream)byteArrayOutputStream);
|
||||
vendorLicense.save(xWriter);
|
||||
return byteArrayOutputStream.toByteArray();
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.verifies = 0;
|
||||
}
|
||||
|
||||
public LicenseTest() {
|
||||
this.this();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.xml.XContent
|
||||
* javax.baja.xml.XElem
|
||||
* javax.baja.xml.XException
|
||||
* javax.baja.xml.XParser
|
||||
* javax.baja.xml.XText
|
||||
* javax.baja.xml.XWriter
|
||||
*/
|
||||
package com.tridium.sys.license.dom;
|
||||
|
||||
import com.tridium.sys.license.LicenseUtil;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.util.Version;
|
||||
import javax.baja.xml.XContent;
|
||||
import javax.baja.xml.XElem;
|
||||
import javax.baja.xml.XException;
|
||||
import javax.baja.xml.XParser;
|
||||
import javax.baja.xml.XText;
|
||||
import javax.baja.xml.XWriter;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class VendorCertificate {
|
||||
private String source;
|
||||
private XElem xml;
|
||||
private String signature;
|
||||
private boolean modified;
|
||||
|
||||
public static VendorCertificate make(BIFile bIFile) throws Exception {
|
||||
VendorCertificate vendorCertificate = new VendorCertificate();
|
||||
vendorCertificate.load(bIFile);
|
||||
return vendorCertificate;
|
||||
}
|
||||
|
||||
public static VendorCertificate make(String string, InputStream inputStream) throws Exception {
|
||||
VendorCertificate vendorCertificate = new VendorCertificate();
|
||||
vendorCertificate.load(string, inputStream);
|
||||
return vendorCertificate;
|
||||
}
|
||||
|
||||
public static VendorCertificate make(String string, InputStream inputStream, boolean bl) throws Exception {
|
||||
VendorCertificate vendorCertificate = new VendorCertificate();
|
||||
vendorCertificate.load(string, inputStream, bl);
|
||||
return vendorCertificate;
|
||||
}
|
||||
|
||||
public static VendorCertificate make(String string, XElem xElem) throws Exception {
|
||||
VendorCertificate vendorCertificate = new VendorCertificate();
|
||||
vendorCertificate.load(string, xElem);
|
||||
return vendorCertificate;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
public String getVendor() {
|
||||
return this.xml.get("vendor");
|
||||
}
|
||||
|
||||
public void setVendor(String string) {
|
||||
this.modify();
|
||||
this.xml.setAttr("vendor", string);
|
||||
}
|
||||
|
||||
public boolean isExpired() {
|
||||
boolean bl = false;
|
||||
if (Clock.millis() > this.getExpiration()) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public long getExpiration() {
|
||||
return LicenseUtil.parseDate(this.xml.get("expiration"));
|
||||
}
|
||||
|
||||
public void setExpiration(long l) {
|
||||
this.modify();
|
||||
this.xml.setAttr("expiration", LicenseUtil.formatDate(l));
|
||||
}
|
||||
|
||||
public long getGenerated() {
|
||||
return LicenseUtil.parseDate(this.xml.get("generated"));
|
||||
}
|
||||
|
||||
public Version getVersion() {
|
||||
return new Version(this.xml.get("version"));
|
||||
}
|
||||
|
||||
public void setVersion(Version version) {
|
||||
this.modify();
|
||||
this.xml.setAttr("version", version.toString());
|
||||
}
|
||||
|
||||
public String getSignature() {
|
||||
return this.signature;
|
||||
}
|
||||
|
||||
public void setSignature(String string) {
|
||||
this.modify();
|
||||
this.signature = string;
|
||||
}
|
||||
|
||||
public String getPublicKey() {
|
||||
XElem xElem = this.xml.elem("publicKey");
|
||||
return xElem == null ? null : xElem.string();
|
||||
}
|
||||
|
||||
public void setPublicKey(String string) {
|
||||
this.modify();
|
||||
XElem xElem = this.xml.elem("publicKey");
|
||||
if (xElem != null) {
|
||||
this.xml.removeContent((XContent)xElem);
|
||||
}
|
||||
xElem = new XElem("publicKey");
|
||||
xElem.addContent((XContent)new XText(string));
|
||||
this.xml.addContent((XContent)xElem);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void load(BIFile bIFile) throws Exception {
|
||||
InputStream inputStream = bIFile.getInputStream();
|
||||
try {
|
||||
this.load(bIFile.toString(), XParser.make((InputStream)inputStream).parse());
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var4_4 = null;
|
||||
try {
|
||||
inputStream.close();
|
||||
throw throwable;
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var4_5 = null;
|
||||
}
|
||||
try {}
|
||||
catch (Exception exception) {
|
||||
return;
|
||||
}
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
public void load(String string, InputStream inputStream) throws Exception {
|
||||
this.load(string, inputStream, true);
|
||||
}
|
||||
|
||||
public void load(String string, InputStream inputStream, boolean bl) throws Exception {
|
||||
this.load(string, XParser.make((InputStream)inputStream).parse(bl));
|
||||
}
|
||||
|
||||
public void load(String string, XElem xElem) throws Exception {
|
||||
this.source = string == null ? string : "Unknown";
|
||||
this.parse(xElem);
|
||||
}
|
||||
|
||||
private final void parse(XElem xElem) throws Exception {
|
||||
XElem xElem2;
|
||||
XElem xElem3;
|
||||
if (!xElem.qname().equals("certificate")) {
|
||||
throw new XException("Root element must be <certificate> element", xElem);
|
||||
}
|
||||
this.modified = false;
|
||||
this.xml = new XElem("certificate");
|
||||
int n = 0;
|
||||
while (n < xElem.attrSize()) {
|
||||
this.xml.addAttr(xElem.attrName(n), xElem.attrValue(n));
|
||||
++n;
|
||||
}
|
||||
if (xElem.get("generated", null) == null) {
|
||||
this.xml.addAttr("generated", LicenseUtil.formatDate(Clock.millis()));
|
||||
}
|
||||
if ((xElem3 = xElem.elem("signature")) != null) {
|
||||
this.signature = xElem3.string();
|
||||
}
|
||||
if ((xElem2 = xElem.elem("publicKey")) != null) {
|
||||
this.xml.addContent((XContent)xElem2.copy());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void save(BIFile bIFile) throws IOException {
|
||||
OutputStream outputStream = bIFile.getOutputStream();
|
||||
try {
|
||||
VendorCertificate.format(this.save(), new XWriter(outputStream));
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var4_4 = null;
|
||||
try {
|
||||
outputStream.close();
|
||||
throw throwable;
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var4_5 = null;
|
||||
}
|
||||
try {}
|
||||
catch (Exception exception) {
|
||||
return;
|
||||
}
|
||||
outputStream.close();
|
||||
}
|
||||
|
||||
public void save(OutputStream outputStream) throws IOException {
|
||||
this.save(outputStream, true);
|
||||
}
|
||||
|
||||
public void save(OutputStream outputStream, boolean bl) throws IOException {
|
||||
XWriter xWriter = new XWriter(outputStream);
|
||||
this.save(xWriter);
|
||||
xWriter.flush();
|
||||
if (bl) {
|
||||
xWriter.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void save(XWriter xWriter) throws IOException {
|
||||
VendorCertificate.format(this.save(), xWriter);
|
||||
}
|
||||
|
||||
public XElem save() {
|
||||
if (this.modified) {
|
||||
this.xml.setAttr("generated", LicenseUtil.formatDate(Clock.millis()));
|
||||
this.modified = false;
|
||||
}
|
||||
XElem xElem = this.xml.copy();
|
||||
if (this.signature != null) {
|
||||
XElem xElem2 = new XElem("signature");
|
||||
xElem2.addContent((XContent)new XText(this.signature));
|
||||
xElem.addContent((XContent)xElem2);
|
||||
}
|
||||
return xElem;
|
||||
}
|
||||
|
||||
public static void format(XElem xElem, XWriter xWriter) {
|
||||
VendorCertificate.formatr(xElem, xWriter, "");
|
||||
xWriter.flush();
|
||||
}
|
||||
|
||||
private static final void formatr(XElem xElem, XWriter xWriter, String string) {
|
||||
xWriter.w((Object)string).w('<').w((Object)xElem.name());
|
||||
int n = xElem.attrSize();
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
xWriter.w((Object)" ").attr(xElem.attrName(n2), xElem.attrValue(n2));
|
||||
++n2;
|
||||
}
|
||||
if (xElem.contentSize() == 0) {
|
||||
xWriter.w((Object)"/>").nl();
|
||||
return;
|
||||
}
|
||||
xWriter.w('>');
|
||||
XElem[] xElemArray = xElem.elems();
|
||||
if (xElemArray.length > 0) {
|
||||
xWriter.nl();
|
||||
}
|
||||
int n3 = 0;
|
||||
while (n3 < xElemArray.length) {
|
||||
VendorCertificate.formatr(xElemArray[n3], xWriter, string + ' ');
|
||||
++n3;
|
||||
}
|
||||
if (xElem.text() != null) {
|
||||
xElem.text().write(xWriter);
|
||||
}
|
||||
if (xElemArray.length > 0) {
|
||||
xWriter.w((Object)string);
|
||||
}
|
||||
xWriter.w((Object)"</").w((Object)xElem.name()).w('>').nl();
|
||||
}
|
||||
|
||||
protected void modify() {
|
||||
this.signature = null;
|
||||
this.modified = true;
|
||||
}
|
||||
|
||||
public void dump() {
|
||||
this.dump(new PrintWriter(System.out));
|
||||
}
|
||||
|
||||
public void dump(PrintWriter printWriter) {
|
||||
printWriter.println(" VendorCertificate");
|
||||
printWriter.println(" source: " + this.source);
|
||||
printWriter.println(" vendor: " + this.getVendor());
|
||||
printWriter.println(" version: " + this.getVersion());
|
||||
printWriter.println(" expiration: " + LicenseUtil.formatDate(this.getExpiration()));
|
||||
printWriter.println(" generated: " + LicenseUtil.formatDate(this.getGenerated()));
|
||||
printWriter.flush();
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.source = "Unknown";
|
||||
this.signature = null;
|
||||
this.modified = false;
|
||||
}
|
||||
|
||||
public VendorCertificate() {
|
||||
this.this();
|
||||
this.xml = new XElem("certificate");
|
||||
this.xml.setAttr("generated", LicenseUtil.formatDate(Clock.millis()));
|
||||
this.modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,436 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.nre.util.TextUtil
|
||||
* javax.baja.xml.XContent
|
||||
* javax.baja.xml.XElem
|
||||
* javax.baja.xml.XException
|
||||
* javax.baja.xml.XParser
|
||||
* javax.baja.xml.XText
|
||||
* javax.baja.xml.XWriter
|
||||
*/
|
||||
package com.tridium.sys.license.dom;
|
||||
|
||||
import com.tridium.sys.license.LicenseUtil;
|
||||
import com.tridium.sys.license.dom.Feature;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.util.Version;
|
||||
import javax.baja.xml.XContent;
|
||||
import javax.baja.xml.XElem;
|
||||
import javax.baja.xml.XException;
|
||||
import javax.baja.xml.XParser;
|
||||
import javax.baja.xml.XText;
|
||||
import javax.baja.xml.XWriter;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class VendorLicense {
|
||||
private String source;
|
||||
private XElem xml;
|
||||
private Array features;
|
||||
private String signature;
|
||||
private boolean modified;
|
||||
static /* synthetic */ Class class$com$tridium$sys$license$dom$Feature;
|
||||
|
||||
public static VendorLicense make(BIFile bIFile) throws Exception {
|
||||
VendorLicense vendorLicense = new VendorLicense();
|
||||
vendorLicense.load(bIFile);
|
||||
return vendorLicense;
|
||||
}
|
||||
|
||||
public static VendorLicense make(String string, InputStream inputStream) throws Exception {
|
||||
VendorLicense vendorLicense = new VendorLicense();
|
||||
vendorLicense.load(string, inputStream);
|
||||
return vendorLicense;
|
||||
}
|
||||
|
||||
public static VendorLicense make(String string, InputStream inputStream, boolean bl) throws Exception {
|
||||
VendorLicense vendorLicense = new VendorLicense();
|
||||
vendorLicense.load(string, inputStream, bl);
|
||||
return vendorLicense;
|
||||
}
|
||||
|
||||
public static VendorLicense make(String string, XElem xElem) throws Exception {
|
||||
VendorLicense vendorLicense = new VendorLicense();
|
||||
vendorLicense.load(string, xElem);
|
||||
return vendorLicense;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
public String getHostId() {
|
||||
return this.xml.get("hostId");
|
||||
}
|
||||
|
||||
public void setHostId(String string) {
|
||||
this.modify();
|
||||
this.xml.setAttr("hostId", string);
|
||||
}
|
||||
|
||||
public String getVendor() {
|
||||
return this.xml.get("vendor");
|
||||
}
|
||||
|
||||
public void setVendor(String string) {
|
||||
this.modify();
|
||||
this.xml.setAttr("vendor", string);
|
||||
}
|
||||
|
||||
public boolean isExpired() {
|
||||
boolean bl = false;
|
||||
if (Clock.millis() > this.getExpiration()) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public long getExpiration() {
|
||||
return LicenseUtil.parseDate(this.xml.get("expiration"));
|
||||
}
|
||||
|
||||
public void setExpiration(long l) {
|
||||
this.modify();
|
||||
this.xml.setAttr("expiration", LicenseUtil.formatDate(l));
|
||||
}
|
||||
|
||||
public long getGenerated() {
|
||||
return LicenseUtil.parseDate(this.xml.get("generated"));
|
||||
}
|
||||
|
||||
public Version getVersion() {
|
||||
return new Version(this.xml.get("version"));
|
||||
}
|
||||
|
||||
public void setVersion(Version version) {
|
||||
this.modify();
|
||||
this.xml.setAttr("version", version.toString());
|
||||
}
|
||||
|
||||
public String getSignature() {
|
||||
return this.signature;
|
||||
}
|
||||
|
||||
public void setSignature(String string) {
|
||||
this.modify();
|
||||
this.signature = string;
|
||||
}
|
||||
|
||||
public Feature getFeature(String string) {
|
||||
int n = 0;
|
||||
while (n < this.features.size()) {
|
||||
Feature feature = (Feature)this.features.get(n);
|
||||
if (feature.getKey().equals(Feature.toKey(string))) {
|
||||
return feature;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Feature.Brand getBrandFeature() {
|
||||
return (Feature.Brand)this.getFeature("brand");
|
||||
}
|
||||
|
||||
public String getBrandId() {
|
||||
if ("tridium".equalsIgnoreCase(this.getVendor())) {
|
||||
Feature.Brand brand = this.getBrandFeature();
|
||||
return brand == null ? null : brand.getBrandId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getLicenseName() {
|
||||
if ("tridium".equalsIgnoreCase(this.getVendor())) {
|
||||
Feature.Brand brand = this.getBrandFeature();
|
||||
return brand == null ? "Tridium" : TextUtil.capitalize((String)brand.getBrandId());
|
||||
}
|
||||
return TextUtil.capitalize((String)this.getVendor());
|
||||
}
|
||||
|
||||
public Feature[] getFeatures() {
|
||||
return (Feature[])this.features.trim();
|
||||
}
|
||||
|
||||
public String[] getFeatureNames() {
|
||||
Feature[] featureArray = this.getFeatures();
|
||||
String[] stringArray = new String[featureArray.length];
|
||||
int n = 0;
|
||||
while (n < stringArray.length) {
|
||||
stringArray[n] = featureArray[n].getName();
|
||||
++n;
|
||||
}
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
public Feature addFeature(String string) {
|
||||
if (this.getFeature(string) != null) {
|
||||
throw new RuntimeException("Feature already exists");
|
||||
}
|
||||
Feature feature = Feature.make(this, string);
|
||||
this.features.add((Object)feature);
|
||||
return feature;
|
||||
}
|
||||
|
||||
public Feature removeFeature(String string) {
|
||||
int n = 0;
|
||||
while (n < this.features.size()) {
|
||||
Feature feature = (Feature)this.features.get(n);
|
||||
if (feature.getKey().equals(Feature.toKey(string))) {
|
||||
this.features.remove(n);
|
||||
return feature;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void load(BIFile bIFile) throws Exception {
|
||||
InputStream inputStream = bIFile.getInputStream();
|
||||
try {
|
||||
this.load(bIFile.toString(), XParser.make((InputStream)inputStream).parse());
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var4_4 = null;
|
||||
try {
|
||||
inputStream.close();
|
||||
throw throwable;
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var4_5 = null;
|
||||
}
|
||||
try {}
|
||||
catch (Exception exception) {
|
||||
return;
|
||||
}
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
public void load(String string, InputStream inputStream) throws Exception {
|
||||
this.load(string, inputStream, true);
|
||||
}
|
||||
|
||||
public void load(String string, InputStream inputStream, boolean bl) throws Exception {
|
||||
this.load(string, XParser.make((InputStream)inputStream).parse(bl));
|
||||
}
|
||||
|
||||
public void load(String string, XElem xElem) throws Exception {
|
||||
this.source = string != null ? string : "Unknown";
|
||||
this.parse(xElem);
|
||||
}
|
||||
|
||||
private final void parse(XElem xElem) throws Exception {
|
||||
if (!xElem.qname().equals("license")) {
|
||||
throw new XException("Root element must be <license> element", xElem);
|
||||
}
|
||||
this.modified = false;
|
||||
this.xml = new XElem("license");
|
||||
int n = 0;
|
||||
while (n < xElem.attrSize()) {
|
||||
this.xml.addAttr(xElem.attrName(n), xElem.attrValue(n));
|
||||
++n;
|
||||
}
|
||||
if (xElem.get("generated", null) == null) {
|
||||
this.xml.addAttr("generated", LicenseUtil.formatDate(Clock.millis()));
|
||||
}
|
||||
XElem[] xElemArray = xElem.elems("feature");
|
||||
Class clazz = class$com$tridium$sys$license$dom$Feature;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$sys$license$dom$Feature = VendorLicense.class("[Lcom.tridium.sys.license.dom.Feature;", false);
|
||||
}
|
||||
this.features = new Array(clazz);
|
||||
int n2 = 0;
|
||||
while (n2 < xElemArray.length) {
|
||||
XElem xElem2 = xElemArray[n2];
|
||||
Feature feature = Feature.make(this, xElem2.get("name"));
|
||||
feature.load(xElemArray[n2]);
|
||||
this.features.add((Object)feature);
|
||||
++n2;
|
||||
}
|
||||
XElem xElem3 = xElem.elem("signature");
|
||||
if (xElem3 != null) {
|
||||
this.signature = xElem3.string();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void save(BIFile bIFile) throws IOException {
|
||||
OutputStream outputStream = bIFile.getOutputStream();
|
||||
try {
|
||||
VendorLicense.format(this.save(), new XWriter(outputStream));
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var4_4 = null;
|
||||
try {
|
||||
outputStream.close();
|
||||
throw throwable;
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var4_5 = null;
|
||||
}
|
||||
try {}
|
||||
catch (Exception exception) {
|
||||
return;
|
||||
}
|
||||
outputStream.close();
|
||||
}
|
||||
|
||||
public void save(OutputStream outputStream) throws IOException {
|
||||
this.save(outputStream, true);
|
||||
}
|
||||
|
||||
public void save(OutputStream outputStream, boolean bl) throws IOException {
|
||||
XWriter xWriter = new XWriter(outputStream);
|
||||
this.save(xWriter);
|
||||
xWriter.flush();
|
||||
if (bl) {
|
||||
xWriter.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void save(XWriter xWriter) throws IOException {
|
||||
VendorLicense.format(this.save(), xWriter);
|
||||
}
|
||||
|
||||
public XElem save() {
|
||||
if (this.modified) {
|
||||
this.xml.setAttr("generated", LicenseUtil.formatDate(Clock.millis()));
|
||||
this.modified = false;
|
||||
}
|
||||
XElem xElem = this.xml.copy();
|
||||
int n = 0;
|
||||
while (n < this.features.size()) {
|
||||
xElem.addContent((XContent)((Feature)this.features.get(n)).save());
|
||||
++n;
|
||||
}
|
||||
if (this.signature != null) {
|
||||
XElem xElem2 = new XElem("signature");
|
||||
xElem2.addContent((XContent)new XText(this.signature));
|
||||
xElem.addContent((XContent)xElem2);
|
||||
}
|
||||
return xElem;
|
||||
}
|
||||
|
||||
public static void format(XElem xElem, XWriter xWriter) {
|
||||
VendorLicense.formatr(xElem, xWriter, "");
|
||||
xWriter.flush();
|
||||
}
|
||||
|
||||
private static final void formatr(XElem xElem, XWriter xWriter, String string) {
|
||||
xWriter.w((Object)string).w('<').w((Object)xElem.name());
|
||||
int n = xElem.attrSize();
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
xWriter.w((Object)" ").attr(xElem.attrName(n2), xElem.attrValue(n2));
|
||||
++n2;
|
||||
}
|
||||
if (xElem.contentSize() == 0) {
|
||||
xWriter.w((Object)"/>").nl();
|
||||
return;
|
||||
}
|
||||
xWriter.w('>');
|
||||
XElem[] xElemArray = xElem.elems();
|
||||
if (xElemArray.length > 0) {
|
||||
xWriter.nl();
|
||||
}
|
||||
int n3 = 0;
|
||||
while (n3 < xElemArray.length) {
|
||||
VendorLicense.formatr(xElemArray[n3], xWriter, string + ' ');
|
||||
++n3;
|
||||
}
|
||||
if (xElem.text() != null) {
|
||||
xElem.text().write(xWriter);
|
||||
}
|
||||
if (xElemArray.length > 0) {
|
||||
xWriter.w((Object)string);
|
||||
}
|
||||
xWriter.w((Object)"</").w((Object)xElem.name()).w('>').nl();
|
||||
}
|
||||
|
||||
protected void modify() {
|
||||
this.signature = null;
|
||||
this.modified = true;
|
||||
}
|
||||
|
||||
public void dump() {
|
||||
this.dump(new PrintWriter(System.out));
|
||||
}
|
||||
|
||||
public void dump(PrintWriter printWriter) {
|
||||
printWriter.println(" VendorLicense");
|
||||
printWriter.println(" source: " + this.source);
|
||||
printWriter.println(" hostId: " + this.getHostId());
|
||||
printWriter.println(" vendor: " + this.getVendor());
|
||||
printWriter.println(" version: " + this.getVersion());
|
||||
printWriter.println(" expiration: " + LicenseUtil.formatDate(this.getExpiration()));
|
||||
printWriter.println(" generated: " + LicenseUtil.formatDate(this.getGenerated()));
|
||||
Feature[] featureArray = this.getFeatures();
|
||||
int n = 0;
|
||||
while (n < featureArray.length) {
|
||||
featureArray[n].dump(printWriter);
|
||||
++n;
|
||||
}
|
||||
printWriter.flush();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.source = "Unknown";
|
||||
Class clazz = class$com$tridium$sys$license$dom$Feature;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$sys$license$dom$Feature = VendorLicense.class("[Lcom.tridium.sys.license.dom.Feature;", false);
|
||||
}
|
||||
this.features = new Array(clazz);
|
||||
this.signature = null;
|
||||
this.modified = false;
|
||||
}
|
||||
|
||||
public VendorLicense() {
|
||||
this.this();
|
||||
this.xml = new XElem("license");
|
||||
this.xml.setAttr("generated", LicenseUtil.formatDate(Clock.millis()));
|
||||
this.xml.setAttr("expiration", "never");
|
||||
this.modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user