link start!

This commit is contained in:
cherubin
2026-03-17 13:31:18 -07:00
commit 08abe87cfb
5910 changed files with 386288 additions and 0 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,160 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.sys.registry;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import javax.baja.io.ByteBuffer;
public class ClassScanner {
private static final String[] noInterfaces = new String[0];
public int modifiers;
public String thisClass;
public String superClass;
public String[] interfaces;
public boolean hasLoadType;
private int[] cpClass;
private byte[][] cpUtf;
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void scan(InputStream inputStream) throws IOException {
DataInputStream dataInputStream = new DataInputStream(new BufferedInputStream(inputStream));
try {
int n;
int n2 = dataInputStream.readInt();
int n3 = dataInputStream.readUnsignedShort();
int n4 = dataInputStream.readUnsignedShort();
int n5 = dataInputStream.readUnsignedShort();
if (n2 != -889275714) {
throw new IOException("Invalid magic");
}
this.cpClass = new int[n5];
this.cpUtf = new byte[n5][];
int n6 = 1;
while (n6 < n5) {
n = this.readCpInfo(dataInputStream, n6);
if (n != 0) {
++n6;
}
++n6;
}
this.modifiers = dataInputStream.readUnsignedShort();
this.thisClass = this.toClass(dataInputStream.readUnsignedShort());
this.superClass = this.toClass(dataInputStream.readUnsignedShort());
n6 = dataInputStream.readUnsignedShort();
if (n6 == 0) {
this.interfaces = noInterfaces;
} else {
this.interfaces = new String[n6];
n = 0;
while (n < n6) {
this.interfaces[n] = this.toClass(dataInputStream.readUnsignedShort());
++n;
}
}
Object var4_11 = null;
}
catch (Throwable throwable) {
Object var4_10 = null;
dataInputStream.close();
throw throwable;
}
dataInputStream.close();
}
private final boolean readCpInfo(DataInputStream dataInputStream, int n) throws IOException {
int n2 = dataInputStream.readUnsignedByte();
switch (n2) {
case 1: {
int n3 = dataInputStream.readUnsignedShort();
byte[] byArray = new byte[n3];
dataInputStream.readFully(byArray, 0, n3);
this.cpUtf[n] = byArray;
this.checkLoadType(byArray);
return false;
}
case 3: {
ClassScanner.skip(dataInputStream, 4);
return false;
}
case 4: {
ClassScanner.skip(dataInputStream, 4);
return false;
}
case 5: {
ClassScanner.skip(dataInputStream, 8);
return true;
}
case 6: {
ClassScanner.skip(dataInputStream, 8);
return true;
}
case 7: {
this.cpClass[n] = dataInputStream.readUnsignedShort();
return false;
}
case 8: {
ClassScanner.skip(dataInputStream, 2);
return false;
}
case 9: {
ClassScanner.skip(dataInputStream, 4);
return false;
}
case 10: {
ClassScanner.skip(dataInputStream, 4);
return false;
}
case 11: {
ClassScanner.skip(dataInputStream, 4);
return false;
}
case 12: {
ClassScanner.skip(dataInputStream, 4);
return false;
}
}
throw new IOException("Invalid cp tag 0x" + Integer.toHexString(n2));
}
private final String toClass(int n) throws IOException {
byte[] byArray = this.cpUtf[this.cpClass[n]];
ByteBuffer byteBuffer = new ByteBuffer(byArray.length + 4);
byteBuffer.writeShort(byArray.length);
byteBuffer.write(byArray, 0, byArray.length);
return byteBuffer.readUTF().replace('/', '.');
}
private final void checkLoadType(byte[] byArray) {
if (this.hasLoadType) {
return;
}
if (byArray.length != "loadType".length()) {
return;
}
boolean bl = false;
if (byArray[0] == 108 && byArray[1] == 111 && byArray[2] == 97 && byArray[3] == 100 && byArray[4] == 84 && byArray[5] == 121 && byArray[6] == 112 && byArray[7] == 101) {
bl = true;
}
this.hasLoadType = bl;
}
private static final void skip(InputStream inputStream, int n) throws IOException {
int n2 = 0;
while (n2 < n) {
if (n2 < 0) {
throw new EOFException();
}
n2 = (int)((long)n2 + inputStream.skip(n - n2));
}
}
}
@@ -0,0 +1,316 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.Array
* javax.baja.nre.util.SortUtil
*/
package com.tridium.sys.registry;
import com.tridium.sys.Nre;
import com.tridium.sys.registry.NAdapterInfo;
import com.tridium.sys.registry.NModuleInfo;
import com.tridium.sys.registry.NTypeInfo;
import java.io.File;
import java.io.StringWriter;
import javax.baja.agent.AgentInfo;
import javax.baja.io.HtmlWriter;
import javax.baja.log.Log;
import javax.baja.nre.util.Array;
import javax.baja.nre.util.SortUtil;
import javax.baja.registry.ModuleInfo;
import javax.baja.registry.RegistryException;
import javax.baja.registry.TypeInfo;
import javax.baja.spy.Spy;
import javax.baja.spy.SpyDir;
import javax.baja.spy.SpyWriter;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.Sys;
public class Debug {
public static final Log log = Log.getLog("sys.registry");
private File root;
public File modulesFile() {
return new File(this.root, "modules.xml");
}
public File moduleDir(String string) {
return new File(this.root, string);
}
public static class AdaptersPage
extends Spy {
public void write(SpyWriter spyWriter) throws Exception {
String string = "../";
NAdapterInfo[] nAdapterInfoArray = Nre.registryManager.db().adapters;
spyWriter.startTable(true);
spyWriter.trTitle("Installed Adapters", 3);
spyWriter.w("<tr>").th("Type").th("From").th("To").w("</tr>\n");
int n = 0;
while (n < nAdapterInfoArray.length) {
NAdapterInfo nAdapterInfo = nAdapterInfoArray[n];
spyWriter.w("<tr>").td("<a href='" + string + "types/" + nAdapterInfo.type.toString() + "'>" + nAdapterInfo.type + "</a>").td("<a href='" + string + "types/" + nAdapterInfo.from.toString() + "'>" + nAdapterInfo.from + "</a>").td("<a href='" + string + "types/" + nAdapterInfo.to.toString() + "'>" + nAdapterInfo.to + "</a>").w("</tr>\n");
++n;
}
spyWriter.endTable();
}
}
public static class OrdSchemesPage
extends Spy {
public void write(SpyWriter spyWriter) throws Exception {
String string = "../";
String[] stringArray = Sys.getRegistry().getOrdSchemes();
spyWriter.startTable(true);
spyWriter.trTitle("Installed Ord Schemes", 2);
int n = 0;
while (n < stringArray.length) {
TypeInfo typeInfo = Sys.getRegistry().getOrdScheme(stringArray[n]);
spyWriter.w("<tr>").td(stringArray[n]).td("<a href='" + string + "types/" + typeInfo.toString() + "'>" + typeInfo + "</a>").w("</tr>\n");
++n;
}
spyWriter.endTable();
}
}
public static class FileExtsPage
extends Spy {
public void write(SpyWriter spyWriter) throws Exception {
String string = "../";
String[] stringArray = Sys.getRegistry().getFileExtensions();
spyWriter.startTable(true);
spyWriter.trTitle("Installed File Extensions", 2);
int n = 0;
while (n < stringArray.length) {
TypeInfo typeInfo = Sys.getRegistry().getFileTypeForExtension(stringArray[n]);
spyWriter.w("<tr>").td(stringArray[n]).td("<a href='" + string + "types/" + typeInfo.toString() + "'>" + typeInfo + "</a>").w("</tr>\n");
++n;
}
spyWriter.endTable();
}
}
public static class DefsPage
extends Spy {
public void write(SpyWriter spyWriter) throws Exception {
Object[] objectArray = Sys.getRegistry().getDefs();
SortUtil.sort((Object[])objectArray, (Object[])objectArray);
spyWriter.startTable(true);
spyWriter.trTitle("Defs [" + objectArray.length + ']', 2);
int n = 0;
while (n < objectArray.length) {
Object object = objectArray[n];
String string = Sys.getRegistry().getDef((String)object);
spyWriter.tr(object, string);
++n;
}
spyWriter.endTable();
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public static class TypePage
extends Spy {
String typeSpec;
static /* synthetic */ Class class$javax$baja$registry$TypeInfo;
public void write(SpyWriter spyWriter) throws Exception {
NTypeInfo[] nTypeInfoArray;
NTypeInfo[] nTypeInfoArray2;
NTypeInfo nTypeInfo = (NTypeInfo)Sys.getRegistry().getType(this.typeSpec);
String string = "../";
spyWriter.startTable(true);
StringWriter stringWriter = new StringWriter();
new HtmlWriter(stringWriter).w("Type ").a("../../modules/" + nTypeInfo.getModuleName(), nTypeInfo.getModuleName()).w(":").w(nTypeInfo.getTypeName());
spyWriter.trTitle(stringWriter, 2);
spyWriter.w("<tr>").td("isAbstract").td("" + nTypeInfo.isAbstract()).w("</tr>\n");
spyWriter.w("<tr>").td("isInterface").td("" + nTypeInfo.isInterface()).w("</tr>\n");
spyWriter.w("<tr>").td("superType").td(this.typeref(string, nTypeInfo.getSuperType())).w("</tr>\n");
TypeInfo[] typeInfoArray = nTypeInfo.getInterfaces();
if (typeInfoArray.length > 0) {
spyWriter.trTitle("Interfaces", 2);
int n = 0;
while (n < typeInfoArray.length) {
spyWriter.w("<tr><td colspan='2'>").w(this.typeref(string, typeInfoArray[n])).w("</td></tr>\n");
++n;
}
}
if ((nTypeInfoArray2 = nTypeInfo.agents).length > 0) {
spyWriter.trTitle("Agents", 2);
int n = 0;
while (n < nTypeInfoArray2.length) {
spyWriter.w("<tr><td colspan='2'>").w(this.typeref(string, nTypeInfoArray2[n])).w("</td></tr>\n");
++n;
}
}
if ((nTypeInfoArray = nTypeInfo.agentOn).length > 0) {
spyWriter.trTitle("Agent On", 2);
int n = 0;
while (n < nTypeInfoArray.length) {
spyWriter.w("<tr><td colspan='2'>").w(this.typeref(string, nTypeInfoArray[n])).w("</td></tr>\n");
++n;
}
}
NTypeInfo[] nTypeInfoArray3 = nTypeInfo.is;
spyWriter.trTitle("Is Types", 2);
int n = 0;
while (n < nTypeInfoArray3.length) {
spyWriter.w("<tr><td colspan='2'>").w(this.typeref(string, nTypeInfoArray3[n])).w("</td></tr>\n");
++n;
}
TypeInfo[] typeInfoArray2 = Sys.getRegistry().getTypes(nTypeInfo);
Class clazz = class$javax$baja$registry$TypeInfo;
if (clazz == null) {
clazz = class$javax$baja$registry$TypeInfo = TypePage.class("[Ljavax.baja.registry.TypeInfo;", false);
}
Array array = new Array(clazz);
int n2 = 0;
while (n2 < typeInfoArray2.length) {
if (nTypeInfo.isInterface()) {
if (new Array((Object[])typeInfoArray2[n2].getInterfaces()).indexOf((Object)nTypeInfo) != -1) {
array.add((Object)typeInfoArray2[n2]);
}
} else {
TypeInfo typeInfo = typeInfoArray2[n2].getSuperType();
if (typeInfo != null && typeInfo.equals(nTypeInfo)) {
array.add((Object)typeInfoArray2[n2]);
}
}
++n2;
}
if (array.size() > 0) {
typeInfoArray2 = (TypeInfo[])array.trim();
spyWriter.trTitle("Sub Types", 2);
n2 = 0;
while (n2 < typeInfoArray2.length) {
spyWriter.w("<tr><td colspan='2'>").w(this.typeref(string, typeInfoArray2[n2])).w("</td></tr>\n");
++n2;
}
}
try {
AgentInfo agentInfo = nTypeInfo.getAgentInfo();
spyWriter.trTitle("AgentInfo", 2);
spyWriter.w("<tr>").td("requiredPermissions").td(agentInfo.getRequiredPermissions()).w("</tr>\n");
spyWriter.w("<tr>").td("appName").td(agentInfo.getAppName()).w("</tr>\n");
}
catch (RegistryException registryException) {}
spyWriter.endTable();
}
private final String typeref(String string, TypeInfo typeInfo) {
if (typeInfo == null) {
return "null";
}
return "<a href='" + string + typeInfo.toString() + "'>" + typeInfo.toString() + "</a>";
}
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());
}
}
TypePage(String string) {
this.typeSpec = string;
}
}
public static class TypesPage
extends SpyDir {
public Spy find(String string) {
return new TypePage(string);
}
public void write(SpyWriter spyWriter) throws Exception {
Object[] objectArray = Sys.getRegistry().getTypes();
SortUtil.sort((Object[])objectArray);
spyWriter.startTable(true);
spyWriter.trTitle("Installed Types", 1);
int n = 0;
while (n < objectArray.length) {
Object object = objectArray[n];
spyWriter.w("<tr>").td("<a href='../types/" + spyWriter.href(object.toString()) + "'>" + object + "</a>").w("</tr>\n");
++n;
}
spyWriter.endTable();
}
}
public static class ModulePage
extends Spy {
String name;
public void write(SpyWriter spyWriter) throws Exception {
Object[] objectArray = Sys.getRegistry().getModule(this.name).getTypes();
SortUtil.sort((Object[])objectArray);
spyWriter.startTable(true);
spyWriter.trTitle("Module \"" + this.name + '\"', 1);
int n = 0;
while (n < objectArray.length) {
NTypeInfo nTypeInfo = (NTypeInfo)objectArray[n];
spyWriter.w("<tr>").td("<a href='" + spyWriter.href("../../types/" + nTypeInfo.toString()) + "'>" + nTypeInfo + "</a>").w("</tr>\n");
++n;
}
spyWriter.endTable();
}
ModulePage(String string) {
this.name = string;
}
}
public static class ModulesPage
extends SpyDir {
public Spy find(String string) {
return new ModulePage(string);
}
public void write(SpyWriter spyWriter) throws Exception {
ModuleInfo[] moduleInfoArray = Sys.getRegistry().getModules();
spyWriter.startTable(true);
spyWriter.trTitle("Installed Modules", 8);
int n = 0;
while (n < moduleInfoArray.length) {
NModuleInfo nModuleInfo = (NModuleInfo)moduleInfoArray[n];
spyWriter.w("<tr>").td("<a href='" + spyWriter.href(nModuleInfo.getModuleName()) + "'>" + nModuleInfo.getModuleName() + "</a>").td(nModuleInfo.getBajaVersion()).td(nModuleInfo.getVendor()).td(nModuleInfo.getVendorVersion()).td(nModuleInfo.getDescription()).td(BAbsTime.make(nModuleInfo.getBuildTime())).td(nModuleInfo.hasPalette() ? "palette" : "no palette").td(nModuleInfo.isAutoload() ? "autoload" : "non-autoload").td(nModuleInfo.isReloadable() ? "reloadable" : "non-reloadable").w("</tr>\n");
++n;
}
spyWriter.endTable();
}
}
public static class SummaryPage
extends SpyDir {
public void write(SpyWriter spyWriter) throws Exception {
spyWriter.startTable(true);
spyWriter.trTitle("Registry", 1);
spyWriter.w("<tr>").td("<a href='" + spyWriter.href("modules") + "'>Installed Modules</a>").w("</tr>");
spyWriter.w("<tr>").td("<a href='" + spyWriter.href("types") + "'>Installed Types</a>").w("</tr>");
spyWriter.w("<tr>").td("<a href='" + spyWriter.href("defs") + "'>Registry Definitions</a>").w("</tr>");
spyWriter.w("<tr>").td("<a href='" + spyWriter.href("fileExts") + "'>Installed File Extensions</a>").w("</tr>");
spyWriter.w("<tr>").td("<a href='" + spyWriter.href("ordSchemes") + "'>Installed Ord Schemes</a>").w("</tr>");
spyWriter.w("<tr>").td("<a href='" + spyWriter.href("adapters") + "'>Installed Adapters</a>").w("</tr>");
spyWriter.endTable();
}
SummaryPage() {
this.add("modules", new ModulesPage());
this.add("types", new TypesPage());
this.add("defs", new DefsPage());
this.add("fileExts", new FileExtsPage());
this.add("ordSchemes", new OrdSchemesPage());
this.add("adapters", new AdaptersPage());
}
}
}
@@ -0,0 +1,46 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.sys.registry;
import com.tridium.sys.registry.NTypeInfo;
import com.tridium.sys.registry.RegistryDatabase;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import javax.baja.registry.TypeInfo;
public class NAdapterInfo {
NTypeInfo type;
NTypeInfo from;
NTypeInfo to;
public boolean isMatch(TypeInfo typeInfo, TypeInfo typeInfo2) {
if (typeInfo == null) {
if (typeInfo2 == null) {
return true;
}
return typeInfo2.is(this.to);
}
if (typeInfo2 == null) {
return typeInfo.is(this.from);
}
boolean bl = false;
if (typeInfo.is(this.from) && typeInfo2.is(this.to)) {
bl = true;
}
return bl;
}
void read(RegistryDatabase registryDatabase, DataInputStream dataInputStream) throws Exception {
this.type = NTypeInfo.readType(registryDatabase, dataInputStream);
this.from = NTypeInfo.readType(registryDatabase, dataInputStream);
this.to = NTypeInfo.readType(registryDatabase, dataInputStream);
}
void write(RegistryDatabase registryDatabase, DataOutputStream dataOutputStream) throws Exception {
NTypeInfo.writeType(registryDatabase, dataOutputStream, this.type);
NTypeInfo.writeType(registryDatabase, dataOutputStream, this.from);
NTypeInfo.writeType(registryDatabase, dataOutputStream, this.to);
}
}
@@ -0,0 +1,118 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.sys.registry;
import com.tridium.sys.registry.NTypeInfo;
import com.tridium.sys.registry.RegistryDatabase;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import javax.baja.agent.AgentInfo;
import javax.baja.registry.TypeInfo;
import javax.baja.security.BPermissions;
import javax.baja.sys.BIcon;
import javax.baja.sys.BObject;
import javax.baja.sys.Context;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class NAgentInfo
implements AgentInfo {
public static final int NO_PREFERRENCE = 0;
public static final int DEFAULT_PREFERRED = 1;
public static final int DEFAULT_NOT_PREFERRED = 2;
final NTypeInfo typeInfo;
BPermissions permissions;
String appName;
int defaultPreferrence;
public final TypeInfo getTypeInfo() {
return this.typeInfo;
}
public final String getAgentId() {
return this.typeInfo.toString();
}
public final BObject getInstance() {
return this.typeInfo.getInstance();
}
public final TypeInfo getAgentType() {
return this.typeInfo;
}
public final String getAppName() {
return this.appName;
}
public TypeInfo[] getAgentOn() {
return this.typeInfo.agentOn;
}
public final String getDisplayName(Context context) {
return this.typeInfo.getDisplayName(context);
}
public final BIcon getIcon(Context context) {
return this.typeInfo.getIcon(context);
}
public final BPermissions getRequiredPermissions() {
return this.permissions;
}
public final String toString() {
return "AgentInfo for " + this.typeInfo;
}
void read(RegistryDatabase registryDatabase, DataInputStream dataInputStream) throws Exception {
this.permissions = BPermissions.make(dataInputStream.readInt());
this.defaultPreferrence = dataInputStream.readShort();
if (dataInputStream.readBoolean()) {
this.appName = dataInputStream.readUTF();
}
}
void write(RegistryDatabase registryDatabase, DataOutputStream dataOutputStream) throws Exception {
dataOutputStream.writeInt(this.permissions.getMask());
dataOutputStream.writeShort(this.defaultPreferrence);
boolean bl = false;
if (this.appName != null) {
bl = true;
}
dataOutputStream.writeBoolean(bl);
if (this.appName != null) {
dataOutputStream.writeUTF(this.appName);
}
}
public static boolean isAdmin(AgentInfo agentInfo) {
int n = agentInfo.getRequiredPermissions().getMask();
int n2 = 112;
boolean bl = false;
if ((n & n2) != 0) {
bl = true;
}
return bl;
}
private final /* synthetic */ void this() {
this.permissions = BPermissions.none;
this.appName = null;
this.defaultPreferrence = 0;
}
public NAgentInfo(NTypeInfo nTypeInfo) {
this.this();
this.typeInfo = nTypeInfo;
}
public NAgentInfo(NTypeInfo nTypeInfo, int n) {
this.this();
this.typeInfo = nTypeInfo;
this.defaultPreferrence = n;
}
}
@@ -0,0 +1,238 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.sys.registry;
import com.tridium.sys.registry.NAgentInfo;
import java.util.ArrayList;
import javax.baja.agent.AgentFilter;
import javax.baja.agent.AgentInfo;
import javax.baja.agent.AgentList;
import javax.baja.agent.NoSuchAgentException;
import javax.baja.sys.Sys;
import javax.baja.sys.TypeNotFoundException;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class NAgentList
implements AgentList {
private ArrayList list;
public int size() {
return this.list.size();
}
public AgentInfo getDefault() {
if (this.list.size() == 0) {
throw new NoSuchAgentException();
}
AgentInfo agentInfo = null;
int n = 0;
while (n < this.list.size()) {
AgentInfo agentInfo2 = (AgentInfo)this.list.get(n);
if (agentInfo2 instanceof NAgentInfo) {
NAgentInfo nAgentInfo = (NAgentInfo)agentInfo2;
if (nAgentInfo.defaultPreferrence == 1) {
return nAgentInfo;
}
if (agentInfo == null && nAgentInfo.defaultPreferrence != 2) {
agentInfo = nAgentInfo;
}
} else if (agentInfo == null) {
agentInfo = agentInfo2;
}
++n;
}
if (agentInfo != null) {
return agentInfo;
}
return (AgentInfo)this.list.get(0);
}
public AgentInfo get(int n) {
return (AgentInfo)this.list.get(n);
}
public AgentInfo get(String string) {
if (string == null) {
return null;
}
int n = 0;
while (n < this.list.size()) {
AgentInfo agentInfo = (AgentInfo)this.list.get(n);
if (agentInfo.getAgentId().equals(string)) {
return agentInfo;
}
++n;
}
return null;
}
public AgentInfo[] list() {
return this.list.toArray(new AgentInfo[this.list.size()]);
}
public int indexOf(String string) {
int n = 0;
while (n < this.list.size()) {
AgentInfo agentInfo = (AgentInfo)this.list.get(n);
if (agentInfo.getAgentId().equals(string)) {
return n;
}
++n;
}
return -1;
}
public int indexOf(AgentInfo agentInfo) {
return this.indexOf(agentInfo.getAgentId());
}
public Object clone() {
NAgentList nAgentList = new NAgentList();
nAgentList.list = (ArrayList)this.list.clone();
return nAgentList;
}
public AgentList filter(AgentFilter agentFilter) {
NAgentList nAgentList = new NAgentList();
ArrayList arrayList = this.list;
int n = arrayList.size();
int n2 = n - 1;
while (n2 >= 0) {
AgentInfo agentInfo = (AgentInfo)arrayList.get(n2);
if (agentFilter.include(agentInfo)) {
nAgentList.add(agentInfo);
}
--n2;
}
return nAgentList;
}
public void add(String string) {
try {
this.add(Sys.getRegistry().getType(string).getAgentInfo());
}
catch (TypeNotFoundException typeNotFoundException) {}
}
public void add(int n, String string) {
try {
this.add(n, Sys.getRegistry().getType(string).getAgentInfo());
}
catch (TypeNotFoundException typeNotFoundException) {}
}
public void add(AgentInfo agentInfo) {
this.add(0, agentInfo);
}
public void add(int n, AgentInfo agentInfo) {
if (agentInfo == null) {
return;
}
int n2 = this.indexOf(agentInfo);
if (n2 >= 0) {
this.list.remove(n2);
if (n > n2) {
--n;
}
}
this.list.add(n, agentInfo);
}
public void remove(String string) {
this.remove(this.indexOf(string));
}
public void remove(AgentInfo agentInfo) {
this.remove(this.indexOf(agentInfo));
}
public void remove(int n) {
if (n < 0 || n >= this.list.size()) {
return;
}
this.list.remove(n);
}
public void remove(AgentList agentList) {
int n = 0;
while (n < agentList.size()) {
this.remove(agentList.get(n));
++n;
}
}
public void toTop(String string) {
this.toTop(this.indexOf(string));
}
public void toTop(AgentInfo agentInfo) {
this.toTop(this.indexOf(agentInfo));
}
public void toTop(int n) {
if (n < 0 || n >= this.list.size()) {
return;
}
AgentInfo agentInfo = (AgentInfo)this.list.remove(n);
this.list.add(0, agentInfo);
}
public void toBottom(String string) {
this.toBottom(this.indexOf(string));
}
public void toBottom(AgentInfo agentInfo) {
this.toBottom(this.indexOf(agentInfo));
}
public void toBottom(int n) {
if (n < 0 || n >= this.list.size()) {
return;
}
AgentInfo agentInfo = (AgentInfo)this.list.remove(n);
this.list.add(agentInfo);
}
public void swap(int n, int n2) {
AgentInfo agentInfo = this.get(n);
AgentInfo agentInfo2 = this.get(n2);
this.list.set(n, agentInfo2);
this.list.set(n2, agentInfo);
}
public String toString() {
StringBuffer stringBuffer = new StringBuffer();
int n = 0;
while (n < this.list.size()) {
if (n > 0) {
stringBuffer.append(';');
}
stringBuffer.append(this.get(n).getAgentId());
++n;
}
return stringBuffer.toString();
}
public void dump() {
System.out.println("AgentList");
int n = 0;
while (n < this.list.size()) {
AgentInfo agentInfo = this.get(n);
System.out.println(" [" + n + "] " + agentInfo.getAgentId() + " (" + agentInfo.getAppName() + ')');
++n;
}
}
private final /* synthetic */ void this() {
this.list = new ArrayList();
}
public NAgentList() {
this.this();
}
}
@@ -0,0 +1,188 @@
/*
* 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;
}
}
@@ -0,0 +1,126 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.xml.XElem
*/
package com.tridium.sys.registry;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import javax.baja.log.Log;
import javax.baja.registry.LexiconInfo;
import javax.baja.sys.BAbsTime;
import javax.baja.xml.XElem;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class NLexiconInfo
implements LexiconInfo {
private static final Log log = Log.getLog("sys.registry");
private static final NLexiconInfo[] none = new NLexiconInfo[0];
private String brandPattern;
private String moduleName;
private String resourcePath;
private String language;
private String containerModuleName;
private BAbsTime lastModified;
private boolean defaultLexicon;
public String getBrandPattern() {
return this.brandPattern;
}
public String getModuleName() {
return this.moduleName;
}
public String getResourcePath() {
return this.resourcePath;
}
public String getLanguage() {
return this.language;
}
public String getContainerModuleName() {
return this.containerModuleName;
}
public BAbsTime getLastModified() {
return this.lastModified;
}
public boolean isDefault() {
return this.defaultLexicon;
}
public void setLastModified(long l) {
this.lastModified = BAbsTime.make(l);
}
public void setLastModified(BAbsTime bAbsTime) {
this.lastModified = bAbsTime;
}
public void read(DataInputStream dataInputStream) throws Exception {
this.moduleName = dataInputStream.readUTF();
this.brandPattern = dataInputStream.readUTF();
this.resourcePath = dataInputStream.readUTF();
this.language = dataInputStream.readUTF();
this.containerModuleName = dataInputStream.readUTF();
this.defaultLexicon = dataInputStream.readBoolean();
}
public void write(DataOutputStream dataOutputStream) throws Exception {
dataOutputStream.writeUTF(this.moduleName);
dataOutputStream.writeUTF(this.brandPattern);
dataOutputStream.writeUTF(this.resourcePath);
dataOutputStream.writeUTF(this.language);
dataOutputStream.writeUTF(this.containerModuleName);
dataOutputStream.writeBoolean(this.defaultLexicon);
}
public String toString() {
StringBuffer stringBuffer = new StringBuffer(this.moduleName);
if (this.language != null) {
stringBuffer.append('-').append(this.language);
}
if (this.brandPattern != null) {
stringBuffer.append('-').append(this.brandPattern);
}
if (this.containerModuleName != null) {
stringBuffer.append('-').append(this.containerModuleName);
}
if (this.resourcePath != null) {
stringBuffer.append('-').append(this.resourcePath);
}
if (this.defaultLexicon) {
stringBuffer.append('-').append("true");
} else {
stringBuffer.append('-').append("false");
}
return stringBuffer.toString();
}
private final /* synthetic */ void this() {
this.defaultLexicon = false;
}
public NLexiconInfo() {
this.this();
}
public NLexiconInfo(XElem xElem, String string, String string2) {
this.this();
this.moduleName = xElem.get("module");
this.brandPattern = string;
this.resourcePath = xElem.get("resource");
this.language = xElem.get("language", "");
this.containerModuleName = string2;
this.defaultLexicon = xElem.getb("default", false);
this.lastModified = BAbsTime.NULL;
}
}
@@ -0,0 +1,141 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.sys.registry;
import com.tridium.sys.registry.NDependencyInfo;
import com.tridium.sys.registry.NTypeInfo;
import com.tridium.sys.registry.RegistryDatabase;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import javax.baja.registry.DependencyInfo;
import javax.baja.registry.ModuleInfo;
import javax.baja.registry.TypeInfo;
import javax.baja.util.Version;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class NModuleInfo
implements ModuleInfo {
int id;
String moduleName;
Version bajaVersion;
String vendor;
Version vendorVersion;
boolean isTransientModule;
boolean isAutoloadModule;
boolean isReloadableModule;
String description;
String moduleContent;
NTypeInfo[] types;
DependencyInfo[] depends;
boolean hasPalette;
long buildTime;
public String getModuleName() {
return this.moduleName;
}
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 TypeInfo[] getTypes() {
return (TypeInfo[])this.types.clone();
}
public DependencyInfo[] getDependencies() {
if (this.depends == null) {
this.depends = NDependencyInfo.load(this.moduleName);
}
return this.depends;
}
public boolean isTransient() {
return this.isTransientModule;
}
public boolean isAutoload() {
return this.isAutoloadModule;
}
public boolean isReloadable() {
return this.isReloadableModule;
}
public long getBuildTime() {
return this.buildTime;
}
public boolean hasPalette() {
return this.hasPalette;
}
public String getModuleContent() {
return this.moduleContent;
}
void read(RegistryDatabase registryDatabase, DataInputStream dataInputStream) throws Exception {
this.moduleName = dataInputStream.readUTF();
this.bajaVersion = new Version(dataInputStream.readUTF());
this.vendor = dataInputStream.readUTF();
this.vendorVersion = new Version(dataInputStream.readUTF());
this.description = dataInputStream.readUTF();
this.hasPalette = dataInputStream.readBoolean();
this.buildTime = dataInputStream.readLong();
this.types = NTypeInfo.readTypes(registryDatabase, dataInputStream);
this.moduleContent = dataInputStream.readUTF();
try {
this.isAutoloadModule = dataInputStream.readBoolean();
this.isReloadableModule = dataInputStream.readBoolean();
}
catch (Exception exception) {}
}
void write(RegistryDatabase registryDatabase, DataOutputStream dataOutputStream) throws Exception {
dataOutputStream.writeUTF(this.moduleName);
dataOutputStream.writeUTF(this.bajaVersion.toString());
dataOutputStream.writeUTF(this.vendor);
dataOutputStream.writeUTF(this.vendorVersion.toString());
dataOutputStream.writeUTF(this.description);
dataOutputStream.writeBoolean(this.hasPalette);
dataOutputStream.writeLong(this.buildTime);
NTypeInfo.writeTypes(registryDatabase, dataOutputStream, this.types);
dataOutputStream.writeUTF(this.moduleContent);
dataOutputStream.writeBoolean(this.isAutoloadModule);
dataOutputStream.writeBoolean(this.isReloadableModule);
}
public String toString() {
return "NModuleInfo (" + this.moduleName + ')';
}
private final /* synthetic */ void this() {
this.isTransientModule = false;
this.isAutoloadModule = true;
this.isReloadableModule = false;
this.moduleContent = "doc";
this.types = NTypeInfo.noTypes;
this.depends = null;
this.hasPalette = false;
}
protected NModuleInfo(int n) {
this.this();
this.id = n;
}
}
@@ -0,0 +1,415 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.xml.XException
*/
package com.tridium.sys.registry;
import com.tridium.sys.Nre;
import com.tridium.sys.registry.Builder;
import com.tridium.sys.registry.Debug;
import com.tridium.sys.registry.NTypeInfo;
import com.tridium.sys.registry.RegistryChecksum;
import com.tridium.sys.registry.RegistryDatabase;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Date;
import javax.baja.agent.AgentInfo;
import javax.baja.agent.AgentList;
import javax.baja.agent.BIAgent;
import javax.baja.io.ValueDocDecoder;
import javax.baja.log.Log;
import javax.baja.registry.LexiconInfo;
import javax.baja.registry.ModuleInfo;
import javax.baja.registry.Registry;
import javax.baja.registry.RegistryException;
import javax.baja.registry.TypeInfo;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BComplex;
import javax.baja.sys.BModule;
import javax.baja.sys.BObject;
import javax.baja.sys.ModuleNotFoundException;
import javax.baja.sys.Type;
import javax.baja.sys.TypeNotFoundException;
import javax.baja.util.BTypeSpec;
import javax.baja.util.Version;
import javax.baja.xml.XException;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public final class NRegistry
implements Registry {
public static final Log log = Log.getLog("sys.registry");
public static boolean forceRebuild = false;
RegistryDatabase db;
public final ValueDocDecoder.ITypeResolver typeResolver;
private String[] invalidModules;
public final BAbsTime getLastBuildTime() {
return BAbsTime.make(this.dbFile().lastModified());
}
public final ModuleInfo[] getModules() {
return this.db().getModules();
}
public final ModuleInfo getModule(String string) {
return this.db().getModule(string);
}
public final TypeInfo[] getTypes() {
return this.db().getTypes();
}
public final TypeInfo[] getTypes(TypeInfo typeInfo) {
return this.db().getTypes(typeInfo, false);
}
public final TypeInfo[] getConcreteTypes(TypeInfo typeInfo) {
return this.db().getTypes(typeInfo, true);
}
public final TypeInfo getType(String string) {
return this.db().getType(string);
}
public final String[] getDefs() {
return this.db().getDefs();
}
public final String[] getDefs(String string) {
return this.db().getDefs(string);
}
public final String getDef(String string) {
return this.db().getDef(string, null);
}
public final String getDef(String string, String string2) {
return this.db().getDef(string, string2);
}
public final AgentList getAgents(TypeInfo typeInfo) {
return this.db().getAgents(typeInfo);
}
public final AgentList getSpecificAgents(TypeInfo typeInfo) {
return this.db().getSpecificAgents(typeInfo);
}
public final boolean isAgent(TypeInfo typeInfo, TypeInfo typeInfo2) {
return this.db().isAgent(typeInfo, typeInfo2);
}
public final boolean isSpecificAgent(TypeInfo typeInfo, TypeInfo typeInfo2) {
return this.db().isSpecificAgent(typeInfo, typeInfo2);
}
public final TypeInfo[] getAdapters(TypeInfo typeInfo, TypeInfo typeInfo2) {
return this.db().getAdapters(typeInfo, typeInfo2);
}
public final String[] getFileExtensions() {
return this.db().getFileExtensions();
}
public final String[] getFileExtensions(TypeInfo typeInfo) {
return this.db().getFileExtensions(typeInfo);
}
public final TypeInfo getFileTypeForExtension(String string) {
return this.db().getFileTypeForExtension(string);
}
public final String[] getOrdSchemes() {
return this.db().getOrdSchemes();
}
public final TypeInfo getOrdScheme(String string) {
return this.db().getOrdScheme(string);
}
public final boolean isOrdScheme(String string) {
return this.db().isOrdScheme(string);
}
public final LexiconInfo[] getLexicons() {
return this.db().getLexicons();
}
public final LexiconInfo[] getLexicons(String string) {
return this.db().getLexicons(string);
}
public final LexiconInfo[] getLexicons(String string, String string2) {
return this.db().getLexicons(string, string2);
}
public final LexiconInfo getLexicon(String string, String string2, String string3) {
return this.db().getLexicon(string, string2, string3);
}
public final Type synthesizeType(BTypeSpec bTypeSpec, String string, TypeInfo typeInfo, TypeInfo[] typeInfoArray, AgentInfo[] agentInfoArray, boolean bl, boolean bl2) {
return this.db().synthesizeType(bTypeSpec, string, typeInfo, typeInfoArray, agentInfoArray, bl, bl2);
}
public final BModule synthesizeModule(String string, Version version, String string2, Version version2, String string3) {
return this.db().synthesizeModule(string, version, string2, version2, string3);
}
final RegistryDatabase db() {
if (this.db == null) {
try {
long l = System.currentTimeMillis();
this.db = new RegistryDatabase();
InputStream inputStream = Nre.bootEnv.isRemote() ? Nre.bootEnv.read(this.dbRemote()) : new BufferedInputStream(new FileInputStream(this.dbFile()));
this.db.read(inputStream);
long l2 = System.currentTimeMillis();
log.message("Loaded [" + (l2 - l) + "ms]");
}
catch (Throwable throwable) {
throw new RegistryException("Cannot load registry", throwable);
}
}
return this.db;
}
public final boolean isRegistryUpToDate() {
if (Nre.bootEnv.isRemote()) {
return true;
}
if (forceRebuild) {
log.message("Force rebuild");
return false;
}
if (this.dummyFile().exists()) {
log.message("*** No Rebuild ***");
return true;
}
long l = System.currentTimeMillis();
try {
File file = this.chkFile();
if (!file.exists()) {
throw new RegistryException("Missing \"" + file + '\"');
}
RegistryChecksum registryChecksum = new RegistryChecksum();
registryChecksum.read(file);
File file2 = new File(Nre.bajaHome, "modules");
File[] fileArray = file2.listFiles();
int n = 0;
while (n < fileArray.length) {
registryChecksum.checkUpToDate(fileArray[n]);
++n;
}
if (registryChecksum.modules.size() > 0) {
String string = ((RegistryChecksum.ModuleSnapshot)registryChecksum.modules.values().toArray()[0]).name;
throw new RegistryException("Module removed \"" + string + '\"');
}
}
catch (RegistryException registryException) {
log.message("Out-of-date: " + registryException.getMessage());
return false;
}
catch (Throwable throwable) {
log.message("Out-of-date", throwable);
return false;
}
long l2 = System.currentTimeMillis();
log.message("Up-to-date [" + (l2 - l) + "ms]");
return true;
}
public final void rebuild() {
try {
log.message("Rebuilding registry...");
long l = System.currentTimeMillis();
File file = this.dummyFile();
boolean bl = file.exists();
int n = Builder.rebuild(this);
TypeInfo[] typeInfoArray = this.getConcreteTypes(BObject.TYPE.getTypeInfo());
int n2 = 0;
while (n2 < typeInfoArray.length) {
NTypeInfo nTypeInfo = (NTypeInfo)typeInfoArray[n2];
if (nTypeInfo.agentOn.length > 0 && !nTypeInfo.is(BIAgent.TYPE)) {
log.warning(nTypeInfo.getTypeSpec() + " declares itself as an agent, but does not implement BIAgent.");
}
++n2;
}
if (bl) {
PrintWriter printWriter = new PrintWriter(new FileWriter(file));
printWriter.write("no-rebuild.dummy " + new Date());
printWriter.close();
}
long l2 = System.currentTimeMillis();
log.message("Rebuilt: " + n + " types [" + (l2 - l) + "ms]");
}
catch (Throwable throwable) {
log.error("Cannot rebuild", throwable);
}
}
public final void syncModules() {
if (Nre.bootEnv.isRemote()) {
return;
}
if (this.db == null) {
throw new IllegalStateException("Can't syncModules() on uninitialized registry");
}
Builder.syncFiles(this);
}
public final void loadModule(String string) throws Exception {
if (Nre.bootEnv.isRemote()) {
return;
}
if (this.db == null) {
throw new IllegalStateException("Can't loadModule(" + string + ") on uninitialized registry");
}
Builder.loadModule(this, string);
}
public final void unloadModule(String string) throws Exception {
if (Nre.bootEnv.isRemote()) {
return;
}
if (this.db == null) {
throw new IllegalStateException("Can't unloadModule(" + string + ") on uninitialized registry");
}
Builder.unloadModule(this, string);
}
public final void reloadModule(String string) throws Exception {
if (Nre.bootEnv.isRemote()) {
return;
}
if (this.db == null) {
throw new IllegalStateException("Can't reloadModule(" + string + ") on uninitialized registry");
}
Builder.reloadModule(this, string);
}
public final void postInit() {
if (!this.isRegistryUpToDate()) {
this.rebuild();
}
try {
this.checkNSedona();
}
catch (RegistryException registryException) {
((NRegistryTypeResolver)this.typeResolver).registryException = new RegistryException(registryException.getMessage());
this.invalidModules = new String[]{((NRegistryTypeResolver)this.typeResolver).invalidModuleName};
}
Nre.spySysManagers.add("registryManager", new Debug.SummaryPage());
}
public final String[] getInvalidModules() {
return this.invalidModules;
}
private final void checkNSedona() throws RegistryException {
Object object;
try {
((NRegistryTypeResolver)this.typeResolver).invalidModuleName = "nsedona";
object = this.getModule("nsedona");
String string = "nsedona " + object.getVendorVersion() + " not supported: ";
if (object.getVendorVersion().compareTo(new Version("1.1")) < 0) {
throw new RegistryException(string + "baja " + this.getModule("baja").getVendorVersion());
}
try {
this.getType("nsedona:DaspTunnel");
}
catch (TypeNotFoundException typeNotFoundException) {
throw new RegistryException(string + "[0]");
}
try {
this.getType("nsedona:SedonaNetwork");
throw new RegistryException(string + "[1]");
}
catch (TypeNotFoundException typeNotFoundException) {
}
}
catch (ModuleNotFoundException moduleNotFoundException) {}
object = this.getTypes();
int n = 0;
while (n < ((TypeInfo[])object).length) {
String string = object[n].getTypeClassName();
if (string.startsWith("javax.baja.sedona.driver.") || string.startsWith("com.tridium.sedona.")) {
((NRegistryTypeResolver)this.typeResolver).invalidModuleName = object[n].getModuleName();
throw new RegistryException(object[n] + ": [2]");
}
++n;
}
}
public final File dir() {
return new File(Nre.bajaHome, "registry");
}
public final File dbFile() {
return new File(this.dir(), "registry.db");
}
public final String dbRemote() {
return "/registry/registry.db";
}
public final File chkFile() {
return new File(this.dir(), "registry.chk");
}
public final File dummyFile() {
return new File(this.dir(), "no-rebuild.dummy");
}
private final /* synthetic */ void this() {
this.typeResolver = new NRegistryTypeResolver();
this.invalidModules = null;
}
public NRegistry() {
this.this();
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private static class NRegistryTypeResolver
extends ValueDocDecoder.BogTypeResolver {
String invalidModuleName;
RegistryException registryException;
public final BModule loadModule(ValueDocDecoder valueDocDecoder, BComplex bComplex, String string, String string2, String string3) {
if (this.registryException != null && this.invalidModuleName != null) {
String string4 = null;
try {
int n = string2.indexOf(61);
string4 = string2.substring(n + 1).trim();
}
catch (Exception exception) {
super.loadModule(valueDocDecoder, bComplex, string, string2, string3);
throw new XException("Invalid module attribute '" + string2 + '\'', ((ValueDocDecoder.BogDecoderPlugin)valueDocDecoder.getPlugin()).getXmlParser());
}
if (string4.equals(this.invalidModuleName)) {
throw this.registryException;
}
}
return super.loadModule(valueDocDecoder, bComplex, string, string2, string3);
}
private final /* synthetic */ void this() {
this.invalidModuleName = null;
this.registryException = null;
}
private NRegistryTypeResolver() {
this.this();
}
}
}
@@ -0,0 +1,284 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.TextUtil
*/
package com.tridium.sys.registry;
import com.tridium.sys.registry.NAgentInfo;
import com.tridium.sys.registry.NAgentList;
import com.tridium.sys.registry.RegistryDatabase;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.lang.reflect.Modifier;
import javax.baja.agent.AgentInfo;
import javax.baja.agent.AgentList;
import javax.baja.agent.BIAgent;
import javax.baja.nre.util.TextUtil;
import javax.baja.registry.RegistryException;
import javax.baja.registry.TypeInfo;
import javax.baja.sys.BIcon;
import javax.baja.sys.BObject;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.BTypeSpec;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class NTypeInfo
implements TypeInfo {
static final NTypeInfo[] noTypes = new NTypeInfo[0];
int id;
BTypeSpec typeSpec;
int modifiers;
String className;
boolean isTransientType;
NAgentInfo agentInfo;
NTypeInfo superType;
NTypeInfo[] interfaces;
NTypeInfo[] agents;
NTypeInfo[] is;
NTypeInfo[] agentOn;
Lexicon lexicon;
String friendlyTypeName;
public final String getModuleName() {
return this.typeSpec.getModuleName();
}
public final String getTypeName() {
return this.typeSpec.getTypeName();
}
public final BTypeSpec getTypeSpec() {
return this.typeSpec;
}
public final BObject getInstance() {
return this.typeSpec.getInstance();
}
public final TypeInfo getSuperType() {
return this.superType;
}
public final TypeInfo[] getInterfaces() {
return (TypeInfo[])this.interfaces.clone();
}
public final boolean isAbstract() {
return Modifier.isAbstract(this.modifiers);
}
public final boolean isFinal() {
return Modifier.isFinal(this.modifiers);
}
public final boolean isInterface() {
return Modifier.isInterface(this.modifiers);
}
public final boolean isTransient() {
return this.isTransientType;
}
public final String getTypeClassName() {
return this.className;
}
public final AgentInfo getAgentInfo() {
if (this.agentInfo == null) {
if (this.is(BIAgent.TYPE)) {
this.agentInfo = new NAgentInfo(this);
} else {
throw new RegistryException("Type \"" + this + "\" is not baja:Agent");
}
}
return this.agentInfo;
}
public final AgentList getAgents() {
NAgentList nAgentList = new NAgentList();
int n = this.is.length - 1;
while (n >= 0) {
NTypeInfo nTypeInfo = this.is[n];
NTypeInfo[] nTypeInfoArray = nTypeInfo.agents;
int n2 = 0;
while (n2 < nTypeInfoArray.length) {
nAgentList.add(nTypeInfoArray[n2].getAgentInfo());
++n2;
}
--n;
}
return nAgentList;
}
public final boolean is(TypeInfo typeInfo) {
int n = this.is.length;
int n2 = 0;
while (n2 < n) {
if (typeInfo == this.is[n2]) {
return true;
}
++n2;
}
return false;
}
public final boolean is(Type type) {
return this.is(type.getTypeInfo());
}
public final int hashCode() {
return this.toString().hashCode();
}
public final boolean equals(Object object) {
boolean bl = false;
if (this == object) {
bl = true;
}
return bl;
}
public final String toString() {
return this.typeSpec.toString(null);
}
public Lexicon getLexicon(Context context) {
if (context == null) {
if (this.lexicon == null || !this.lexicon.language.equals(Sys.getLanguage())) {
this.lexicon = Lexicon.make(this.getModuleName());
}
return this.lexicon;
}
return Lexicon.make(this.getModuleName(), context);
}
public String getDisplayName(Context context) {
String string = this.getLexicon(context).get(this.getTypeName() + ".displayName");
if (string != null) {
return string;
}
if (this.friendlyTypeName == null) {
this.friendlyTypeName = TextUtil.toFriendly((String)this.getTypeName());
}
return this.friendlyTypeName;
}
public BIcon getIcon(Context context) {
String string = this.getLexicon(context).get(this.getTypeName() + ".icon");
if (string != null) {
return BIcon.make(string);
}
TypeInfo typeInfo = this.getSuperType();
if (typeInfo != null) {
return typeInfo.getIcon(context);
}
return null;
}
void read(RegistryDatabase registryDatabase, DataInputStream dataInputStream) throws Exception {
this.typeSpec = BTypeSpec.make(dataInputStream.readUTF());
this.modifiers = dataInputStream.readUnsignedShort();
this.className = dataInputStream.readUTF();
this.superType = NTypeInfo.readType(registryDatabase, dataInputStream);
this.interfaces = NTypeInfo.readTypes(registryDatabase, dataInputStream);
this.agents = NTypeInfo.readTypes(registryDatabase, dataInputStream);
this.is = NTypeInfo.readTypes(registryDatabase, dataInputStream);
if (dataInputStream.readBoolean()) {
this.agentInfo = new NAgentInfo(this);
this.agentInfo.read(registryDatabase, dataInputStream);
}
}
void write(RegistryDatabase registryDatabase, DataOutputStream dataOutputStream) throws Exception {
dataOutputStream.writeUTF(this.typeSpec.encodeToString());
dataOutputStream.writeShort(this.modifiers);
dataOutputStream.writeUTF(this.className);
NTypeInfo.writeType(registryDatabase, dataOutputStream, this.superType);
NTypeInfo.writeTypes(registryDatabase, dataOutputStream, this.interfaces);
NTypeInfo.writeTypes(registryDatabase, dataOutputStream, this.agents);
NTypeInfo.writeTypes(registryDatabase, dataOutputStream, this.is);
if (this.agentInfo == null) {
dataOutputStream.writeBoolean(false);
} else {
dataOutputStream.writeBoolean(true);
this.agentInfo.write(registryDatabase, dataOutputStream);
}
}
static NTypeInfo readType(RegistryDatabase registryDatabase, DataInputStream dataInputStream) throws Exception {
short s = dataInputStream.readShort();
if (s < 0) {
return null;
}
return registryDatabase.types[s];
}
static void writeType(RegistryDatabase registryDatabase, DataOutputStream dataOutputStream, NTypeInfo nTypeInfo) throws Exception {
if (nTypeInfo == null) {
dataOutputStream.writeShort(-1);
} else {
dataOutputStream.writeShort(nTypeInfo.id);
}
}
static NTypeInfo[] readTypes(RegistryDatabase registryDatabase, DataInputStream dataInputStream) throws Exception {
int n = dataInputStream.readUnsignedShort();
if (n == 0) {
return noTypes;
}
NTypeInfo[] nTypeInfoArray = new NTypeInfo[n];
int n2 = 0;
while (n2 < n) {
nTypeInfoArray[n2] = registryDatabase.types[dataInputStream.readShort()];
++n2;
}
return nTypeInfoArray;
}
static void writeTypes(RegistryDatabase registryDatabase, DataOutputStream dataOutputStream, NTypeInfo[] nTypeInfoArray) throws Exception {
int n = nTypeInfoArray.length;
dataOutputStream.writeShort(n);
int n2 = 0;
while (n2 < n) {
dataOutputStream.writeShort(nTypeInfoArray[n2].id);
++n2;
}
}
static void writeAgentTypes(RegistryDatabase registryDatabase, DataOutputStream dataOutputStream, NAgentInfo[] nAgentInfoArray) throws Exception {
int n = nAgentInfoArray.length;
dataOutputStream.writeShort(n);
int n2 = 0;
while (n2 < n) {
dataOutputStream.writeShort(nAgentInfoArray[n2].typeInfo.id);
dataOutputStream.writeShort(nAgentInfoArray[n2].defaultPreferrence);
++n2;
}
}
private final /* synthetic */ void this() {
this.modifiers = 0;
this.className = null;
this.isTransientType = false;
this.agentInfo = null;
this.superType = null;
this.interfaces = noTypes;
this.agents = noTypes;
this.is = noTypes;
this.agentOn = noTypes;
}
public NTypeInfo(int n, BTypeSpec bTypeSpec) {
this.this();
this.id = n;
this.typeSpec = bTypeSpec;
}
}
@@ -0,0 +1,49 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.TextUtil
*/
package com.tridium.sys.registry;
import javax.baja.nre.util.TextUtil;
import javax.baja.registry.TypeInfo;
import javax.baja.sys.Sys;
public class RegTool {
public static void main(String[] stringArray) {
if (stringArray.length == 0) {
RegTool.println("RegTool <cmd>:");
RegTool.println(" types <t> List types which extent t");
return;
}
String string = stringArray[0];
if (string.equals("types")) {
RegTool.types(stringArray[1]);
}
}
public static void types(String string) {
TypeInfo typeInfo = Sys.getRegistry().getType(string);
TypeInfo[] typeInfoArray = Sys.getRegistry().getTypes(typeInfo);
System.out.println("Types: " + typeInfo);
int n = 0;
while (n < typeInfoArray.length) {
TypeInfo typeInfo2 = typeInfoArray[n];
if (!typeInfo2.isAbstract()) {
System.out.print(" " + TextUtil.padRight((String)typeInfo2.toString(), (int)50));
try {
System.out.print(" " + typeInfo2.getAgentInfo().getRequiredPermissions());
}
catch (Exception exception) {}
System.out.println();
}
++n;
}
}
public static void println(String string) {
System.out.println(string);
}
}
@@ -0,0 +1,105 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.sys.registry;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import javax.baja.registry.RegistryException;
public class RegistryChecksum {
public static final long magic = 7958534986241635693L;
public static final int version = 3;
HashMap modules;
void checkUpToDate(File file) {
String string = file.getName();
if (string.endsWith(".jar")) {
string = string.substring(0, string.length() - ".jar".length());
} else if (string.endsWith(".sjar")) {
string = string.substring(0, string.length() - ".sjar".length());
} else {
return;
}
ModuleSnapshot moduleSnapshot = (ModuleSnapshot)this.modules.get(string);
if (moduleSnapshot == null) {
throw new RegistryException("Module added \"" + string + '\"');
}
if (moduleSnapshot.size != file.length() || moduleSnapshot.timestamp != file.lastModified()) {
throw new RegistryException("Module changed \"" + string + '\"');
}
this.modules.remove(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
*/
void read(File file) throws Exception {
DataInputStream dataInputStream = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
try {
if (dataInputStream.readLong() != 7958534986241635693L) {
throw new IOException("Invalid magic");
}
if (dataInputStream.readInt() != 3) {
throw new IOException("Invalid version");
}
int n = dataInputStream.readInt();
this.modules = new HashMap(n * 3);
int n2 = 0;
while (n2 < n) {
ModuleSnapshot moduleSnapshot = new ModuleSnapshot();
moduleSnapshot.name = dataInputStream.readUTF();
moduleSnapshot.timestamp = dataInputStream.readLong();
moduleSnapshot.size = dataInputStream.readLong();
this.modules.put(moduleSnapshot.name, moduleSnapshot);
++n2;
}
}
catch (Throwable throwable) {
Object var4_7 = null;
dataInputStream.close();
throw throwable;
}
{
Object var4_8 = null;
}
dataInputStream.close();
}
void write(File file) throws Exception {
DataOutputStream dataOutputStream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
dataOutputStream.writeLong(7958534986241635693L);
dataOutputStream.writeInt(3);
int n = this.modules.size();
dataOutputStream.writeInt(n);
Iterator iterator = this.modules.values().iterator();
while (iterator.hasNext()) {
ModuleSnapshot moduleSnapshot = (ModuleSnapshot)iterator.next();
dataOutputStream.writeUTF(moduleSnapshot.name);
dataOutputStream.writeLong(moduleSnapshot.timestamp);
dataOutputStream.writeLong(moduleSnapshot.size);
}
dataOutputStream.close();
}
static class ModuleSnapshot {
String name;
long timestamp;
long size;
ModuleSnapshot() {
}
}
}
@@ -0,0 +1,662 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.Array
* javax.baja.nre.util.SortUtil
* javax.baja.nre.util.TextUtil
*/
package com.tridium.sys.registry;
import com.tridium.sys.Nre;
import com.tridium.sys.registry.Builder;
import com.tridium.sys.registry.NAdapterInfo;
import com.tridium.sys.registry.NAgentInfo;
import com.tridium.sys.registry.NAgentList;
import com.tridium.sys.registry.NDependencyInfo;
import com.tridium.sys.registry.NLexiconInfo;
import com.tridium.sys.registry.NModuleInfo;
import com.tridium.sys.registry.NTypeInfo;
import com.tridium.util.ArrayUtil;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import javax.baja.agent.AgentInfo;
import javax.baja.agent.AgentList;
import javax.baja.agent.BIAgent;
import javax.baja.naming.UnknownSchemeException;
import javax.baja.nre.util.Array;
import javax.baja.nre.util.SortUtil;
import javax.baja.nre.util.TextUtil;
import javax.baja.registry.LexiconInfo;
import javax.baja.registry.ModuleInfo;
import javax.baja.registry.RegistryException;
import javax.baja.registry.TypeInfo;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BFrozenEnum;
import javax.baja.sys.BModule;
import javax.baja.sys.ModuleNotFoundException;
import javax.baja.sys.Type;
import javax.baja.sys.TypeNotFoundException;
import javax.baja.util.BTypeSpec;
import javax.baja.util.Lexicon;
import javax.baja.util.Version;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class RegistryDatabase {
static String[] noDefs = new String[0];
public static final long magic = 7958534985112118370L;
public static final int version = 3;
NModuleInfo[] modules;
HashMap modulesByName;
NTypeInfo[] types;
HashMap typesBySpec;
HashMap defs;
String[] fileExts;
HashMap typesByFileExt;
String[] ordSchemes;
HashMap lexicons;
HashMap typesByOrdScheme;
NAdapterInfo[] adapters;
static /* synthetic */ Class class$com$tridium$sys$registry$NAgentInfo;
public ModuleInfo[] getModules() {
return (ModuleInfo[])this.modules.clone();
}
public ModuleInfo getModule(String string) {
ModuleInfo moduleInfo = (ModuleInfo)this.modulesByName.get(string);
if (moduleInfo == null) {
throw new ModuleNotFoundException(string);
}
return moduleInfo;
}
public TypeInfo[] getTypes() {
return (TypeInfo[])this.types.clone();
}
public TypeInfo[] getTypes(TypeInfo typeInfo, boolean bl) {
ArrayList<TypeInfo> arrayList = new ArrayList<TypeInfo>();
ModuleInfo[] moduleInfoArray = this.getModules();
int n = 0;
while (n < moduleInfoArray.length) {
TypeInfo[] typeInfoArray = moduleInfoArray[n].getTypes();
int n2 = 0;
while (n2 < typeInfoArray.length) {
TypeInfo typeInfo2 = typeInfoArray[n2];
if (!(bl && typeInfo2.isAbstract() || !typeInfo2.is(typeInfo))) {
arrayList.add(typeInfo2);
}
++n2;
}
++n;
}
return arrayList.toArray(new TypeInfo[arrayList.size()]);
}
public TypeInfo getType(String string) {
NTypeInfo nTypeInfo = (NTypeInfo)this.typesBySpec.get(string);
if (nTypeInfo == null) {
throw new TypeNotFoundException(string);
}
return nTypeInfo;
}
public String[] getDefs() {
return this.defs.keySet().toArray(new String[this.defs.size()]);
}
public String[] getDefs(String string) {
String[] stringArray = (String[])this.defs.get(string);
if (stringArray == null) {
return noDefs;
}
return (String[])stringArray.clone();
}
public String getDef(String string, String string2) {
String[] stringArray = (String[])this.defs.get(string);
if (stringArray == null) {
return string2;
}
return stringArray[0];
}
public AgentList getAgents(TypeInfo typeInfo) {
return typeInfo.getAgents();
}
public AgentList getSpecificAgents(TypeInfo typeInfo) {
NAgentList nAgentList = new NAgentList();
NTypeInfo[] nTypeInfoArray = ((NTypeInfo)typeInfo).agents;
int n = 0;
while (n < nTypeInfoArray.length) {
nAgentList.add(nTypeInfoArray[n].getAgentInfo());
++n;
}
return nAgentList;
}
public boolean isAgent(TypeInfo typeInfo, TypeInfo typeInfo2) {
NTypeInfo[] nTypeInfoArray = ((NTypeInfo)typeInfo2).is;
int n = nTypeInfoArray.length - 1;
while (n >= 0) {
NTypeInfo[] nTypeInfoArray2 = nTypeInfoArray[n].agents;
int n2 = 0;
while (n2 < nTypeInfoArray2.length) {
if (nTypeInfoArray2[n2].getAgentInfo().getAgentType() == typeInfo) {
return true;
}
++n2;
}
--n;
}
return false;
}
public boolean isSpecificAgent(TypeInfo typeInfo, TypeInfo typeInfo2) {
NTypeInfo[] nTypeInfoArray = ((NTypeInfo)typeInfo2).agents;
int n = 0;
while (n < nTypeInfoArray.length) {
if (nTypeInfoArray[n] == typeInfo) {
return true;
}
++n;
}
return false;
}
public TypeInfo[] getAdapters(TypeInfo typeInfo, TypeInfo typeInfo2) {
ArrayList<NTypeInfo> arrayList = new ArrayList<NTypeInfo>();
NAdapterInfo[] nAdapterInfoArray = this.adapters;
int n = nAdapterInfoArray.length;
int n2 = 0;
while (n2 < n) {
if (nAdapterInfoArray[n2].isMatch(typeInfo, typeInfo2)) {
arrayList.add(nAdapterInfoArray[n2].type);
}
++n2;
}
return arrayList.toArray(new TypeInfo[arrayList.size()]);
}
public String[] getFileExtensions() {
return (String[])this.fileExts.clone();
}
public String[] getFileExtensions(TypeInfo typeInfo) {
ArrayList<String> arrayList = new ArrayList<String>();
int n = 0;
while (n < this.fileExts.length) {
TypeInfo typeInfo2 = (TypeInfo)this.typesByFileExt.get(this.fileExts[n]);
if (typeInfo2.is(typeInfo)) {
arrayList.add(this.fileExts[n]);
}
++n;
}
return arrayList.toArray(new String[arrayList.size()]);
}
public TypeInfo getFileTypeForExtension(String string) {
NTypeInfo nTypeInfo = (NTypeInfo)this.typesByFileExt.get(TextUtil.toLowerCase((String)string));
if (nTypeInfo == null) {
return this.getType("baja:DataFile");
}
return nTypeInfo;
}
public String[] getOrdSchemes() {
return (String[])this.ordSchemes.clone();
}
public TypeInfo getOrdScheme(String string) {
NTypeInfo nTypeInfo = (NTypeInfo)this.typesByOrdScheme.get(TextUtil.toLowerCase((String)string));
if (nTypeInfo == null) {
throw new UnknownSchemeException(string);
}
return nTypeInfo;
}
public boolean isOrdScheme(String string) {
NTypeInfo nTypeInfo = (NTypeInfo)this.typesByOrdScheme.get(TextUtil.toLowerCase((String)string));
boolean bl = false;
if (nTypeInfo != null) {
bl = true;
}
return bl;
}
public LexiconInfo[] getLexicons() {
return this.lexicons.values().toArray(new LexiconInfo[this.lexicons.size()]);
}
public LexiconInfo[] getLexicons(String string) {
return this.getLexicons(string, null);
}
public LexiconInfo[] getLexicons(String string, String string2) {
ArrayList<LexiconInfo> arrayList = new ArrayList<LexiconInfo>();
Iterator iterator = this.lexicons.values().iterator();
String string3 = string2;
if (string2 == null) {
string3 = "";
}
while (iterator.hasNext()) {
LexiconInfo lexiconInfo = (LexiconInfo)iterator.next();
if (!lexiconInfo.getModuleName().equalsIgnoreCase(string) || !lexiconInfo.getLanguage().equalsIgnoreCase(string3)) continue;
arrayList.add(lexiconInfo);
}
return arrayList.toArray(new LexiconInfo[arrayList.size()]);
}
public LexiconInfo getLexicon(String string, String string2, String string3) {
LexiconInfo lexiconInfo;
String string4 = string;
if (string2 != null && string2.length() > 0) {
string4 = string + '-' + string2;
}
if ((lexiconInfo = (LexiconInfo)this.lexicons.get(string4 = string4 + '-' + string3)) == null) {
throw new RegistryException("Unknown lexicon" + string4);
}
return lexiconInfo;
}
void read(InputStream inputStream) throws Exception {
DataInputStream dataInputStream = new DataInputStream(inputStream);
this.readHeader(dataInputStream);
this.readModules(dataInputStream);
this.readTypes(dataInputStream);
this.readDefs(dataInputStream);
this.readFileExts(dataInputStream);
this.readOrdSchemes(dataInputStream);
this.readLexicons(dataInputStream);
this.readAdapters(dataInputStream);
dataInputStream.close();
}
void readHeader(DataInputStream dataInputStream) throws Exception {
if (dataInputStream.readLong() != 7958534985112118370L) {
throw new IOException("Invalid magic");
}
if (dataInputStream.readInt() != 3) {
throw new IOException("Invalid version");
}
int n = dataInputStream.readInt();
this.modules = new NModuleInfo[n];
this.modulesByName = new HashMap(n * 3);
int n2 = 0;
while (n2 < n) {
this.modules[n2] = new NModuleInfo(n2);
++n2;
}
n2 = dataInputStream.readInt();
this.types = new NTypeInfo[n2];
this.typesBySpec = new HashMap(n2 * 3);
int n3 = 0;
while (n3 < n2) {
this.types[n3] = new NTypeInfo(n3, null);
++n3;
}
}
void readModules(DataInputStream dataInputStream) throws Exception {
int n = 0;
while (n < this.modules.length) {
NModuleInfo nModuleInfo = this.modules[n];
nModuleInfo.read(this, dataInputStream);
this.modulesByName.put(nModuleInfo.moduleName, nModuleInfo);
++n;
}
}
void readTypes(DataInputStream dataInputStream) throws Exception {
Array array;
NTypeInfo[] nTypeInfoArray;
NTypeInfo nTypeInfo;
int n = 0;
while (n < this.types.length) {
NTypeInfo nTypeInfo2 = this.types[n];
nTypeInfo2.read(this, dataInputStream);
this.typesBySpec.put(nTypeInfo2.toString(), nTypeInfo2);
++n;
}
HashMap<NTypeInfo[], Array> hashMap = new HashMap<NTypeInfo[], Array>();
int n2 = 0;
while (n2 < this.types.length) {
nTypeInfo = this.types[n2];
int n3 = 0;
while (n3 < nTypeInfo.agents.length) {
nTypeInfoArray = nTypeInfo.agents[n3];
array = (Array)hashMap.get(nTypeInfoArray);
if (array == null) {
Class clazz = class$com$tridium$sys$registry$NAgentInfo;
if (clazz == null) {
clazz = RegistryDatabase.class("[Lcom.tridium.sys.registry.NAgentInfo;", false);
}
array = new Array(clazz);
hashMap.put(nTypeInfoArray, array);
}
array.add((Object)new NAgentInfo(nTypeInfo));
++n3;
}
++n2;
}
Iterator iterator = hashMap.keySet().iterator();
while (iterator.hasNext()) {
nTypeInfo = (NTypeInfo)iterator.next();
Array array2 = (Array)hashMap.get(nTypeInfo);
nTypeInfoArray = new NTypeInfo[array2.size()];
array = (Array)array2.trim();
int n4 = 0;
while (n4 < ((NAgentInfo[])array).length) {
nTypeInfoArray[n4] = (NTypeInfo)array[n4].getTypeInfo();
++n4;
}
nTypeInfo.agentOn = nTypeInfoArray;
}
}
void readDefs(DataInputStream dataInputStream) throws Exception {
int n = dataInputStream.readInt();
this.defs = new HashMap(n * 3);
int n2 = 0;
while (n2 < n) {
String string = dataInputStream.readUTF();
int n3 = dataInputStream.readUnsignedByte();
String[] stringArray = new String[n3];
int n4 = 0;
while (n4 < n3) {
stringArray[n4] = dataInputStream.readUTF();
++n4;
}
this.defs.put(string, stringArray);
++n2;
}
}
void readFileExts(DataInputStream dataInputStream) throws Exception {
int n = dataInputStream.readUnsignedShort();
this.fileExts = new String[n];
this.typesByFileExt = new HashMap(n * 3);
int n2 = 0;
while (n2 < n) {
String string;
this.fileExts[n2] = string = dataInputStream.readUTF();
this.typesByFileExt.put(string, this.types[dataInputStream.readUnsignedShort()]);
++n2;
}
}
void readOrdSchemes(DataInputStream dataInputStream) throws Exception {
int n = dataInputStream.readUnsignedShort();
this.ordSchemes = new String[n];
this.typesByOrdScheme = new HashMap(n * 3);
int n2 = 0;
while (n2 < n) {
String string;
this.ordSchemes[n2] = string = dataInputStream.readUTF();
this.typesByOrdScheme.put(string, this.types[dataInputStream.readUnsignedShort()]);
++n2;
}
}
void readLexicons(DataInputStream dataInputStream) throws Exception {
int n = dataInputStream.readInt();
this.lexicons = new HashMap(n * 3);
int n2 = 0;
while (n2 < n) {
NLexiconInfo nLexiconInfo = new NLexiconInfo();
nLexiconInfo.read(dataInputStream);
String string = nLexiconInfo.getModuleName();
String string2 = nLexiconInfo.getLanguage();
String string3 = nLexiconInfo.getContainerModuleName();
if (string2 != null && string2.length() > 0) {
string = string + '-' + string2;
}
string = string + '-' + string3;
this.lexicons.put(string, nLexiconInfo);
++n2;
}
}
void readAdapters(DataInputStream dataInputStream) throws Exception {
int n = dataInputStream.readUnsignedShort();
this.adapters = new NAdapterInfo[n];
int n2 = 0;
while (n2 < n) {
this.adapters[n2] = new NAdapterInfo();
this.adapters[n2].read(this, dataInputStream);
++n2;
}
}
public BModule synthesizeModule(String string, Version version, String string2, Version version2, String string3) {
if (this.modulesByName.containsKey(string)) {
throw new RegistryException("Duplicate module name: " + string);
}
NModuleInfo nModuleInfo = new NModuleInfo(-1);
nModuleInfo.moduleName = string;
nModuleInfo.bajaVersion = version;
nModuleInfo.vendor = string2;
nModuleInfo.vendorVersion = version2;
nModuleInfo.description = string3;
nModuleInfo.hasPalette = false;
nModuleInfo.buildTime = BAbsTime.now().getMillis();
nModuleInfo.types = NTypeInfo.noTypes;
nModuleInfo.moduleContent = "doc";
nModuleInfo.depends = new NDependencyInfo[0];
nModuleInfo.isTransientModule = true;
this.modulesByName.put(nModuleInfo.moduleName, nModuleInfo);
this.modules = (NModuleInfo[])ArrayUtil.addOne(this.modules, nModuleInfo);
SortUtil.sort((Object[])this.modules);
return Nre.moduleManager.synthesizeModule(nModuleInfo).bmodule();
}
public Type synthesizeType(BTypeSpec bTypeSpec, String string, TypeInfo typeInfo, TypeInfo[] typeInfoArray, AgentInfo[] agentInfoArray, boolean bl, boolean bl2) {
if (this.typesBySpec.get(bTypeSpec.toString()) != null) {
throw new RegistryException("Type already exists: " + bTypeSpec);
}
if (!this.modulesByName.containsKey(bTypeSpec.getModuleName())) {
throw new RegistryException("Module does not exist: " + bTypeSpec.getModuleName());
}
if (!string.startsWith("auto.")) {
throw new IllegalArgumentException("Class package must start with 'auto.'.");
}
if (!string.endsWith(".B" + bTypeSpec.getTypeName())) {
throw new IllegalArgumentException("TypeSpec does not match class name.");
}
if (typeInfo.is(BFrozenEnum.TYPE) && !bl2) {
throw new IllegalArgumentException("Frozen enumerations must be declared final.");
}
NTypeInfo nTypeInfo = new NTypeInfo(-1, bTypeSpec);
nTypeInfo.superType = (NTypeInfo)typeInfo;
nTypeInfo.lexicon = Lexicon.make("baja");
nTypeInfo.className = string;
nTypeInfo.isTransientType = true;
boolean bl3 = false;
NTypeInfo[] nTypeInfoArray = new NTypeInfo[typeInfoArray.length];
int n = 0;
while (n < typeInfoArray.length) {
nTypeInfoArray[n] = (NTypeInfo)typeInfoArray[n];
if (typeInfoArray[n].is(BIAgent.TYPE)) {
bl3 = true;
}
++n;
}
nTypeInfo.interfaces = nTypeInfoArray;
if (agentInfoArray.length > 0 && !bl3) {
throw new RegistryException("Type is an agent on other types, but does not implement BIAgent.");
}
NTypeInfo[] nTypeInfoArray2 = new NTypeInfo[agentInfoArray.length];
int n2 = 0;
while (n2 < agentInfoArray.length) {
nTypeInfoArray2[n2] = (NTypeInfo)agentInfoArray[n2].getAgentType();
++n2;
}
nTypeInfo.agentOn = nTypeInfoArray2;
n2 = 0;
while (n2 < nTypeInfo.agentOn.length) {
ArrayUtil.addOne(nTypeInfo.agentOn[n2].agents, nTypeInfo);
++n2;
}
n2 = 1;
if (bl) {
n2 |= 0x400;
}
if (bl2) {
n2 |= 0x10;
}
nTypeInfo.modifiers = n2;
Object object = new Builder.IsMap();
NTypeInfo nTypeInfo2 = nTypeInfo;
while (nTypeInfo2 != null) {
((Builder.IsMap)object).add(nTypeInfo2);
nTypeInfo2 = nTypeInfo2.superType;
}
nTypeInfo2 = nTypeInfo;
while (nTypeInfo2 != null) {
this.mapInterfaces((Builder.IsMap)object, nTypeInfo2);
nTypeInfo2 = nTypeInfo2.superType;
}
nTypeInfo.is = ((Builder.IsMap)object).toArray();
this.types = (NTypeInfo[])ArrayUtil.addOne(this.types, nTypeInfo);
this.typesBySpec.put(nTypeInfo.toString(), nTypeInfo);
object = (NModuleInfo)this.modulesByName.get(bTypeSpec.getModuleName());
((NModuleInfo)object).types = (NTypeInfo[])ArrayUtil.addOne(((NModuleInfo)object).types, nTypeInfo);
Nre.moduleManager.synthesizeType(bTypeSpec, string, typeInfo, typeInfoArray, bl, bl2);
return bTypeSpec.getResolvedType();
}
private final void mapInterfaces(Builder.IsMap isMap, NTypeInfo nTypeInfo) {
if (nTypeInfo.isInterface()) {
isMap.add(nTypeInfo);
}
int n = 0;
while (n < nTypeInfo.interfaces.length) {
this.mapInterfaces(isMap, nTypeInfo.interfaces[n]);
++n;
}
}
void write(File file) throws Exception {
DataOutputStream dataOutputStream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
this.writeHeader(dataOutputStream);
this.writeModules(dataOutputStream);
this.writeTypes(dataOutputStream);
this.writeDefs(dataOutputStream);
this.writeFileExts(dataOutputStream);
this.writeOrdSchemes(dataOutputStream);
this.writeLexicons(dataOutputStream);
this.writeAdapters(dataOutputStream);
dataOutputStream.close();
}
void writeHeader(DataOutputStream dataOutputStream) throws Exception {
dataOutputStream.writeLong(7958534985112118370L);
dataOutputStream.writeInt(3);
dataOutputStream.writeInt(this.modules.length);
dataOutputStream.writeInt(this.types.length);
}
void writeModules(DataOutputStream dataOutputStream) throws Exception {
int n = 0;
while (n < this.modules.length) {
this.modules[n].write(this, dataOutputStream);
++n;
}
}
void writeTypes(DataOutputStream dataOutputStream) throws Exception {
int n = 0;
while (n < this.types.length) {
this.types[n].write(this, dataOutputStream);
++n;
}
}
void writeDefs(DataOutputStream dataOutputStream) throws Exception {
dataOutputStream.writeInt(this.defs.size());
Iterator iterator = this.defs.keySet().iterator();
while (iterator.hasNext()) {
String string = (String)iterator.next();
String[] stringArray = (String[])this.defs.get(string);
dataOutputStream.writeUTF(string);
dataOutputStream.write(stringArray.length);
int n = 0;
while (n < stringArray.length) {
dataOutputStream.writeUTF(stringArray[n]);
++n;
}
}
}
void writeFileExts(DataOutputStream dataOutputStream) throws Exception {
int n = this.fileExts.length;
dataOutputStream.writeShort(n);
int n2 = 0;
while (n2 < n) {
String string = this.fileExts[n2];
NTypeInfo nTypeInfo = (NTypeInfo)this.typesByFileExt.get(string);
dataOutputStream.writeUTF(string);
dataOutputStream.writeShort(nTypeInfo.id);
++n2;
}
}
void writeOrdSchemes(DataOutputStream dataOutputStream) throws Exception {
int n = this.ordSchemes.length;
dataOutputStream.writeShort(n);
int n2 = 0;
while (n2 < n) {
String string = this.ordSchemes[n2];
NTypeInfo nTypeInfo = (NTypeInfo)this.typesByOrdScheme.get(string);
dataOutputStream.writeUTF(string);
dataOutputStream.writeShort(nTypeInfo.id);
++n2;
}
}
void writeLexicons(DataOutputStream dataOutputStream) throws Exception {
dataOutputStream.writeInt(this.lexicons.size());
Iterator iterator = this.lexicons.keySet().iterator();
while (iterator.hasNext()) {
String string = (String)iterator.next();
NLexiconInfo nLexiconInfo = (NLexiconInfo)this.lexicons.get(string);
nLexiconInfo.write(dataOutputStream);
}
}
void writeAdapters(DataOutputStream dataOutputStream) throws Exception {
int n = this.adapters.length;
dataOutputStream.writeShort(n);
int n2 = 0;
while (n2 < n) {
this.adapters[n2].write(this, dataOutputStream);
++n2;
}
}
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());
}
}
}