215 lines
9.6 KiB
Java
215 lines
9.6 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.schema;
|
|
|
|
import com.tridium.sys.Nre;
|
|
import com.tridium.sys.module.NModule;
|
|
import com.tridium.sys.schema.ComplexIntrospector;
|
|
import com.tridium.sys.schema.ComplexType;
|
|
import com.tridium.sys.schema.NAction;
|
|
import com.tridium.sys.schema.NProperty;
|
|
import com.tridium.sys.schema.NSlot;
|
|
import com.tridium.sys.schema.NTopic;
|
|
import com.tridium.sys.schema.SyntheticComplexSlotMap;
|
|
import com.tridium.sys.schema.SyntheticComplexType;
|
|
import com.tridium.sys.schema.SyntheticComponentSlotMap;
|
|
import com.tridium.util.jar.JarEntry;
|
|
import java.io.BufferedInputStream;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.lang.reflect.Field;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import javax.baja.io.BIEncodable;
|
|
import javax.baja.io.ValueDocDecoder;
|
|
import javax.baja.sys.BFacets;
|
|
import javax.baja.sys.BValue;
|
|
import javax.baja.sys.ModuleException;
|
|
import javax.baja.sys.Type;
|
|
import javax.baja.util.BTypeSpec;
|
|
import javax.baja.xml.XElem;
|
|
import javax.baja.xml.XParser;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public class SyntheticComplexIntrospector
|
|
extends ComplexIntrospector {
|
|
static /* synthetic */ Class class$javax$baja$sys$BComponent;
|
|
static /* synthetic */ Class class$javax$baja$sys$BComplex;
|
|
|
|
protected void mapSlots() throws Exception {
|
|
XElem[] xElemArray;
|
|
NSlot nSlot;
|
|
XElem[] xElemArray2;
|
|
Object object;
|
|
NModule nModule = Nre.moduleManager.getModuleForClass(this.cls);
|
|
ArrayList<NSlot> arrayList = new ArrayList<NSlot>();
|
|
ArrayList<NProperty> arrayList2 = new ArrayList<NProperty>();
|
|
ArrayList<NSlot> arrayList3 = new ArrayList<NSlot>();
|
|
ArrayList<NSlot> arrayList4 = new ArrayList<NSlot>();
|
|
ComplexType complexType = (ComplexType)this.cls.getSuperclass().getField("TYPE").get(null);
|
|
if (complexType instanceof SyntheticComplexType) {
|
|
object = (Field[])complexType;
|
|
arrayList.addAll(Arrays.asList(((SyntheticComplexType)object).slots));
|
|
arrayList2.addAll(Arrays.asList(((SyntheticComplexType)object).properties));
|
|
arrayList3.addAll(Arrays.asList(((SyntheticComplexType)object).actions));
|
|
arrayList4.addAll(Arrays.asList(((SyntheticComplexType)object).topics));
|
|
} else {
|
|
object = this.resolveFields();
|
|
int n = 0;
|
|
while (n < ((Field[])object).length) {
|
|
xElemArray2 = object[n];
|
|
if (xElemArray2 != null) {
|
|
Class<?> clazz = xElemArray2.getType();
|
|
nSlot = null;
|
|
try {
|
|
if (clazz == propertyClass) {
|
|
xElemArray = this.mapProperty((NProperty)this.getSlotField((Field)xElemArray2));
|
|
arrayList2.add((NProperty)xElemArray);
|
|
nSlot = xElemArray;
|
|
} else if (clazz == actionClass) {
|
|
xElemArray = this.mapAction((NAction)this.getSlotField((Field)xElemArray2));
|
|
arrayList3.add((NSlot)xElemArray);
|
|
nSlot = xElemArray;
|
|
} else if (clazz == topicClass) {
|
|
xElemArray = this.mapTopic((NTopic)this.getSlotField((Field)xElemArray2));
|
|
arrayList4.add((NSlot)xElemArray);
|
|
nSlot = xElemArray;
|
|
}
|
|
}
|
|
catch (Exception exception) {
|
|
this.err("" + xElemArray2);
|
|
throw exception;
|
|
}
|
|
if (nSlot != null) {
|
|
nSlot.index = arrayList.size();
|
|
arrayList.add(nSlot);
|
|
}
|
|
}
|
|
++n;
|
|
}
|
|
}
|
|
if (nModule.jarFile != null) {
|
|
object = nModule.jarFile.getJarEntry("META-INF/module.xml");
|
|
if (object == null) {
|
|
object = nModule.jarFile.getJarEntry("meta-inf/module.xml");
|
|
}
|
|
if (object == null) {
|
|
throw new ModuleException("Module missing META-INF/module.xml: " + nModule.jarFile.getFile());
|
|
}
|
|
XElem xElem = XParser.make((InputStream)new BufferedInputStream(((JarEntry)object).getInputStream())).parse();
|
|
if (xElem.elem("types") != null) {
|
|
xElemArray2 = xElem.elem("types").elems("type");
|
|
int n = 0;
|
|
while (n < xElemArray2.length) {
|
|
if (xElemArray2[n].get("name").equals(this.typeName) && (nSlot = xElemArray2[n].elem("slots")) != null) {
|
|
xElemArray = nSlot.elems("property");
|
|
int n2 = 0;
|
|
while (n2 < xElemArray.length) {
|
|
block27: {
|
|
try {
|
|
NSlot nSlot2;
|
|
String string = xElemArray[n2].get("name");
|
|
int n3 = xElemArray[n2].geti("flags", 0);
|
|
BTypeSpec bTypeSpec = BTypeSpec.make(xElemArray[n2].get("type"));
|
|
BValue bValue = bTypeSpec.getResolvedType().is(BIEncodable.TYPE) ? (BValue)((BIEncodable)((Object)bTypeSpec.getInstance())).decodeFromString(xElemArray[n2].get("value")) : ValueDocDecoder.unmarshal(xElemArray[n2].get("value"));
|
|
BFacets bFacets = (BFacets)BFacets.DEFAULT.decodeFromString(xElemArray[n2].get("facets", ""));
|
|
NProperty nProperty = new NProperty(string, n3, bValue, bFacets, true);
|
|
boolean bl = false;
|
|
int n4 = 0;
|
|
while (n4 < arrayList2.size()) {
|
|
nSlot2 = (NProperty)arrayList2.get(n4);
|
|
if (nSlot2.name.equals(nProperty.name)) {
|
|
arrayList2.set(n4, nProperty);
|
|
bl = true;
|
|
break;
|
|
}
|
|
++n4;
|
|
}
|
|
if (bl) {
|
|
n4 = 0;
|
|
while (n4 < arrayList.size()) {
|
|
nSlot2 = (NSlot)arrayList.get(n4);
|
|
if (nSlot2.name.equals(nProperty.name)) {
|
|
nProperty.index = n4;
|
|
arrayList.set(n4, nProperty);
|
|
break block27;
|
|
}
|
|
++n4;
|
|
}
|
|
break block27;
|
|
}
|
|
nProperty.index = arrayList.size();
|
|
arrayList2.add(nProperty);
|
|
arrayList.add(nProperty);
|
|
}
|
|
catch (IOException iOException) {
|
|
iOException.printStackTrace();
|
|
}
|
|
}
|
|
++n2;
|
|
}
|
|
break;
|
|
}
|
|
++n;
|
|
}
|
|
}
|
|
}
|
|
this.slots = arrayList.toArray(new NSlot[arrayList.size()]);
|
|
this.properties = arrayList2.toArray(new NProperty[arrayList2.size()]);
|
|
this.actions = arrayList3.toArray(new NAction[arrayList3.size()]);
|
|
this.topics = arrayList4.toArray(new NTopic[arrayList4.size()]);
|
|
if (this.superSlotsToFix != null) {
|
|
this.fixSuperSlots();
|
|
}
|
|
}
|
|
|
|
protected Type makeType() {
|
|
return new SyntheticComplexType(this, this.cls);
|
|
}
|
|
|
|
protected void generateSlotMapClass() throws Exception {
|
|
Class clazz = class$javax$baja$sys$BComponent;
|
|
if (clazz == null) {
|
|
clazz = class$javax$baja$sys$BComponent = SyntheticComplexIntrospector.class("[Ljavax.baja.sys.BComponent;", false);
|
|
}
|
|
if (clazz.isAssignableFrom(this.cls)) {
|
|
this.slotMap = new SyntheticComponentSlotMap();
|
|
} else {
|
|
Class clazz2 = class$javax$baja$sys$BComplex;
|
|
if (clazz2 == null) {
|
|
clazz2 = class$javax$baja$sys$BComplex = SyntheticComplexIntrospector.class("[Ljavax.baja.sys.BComplex;", false);
|
|
}
|
|
if (clazz2.isAssignableFrom(this.cls)) {
|
|
this.slotMap = new SyntheticComplexSlotMap();
|
|
} else {
|
|
throw new IllegalStateException();
|
|
}
|
|
}
|
|
}
|
|
|
|
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 SyntheticComplexIntrospector(int n, Class clazz) {
|
|
super(n, clazz);
|
|
}
|
|
}
|
|
|