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
@@ -0,0 +1,124 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.sys.spy;
import javax.baja.log.Log;
import javax.baja.spy.ISpyDir;
import javax.baja.spy.Spy;
import javax.baja.spy.SpyWriter;
import javax.baja.sys.BAbsTime;
public class LogSetupSpy
extends Spy
implements ISpyDir {
private static final Log log = Log.getLog("sys");
public String[] list() {
return new String[0];
}
public Spy find(String string) {
String string2 = string;
String string3 = null;
int n = string.indexOf(45);
if (n > 0) {
string2 = string.substring(0, n);
string3 = string.substring(n + 1);
}
if (string2.equals("save")) {
return this.save();
}
if (string2.equals("trace")) {
return this.change(string3, 0);
}
if (string2.equals("message")) {
return this.change(string3, 1);
}
if (string2.equals("warning")) {
return this.change(string3, 2);
}
if (string2.equals("error")) {
return this.change(string3, 3);
}
if (string2.equals("none")) {
return this.change(string3, 4);
}
return null;
}
public void write(SpyWriter spyWriter) {
spyWriter.startTable(true);
spyWriter.trTitle("Logs [<a href='spy:/logSetup/" + this.cmdToHref("save", null) + "'>Save To File</a>]", 7);
spyWriter.w("<tr><th align='left'>log.properties</th><td align='left' colspan='6'>").w(BAbsTime.make(Log.getLogFile().lastModified())).w("</td></tr>\n");
spyWriter.w("<tr>");
spyWriter.thTitle("Log").thTitle("Level").thTitle("<a color='black' href='spy:/logSetup/" + this.cmdToHref("trace", null) + "'>Trace</a>").thTitle("<a color='black' href='spy:/logSetup/" + this.cmdToHref("message", null) + "'>Message</a>").thTitle("<a color='black' href='spy:/logSetup/" + this.cmdToHref("warning", null) + "'>Warning</a>").thTitle("<a color='black' href='spy:/logSetup/" + this.cmdToHref("error", null) + "'>Error</a>").thTitle("<a color='black' href='spy:/logSetup/" + this.cmdToHref("none", null) + "'>None</a>").w("</tr>");
Log[] logArray = Log.getLogs();
int n = 0;
while (n < logArray.length) {
Log log = logArray[n];
String string = log.getLogName();
int n2 = log.getSeverity();
String string2 = n2 == 0 ? "[X]" : "[<a href='spy:/logSetup/" + this.cmdToHref("trace", string) + "'>_</a>]";
String string3 = n2 == 1 ? "[X]" : "[<a href='spy:/logSetup/" + this.cmdToHref("message", string) + "'>_</a>]";
String string4 = n2 == 2 ? "[X]" : "[<a href='spy:/logSetup/" + this.cmdToHref("warning", string) + "'>_</a>]";
String string5 = n2 == 3 ? "[X]" : "[<a href='spy:/logSetup/" + this.cmdToHref("error", string) + "'>_</a>]";
String string6 = n2 == 4 ? "[X]" : "[<a href='spy:/logSetup/" + this.cmdToHref("none", string) + "'>_</a>]";
spyWriter.w("<tr>");
spyWriter.w("<td align='left' nowrap='true'>").w(string).w("</td>");
spyWriter.w("<td align='left' nowrap='true'>").w(log.getSeverityString()).w("</td>");
spyWriter.w("<td align='center' nowrap='true'>").w(string2).w("</td>");
spyWriter.w("<td align='center' nowrap='true'>").w(string3).w("</td>");
spyWriter.w("<td align='center' nowrap='true'>").w(string4).w("</td>");
spyWriter.w("<td align='center' nowrap='true'>").w(string5).w("</td>");
spyWriter.w("<td align='center' nowrap='true'>").w(string6).w("</td>");
spyWriter.w("</tr>\n");
++n;
}
spyWriter.endTable();
}
public String cmdToHref(String string, String string2) {
if (string2 == null) {
return string;
}
return string + '-' + string2;
}
public Spy save() {
log.message("Saved 'log.properties'.");
Log.save();
return new MessageLogSetupSpy("Saved 'log.properties' file");
}
public Spy change(String string, int n) {
if (string != null) {
Log.getLog(string).setSeverity(n);
return new MessageLogSetupSpy("Changed " + string + " log to level '" + Log.severityToString(n) + "'.");
}
Log[] logArray = Log.getLogs();
int n2 = 0;
while (n2 < logArray.length) {
logArray[n2].setSeverity(n);
++n2;
}
return new MessageLogSetupSpy("All logs changed to level '" + Log.severityToString(n) + "'.");
}
private static class MessageLogSetupSpy
extends LogSetupSpy {
String message;
public void write(SpyWriter spyWriter) {
spyWriter.write("<br><b>");
spyWriter.write(this.message);
spyWriter.write("</b><br><br>");
super.write(spyWriter);
}
public MessageLogSetupSpy(String string) {
this.message = string;
}
}
}
@@ -0,0 +1,84 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.sys.spy;
import com.tridium.sys.Nre;
import java.io.IOException;
import java.util.Locale;
import java.util.TimeZone;
import javax.baja.spy.Spy;
import javax.baja.spy.SpyWriter;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BFacets;
import javax.baja.sys.BRelTime;
import javax.baja.sys.BStation;
import javax.baja.sys.Clock;
import javax.baja.sys.Sys;
public class SysInfoSpy
extends Spy {
private static BAbsTime bootTime = Clock.time();
private static long bootTicks = Clock.ticks();
public void write(SpyWriter spyWriter) throws IOException {
long l = Runtime.getRuntime().totalMemory() / 1024L;
long l2 = Runtime.getRuntime().freeMemory() / 1024L;
String string = Sys.getLocalHost().toString();
spyWriter.startProps("System Overview");
spyWriter.prop((Object)"hostname", string);
spyWriter.prop((Object)"hostModel", Nre.getHostModel());
spyWriter.prop((Object)"baja.bajaVersion", Sys.getBajaModule().getBajaVersion());
spyWriter.prop((Object)"baja.vendor", Sys.getBajaModule().getVendor());
spyWriter.prop((Object)"baja.vendorVersion", Sys.getBajaModule().getVendorVersion());
spyWriter.prop((Object)"commandLine", Nre.commandLine);
spyWriter.prop((Object)"baja.home", Sys.getBajaHome());
spyWriter.prop((Object)"user.home", Sys.getUserHome());
if (Sys.getStation() != null) {
BStation bStation = Sys.getStation();
spyWriter.trTitle("Station", 2);
spyWriter.prop((Object)"station.name", bStation.getStationName());
spyWriter.prop((Object)"station.home", Sys.getStationHome());
spyWriter.prop((Object)"atSteadyState", Sys.atSteadyState());
spyWriter.prop((Object)"componentCount", "" + bStation.getComponentSpace().getComponentCount());
BFacets bFacets = bStation.getSysInfo();
String[] stringArray = bFacets.list();
if (stringArray.length > 0) {
spyWriter.trTitle("Station - sysInfo", 2);
int n = 0;
while (n < stringArray.length) {
spyWriter.prop((Object)stringArray[n], bFacets.get(stringArray[n]));
++n;
}
}
}
spyWriter.trTitle("Time", 2);
spyWriter.prop((Object)"currentTime", Clock.time());
spyWriter.prop((Object)"currentTicks", "" + Clock.ticks());
spyWriter.prop((Object)"bootTime", bootTime);
spyWriter.prop((Object)"bootTicks", "" + bootTicks);
spyWriter.prop((Object)"upTime", BRelTime.toString(Clock.ticks() - bootTicks));
spyWriter.trTitle("Performance", 2);
spyWriter.prop((Object)"totalMemory", l + "kb");
spyWriter.prop((Object)"freeMemory", l2 + "kb");
spyWriter.prop((Object)"usedMemory", l - l2 + "kb");
spyWriter.trTitle("Platform", 2);
spyWriter.prop((Object)"java.version", System.getProperty("java.version"));
spyWriter.prop((Object)"java.vendor", System.getProperty("java.vendor"));
spyWriter.prop((Object)"java.vm.name", System.getProperty("java.vm.name"));
spyWriter.prop((Object)"java.vm.version", System.getProperty("java.vm.version"));
spyWriter.prop((Object)"classpath", System.getProperty("java.class.path"));
spyWriter.prop((Object)"java.home", System.getProperty("java.home"));
spyWriter.prop((Object)"os.name", System.getProperty("os.name"));
spyWriter.prop((Object)"os.version", System.getProperty("os.version"));
spyWriter.prop((Object)"os.arch", System.getProperty("os.arch"));
spyWriter.prop((Object)"baja.home", System.getProperty("baja.home"));
spyWriter.prop((Object)"nre.hostid", Nre.getHostId());
spyWriter.prop((Object)"nre.vmUuid", Nre.vmUuid);
spyWriter.prop((Object)"language", Sys.getLanguage());
spyWriter.prop((Object)"locale", Locale.getDefault());
spyWriter.prop((Object)"timezone", TimeZone.getDefault().getID());
spyWriter.endProps();
}
}
@@ -0,0 +1,51 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.SortUtil
*/
package com.tridium.sys.spy;
import java.io.IOException;
import java.util.Enumeration;
import javax.baja.nre.util.SortUtil;
import javax.baja.spy.Spy;
import javax.baja.spy.SpyWriter;
public class SystemPropertiesSpy
extends Spy {
public void write(SpyWriter spyWriter) throws IOException {
Object[] objectArray = new Pair[System.getProperties().size()];
Enumeration<Object> enumeration = System.getProperties().keys();
int n = 0;
while (enumeration.hasMoreElements()) {
Pair pair = new Pair();
pair.key = enumeration.nextElement().toString();
pair.value = System.getProperty(pair.key);
objectArray[n] = pair;
++n;
}
SortUtil.sort((Object[])objectArray);
spyWriter.startProps("System Properties");
n = 0;
while (n < objectArray.length) {
spyWriter.prop((Object)((Pair)objectArray[n]).key, ((Pair)objectArray[n]).value);
++n;
}
spyWriter.endProps();
}
static class Pair
implements Comparable {
String key;
String value;
public int compareTo(Object object) {
return this.key.compareTo(((Pair)object).key);
}
Pair() {
}
}
}
@@ -0,0 +1,92 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.sys.spy;
import com.tridium.sys.Nre;
import javax.baja.spy.Spy;
import javax.baja.spy.SpyDir;
import javax.baja.spy.SpyWriter;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class UtilSpy
extends SpyDir {
static /* synthetic */ Class class$javax$baja$spy$Spy;
public void write(SpyWriter spyWriter) throws Exception {
super.write(spyWriter);
spyWriter.println("<hr>");
}
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 UtilSpy() {
this.add("gc", new GC());
this.add("forceThreadDump", new ForceThreadDump());
try {
Class<?> clazz = Class.forName("com.tridium.sys.spy.se.JmxInfo");
Object obj = clazz.newInstance();
Class clazz2 = class$javax$baja$spy$Spy;
if (clazz2 == null) {
clazz2 = class$javax$baja$spy$Spy = UtilSpy.class("[Ljavax.baja.spy.Spy;", false);
}
if (clazz2.isAssignableFrom(obj.getClass())) {
this.add("JMX Info", (Spy)obj);
}
}
catch (Throwable throwable) {}
}
static class GC
extends Spy {
public void write(SpyWriter spyWriter) throws Exception {
long l = Runtime.getRuntime().totalMemory() / 1024L;
long l2 = Runtime.getRuntime().freeMemory() / 1024L;
System.gc();
long l3 = Runtime.getRuntime().totalMemory() / 1024L;
long l4 = Runtime.getRuntime().freeMemory() / 1024L;
spyWriter.startProps("Force Garbage Collection");
spyWriter.trTitle("Before GC", 2);
spyWriter.prop((Object)"totalMemory", l + "kb");
spyWriter.prop((Object)"freeMemory", l2 + "kb");
spyWriter.prop((Object)"usedMemory", l - l2 + "kb");
spyWriter.trTitle("After GC", 2);
spyWriter.prop((Object)"totalMemory", l3 + "kb");
spyWriter.prop((Object)"freeMemory", l4 + "kb");
spyWriter.prop((Object)"usedMemory", l3 - l4 + "kb");
spyWriter.trTitle("Freed", 2);
spyWriter.prop((Object)"freed", l - l2 - (l3 - l4) + "kb");
spyWriter.endProps();
}
GC() {
}
}
static class ForceThreadDump
extends Spy {
public void write(SpyWriter spyWriter) throws Exception {
Nre.dumpThreads();
spyWriter.println("The thread dump has been performed. Access to the dump");
spyWriter.println("cannot be provided via the spy utility since it is done");
spyWriter.println("by native code. Try using the Platform Manager.");
}
ForceThreadDump() {
}
}
}
@@ -0,0 +1,69 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.sys.spy.se;
import java.lang.management.ClassLoadingMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryUsage;
import java.lang.management.ThreadMXBean;
import java.util.List;
import javax.baja.spy.Spy;
import javax.baja.spy.SpyWriter;
public class JmxInfo
extends Spy {
private final void row(SpyWriter spyWriter, String string, MemoryUsage memoryUsage) {
spyWriter.w("<tr>");
spyWriter.w("<td align='left' nowrap='true'>").w(string).w("</td>");
spyWriter.w("<td align='right' nowrap='true'>").w(memoryUsage.getInit() / 1024L).w("</td>");
spyWriter.w("<td align='right' nowrap='true'>").w(memoryUsage.getUsed() / 1024L).w("</td>");
spyWriter.w("<td align='right' nowrap='true'>").w(memoryUsage.getCommitted() / 1024L).w("</td>");
spyWriter.w("<td align='right' nowrap='true'>").w(memoryUsage.getMax() / 1024L).w("</td>");
spyWriter.w("</tr>\n");
}
public void write(SpyWriter spyWriter) throws Exception {
if (Integer.parseInt(String.valueOf(System.getProperty("java.version", "1.5").charAt(2))) < 8) {
spyWriter.w("JMX Info Unavailable, VM version &lt; 1.8\n");
return;
}
spyWriter.startProps("JMX Thread Info");
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
spyWriter.prop((Object)"peak thread count", threadMXBean.getPeakThreadCount());
spyWriter.prop((Object)"current thread count", threadMXBean.getThreadCount());
spyWriter.prop((Object)"total started thread count", Long.toString(threadMXBean.getTotalStartedThreadCount()));
spyWriter.endProps();
spyWriter.startProps("JMX Class Loading Info");
ClassLoadingMXBean classLoadingMXBean = ManagementFactory.getClassLoadingMXBean();
spyWriter.prop((Object)"loaded class count", classLoadingMXBean.getLoadedClassCount());
spyWriter.prop((Object)"total loaded class count", Long.toString(classLoadingMXBean.getTotalLoadedClassCount()));
spyWriter.prop((Object)"unloaded class count", Long.toString(classLoadingMXBean.getUnloadedClassCount()));
spyWriter.endProps();
List<MemoryPoolMXBean> list = ManagementFactory.getMemoryPoolMXBeans();
int n = 0;
while (n < list.size()) {
try {
MemoryPoolMXBean memoryPoolMXBean = list.get(n);
MemoryUsage memoryUsage = memoryPoolMXBean.getUsage();
MemoryUsage memoryUsage2 = memoryPoolMXBean.getPeakUsage();
spyWriter.startTable(true);
spyWriter.trTitle(memoryPoolMXBean.getName() + " (KB)", 5);
spyWriter.w("<tr>");
spyWriter.thTitle("Type");
spyWriter.thTitle("init");
spyWriter.thTitle("used");
spyWriter.thTitle("committed");
spyWriter.thTitle("max");
spyWriter.w("</tr>");
this.row(spyWriter, "current", memoryUsage);
this.row(spyWriter, "peak", memoryUsage2);
spyWriter.endTable();
}
catch (Exception exception) {}
++n;
}
}
}