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,197 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.sys.Nre
* javax.baja.nre.util.Array
* javax.baja.sys.BFacets
* javax.baja.sys.BValue
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.SlotCursor
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.npsdk;
import com.tridium.platform.ntp.BNtpPlatformService;
import com.tridium.platform.ntp.BNtpServer;
import com.tridium.platform.ntp.BNtpServerVector;
import com.tridium.platform.posix.NtpConfUtil;
import com.tridium.sys.Nre;
import java.io.File;
import javax.baja.nre.util.Array;
import javax.baja.sys.BFacets;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.SlotCursor;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BNtpPlatformServiceNpsdk
extends BNtpPlatformService {
public static final Property timeServers = BNtpPlatformServiceNpsdk.newProperty((int)3, (BValue)new BNtpServerVector(), (BFacets)BFacets.make((String)"elementType", (String)"platform:NtpServerNpsdk"));
public static final Property statistics = BNtpPlatformServiceNpsdk.newProperty((int)3, (boolean)true, null);
public static final Property ntp = BNtpPlatformServiceNpsdk.newProperty((int)3, (boolean)true, null);
public static final Property localBackup = BNtpPlatformServiceNpsdk.newProperty((int)3, (boolean)true, null);
public static final Property panic = BNtpPlatformServiceNpsdk.newProperty((int)7, (int)1000, null);
public static final Type TYPE;
protected boolean allowUpdate;
static /* synthetic */ Class class$com$tridium$platform$npsdk$BNtpPlatformServiceNpsdk;
static /* synthetic */ Class class$java$lang$String;
public boolean getStatistics() {
return this.getBoolean(statistics);
}
public void setStatistics(boolean bl) {
this.setBoolean(statistics, bl, null);
}
public boolean getNtp() {
return this.getBoolean(ntp);
}
public void setNtp(boolean bl) {
this.setBoolean(ntp, bl, null);
}
public boolean getLocalBackup() {
return this.getBoolean(localBackup);
}
public void setLocalBackup(boolean bl) {
this.setBoolean(localBackup, bl, null);
}
public int getPanic() {
return this.getInt(panic);
}
public void setPanic(int n) {
this.setInt(panic, n, null);
}
public Type getType() {
return TYPE;
}
public boolean isValidPlatform() {
return false;
}
public int getSlotFlags() {
return 0;
}
public void loadPlatformServiceProperties() {
super.loadPlatformServiceProperties();
this.allowUpdate = false;
this.setEnabled(NtpConfUtil.isEnabled());
this.setPanic(NtpConfUtil.getPanic());
String string = NtpConfUtil.getDisabledString();
boolean bl = false;
if (string.indexOf("ntp") == -1) {
bl = true;
}
this.setNtp(bl);
this.setLocalBackup(NtpConfUtil.getUseLocalBackup());
boolean bl2 = false;
if (string.indexOf("stats") == -1) {
bl2 = true;
}
this.setStatistics(bl2);
this.getTimeServers().sync(NtpConfUtil.getNtpServers());
this.allowUpdate = true;
}
public void doPoll(Context context) {
super.doPoll(context);
if (!this.isRunning()) {
return;
}
this.allowUpdate = false;
this.setEnabled(NtpConfUtil.isEnabled());
this.setPanic(NtpConfUtil.getPanic());
String string = NtpConfUtil.getDisabledString();
boolean bl = false;
if (string.indexOf("ntp") == -1) {
bl = true;
}
this.setNtp(bl);
this.setLocalBackup(NtpConfUtil.getUseLocalBackup());
boolean bl2 = false;
if (string.indexOf("stats") == -1) {
bl2 = true;
}
this.setStatistics(bl2);
this.getTimeServers().sync(NtpConfUtil.getNtpServers());
this.allowUpdate = true;
}
public void doSavePlatformServiceProperties() throws Exception {
if (!this.isRunning()) {
return;
}
super.doSavePlatformServiceProperties();
NtpConfUtil.setEnabled(this.getEnabled());
NtpConfUtil.setPanic(this.getPanic());
StringBuffer stringBuffer = new StringBuffer("enable");
StringBuffer stringBuffer2 = new StringBuffer("disable");
if (!this.getNtp()) {
stringBuffer2.append(" ntp");
}
if (!this.getStatistics()) {
stringBuffer2.append(" stats");
}
NtpConfUtil.setEnabledString(stringBuffer.toString());
NtpConfUtil.setDisabledString(stringBuffer2.toString());
Class clazz = class$java$lang$String;
if (clazz == null) {
clazz = class$java$lang$String = BNtpPlatformServiceNpsdk.class("[Ljava.lang.String;", false);
}
Array array = new Array(clazz);
SlotCursor slotCursor = this.getTimeServers().getProperties();
while (slotCursor.next()) {
array.add((Object)((BNtpServer)slotCursor.get()).getServerString());
}
NtpConfUtil.setNtpServers((String[])array.trim());
NtpConfUtil.setLocalBackup(this.getLocalBackup());
NtpConfUtil.write();
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private final /* synthetic */ void this() {
this.allowUpdate = true;
}
public BNtpPlatformServiceNpsdk() {
this.this();
NtpConfUtil.setNtpPath(Nre.bootEnv.getBajaHome() + File.separator + "lib" + File.separator + "ntp.conf");
}
static {
Class clazz = class$com$tridium$platform$npsdk$BNtpPlatformServiceNpsdk;
if (clazz == null) {
clazz = class$com$tridium$platform$npsdk$BNtpPlatformServiceNpsdk = BNtpPlatformServiceNpsdk.class("[Lcom.tridium.platform.npsdk.BNtpPlatformServiceNpsdk;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,231 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.data.BIDataValue
* javax.baja.naming.SlotPath
* javax.baja.sys.BEnumRange
* javax.baja.sys.BFacets
* javax.baja.sys.BInteger
* javax.baja.sys.BValue
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.npsdk;
import com.tridium.platform.ntp.BNtpPlatformService;
import com.tridium.platform.ntp.BNtpServer;
import com.tridium.platform.posix.BNtpModePosix;
import java.util.StringTokenizer;
import javax.baja.data.BIDataValue;
import javax.baja.naming.SlotPath;
import javax.baja.sys.BEnumRange;
import javax.baja.sys.BFacets;
import javax.baja.sys.BInteger;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BNtpServerNpsdk
extends BNtpServer {
public static final Property useBurst = BNtpServerNpsdk.newProperty((int)3, (boolean)false, null);
public static final Property serverPreferred = BNtpServerNpsdk.newProperty((int)3, (boolean)false, null);
public static final Property minPollInterval = BNtpServerNpsdk.newProperty((int)3, (int)6, (BFacets)BFacets.make((String[])new String[]{"min", "max", "fieldWidth", "units"}, (BIDataValue[])new BIDataValue[]{BInteger.make((int)4), BInteger.make((int)16), BInteger.make((int)3), BNtpPlatformService.LOG_2_SEC_UNIT}));
public static final Property maxPollInterval = BNtpServerNpsdk.newProperty((int)3, (int)10, (BFacets)BFacets.make((String[])new String[]{"min", "max", "fieldWidth", "units"}, (BIDataValue[])new BIDataValue[]{BInteger.make((int)5), BInteger.make((int)17), BInteger.make((int)3), BNtpPlatformService.LOG_2_SEC_UNIT}));
public static final Property peerMode = BNtpServerNpsdk.newProperty((int)3, (BValue)BNtpModePosix.server, (BFacets)BFacets.make((String)"range", (BIDataValue)BEnumRange.make(null, (int[])new int[]{2, 1, 3, 4}, (String[])new String[]{BNtpModePosix.server.getTag(), BNtpModePosix.peer.getTag(), BNtpModePosix.broadcast.getTag(), BNtpModePosix.manycastclient.getTag()})));
public static final Type TYPE;
protected String serverString;
static /* synthetic */ Class class$com$tridium$platform$npsdk$BNtpServerNpsdk;
public boolean getUseBurst() {
return this.getBoolean(useBurst);
}
public void setUseBurst(boolean bl) {
this.setBoolean(useBurst, bl, null);
}
public boolean getServerPreferred() {
return this.getBoolean(serverPreferred);
}
public void setServerPreferred(boolean bl) {
this.setBoolean(serverPreferred, bl, null);
}
public int getMinPollInterval() {
return this.getInt(minPollInterval);
}
public void setMinPollInterval(int n) {
this.setInt(minPollInterval, n, null);
}
public int getMaxPollInterval() {
return this.getInt(maxPollInterval);
}
public void setMaxPollInterval(int n) {
this.setInt(maxPollInterval, n, null);
}
public BNtpModePosix getPeerMode() {
return (BNtpModePosix)this.get(peerMode);
}
public void setPeerMode(BNtpModePosix bNtpModePosix) {
this.set(peerMode, (BValue)bNtpModePosix, null);
}
public Type getType() {
return TYPE;
}
public BNtpServer makeServer(String string) {
return new BNtpServerNpsdk(string);
}
public void updateServerString(String string) {
this.serverString = string;
StringTokenizer stringTokenizer = new StringTokenizer(string);
String string2 = stringTokenizer.nextToken();
if (string2.equals("server")) {
this.setPeerMode(BNtpModePosix.server);
} else if (string2.equals("peer")) {
this.setPeerMode(BNtpModePosix.peer);
} else if (string2.equals("broadcast")) {
this.setPeerMode(BNtpModePosix.broadcast);
} else if (string2.equals("manycastclient")) {
this.setPeerMode(BNtpModePosix.manycastclient);
}
this.setAddress(stringTokenizer.nextToken());
this.setUseBurst(false);
this.setMaxPollInterval(10);
this.setMinPollInterval(6);
this.setServerPreferred(false);
string2 = null;
block5: while (stringTokenizer.hasMoreTokens()) {
string2 = stringTokenizer.nextToken();
switch (string2.charAt(0)) {
case 'b': {
if (!string2.equals("burst")) continue block5;
this.setUseBurst(true);
break;
}
case 'm': {
if (string2.equals("minpoll")) {
this.setMinPollInterval(Integer.valueOf(stringTokenizer.nextToken()));
break;
}
if (!string2.equals("maxpoll")) continue block5;
this.setMaxPollInterval(Integer.valueOf(stringTokenizer.nextToken()));
break;
}
case 'p': {
if (!string2.equals("prefer")) continue block5;
this.setServerPreferred(true);
break;
}
}
}
}
public String getServerString() {
if (this.serverString == null) {
this.serverString = this.getServerString(this.getPeerMode(), this.getAddress(), this.getUseBurst(), this.getServerPreferred(), this.getMinPollInterval(), this.getMaxPollInterval());
}
return this.serverString;
}
public String getServerString(BNtpModePosix bNtpModePosix, String string, boolean bl, boolean bl2, int n, int n2) {
StringBuffer stringBuffer = null;
if (bNtpModePosix == BNtpModePosix.server) {
stringBuffer = new StringBuffer("server");
} else if (bNtpModePosix == BNtpModePosix.peer) {
stringBuffer = new StringBuffer("peer");
} else if (bNtpModePosix == BNtpModePosix.manycastclient) {
stringBuffer = new StringBuffer("manycastclient");
} else if (bNtpModePosix == BNtpModePosix.broadcast) {
stringBuffer = new StringBuffer("broadcast");
} else {
return null;
}
stringBuffer.append(" " + string);
if (bl) {
stringBuffer.append(" burst");
}
if (bl2 && bNtpModePosix != BNtpModePosix.manycastclient && bNtpModePosix != BNtpModePosix.broadcast) {
stringBuffer.append(" prefer");
}
if (n != 6 && n >= 4 && n < 17 && n < n2) {
stringBuffer.append(" minpoll " + n);
}
if (n2 != 10 && n2 <= 17 && n2 > 4 && n2 > n) {
stringBuffer.append(" maxpoll " + n2);
}
return stringBuffer.toString();
}
public String getPropertyName(String string) {
return SlotPath.escape((String)string);
}
public synchronized boolean equivalent(Object object) {
if (object instanceof String) {
return this.getServerString().equals(object);
}
if (object instanceof BNtpServerNpsdk) {
return ((BNtpServerNpsdk)((Object)object)).getServerString().equals(this.getServerString());
}
return false;
}
public void changed(Property property, Context context) {
super.changed(property, context);
if (property == address || property == useBurst || property == maxPollInterval || property == minPollInterval || property == serverPreferred || property == peerMode) {
this.serverString = null;
}
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private final /* synthetic */ void this() {
this.serverString = null;
}
public BNtpServerNpsdk() {
this.this();
}
public BNtpServerNpsdk(String string) {
this.this();
this.updateServerString(string);
}
static {
Class clazz = class$com$tridium$platform$npsdk$BNtpServerNpsdk;
if (clazz == null) {
clazz = class$com$tridium$platform$npsdk$BNtpServerNpsdk = BNtpServerNpsdk.class("[Lcom.tridium.platform.npsdk.BNtpServerNpsdk;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,223 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.naming.SlotPath
* javax.baja.spy.SpyWriter
* javax.baja.sys.BValue
* javax.baja.sys.Clock
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.npsdk;
import com.tridium.platform.BFilesystemAttributes;
import com.tridium.platform.BPlatform;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.IPlatformLibrary;
import com.tridium.platform.NativePlatformLibraryNpsdk;
import com.tridium.platform.NativePlatformLibraryTridium;
import com.tridium.platform.archive.FileArchive;
import com.tridium.platform.archive.NullFileArchive;
import com.tridium.platform.archive.ZipArchive;
import com.tridium.platform.timezone.BDstSupportLevel;
import java.io.File;
import javax.baja.naming.SlotPath;
import javax.baja.spy.SpyWriter;
import javax.baja.sys.BValue;
import javax.baja.sys.Clock;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BSystemPlatformServiceNpsdk
extends BSystemPlatformService {
public static final Type TYPE;
private static long lastFileCheck;
private static final IPlatformLibrary _PLATFORM_LIBRARY_INSTANCE;
private String[] fileSystems;
private Property[] filesystemProps;
static /* synthetic */ Class class$com$tridium$platform$npsdk$BSystemPlatformServiceNpsdk;
public Type getType() {
return TYPE;
}
public boolean isValidPlatform() {
return false;
}
public void loadPlatformServiceProperties() {
super.loadPlatformServiceProperties();
if (!NativePlatformLibraryNpsdk.load()) {
return;
}
IPlatformLibrary iPlatformLibrary = this.getPlatformLibrary();
this.fileSystems = iPlatformLibrary.getAllFileSystemNames();
this.filesystemProps = new Property[this.fileSystems.length];
this.getFilesystemAttributes().removeAll();
int n = 0;
while (n < this.fileSystems.length) {
BFilesystemAttributes bFilesystemAttributes = new BFilesystemAttributes(iPlatformLibrary.getTotalBytes(this.fileSystems[n]) / 1024L, iPlatformLibrary.getFreeBytes(this.fileSystems[n]) / 1024L, iPlatformLibrary.getBlockSize(this.fileSystems[n]), iPlatformLibrary.getMaxFileCount(this.fileSystems[n]), iPlatformLibrary.getCurrentFileCount(this.fileSystems[n]), iPlatformLibrary.isFlash(this.fileSystems[n]));
this.filesystemProps[n] = this.getFilesystemAttributes().add(SlotPath.escape((String)this.fileSystems[n]), (BValue)bFilesystemAttributes, 3);
++n;
}
this.setTotalPhysicalMemory((int)(iPlatformLibrary.getTotalPhysicalMemoryBytes() / 1024L));
this.setFreePhysicalMemory((int)(iPlatformLibrary.getFreePhysicalMemoryBytes() / 1024L));
this.setCurrentCpuUsage(iPlatformLibrary.getCurrentCPUUtilization());
this.setOverallCpuUsage(iPlatformLibrary.getOverallCPUUtilization());
this.setNumCpus(iPlatformLibrary.getNumberCPUs());
}
public String makeRootName(String string) {
return "/" + string + '/';
}
public void doPoll(Context context) {
if (!this.isRunning()) {
return;
}
if (!NativePlatformLibraryNpsdk.load()) {
return;
}
IPlatformLibrary iPlatformLibrary = this.getPlatformLibrary();
this.setTotalPhysicalMemory((int)(iPlatformLibrary.getTotalPhysicalMemoryBytes() / 1024L));
this.setFreePhysicalMemory((int)(iPlatformLibrary.getFreePhysicalMemoryBytes() / 1024L));
this.setCurrentCpuUsage(iPlatformLibrary.getCurrentCPUUtilization());
this.setOverallCpuUsage(iPlatformLibrary.getOverallCPUUtilization());
long l = Clock.ticks();
if (l - lastFileCheck > 15000L) {
lastFileCheck = l;
int n = 0;
while (n < this.fileSystems.length) {
BFilesystemAttributes bFilesystemAttributes = (BFilesystemAttributes)this.getFilesystemAttributes().get(this.filesystemProps[n]);
bFilesystemAttributes.setFreeSpace(iPlatformLibrary.getFreeBytes(this.fileSystems[n]) / 1024L);
bFilesystemAttributes.setTotalSpace(iPlatformLibrary.getTotalBytes(this.fileSystems[n]) / 1024L);
bFilesystemAttributes.setBlockSize(iPlatformLibrary.getBlockSize(this.fileSystems[n]));
bFilesystemAttributes.setMaxFileCount((int)iPlatformLibrary.getMaxFileCount(this.fileSystems[n]));
bFilesystemAttributes.setCurrentFileCount((int)iPlatformLibrary.getCurrentFileCount(this.fileSystems[n]));
++n;
}
}
if (context != null && context.getFacets().getb("resourceOnly", false)) {
return;
}
super.doPoll(context);
}
public boolean archiveEnabled(String string) {
NativePlatformLibraryNpsdk.load();
String string2 = ((NativePlatformLibraryNpsdk)_PLATFORM_LIBRARY_INSTANCE).getAltArchivePath();
boolean bl = false;
if (string2 != null) {
bl = true;
}
return bl;
}
public FileArchive createFileArchive(String string) {
NativePlatformLibraryNpsdk.load();
String string2 = ((NativePlatformLibraryNpsdk)_PLATFORM_LIBRARY_INSTANCE).getAltArchivePath();
if (string2 == null) {
return new NullFileArchive();
}
String string3 = Sys.getStationHome().getPath() + '/' + string;
String string4 = string + ".zip";
File file = new File(Sys.getStationHome().getPath() + File.separator + string);
file.mkdir();
return new ZipArchive(string3, string4, this.getArchiveBackupCount());
}
private final int getArchiveBackupCount() {
int n = ((NativePlatformLibraryNpsdk)_PLATFORM_LIBRARY_INSTANCE).getArchiveBackupCount();
if (n <= 0) {
return 0;
}
return n;
}
public synchronized void extractArchive(String string) {
NativePlatformLibraryNpsdk.load();
String string2 = ((NativePlatformLibraryNpsdk)_PLATFORM_LIBRARY_INSTANCE).getAltArchivePath();
if (string2 == null) {
return;
}
try {
ZipArchive.unzip(Sys.getStationHome().getPath() + File.separator + string, string + ".zip", File.separator + string2 + File.separator + string);
}
catch (Exception exception) {
exception.printStackTrace();
BPlatform.log.error("Failed to extrace archive " + string + " to " + string2, (Throwable)exception);
}
}
public String getRuntimeDirectory(String string) {
String string2 = ((NativePlatformLibraryNpsdk)_PLATFORM_LIBRARY_INSTANCE).getAltArchivePath();
if (string2 == null) {
return super.getRuntimeDirectory(string);
}
return string2 + File.separator + string;
}
public void spy(SpyWriter spyWriter) throws Exception {
super.spy(spyWriter);
spyWriter.startProps();
spyWriter.trTitle((Object)"SystemPlatformServiceLinux", 2);
if (this.isProxy()) {
spyWriter.prop((Object)"lastErrorMessage", (Object)"remote");
} else if (NativePlatformLibraryTridium.load()) {
spyWriter.prop((Object)"lastErrorMessage", (Object)this.getPlatformLibrary().getLastErrorMessage());
}
spyWriter.endProps();
}
public IPlatformLibrary getPlatformLibrary() {
NativePlatformLibraryNpsdk.load();
return _PLATFORM_LIBRARY_INSTANCE;
}
public static void main(String[] stringArray) {
try {
System.out.println("Platform Service Test");
NativePlatformLibraryTridium.load();
System.out.println("Natives loaded");
}
catch (Exception exception) {
exception.printStackTrace();
}
}
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 BSystemPlatformServiceNpsdk() {
this.setTimezoneDayModeSupport(BDstSupportLevel.full);
}
static {
Class clazz = class$com$tridium$platform$npsdk$BSystemPlatformServiceNpsdk;
if (clazz == null) {
clazz = class$com$tridium$platform$npsdk$BSystemPlatformServiceNpsdk = BSystemPlatformServiceNpsdk.class("[Lcom.tridium.platform.npsdk.BSystemPlatformServiceNpsdk;", false);
}
TYPE = Sys.loadType((Class)clazz);
lastFileCheck = 0L;
_PLATFORM_LIBRARY_INSTANCE = new NativePlatformLibraryNpsdk();
}
}