link start!
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.sys.module;
|
||||
|
||||
import com.tridium.asm.Buffer;
|
||||
import com.tridium.sys.module.ModuleClassLoader;
|
||||
|
||||
public class AutoClassLoader {
|
||||
public static final SysClassLoader sysClassLoader = new SysClassLoader();
|
||||
|
||||
public static Class load(Class clazz, String string, Buffer buffer) throws ClassNotFoundException {
|
||||
if (!string.startsWith("auto.")) {
|
||||
throw new IllegalStateException("class name must begin with auto");
|
||||
}
|
||||
ClassLoader classLoader = clazz.getClassLoader();
|
||||
if (classLoader instanceof ModuleClassLoader) {
|
||||
return ((ModuleClassLoader)classLoader).loadAutoClass(string, buffer);
|
||||
}
|
||||
return sysClassLoader.loadAutoClass(string, buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
static class SysClassLoader
|
||||
extends ClassLoader {
|
||||
private Buffer buffer;
|
||||
static /* synthetic */ Class class$com$tridium$sys$module$AutoClassLoader$SysClassLoader;
|
||||
|
||||
Class loadAutoClass(String string, Buffer buffer) throws ClassNotFoundException {
|
||||
this.buffer = buffer;
|
||||
return this.loadClass(string);
|
||||
}
|
||||
|
||||
public Class loadClass(String string, boolean bl) throws ClassNotFoundException {
|
||||
if (!string.startsWith("auto.")) {
|
||||
return super.loadClass(string, bl);
|
||||
}
|
||||
Class<?> clazz = this.defineClass(string, this.buffer.bytes, 0, this.buffer.count);
|
||||
if (bl) {
|
||||
this.resolveClass(clazz);
|
||||
}
|
||||
this.buffer = null;
|
||||
return clazz;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
SysClassLoader() {
|
||||
Class clazz = class$com$tridium$sys$module$AutoClassLoader$SysClassLoader;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$sys$module$AutoClassLoader$SysClassLoader = SysClassLoader.class("[Lcom.tridium.sys.module.AutoClassLoader$SysClassLoader;", false);
|
||||
}
|
||||
super(clazz.getClassLoader());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.sys.module;
|
||||
|
||||
import javax.baja.file.zip.BZipFile;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BModuleFile
|
||||
extends BZipFile {
|
||||
public static final Type TYPE;
|
||||
private static final BIcon icon;
|
||||
static /* synthetic */ Class class$com$tridium$sys$module$BModuleFile;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$sys$module$BModuleFile;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$sys$module$BModuleFile = BModuleFile.class("[Lcom.tridium.sys.module.BModuleFile;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
icon = BIcon.std("module.png");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.sys.module;
|
||||
|
||||
import com.tridium.sys.registry.NModuleInfo;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.nav.BNavContainer;
|
||||
import javax.baja.registry.ModuleInfo;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BModule;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BModuleNavNode
|
||||
extends BNavContainer {
|
||||
public static final Type TYPE;
|
||||
public final NModuleInfo info;
|
||||
public final BOrd ord;
|
||||
private BModule module;
|
||||
static /* synthetic */ Class class$com$tridium$sys$module$BModuleNavNode;
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BINavNode getNavChild(String string) {
|
||||
return this.load().getNavChild(string);
|
||||
}
|
||||
|
||||
public BINavNode[] getNavChildren() {
|
||||
return this.load().getNavChildren();
|
||||
}
|
||||
|
||||
public BOrd getNavOrd() {
|
||||
return this.ord;
|
||||
}
|
||||
|
||||
public BModule load() {
|
||||
if (this.module == null) {
|
||||
this.module = Sys.loadModule(this.info.getModuleName());
|
||||
}
|
||||
return this.module;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
this.load();
|
||||
return this.module.getIcon();
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BModuleNavNode(ModuleInfo moduleInfo) {
|
||||
super(moduleInfo.getModuleName());
|
||||
this.info = (NModuleInfo)moduleInfo;
|
||||
this.ord = BOrd.make("local:|module://" + moduleInfo.getModuleName());
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$sys$module$BModuleNavNode;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$sys$module$BModuleNavNode = BModuleNavNode.class("[Lcom.tridium.sys.module.BModuleNavNode;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.SortUtil
|
||||
*/
|
||||
package com.tridium.sys.module;
|
||||
|
||||
import com.tridium.sys.module.BTypeNavNode;
|
||||
import com.tridium.sys.module.NModule;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.UnresolvedException;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.nav.BNavContainer;
|
||||
import javax.baja.nre.util.SortUtil;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BModule;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.BTypeSpec;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BModuleTypesContainer
|
||||
extends BNavContainer {
|
||||
public static final Type TYPE;
|
||||
static HashMap moduleTypeNodes;
|
||||
HashMap types;
|
||||
BModule module;
|
||||
static /* synthetic */ Class class$com$tridium$sys$module$BModuleTypesContainer;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static BModuleTypesContainer get(BModule bModule) {
|
||||
if (moduleTypeNodes.containsKey(bModule.getModuleName())) {
|
||||
return (BModuleTypesContainer)moduleTypeNodes.get(bModule.getModuleName());
|
||||
}
|
||||
BModuleTypesContainer bModuleTypesContainer = new BModuleTypesContainer(bModule);
|
||||
moduleTypeNodes.put(bModule.getModuleName(), bModuleTypesContainer);
|
||||
return bModuleTypesContainer;
|
||||
}
|
||||
|
||||
private final void load() {
|
||||
if (this.types != null) {
|
||||
return;
|
||||
}
|
||||
this.types = new HashMap();
|
||||
NModule nModule = (NModule)this.module.fw(405);
|
||||
String[] stringArray = nModule.getTypeList();
|
||||
int n = 0;
|
||||
while (n < stringArray.length) {
|
||||
BTypeNavNode bTypeNavNode = new BTypeNavNode(this, BTypeSpec.make(nModule.getModuleName(), stringArray[n]));
|
||||
this.types.put(stringArray[n], bTypeNavNode);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public String getNavDescription(Context context) {
|
||||
return "types";
|
||||
}
|
||||
|
||||
public String getNavDisplayName(Context context) {
|
||||
return "types";
|
||||
}
|
||||
|
||||
public BIcon getNavIcon() {
|
||||
return BIcon.std("folder.png");
|
||||
}
|
||||
|
||||
public String getNavName() {
|
||||
return "types";
|
||||
}
|
||||
|
||||
public BOrd getNavOrd() {
|
||||
return BOrd.make(this.module.getNavOrd().toString() + "/types");
|
||||
}
|
||||
|
||||
public BINavNode getNavParent() {
|
||||
return this.module;
|
||||
}
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
this.load();
|
||||
boolean bl = false;
|
||||
if (this.types.size() != 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public BINavNode resolveNavChild(String string) {
|
||||
this.load();
|
||||
BTypeNavNode bTypeNavNode = (BTypeNavNode)this.types.get(string);
|
||||
if (bTypeNavNode == null) {
|
||||
throw new UnresolvedException();
|
||||
}
|
||||
return bTypeNavNode;
|
||||
}
|
||||
|
||||
public BINavNode getNavChild(String string) {
|
||||
this.load();
|
||||
return (BTypeNavNode)this.types.get(string);
|
||||
}
|
||||
|
||||
public BINavNode[] getNavChildren() {
|
||||
this.load();
|
||||
Object[] objectArray = this.types.values().toArray(new BINavNode[this.types.size()]);
|
||||
SortUtil.sort((Object[])objectArray, (Object[])objectArray, (Comparator)new Comparator(){
|
||||
|
||||
public final int compare(Object object, Object object2) {
|
||||
if (object == null || object2 == null) {
|
||||
return 0;
|
||||
}
|
||||
return ((BINavNode)object).getNavName().compareTo(((BINavNode)object2).getNavName());
|
||||
}
|
||||
});
|
||||
return objectArray;
|
||||
}
|
||||
|
||||
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.types = null;
|
||||
}
|
||||
|
||||
private BModuleTypesContainer(BModule bModule) {
|
||||
super("types");
|
||||
this.this();
|
||||
this.module = bModule;
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$sys$module$BModuleTypesContainer;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$sys$module$BModuleTypesContainer = BModuleTypesContainer.class("[Lcom.tridium.sys.module.BModuleTypesContainer;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
moduleTypeNodes = new HashMap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.sys.module;
|
||||
|
||||
import com.tridium.sys.module.BModuleFile;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BSyntheticModuleFile
|
||||
extends BModuleFile {
|
||||
public static final Type TYPE;
|
||||
private static final BIcon icon;
|
||||
static /* synthetic */ Class class$com$tridium$sys$module$BSyntheticModuleFile;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public BOrd getNavOrd() {
|
||||
return this.getAbsoluteOrd();
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$sys$module$BSyntheticModuleFile;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$sys$module$BSyntheticModuleFile = BSyntheticModuleFile.class("[Lcom.tridium.sys.module.BSyntheticModuleFile;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
icon = BIcon.make(BIcon.std("syntheticModule.png"), BIcon.std("badges/beaker.png"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.sys.module;
|
||||
|
||||
import com.tridium.sys.module.BModuleTypesContainer;
|
||||
import com.tridium.sys.schema.ComplexType;
|
||||
import com.tridium.sys.schema.NSlot;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.UnresolvedException;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.BTypeSpec;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BTypeNavNode
|
||||
extends BObject
|
||||
implements BINavNode {
|
||||
public static final Type TYPE;
|
||||
NSlot[] slots;
|
||||
BModuleTypesContainer typesNode;
|
||||
BTypeSpec type;
|
||||
static /* synthetic */ Class class$com$tridium$sys$module$BTypeNavNode;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public String getNavDescription(Context context) {
|
||||
return this.type.toString();
|
||||
}
|
||||
|
||||
public String getNavDisplayName(Context context) {
|
||||
return this.type.getTypeName();
|
||||
}
|
||||
|
||||
public BIcon getNavIcon() {
|
||||
if (this.type.getTypeInfo().isInterface()) {
|
||||
return BIcon.std("shapes/rectGray.png");
|
||||
}
|
||||
if (this.type.getTypeInfo().isAbstract()) {
|
||||
return BIcon.std("shapes/diamondGray.png");
|
||||
}
|
||||
return BIcon.std("shapes/squareGray.png");
|
||||
}
|
||||
|
||||
public String getNavName() {
|
||||
return this.type.getTypeName();
|
||||
}
|
||||
|
||||
public BOrd getNavOrd() {
|
||||
return BOrd.make(this.typesNode.getNavOrd().toString() + '/' + this.type.getTypeName());
|
||||
}
|
||||
|
||||
public BINavNode getNavParent() {
|
||||
return this.typesNode;
|
||||
}
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public BINavNode resolveNavChild(String string) {
|
||||
throw new UnresolvedException();
|
||||
}
|
||||
|
||||
public BINavNode getNavChild(String string) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public BINavNode[] getNavChildren() {
|
||||
return new BINavNode[0];
|
||||
}
|
||||
|
||||
public Slot[] getSlots() {
|
||||
if (this.type.getResolvedType() instanceof ComplexType) {
|
||||
return ((ComplexType)this.type.getResolvedType()).getFrozenSlots();
|
||||
}
|
||||
return new NSlot[0];
|
||||
}
|
||||
|
||||
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.slots = null;
|
||||
}
|
||||
|
||||
public BTypeNavNode(BModuleTypesContainer bModuleTypesContainer, BTypeSpec bTypeSpec) {
|
||||
this.this();
|
||||
this.typesNode = bModuleTypesContainer;
|
||||
this.type = bTypeSpec;
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$sys$module$BTypeNavNode;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$sys$module$BTypeNavNode = BTypeNavNode.class("[Lcom.tridium.sys.module.BTypeNavNode;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.sys.module;
|
||||
|
||||
import com.tridium.sys.module.NModule;
|
||||
import javax.baja.util.Version;
|
||||
|
||||
public class Dependency {
|
||||
public final String name;
|
||||
public final Version bajaVersion;
|
||||
public final String vendor;
|
||||
public final Version vendorVersion;
|
||||
NModule resolution;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
if (this.resolution != null) {
|
||||
stringBuffer.append(" -> ").append(this.resolution);
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public Dependency(String string, Version version, String string2, Version version2) {
|
||||
this.name = string;
|
||||
this.bajaVersion = version;
|
||||
this.vendor = string2;
|
||||
this.vendorVersion = version2;
|
||||
}
|
||||
|
||||
public Dependency(String string, Version version, String string2, Version version2, NModule nModule) {
|
||||
this(string, version, string2, version2);
|
||||
this.resolution = nModule;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,399 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.sys.module;
|
||||
|
||||
import com.tridium.asm.Buffer;
|
||||
import com.tridium.sys.module.ModuleExtClassLoader;
|
||||
import com.tridium.sys.module.NModule;
|
||||
import com.tridium.util.jar.JarEntry;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.security.AllPermission;
|
||||
import java.security.CodeSource;
|
||||
import java.security.PermissionCollection;
|
||||
import java.security.Permissions;
|
||||
import java.security.SecureClassLoader;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
import javax.baja.spy.Spy;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class ModuleClassLoader
|
||||
extends SecureClassLoader {
|
||||
private static final DecimalFormat DF = new DecimalFormat("###,###,###");
|
||||
static final boolean legacyExtClassLoader = Boolean.getBoolean("niagara.classLoader.ext");
|
||||
static final boolean parallelCapableClassLoader = Boolean.getBoolean("niagara.classLoader.parallelCapable");
|
||||
static final Object NOT_FOUND;
|
||||
private static final Map spyMap;
|
||||
public final NModule module;
|
||||
private Hashtable cache;
|
||||
private Buffer buffer;
|
||||
protected CodeSource codeSource;
|
||||
private Permissions permissions;
|
||||
private Hashtable extClassLoadersByResourcePath;
|
||||
static /* synthetic */ Class class$java$lang$String;
|
||||
static /* synthetic */ Class class$java$lang$ClassLoader;
|
||||
|
||||
public Class loadClass(String string, boolean bl) throws ClassNotFoundException {
|
||||
Class clazz = this.nload(string, bl);
|
||||
if (clazz == null) {
|
||||
String string2 = string;
|
||||
if (this.module != null) {
|
||||
string2 = this.module.name + ':' + string;
|
||||
}
|
||||
throw new ClassNotFoundException(string2);
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public Class nload(String string, boolean bl) {
|
||||
Object object = ModuleClassLoader.getLoadClassLock(this, string);
|
||||
Object object2 = object;
|
||||
synchronized (object2) {
|
||||
Object v = this.cache.get(string);
|
||||
if (v == NOT_FOUND) {
|
||||
return null;
|
||||
}
|
||||
Class clazz = (Class)v;
|
||||
if (clazz == null) {
|
||||
clazz = this.nfind(string, bl);
|
||||
if (clazz == null) {
|
||||
this.cache.put(string, NOT_FOUND);
|
||||
return null;
|
||||
}
|
||||
this.cache.put(string, clazz);
|
||||
}
|
||||
if (bl) {
|
||||
this.resolveClass(clazz);
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
}
|
||||
|
||||
static final Object getLoadClassLock(ClassLoader classLoader, String string) {
|
||||
Object object = classLoader;
|
||||
try {
|
||||
Method method;
|
||||
Class clazz = class$java$lang$ClassLoader;
|
||||
if (clazz == null) {
|
||||
clazz = class$java$lang$ClassLoader = ModuleClassLoader.class("[Ljava.lang.ClassLoader;", false);
|
||||
}
|
||||
Class[] classArray = new Class[1];
|
||||
Class clazz2 = class$java$lang$String;
|
||||
if (clazz2 == null) {
|
||||
clazz2 = classArray[0] = (class$java$lang$String = ModuleClassLoader.class("[Ljava.lang.String;", false));
|
||||
}
|
||||
if ((method = clazz.getDeclaredMethod("getClassLoadingLock", classArray)) != null) {
|
||||
object = method.invoke((Object)classLoader, string);
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable) {}
|
||||
return object;
|
||||
}
|
||||
|
||||
Class defineExtClass(String string, byte[] byArray, int n, int n2, CodeSource codeSource) {
|
||||
return this.defineClass(string, byArray, 0, byArray.length, codeSource);
|
||||
}
|
||||
|
||||
protected Class nfind(String string, boolean bl) {
|
||||
block18: {
|
||||
block17: {
|
||||
if (string.startsWith("auto.")) {
|
||||
ModuleClassLoader.addClassToSpy(this.module.name, string, this.buffer.count);
|
||||
return this.defineClass(string, this.buffer.bytes, 0, this.buffer.count, this.codeSource);
|
||||
}
|
||||
try {
|
||||
return this.getParent().loadClass(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
String string2 = string.replace('.', '/') + ".class";
|
||||
ArrayList arrayList = (ArrayList)this.extClassLoadersByResourcePath.get(string2);
|
||||
if (arrayList != null) {
|
||||
return ((ModuleExtClassLoader)arrayList.get(0)).nfind(string, bl, false);
|
||||
}
|
||||
if (this.module.isSynthetic()) break block17;
|
||||
JarEntry jarEntry = this.module.jarFile.getJarEntry(string2);
|
||||
if (jarEntry != null) {
|
||||
byte[] byArray = null;
|
||||
try {
|
||||
int n = (int)jarEntry.getSize();
|
||||
InputStream inputStream = jarEntry.getInputStream();
|
||||
byArray = new byte[n];
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
int n3 = inputStream.read(byArray, n2, n - n2);
|
||||
if (n3 < 0) {
|
||||
throw new IOException("Unexpected EOF");
|
||||
}
|
||||
n2 += n3;
|
||||
}
|
||||
inputStream.close();
|
||||
ModuleClassLoader.addClassToSpy(this.module.name, string, byArray.length);
|
||||
return this.defineClass(string, byArray, 0, byArray.length, this.codeSource);
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
iOException.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
break block18;
|
||||
}
|
||||
}
|
||||
if (this.module.getTypeClassName(string.substring(string.lastIndexOf(46) + 2)) != null) {
|
||||
ModuleClassLoader.addClassToSpy(this.module.name, string, this.buffer.count);
|
||||
Class<?> clazz = this.defineClass(string, this.buffer.bytes, 0, this.buffer.count, this.codeSource);
|
||||
try {
|
||||
Class.forName(clazz.getName(), true, clazz.getClassLoader());
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {}
|
||||
return clazz;
|
||||
}
|
||||
}
|
||||
if (this.module.depends != null) {
|
||||
Class clazz;
|
||||
NModule nModule;
|
||||
int n = string.lastIndexOf(46);
|
||||
String string3 = n == -1 ? "" : string.substring(0, n);
|
||||
int n4 = 0;
|
||||
while (n4 < this.module.depends.length) {
|
||||
nModule = this.module.depends[n4].resolution;
|
||||
if (!nModule.isSystemJar && nModule.containsPackage(string3) && (clazz = nModule.classLoader.nload(string, bl)) != null) {
|
||||
return clazz;
|
||||
}
|
||||
++n4;
|
||||
}
|
||||
n4 = 0;
|
||||
while (n4 < this.module.depends.length) {
|
||||
nModule = this.module.depends[n4].resolution;
|
||||
if (!nModule.isSystemJar && (clazz = nModule.classLoader.nload(string, bl)) != null) {
|
||||
return clazz;
|
||||
}
|
||||
++n4;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public URL getResource(String string) {
|
||||
URL uRL = this.getResourceImpl(string);
|
||||
if (uRL != null) {
|
||||
return uRL;
|
||||
}
|
||||
return ModuleClassLoader.getSystemResource(string);
|
||||
}
|
||||
|
||||
private final URL getResourceImpl(String string) {
|
||||
ArrayList arrayList = (ArrayList)this.extClassLoadersByResourcePath.get(string);
|
||||
if (arrayList != null) {
|
||||
return ((ModuleExtClassLoader)arrayList.get(0)).getResourceImpl(string);
|
||||
}
|
||||
JarEntry jarEntry = this.module.jarFile.getJarEntry(string);
|
||||
if (jarEntry != null) {
|
||||
return jarEntry.getURL();
|
||||
}
|
||||
if (this.module.depends != null) {
|
||||
int n = 0;
|
||||
while (n < this.module.depends.length) {
|
||||
URL uRL;
|
||||
NModule nModule = this.module.depends[n].resolution;
|
||||
if (!nModule.isSystemJar && (uRL = nModule.classLoader.getResourceImpl(string)) != null) {
|
||||
return uRL;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public InputStream getResourceAsStream(String string) {
|
||||
try {
|
||||
URL uRL = this.getResource(string);
|
||||
if (uRL != null) {
|
||||
URLConnection uRLConnection = uRL.openConnection();
|
||||
uRLConnection.connect();
|
||||
return uRLConnection.getInputStream();
|
||||
}
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
iOException.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Enumeration findResources(String string) throws IOException {
|
||||
ArrayList arrayList = (ArrayList)this.extClassLoadersByResourcePath.get(string);
|
||||
Vector<URL> vector = new Vector<URL>();
|
||||
if (arrayList != null) {
|
||||
Iterator iterator = arrayList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
vector.add(((ModuleExtClassLoader)iterator.next()).getResourceImpl(string));
|
||||
}
|
||||
return vector.elements();
|
||||
}
|
||||
URL uRL = this.getResourceImpl(string);
|
||||
if (uRL != null) {
|
||||
vector.add(uRL);
|
||||
}
|
||||
return vector.elements();
|
||||
}
|
||||
|
||||
public PermissionCollection getPermissions(CodeSource codeSource) {
|
||||
return this.permissions;
|
||||
}
|
||||
|
||||
Class loadAutoClass(String string, Buffer buffer) throws ClassNotFoundException {
|
||||
this.buffer = buffer;
|
||||
Class<?> clazz = this.loadClass(string);
|
||||
this.buffer = null;
|
||||
return clazz;
|
||||
}
|
||||
|
||||
protected static void addClassToSpy(String string, String string2, int n) {
|
||||
int[] nArray = (int[])spyMap.get(string);
|
||||
if (nArray == null) {
|
||||
nArray = new int[2];
|
||||
spyMap.put(string, nArray);
|
||||
}
|
||||
nArray[0] = nArray[0] + 1;
|
||||
nArray[1] = nArray[1] + n;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.getClass().getName() + " for " + this.module + " [" + Integer.toString(System.identityHashCode(this), 36) + ']';
|
||||
}
|
||||
|
||||
public static void registerAsParallelCapableFix() {
|
||||
try {
|
||||
Method method;
|
||||
Class clazz = class$java$lang$ClassLoader;
|
||||
if (clazz == null) {
|
||||
clazz = class$java$lang$ClassLoader = ModuleClassLoader.class("[Ljava.lang.ClassLoader;", false);
|
||||
}
|
||||
if ((method = clazz.getDeclaredMethod("registerAsParallelCapable", null)) != null) {
|
||||
method.setAccessible(true);
|
||||
Object object = method.invoke(null, null);
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable) {}
|
||||
}
|
||||
|
||||
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.cache = new Hashtable();
|
||||
this.extClassLoadersByResourcePath = new Hashtable();
|
||||
}
|
||||
|
||||
ModuleClassLoader(NModule nModule) {
|
||||
super(nModule.getClass().getClassLoader());
|
||||
this.this();
|
||||
this.module = nModule;
|
||||
URL uRL = null;
|
||||
if (nModule.jarFile != null) {
|
||||
uRL = nModule.jarFile.getFileURL();
|
||||
}
|
||||
this.codeSource = new CodeSource(uRL, null);
|
||||
this.permissions = new Permissions();
|
||||
this.permissions.add(new AllPermission());
|
||||
if (nModule.extJars != null) {
|
||||
int n = 0;
|
||||
while (n < nModule.extJars.length) {
|
||||
ModuleExtClassLoader moduleExtClassLoader = new ModuleExtClassLoader(this, nModule.extJars[n], this.codeSource);
|
||||
Iterator iterator = nModule.extJars[n].resourcePaths.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String string = (String)iterator.next();
|
||||
ArrayList<ModuleExtClassLoader> arrayList = (ArrayList<ModuleExtClassLoader>)this.extClassLoadersByResourcePath.get(string);
|
||||
if (arrayList == null) {
|
||||
arrayList = new ArrayList<ModuleExtClassLoader>();
|
||||
this.extClassLoadersByResourcePath.put(string, arrayList);
|
||||
}
|
||||
arrayList.add(moduleExtClassLoader);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
if (parallelCapableClassLoader) {
|
||||
ModuleClassLoader.registerAsParallelCapableFix();
|
||||
}
|
||||
NOT_FOUND = new Object();
|
||||
spyMap = new HashMap();
|
||||
}
|
||||
|
||||
public static class LoaderSpy
|
||||
extends Spy {
|
||||
private final void row(SpyWriter spyWriter, String string, int n, int n2) {
|
||||
spyWriter.w("<tr>");
|
||||
spyWriter.w("<td align='left' nowrap='true'>").w(string).w("</td>");
|
||||
spyWriter.w("<td align='right' nowrap='true'>").w(DF.format(n)).w("</td>");
|
||||
spyWriter.w("<td align='right' nowrap='true'>").w(DF.format(n2)).w("</td>");
|
||||
spyWriter.w("</tr>\n");
|
||||
}
|
||||
|
||||
private final void summary(SpyWriter spyWriter, String string, int n) {
|
||||
spyWriter.w("<tr>");
|
||||
spyWriter.w("<td align='left' nowrap='true'>").w(string).w("</td>");
|
||||
spyWriter.w("<td align='right' nowrap='true'>").w(DF.format(n)).w("</td>");
|
||||
spyWriter.w("</tr>\n");
|
||||
}
|
||||
|
||||
public void write(SpyWriter spyWriter) throws Exception {
|
||||
int n = 0;
|
||||
int n2 = 0;
|
||||
spyWriter.startTable(true);
|
||||
spyWriter.w("<tr>");
|
||||
spyWriter.thTitle("Class Loader");
|
||||
spyWriter.thTitle("Classes");
|
||||
spyWriter.thTitle("Bytes Loaded");
|
||||
spyWriter.w("</tr>");
|
||||
Iterator iterator = spyMap.keySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String string = (String)iterator.next();
|
||||
int[] nArray = (int[])spyMap.get(string);
|
||||
this.row(spyWriter, string, nArray[0], nArray[1]);
|
||||
n += nArray[0];
|
||||
n2 += nArray[1];
|
||||
}
|
||||
spyWriter.endTable();
|
||||
spyWriter.w("<p/>");
|
||||
spyWriter.startTable(true);
|
||||
spyWriter.trTitle("Summary", 2);
|
||||
this.summary(spyWriter, "Total Classes", n);
|
||||
this.summary(spyWriter, "Total Bytes Loaded", n2);
|
||||
spyWriter.endTable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.sys.module;
|
||||
|
||||
import com.tridium.sys.module.ModuleClassLoader;
|
||||
import com.tridium.sys.module.ModuleExtJar;
|
||||
import com.tridium.sys.module.NModule;
|
||||
import com.tridium.util.jar.JarEntry;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.security.CodeSource;
|
||||
import java.security.PermissionCollection;
|
||||
import java.security.SecureClassLoader;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.sys.BModule;
|
||||
import javax.baja.sys.Sys;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class ModuleExtClassLoader
|
||||
extends SecureClassLoader {
|
||||
static final Object NOT_FOUND = new Object();
|
||||
static final Log log = Log.getLog("loader");
|
||||
protected ModuleExtJar extJar;
|
||||
private Hashtable cache;
|
||||
private CodeSource codeSource;
|
||||
|
||||
public Class loadClass(String string, boolean bl) throws ClassNotFoundException {
|
||||
Class clazz = this.nload(string, bl);
|
||||
if (clazz == null) {
|
||||
String string2 = string;
|
||||
if (this.module() != null) {
|
||||
string2 = this.module().name + ':' + string;
|
||||
}
|
||||
throw new ClassNotFoundException(string2);
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public Class nload(String string, boolean bl) {
|
||||
Object object = ModuleClassLoader.getLoadClassLock(this.moduleClassLoader(), string);
|
||||
if (ModuleClassLoader.legacyExtClassLoader) {
|
||||
object = ModuleClassLoader.getLoadClassLock(this, string);
|
||||
}
|
||||
Object object2 = object;
|
||||
synchronized (object2) {
|
||||
Object v = this.cache.get(string);
|
||||
if (v == NOT_FOUND) {
|
||||
return null;
|
||||
}
|
||||
Class clazz = (Class)v;
|
||||
if (clazz == null) {
|
||||
clazz = this.nfind(string, bl, true);
|
||||
if (log.isTraceOn()) {
|
||||
String string2 = "NOT FOUND";
|
||||
if (clazz != null) {
|
||||
BModule bModule = Sys.getModuleForClass(clazz);
|
||||
string2 = bModule != null ? bModule.getModuleName() : "{system}";
|
||||
}
|
||||
log.trace(this.module().name + ':' + string + " -> " + string2);
|
||||
}
|
||||
if (clazz == null) {
|
||||
this.cache.put(string, NOT_FOUND);
|
||||
return null;
|
||||
}
|
||||
this.cache.put(string, clazz);
|
||||
}
|
||||
if (bl) {
|
||||
this.resolveClass(clazz);
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
}
|
||||
|
||||
public URL getResource(String string) {
|
||||
URL uRL = this.getResourceImpl(string);
|
||||
if (uRL != null) {
|
||||
return uRL;
|
||||
}
|
||||
return ModuleExtClassLoader.getSystemResource(string);
|
||||
}
|
||||
|
||||
URL getResourceImpl(String string) {
|
||||
JarEntry jarEntry = this.module().jarFile.getJarEntry(this.extJar.getEntryPath(string));
|
||||
if (jarEntry != null) {
|
||||
return jarEntry.getURL();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public InputStream getResourceAsStream(String string) {
|
||||
try {
|
||||
URL uRL = this.getResource(string);
|
||||
if (uRL != null) {
|
||||
URLConnection uRLConnection = uRL.openConnection();
|
||||
uRLConnection.connect();
|
||||
return uRLConnection.getInputStream();
|
||||
}
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
iOException.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Enumeration findResources(String string) throws IOException {
|
||||
Vector<URL> vector = new Vector<URL>();
|
||||
URL uRL = this.getResourceImpl(string);
|
||||
if (uRL != null) {
|
||||
vector.add(uRL);
|
||||
}
|
||||
return vector.elements();
|
||||
}
|
||||
|
||||
public PermissionCollection getPermissions(CodeSource codeSource) {
|
||||
return this.moduleClassLoader().getPermissions(codeSource);
|
||||
}
|
||||
|
||||
Class nfind(String string, boolean bl, boolean bl2) {
|
||||
Object object;
|
||||
if (bl2 && (object = this.moduleClassLoader().nload(string, bl)) != null) {
|
||||
return object;
|
||||
}
|
||||
object = this.extJar.getEntryPath(string.replace('.', '/') + ".class");
|
||||
JarEntry jarEntry = this.module().jarFile.getJarEntry((String)object);
|
||||
if (jarEntry != null) {
|
||||
byte[] byArray = null;
|
||||
try {
|
||||
int n = (int)jarEntry.getSize();
|
||||
InputStream inputStream = jarEntry.getInputStream();
|
||||
byArray = new byte[n];
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
int n3 = inputStream.read(byArray, n2, n - n2);
|
||||
if (n3 < 0) {
|
||||
throw new IOException("Unexpected EOF");
|
||||
}
|
||||
n2 += n3;
|
||||
}
|
||||
inputStream.close();
|
||||
if (ModuleClassLoader.legacyExtClassLoader) {
|
||||
return this.defineClass(string, byArray, 0, byArray.length, this.codeSource);
|
||||
}
|
||||
return this.moduleClassLoader().defineExtClass(string, byArray, 0, byArray.length, this.codeSource);
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
iOException.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected ClassLoader topClassLoader() {
|
||||
return this.getParent().getParent();
|
||||
}
|
||||
|
||||
protected ModuleClassLoader moduleClassLoader() {
|
||||
return (ModuleClassLoader)this.getParent();
|
||||
}
|
||||
|
||||
protected NModule module() {
|
||||
return this.moduleClassLoader().module;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.cache = new Hashtable();
|
||||
}
|
||||
|
||||
ModuleExtClassLoader(ModuleClassLoader moduleClassLoader, ModuleExtJar moduleExtJar, CodeSource codeSource) {
|
||||
super(moduleClassLoader);
|
||||
this.this();
|
||||
this.extJar = moduleExtJar;
|
||||
this.codeSource = codeSource;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.xml.XElem
|
||||
*/
|
||||
package com.tridium.sys.module;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.baja.xml.XElem;
|
||||
|
||||
public class ModuleExtJar {
|
||||
public String extFilename;
|
||||
public Map entryPathsByResourcePath;
|
||||
public Set resourcePaths;
|
||||
|
||||
public String getEntryPath(String string) {
|
||||
String string2 = (String)this.entryPathsByResourcePath.get(string);
|
||||
return string2 == null ? string : string2;
|
||||
}
|
||||
|
||||
public ModuleExtJar(XElem xElem) {
|
||||
this.extFilename = xElem.get("name");
|
||||
this.entryPathsByResourcePath = new HashMap();
|
||||
this.resourcePaths = new HashSet();
|
||||
XElem[] xElemArray = xElem.elems("entry");
|
||||
int n = 0;
|
||||
while (n < xElemArray.length) {
|
||||
String string = xElemArray[n].get("moduleEntryPath", null);
|
||||
String string2 = xElemArray[n].get("resourcePath");
|
||||
if (string != null) {
|
||||
this.entryPathsByResourcePath.put(string2, string);
|
||||
}
|
||||
this.resourcePaths.add(string2);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,404 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.SortUtil
|
||||
* javax.baja.xml.XParser
|
||||
*/
|
||||
package com.tridium.sys.module;
|
||||
|
||||
import com.tridium.asm.Buffer;
|
||||
import com.tridium.sys.Nre;
|
||||
import com.tridium.sys.module.Dependency;
|
||||
import com.tridium.sys.module.ModuleClassLoader;
|
||||
import com.tridium.sys.module.NModule;
|
||||
import com.tridium.sys.module.SyntheticModuleClassLoader;
|
||||
import com.tridium.sys.registry.NModuleInfo;
|
||||
import com.tridium.sys.schema.SyntheticCompiler;
|
||||
import com.tridium.util.ArrayUtil;
|
||||
import com.tridium.util.jar.JarEntry;
|
||||
import com.tridium.util.jar.JarFile;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.nre.util.SortUtil;
|
||||
import javax.baja.registry.TypeInfo;
|
||||
import javax.baja.spy.Spy;
|
||||
import javax.baja.spy.SpyDir;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.ModuleException;
|
||||
import javax.baja.sys.ModuleNotFoundException;
|
||||
import javax.baja.util.BTypeSpec;
|
||||
import javax.baja.xml.XParser;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class ModuleManager {
|
||||
public static ModuleManager instance;
|
||||
public static final Log log;
|
||||
private NModule baja;
|
||||
private NModule[] moduleArray;
|
||||
private Hashtable moduleTable;
|
||||
private ArrayList resolving;
|
||||
private boolean postInit;
|
||||
|
||||
public synchronized NModule[] getModules() {
|
||||
NModule[] nModuleArray = new NModule[this.moduleArray.length];
|
||||
System.arraycopy(this.moduleArray, 0, nModuleArray, 0, nModuleArray.length);
|
||||
return nModuleArray;
|
||||
}
|
||||
|
||||
public NModule getModuleForClass(Class clazz) {
|
||||
ClassLoader classLoader = clazz.getClassLoader();
|
||||
if (classLoader instanceof ModuleClassLoader) {
|
||||
return ((ModuleClassLoader)classLoader).module;
|
||||
}
|
||||
if (clazz.isPrimitive()) {
|
||||
return null;
|
||||
}
|
||||
String string = clazz.getName();
|
||||
if (clazz.isArray()) {
|
||||
int n = string.indexOf(76);
|
||||
string = string.substring(n + 1);
|
||||
}
|
||||
if (string.startsWith("javax.baja.") || string.startsWith("com.tridium.asm.") || string.startsWith("com.tridium.collection.") || string.startsWith("com.tridium.data.") || string.startsWith("com.tridium.sys.") || string.startsWith("com.tridium.timezone.") || string.startsWith("com.tridium.util.")) {
|
||||
return this.baja;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized NModule loadModule(String string) throws ModuleNotFoundException, ModuleException {
|
||||
NModule nModule = (NModule)this.moduleTable.get(string);
|
||||
if (nModule != null) {
|
||||
return nModule;
|
||||
}
|
||||
try {
|
||||
if (Nre.bootEnv.isRemote()) {
|
||||
Nre.bootEnv.findModule(string);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException("Missing module: " + string, exception);
|
||||
}
|
||||
return new PrivilegedLoader().load(string);
|
||||
}
|
||||
|
||||
public synchronized void unloadModule(String string) throws ModuleException {
|
||||
NModule nModule = (NModule)this.moduleTable.get(string);
|
||||
if (nModule == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
nModule.jarFile.close();
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw new ModuleException("Cannot close " + nModule.jarFile, iOException);
|
||||
}
|
||||
this.moduleArray = (NModule[])ArrayUtil.removeOne((Object[])this.moduleArray, nModule);
|
||||
this.moduleTable.remove(nModule.name);
|
||||
}
|
||||
|
||||
NModule doLoad(String string) throws ModuleException {
|
||||
NModule nModule = this.find(string);
|
||||
if (!nModule.name.equals(string)) {
|
||||
throw new ModuleException("Invalid case \"" + string + "\" != \"" + nModule.name + '\"');
|
||||
}
|
||||
this.resolve(nModule);
|
||||
if (!nModule.isSystemJar) {
|
||||
nModule.classLoader = !nModule.isSynthetic() ? new ModuleClassLoader(nModule) : new SyntheticModuleClassLoader(nModule);
|
||||
}
|
||||
this.add(nModule);
|
||||
return nModule;
|
||||
}
|
||||
|
||||
private final NModule loadSystemModule(String string) {
|
||||
Object object;
|
||||
File file = null;
|
||||
try {
|
||||
file = Nre.bootEnv.findModule(string);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException("Missing system module: " + string, exception);
|
||||
}
|
||||
if (file == null || !file.exists()) {
|
||||
object = File.separator;
|
||||
String string2 = Nre.bajaHome + (String)object + "lib" + (String)object + string + ".jar";
|
||||
file = new File(string2);
|
||||
}
|
||||
if (!file.exists()) {
|
||||
throw new IllegalStateException("Missing system module: " + file);
|
||||
}
|
||||
try {
|
||||
object = this.makeModule(file);
|
||||
((NModule)object).isSystemJar = true;
|
||||
this.add((NModule)object);
|
||||
return object;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("Cannot load system jar file: " + file, exception);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private final NModule find(String string) throws ModuleException {
|
||||
File file;
|
||||
String[] stringArray = Nre.registryManager.getInvalidModules();
|
||||
if (stringArray != null) {
|
||||
int n = stringArray.length;
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
if (string.equals(stringArray[n2])) {
|
||||
throw new ModuleException("Unsupported " + string + " module");
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
}
|
||||
try {
|
||||
file = Nre.bootEnv.findModule(string);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new ModuleNotFoundException(string, exception);
|
||||
}
|
||||
if (file == null || !file.exists()) {
|
||||
throw new ModuleNotFoundException(string);
|
||||
}
|
||||
return this.makeModule(file);
|
||||
}
|
||||
|
||||
public NModule makeModule(File file) throws ModuleException {
|
||||
NModule nModule;
|
||||
try {
|
||||
nModule = new NModule();
|
||||
nModule.jarFile = new JarFile(file);
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw new ModuleException("Cannot open jar: " + file, iOException);
|
||||
}
|
||||
JarFile jarFile = nModule.jarFile;
|
||||
JarEntry jarEntry = jarFile.getJarEntry("META-INF/module.xml");
|
||||
if (jarEntry == null) {
|
||||
jarEntry = jarFile.getJarEntry("meta-inf/module.xml");
|
||||
}
|
||||
if (jarEntry == null) {
|
||||
throw new ModuleException("Module missing META-INF/module.xml: " + file);
|
||||
}
|
||||
try {
|
||||
nModule.readXml(XParser.make((InputStream)new BufferedInputStream(jarEntry.getInputStream())).parse());
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("Cannot parse XML: " + file, exception);
|
||||
throw new ModuleException("Cannot parse XML: " + file, exception);
|
||||
}
|
||||
if (this.postInit) {
|
||||
nModule.init();
|
||||
}
|
||||
return nModule;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
private final void resolve(NModule nModule) throws ModuleException {
|
||||
NModule nModule2;
|
||||
if (nModule.depends == null) {
|
||||
return;
|
||||
}
|
||||
int n = 0;
|
||||
while (n < this.resolving.size()) {
|
||||
nModule2 = (NModule)this.resolving.get(n);
|
||||
if (nModule2.name.equals(nModule.name)) {
|
||||
throw new ModuleException("Circular dependency: " + nModule);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
this.resolving.add(nModule);
|
||||
try {
|
||||
int n2 = 0;
|
||||
while (n2 < nModule.depends.length) {
|
||||
Dependency dependency = nModule.depends[n2];
|
||||
if (dependency != null) {
|
||||
log.trace("Resolve: " + nModule + " -> " + dependency);
|
||||
try {
|
||||
dependency.resolution = this.loadModule(dependency.name);
|
||||
dependency.resolution.checkBajaVersion(dependency.bajaVersion);
|
||||
dependency.resolution.checkVendor(dependency.vendor, dependency.vendorVersion);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new ModuleException("Cannot resolve dependency " + dependency + " for " + nModule, exception);
|
||||
}
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
nModule2 = null;
|
||||
this.resolving.remove(nModule);
|
||||
return;
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
nModule2 = null;
|
||||
this.resolving.remove(nModule);
|
||||
throw throwable;
|
||||
}
|
||||
}
|
||||
|
||||
public NModule synthesizeModule(NModuleInfo nModuleInfo) {
|
||||
NModule nModule = new NModule();
|
||||
nModule.name = nModuleInfo.getModuleName();
|
||||
nModule.bajaVersion = nModuleInfo.getBajaVersion();
|
||||
nModule.vendorVersion = nModuleInfo.getVendorVersion();
|
||||
nModule.description = nModuleInfo.getDescription();
|
||||
nModule.vendor = nModuleInfo.getVendor();
|
||||
nModule.preferredSymbol = nModuleInfo.getModuleName();
|
||||
nModule.isSystemJar = false;
|
||||
nModule.depends = new Dependency[0];
|
||||
nModule.typeList = new String[0];
|
||||
nModule.types = new HashMap();
|
||||
nModule.jarFile = null;
|
||||
nModule.classLoader = new ModuleClassLoader(nModule);
|
||||
if (this.postInit) {
|
||||
nModule.init();
|
||||
}
|
||||
this.add(nModule);
|
||||
return nModule;
|
||||
}
|
||||
|
||||
public void synthesizeType(BTypeSpec bTypeSpec, String string, TypeInfo typeInfo, TypeInfo[] typeInfoArray, boolean bl, boolean bl2) {
|
||||
NModule nModule = Nre.moduleManager.loadModule(bTypeSpec.getModuleName());
|
||||
Buffer buffer = SyntheticCompiler.compile(bTypeSpec, typeInfo, typeInfoArray, bl, bl2, true);
|
||||
nModule.typeList = (String[])ArrayUtil.addOne(nModule.typeList, bTypeSpec.getTypeName());
|
||||
nModule.types.put(bTypeSpec.getTypeName(), string);
|
||||
try {
|
||||
nModule.getClassLoader().loadAutoClass(string, buffer);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new BajaRuntimeException(classNotFoundException);
|
||||
}
|
||||
}
|
||||
|
||||
private final synchronized void add(NModule nModule) {
|
||||
log.trace("Loaded: " + nModule);
|
||||
NModule[] nModuleArray = new NModule[this.moduleArray.length + 1];
|
||||
System.arraycopy(this.moduleArray, 0, nModuleArray, 0, this.moduleArray.length);
|
||||
nModuleArray[this.moduleArray.length] = nModule;
|
||||
this.moduleArray = nModuleArray;
|
||||
this.moduleTable.put(nModule.name, nModule);
|
||||
}
|
||||
|
||||
public void postInit() {
|
||||
Nre.spySysManagers.add("moduleManager", new Page());
|
||||
this.postInit = true;
|
||||
NModule[] nModuleArray = this.getModules();
|
||||
int n = 0;
|
||||
while (n < nModuleArray.length) {
|
||||
nModuleArray[n].init();
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.moduleArray = new NModule[0];
|
||||
this.moduleTable = new Hashtable();
|
||||
this.resolving = new ArrayList();
|
||||
this.postInit = false;
|
||||
}
|
||||
|
||||
public ModuleManager() {
|
||||
this.this();
|
||||
instance = this;
|
||||
this.baja = this.loadSystemModule("baja");
|
||||
}
|
||||
|
||||
static {
|
||||
log = Log.getLog("sys.module");
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class PrivilegedLoader
|
||||
implements PrivilegedExceptionAction {
|
||||
String name;
|
||||
|
||||
NModule load(String string) throws ModuleException {
|
||||
this.name = string;
|
||||
try {
|
||||
return (NModule)AccessController.doPrivileged(this);
|
||||
}
|
||||
catch (PrivilegedActionException privilegedActionException) {
|
||||
Exception exception = privilegedActionException.getException();
|
||||
if (exception instanceof ModuleException) {
|
||||
throw (ModuleException)exception;
|
||||
}
|
||||
throw new BajaRuntimeException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
public Object run() throws Exception {
|
||||
return ModuleManager.this.doLoad(this.name);
|
||||
}
|
||||
|
||||
PrivilegedLoader() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class Page
|
||||
extends SpyDir {
|
||||
public Spy find(String string) {
|
||||
return new ModulePage(ModuleManager.this.loadModule(string));
|
||||
}
|
||||
|
||||
public void write(SpyWriter spyWriter) throws Exception {
|
||||
Object[] objectArray = ModuleManager.this.getModules();
|
||||
SortUtil.sort((Object[])objectArray, (Object[])objectArray, (Comparator)new Comparator(){
|
||||
|
||||
public final int compare(Object object, Object object2) {
|
||||
if (!(object instanceof NModule) || !(object2 instanceof NModule)) {
|
||||
return 0;
|
||||
}
|
||||
return ((NModule)object).getModuleName().compareTo(((NModule)object2).getModuleName());
|
||||
}
|
||||
});
|
||||
spyWriter.startTable(true);
|
||||
int n = 0;
|
||||
while (n < objectArray.length) {
|
||||
Object object = objectArray[n];
|
||||
String string = ((NModule)object).getModuleName();
|
||||
spyWriter.tr("<a href='" + string + "'>" + string + "</a>", ((NModule)object).getBajaVersion(), ((NModule)object).getVendor(), ((NModule)object).getVendorVersion(), ((NModule)object).getDescription());
|
||||
++n;
|
||||
}
|
||||
spyWriter.endTable();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class ModulePage
|
||||
extends Spy {
|
||||
NModule m;
|
||||
|
||||
public void write(SpyWriter spyWriter) throws Exception {
|
||||
this.m.bmodule().spy(spyWriter);
|
||||
}
|
||||
|
||||
ModulePage(NModule nModule) {
|
||||
this.m = nModule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,366 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.SortUtil
|
||||
* javax.baja.xml.XElem
|
||||
*/
|
||||
package com.tridium.sys.module;
|
||||
|
||||
import com.tridium.sys.Nre;
|
||||
import com.tridium.sys.module.Dependency;
|
||||
import com.tridium.sys.module.ModuleClassLoader;
|
||||
import com.tridium.sys.module.ModuleExtJar;
|
||||
import com.tridium.sys.module.ModuleManager;
|
||||
import com.tridium.util.jar.JarFile;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipFile;
|
||||
import javax.baja.nre.util.SortUtil;
|
||||
import javax.baja.sys.BModule;
|
||||
import javax.baja.sys.ModuleException;
|
||||
import javax.baja.sys.ModuleIncompatibleException;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.sys.TypeException;
|
||||
import javax.baja.sys.TypeNotFoundException;
|
||||
import javax.baja.util.Lexicon;
|
||||
import javax.baja.util.Version;
|
||||
import javax.baja.xml.XElem;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class NModule {
|
||||
protected String name;
|
||||
protected Version bajaVersion;
|
||||
protected Version vendorVersion;
|
||||
protected String description;
|
||||
protected String vendor;
|
||||
protected String preferredSymbol;
|
||||
boolean isSystemJar;
|
||||
public JarFile jarFile;
|
||||
protected Dependency[] depends;
|
||||
protected ModuleClassLoader classLoader;
|
||||
String[] typeList;
|
||||
protected Map types;
|
||||
protected Map packages;
|
||||
ModuleExtJar[] extJars;
|
||||
protected Object bmodule;
|
||||
Lexicon lexicon;
|
||||
HashMap lexicons;
|
||||
|
||||
void init() {
|
||||
this.bmodule = new BModule(this);
|
||||
}
|
||||
|
||||
public String getModuleName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getPreferredSymbol() {
|
||||
return this.preferredSymbol;
|
||||
}
|
||||
|
||||
public Version getBajaVersion() {
|
||||
return this.bajaVersion;
|
||||
}
|
||||
|
||||
public String getVendor() {
|
||||
return this.vendor;
|
||||
}
|
||||
|
||||
public Version getVendorVersion() {
|
||||
return this.vendorVersion;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public BModule bmodule() {
|
||||
return (BModule)this.bmodule;
|
||||
}
|
||||
|
||||
public void checkBajaVersion(Version version) throws ModuleIncompatibleException {
|
||||
if (version != null && version.compareTo(this.getBajaVersion()) > 0) {
|
||||
throw new ModuleIncompatibleException(this.getModuleName() + '-' + version);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkVendor(String string, Version version) throws ModuleIncompatibleException {
|
||||
if (string != null && !string.equalsIgnoreCase(this.getVendor()) || version != null && version.compareTo(this.getVendorVersion()) > 0) {
|
||||
throw new ModuleIncompatibleException(this.getModuleName() + '-' + string + '-' + version);
|
||||
}
|
||||
}
|
||||
|
||||
public Class loadClass(String string) throws ClassNotFoundException {
|
||||
if (this.isSystemJar) {
|
||||
return Class.forName(string);
|
||||
}
|
||||
return Class.forName(string, true, this.classLoader);
|
||||
}
|
||||
|
||||
public URL getResource(String string) {
|
||||
if (this.isSystemJar) {
|
||||
return ClassLoader.getSystemResource(string);
|
||||
}
|
||||
return this.classLoader.getResource(string);
|
||||
}
|
||||
|
||||
public ModuleClassLoader getClassLoader() {
|
||||
return this.classLoader;
|
||||
}
|
||||
|
||||
public String[] getTypeList() {
|
||||
if (this.typeList == null) {
|
||||
this.typeList = this.types.keySet().toArray(new String[this.types.size()]);
|
||||
SortUtil.sort((Object[])this.typeList);
|
||||
}
|
||||
String[] stringArray = new String[this.typeList.length];
|
||||
System.arraycopy(this.typeList, 0, stringArray, 0, stringArray.length);
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
public Type getType(String string) throws TypeException {
|
||||
Object v = this.types.get(string);
|
||||
if (v == null) {
|
||||
throw new TypeNotFoundException(this.name + ':' + string);
|
||||
}
|
||||
if (v instanceof Type) {
|
||||
return (Type)v;
|
||||
}
|
||||
String string2 = (String)v;
|
||||
try {
|
||||
Class clazz = this.loadClass(string2);
|
||||
v = this.types.get(string);
|
||||
if (v == null || !(v instanceof Type)) {
|
||||
throw new TypeException("Class loaded, but didn't register a type " + this.name + ':' + string + '=' + string2);
|
||||
}
|
||||
return (Type)v;
|
||||
}
|
||||
catch (TypeException typeException) {
|
||||
throw typeException;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new TypeException("Class not found for type " + this.name + ':' + string + '=' + string2);
|
||||
}
|
||||
catch (ExceptionInInitializerError exceptionInInitializerError) {
|
||||
Throwable throwable = exceptionInInitializerError.getException();
|
||||
if (throwable == null) {
|
||||
throwable = exceptionInInitializerError;
|
||||
}
|
||||
throw new TypeException(exceptionInInitializerError.toString() + ' ' + this.name + ':' + string + '=' + string2, throwable);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
throw new TypeException(throwable.toString() + ' ' + this.name + ':' + string + '=' + string2, throwable);
|
||||
}
|
||||
}
|
||||
|
||||
public void register(String string, Type type) {
|
||||
this.types.put(string, type);
|
||||
}
|
||||
|
||||
public void register(String string, String string2) {
|
||||
this.types.put(string, string2);
|
||||
}
|
||||
|
||||
public ZipFile getZipFile() {
|
||||
if (this.jarFile instanceof JarFile) {
|
||||
return this.jarFile.zip;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public final Lexicon getLexicon(String string) {
|
||||
HashMap hashMap = this.lexicons;
|
||||
synchronized (hashMap) {
|
||||
Lexicon lexicon = (Lexicon)this.lexicons.get(string);
|
||||
if (lexicon == null) {
|
||||
lexicon = Lexicon.make(this.bmodule(), string);
|
||||
this.lexicons.put(string, lexicon);
|
||||
}
|
||||
return lexicon;
|
||||
}
|
||||
}
|
||||
|
||||
public final Lexicon getLexicon() {
|
||||
if (this.lexicon == null || !this.lexicon.language.equals(Sys.getLanguage())) {
|
||||
this.lexicon = this.getLexicon(Sys.getLanguage());
|
||||
}
|
||||
return this.lexicon;
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return this.jarFile.getFile();
|
||||
}
|
||||
|
||||
public String getTypeClassName(String string) {
|
||||
Object v = this.types.get(string);
|
||||
if (v == null) {
|
||||
return null;
|
||||
}
|
||||
if (v instanceof String) {
|
||||
return (String)v;
|
||||
}
|
||||
return ((Type)v).getTypeClass().getName();
|
||||
}
|
||||
|
||||
public boolean isSystemJar() {
|
||||
return this.isSystemJar;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.name + '-' + this.vendor + '-' + this.vendorVersion;
|
||||
}
|
||||
|
||||
public void loadAllTypes() {
|
||||
String[] stringArray = this.getTypeList();
|
||||
int n = 0;
|
||||
while (n < stringArray.length) {
|
||||
try {
|
||||
this.getType(stringArray[n]);
|
||||
}
|
||||
catch (TypeException typeException) {
|
||||
ModuleManager.log.error("Cannot load type", typeException);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSynthetic() {
|
||||
if (this.getZipFile() == null) {
|
||||
return true;
|
||||
}
|
||||
return this.getZipFile().getName().endsWith(".sjar");
|
||||
}
|
||||
|
||||
public boolean isTransient() {
|
||||
boolean bl = false;
|
||||
if (this.getZipFile() == null) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public boolean containsPackage(String string) {
|
||||
return this.packages.containsKey(string);
|
||||
}
|
||||
|
||||
void readXml(XElem xElem) throws IOException {
|
||||
this.readAttributes(xElem);
|
||||
this.readDependencies(xElem);
|
||||
this.readTypes(xElem);
|
||||
this.readExts(xElem);
|
||||
this.__postReadXml(xElem);
|
||||
}
|
||||
|
||||
private final void readAttributes(XElem xElem) throws IOException {
|
||||
this.name = xElem.get("name");
|
||||
this.bajaVersion = new Version(xElem.get("bajaVersion"));
|
||||
this.vendorVersion = new Version(xElem.get("vendorVersion"));
|
||||
this.description = xElem.get("description");
|
||||
this.vendor = xElem.get("vendor");
|
||||
this.preferredSymbol = xElem.get("preferredSymbol");
|
||||
}
|
||||
|
||||
private final void readDependencies(XElem xElem) throws IOException {
|
||||
XElem xElem2 = xElem.elem("dependencies");
|
||||
if (xElem2 == null) {
|
||||
return;
|
||||
}
|
||||
XElem[] xElemArray = xElem2.elems("dependency");
|
||||
ArrayList<Dependency> arrayList = new ArrayList<Dependency>(xElemArray.length);
|
||||
int n = 0;
|
||||
while (n < xElemArray.length) {
|
||||
XElem xElem3 = xElemArray[n];
|
||||
String string = xElem3.get("name");
|
||||
String string2 = xElem3.get("bajaVersion", null);
|
||||
String string3 = xElem3.get("vendor", null);
|
||||
String string4 = xElem3.get("vendorVersion", null);
|
||||
Version version = string2 == null ? null : new Version(string2);
|
||||
Version version2 = string4 == null ? null : new Version(string4);
|
||||
arrayList.add(new Dependency(string, version, string3, version2));
|
||||
++n;
|
||||
}
|
||||
this.depends = arrayList.toArray(new Dependency[arrayList.size()]);
|
||||
}
|
||||
|
||||
private final void readTypes(XElem xElem) throws IOException {
|
||||
XElem xElem2 = xElem.elem("types");
|
||||
if (xElem2 == null) {
|
||||
return;
|
||||
}
|
||||
XElem[] xElemArray = xElem2.elems("type");
|
||||
int n = 0;
|
||||
while (n < xElemArray.length) {
|
||||
String string;
|
||||
XElem xElem3 = xElemArray[n];
|
||||
String string2 = xElem3.get("name");
|
||||
String string3 = xElem3.get("class");
|
||||
this.types.put(string2, string3);
|
||||
int n2 = string3.lastIndexOf(46);
|
||||
String string4 = string = n2 == -1 ? "" : string3.substring(0, n2);
|
||||
if (!this.packages.containsKey(string)) {
|
||||
this.packages.put(string, string);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
private final void readExts(XElem xElem) throws IOException {
|
||||
XElem xElem2 = xElem.elem("extFiles");
|
||||
if (xElem2 == null) {
|
||||
return;
|
||||
}
|
||||
XElem[] xElemArray = xElem2.elems("extFile");
|
||||
this.extJars = new ModuleExtJar[xElemArray.length];
|
||||
int n = 0;
|
||||
while (n < xElemArray.length) {
|
||||
this.extJars[n] = new ModuleExtJar(xElemArray[n]);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
private final void __postReadXml(XElem xElem) {
|
||||
String[] stringArray = Nre.registryManager.getInvalidModules();
|
||||
if (stringArray == null) {
|
||||
return;
|
||||
}
|
||||
int n = stringArray.length;
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
if (this.name.equals(stringArray[n2])) {
|
||||
this.types.clear();
|
||||
this.types = Collections.unmodifiableMap(this.types);
|
||||
this.typeList = null;
|
||||
throw new ModuleException("Unsupported " + this.name + " module");
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.bajaVersion = Version.ZERO;
|
||||
this.vendorVersion = Version.ZERO;
|
||||
this.types = new HashMap(63);
|
||||
this.packages = new HashMap(10);
|
||||
this.lexicons = new HashMap();
|
||||
}
|
||||
|
||||
public NModule() {
|
||||
this.this();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.sys.module;
|
||||
|
||||
import com.tridium.asm.Buffer;
|
||||
import com.tridium.sys.module.ModuleClassLoader;
|
||||
import com.tridium.sys.module.NModule;
|
||||
import com.tridium.sys.schema.SyntheticCompiler;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.util.BTypeSpec;
|
||||
|
||||
public class SyntheticModuleClassLoader
|
||||
extends ModuleClassLoader {
|
||||
public Class loadAutoClass(String string, Buffer buffer) throws ClassNotFoundException {
|
||||
return super.loadAutoClass(string, buffer);
|
||||
}
|
||||
|
||||
public Class ndefineClass(String string, byte[] byArray, int n, int n2) {
|
||||
return super.defineClass(string, byArray, n, n2, this.codeSource);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unable to fully structure code
|
||||
*/
|
||||
protected Class nfind(String var1_1, boolean var2_2) {
|
||||
block13: {
|
||||
if (var1_1.startsWith("auto.")) {
|
||||
block12: {
|
||||
try {
|
||||
return super.nfind(var1_1, var2_2);
|
||||
}
|
||||
catch (NoClassDefFoundError var3_3) {
|
||||
if (this.module.depends == null) break block12;
|
||||
var4_6 = 0;
|
||||
** while (var4_6 < this.module.depends.length)
|
||||
}
|
||||
lbl-1000:
|
||||
// 1 sources
|
||||
|
||||
{
|
||||
var5_9 = this.module.depends[var4_6].resolution;
|
||||
if (var5_9.isSynthetic() && !var5_9.isSystemJar && (var6_12 = var5_9.classLoader.nload(var1_1, var2_2)) != null) {
|
||||
return var6_12;
|
||||
}
|
||||
++var4_6;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
throw var3_3;
|
||||
}
|
||||
try {
|
||||
return this.getParent().loadClass(var1_1);
|
||||
}
|
||||
catch (ClassNotFoundException v0) {
|
||||
if (this.module.getTypeClassName(var1_1.substring(var1_1.lastIndexOf(46) + 2)) != null) {
|
||||
var3_4 = BTypeSpec.make(this.module.getModuleName(), var1_1.substring(var1_1.lastIndexOf(46) + 2));
|
||||
var4_7 = Sys.getRegistry().getType(var3_4.toString());
|
||||
var5_10 = var4_7.getInterfaces();
|
||||
var6_13 = var4_7.isAbstract();
|
||||
var7_14 = var4_7.isFinal();
|
||||
var8_15 = var4_7.getSuperType();
|
||||
var9_16 = SyntheticCompiler.compile(var3_4, var8_15, var5_10, var6_13, var7_14, false);
|
||||
SyntheticModuleClassLoader.addClassToSpy(this.module.name, var1_1, var9_16.count);
|
||||
var10_17 = this.defineClass(var1_1, var9_16.bytes, 0, var9_16.count, this.codeSource);
|
||||
try {
|
||||
Class.forName(var10_17.getName(), true, var10_17.getClassLoader());
|
||||
}
|
||||
catch (ClassNotFoundException v1) {}
|
||||
return var10_17;
|
||||
}
|
||||
if (this.module.depends == null) break block13;
|
||||
var3_5 = 0;
|
||||
** while (var3_5 < this.module.depends.length)
|
||||
}
|
||||
lbl-1000:
|
||||
// 1 sources
|
||||
|
||||
{
|
||||
var4_8 = this.module.depends[var3_5].resolution;
|
||||
if (!var4_8.isSystemJar && (var5_11 = var4_8.classLoader.nload(var1_1, var2_2)) != null) {
|
||||
return var5_11;
|
||||
}
|
||||
++var3_5;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public SyntheticModuleClassLoader(NModule nModule) {
|
||||
super(nModule);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user