65 lines
1.9 KiB
Java
65 lines
1.9 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* javax.baja.xml.XElem
|
|
* javax.baja.xml.XParser
|
|
*/
|
|
package com.tridium.sys.license;
|
|
|
|
import com.tridium.sys.Nre;
|
|
import com.tridium.sys.license.LicenseFile;
|
|
import com.tridium.sys.license.NLicenseManager;
|
|
import com.tridium.sys.license.dom.LicenseDatabase;
|
|
import java.io.File;
|
|
import java.util.ArrayList;
|
|
import javax.baja.sys.Sys;
|
|
import javax.baja.xml.XElem;
|
|
import javax.baja.xml.XParser;
|
|
|
|
public class NodeLockedLicenseManager
|
|
extends NLicenseManager {
|
|
protected LicenseFile[] loadLicenses() {
|
|
LicenseDatabase.LOCAL_INSTANCE.getHostIds();
|
|
ArrayList<NodeLockedLicense> arrayList = new ArrayList<NodeLockedLicense>();
|
|
File file = new File(Sys.getBajaHome(), "licenses");
|
|
File[] fileArray = file.listFiles();
|
|
int n = 0;
|
|
while (fileArray != null && n < fileArray.length) {
|
|
if (fileArray[n].getName().toLowerCase().endsWith(".license")) {
|
|
NodeLockedLicense nodeLockedLicense = new NodeLockedLicense(fileArray[n]);
|
|
nodeLockedLicense.load(this);
|
|
arrayList.add(nodeLockedLicense);
|
|
}
|
|
++n;
|
|
}
|
|
return arrayList.toArray(new LicenseFile[arrayList.size()]);
|
|
}
|
|
|
|
private static class NodeLockedLicense
|
|
extends LicenseFile {
|
|
File file;
|
|
|
|
protected String getLicenseName() {
|
|
return this.file.getName();
|
|
}
|
|
|
|
protected XElem getRoot() throws Exception {
|
|
return XParser.make((File)this.file).parse();
|
|
}
|
|
|
|
protected boolean isLicenseHostIdValid() {
|
|
boolean bl = false;
|
|
if (this.hostId.equals(Nre.getHostId()) || this.hostId.equals("*")) {
|
|
bl = true;
|
|
}
|
|
return bl;
|
|
}
|
|
|
|
public NodeLockedLicense(File file) {
|
|
this.file = file;
|
|
}
|
|
}
|
|
}
|
|
|