2026-03-17 13:31:18 -07:00

189 lines
7.4 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.registry;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import javax.baja.registry.DependencyInfo;
import javax.baja.registry.ModuleInfo;
import javax.baja.sys.ModuleException;
import javax.baja.sys.Sys;
import javax.baja.util.Version;
import javax.baja.xml.XElem;
import javax.baja.xml.XParser;
public class NDependencyInfo
implements DependencyInfo {
static final NDependencyInfo[] none = new NDependencyInfo[0];
String name;
ModuleInfo module;
Version bajaVersion;
String vendor;
Version vendorVersion;
public String getModuleName() {
return this.name;
}
public ModuleInfo getModuleInfo() {
return this.module;
}
public Version getBajaVersion() {
return this.bajaVersion;
}
public String getVendor() {
return this.vendor;
}
public Version getVendorVersion() {
return this.vendorVersion;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public static DependencyInfo[] load(String string) {
DependencyInfo[] dependencyInfoArray2;
ZipFile zipFile;
block23: {
DependencyInfo[] dependencyInfoArray;
block22: {
DependencyInfo[] dependencyInfoArray3;
block21: {
DependencyInfo[] dependencyInfoArray4;
block20: {
zipFile = null;
try {
try {
ZipEntry zipEntry;
if (string.equals("baja")) {
dependencyInfoArray4 = none;
Object var3_7 = null;
break block20;
}
File file = new File(Sys.getBajaHome(), "modules" + File.separator + string + ".jar");
if (!file.exists()) {
file = new File(Sys.getBajaHome(), "modules" + File.separator + string + ".sjar");
}
if ((zipEntry = (zipFile = new ZipFile(file)).getEntry("META-INF/module.xml")) == null) {
zipEntry = zipFile.getEntry("meta-inf/module.xml");
}
if (zipEntry == null) {
throw new ModuleException("Module missing META-INF/module.xml: " + file);
}
BufferedInputStream bufferedInputStream = new BufferedInputStream(zipFile.getInputStream(zipEntry));
XElem xElem = XParser.make((InputStream)bufferedInputStream).parse().elem("dependencies");
if (xElem == null) {
dependencyInfoArray3 = none;
break block21;
}
XElem[] xElemArray = xElem.elems("dependency");
if (xElemArray.length == 0) {
dependencyInfoArray = none;
break block22;
}
DependencyInfo[] dependencyInfoArray5 = new NDependencyInfo[xElemArray.length];
int n = 0;
while (true) {
if (n >= dependencyInfoArray5.length) {
dependencyInfoArray2 = dependencyInfoArray5;
break block23;
}
dependencyInfoArray5[n] = new NDependencyInfo(xElemArray[n]);
++n;
}
}
catch (Exception exception) {
exception.printStackTrace();
DependencyInfo[] dependencyInfoArray32 = none;
Object var3_11 = null;
try {
if (zipFile == null) return dependencyInfoArray32;
zipFile.close();
return dependencyInfoArray32;
}
catch (Exception exception2) {}
return dependencyInfoArray32;
}
}
catch (Throwable throwable) {
Object var3_12 = null;
try {}
catch (Exception exception) {
throw throwable;
}
if (zipFile == null) throw throwable;
zipFile.close();
throw throwable;
}
}
try {}
catch (Exception exception) {}
if (zipFile == null) return dependencyInfoArray4;
zipFile.close();
return dependencyInfoArray4;
}
Object var3_8 = null;
try {}
catch (Exception exception) {}
if (zipFile == null) return dependencyInfoArray3;
zipFile.close();
return dependencyInfoArray3;
}
Object var3_9 = null;
try {}
catch (Exception exception) {}
if (zipFile == null) return dependencyInfoArray;
zipFile.close();
return dependencyInfoArray;
}
Object var3_10 = null;
try {}
catch (Exception exception) {}
if (zipFile == null) return dependencyInfoArray2;
zipFile.close();
return dependencyInfoArray2;
}
public String toString() {
StringBuffer stringBuffer = new StringBuffer(this.name);
if (this.bajaVersion != null) {
stringBuffer.append('-').append(this.bajaVersion);
}
if (this.vendor != null) {
stringBuffer.append('-').append(this.vendor);
if (this.vendorVersion != null) {
stringBuffer.append('-').append(this.vendorVersion);
}
}
return stringBuffer.toString();
}
public NDependencyInfo(XElem xElem) {
this.name = xElem.get("name");
try {
this.module = Sys.getRegistry().getModule(this.name);
}
catch (Exception exception) {}
String string = xElem.get("bajaVersion", null);
this.bajaVersion = string != null ? new Version(string) : null;
this.vendor = xElem.get("vendor", null);
String string2 = xElem.get("vendorVersion", null);
this.vendorVersion = string2 != null ? new Version(string2) : null;
}
}