link start!
This commit is contained in:
@@ -0,0 +1,266 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BInteger
|
||||
* 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.linux;
|
||||
|
||||
import com.tridium.platform.BOperatingSystemEnum;
|
||||
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 javax.baja.data.BIDataValue;
|
||||
import javax.baja.nre.util.Array;
|
||||
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.SlotCursor;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BNtpPlatformServiceLinux
|
||||
extends BNtpPlatformService {
|
||||
public static final Property timeServers = BNtpPlatformServiceLinux.newProperty((int)3, (BValue)new BNtpServerVector(), (BFacets)BFacets.make((String)"elementType", (String)"platform:NtpServerLinux"));
|
||||
public static final Property statistics = BNtpPlatformServiceLinux.newProperty((int)3, (boolean)true, null);
|
||||
public static final Property ntp = BNtpPlatformServiceLinux.newProperty((int)3, (boolean)true, null);
|
||||
public static final Property localBackup = BNtpPlatformServiceLinux.newProperty((int)3, (boolean)true, null);
|
||||
public static final Property authentication = BNtpPlatformServiceLinux.newProperty((int)3, (boolean)true, null);
|
||||
public static final Property monitor = BNtpPlatformServiceLinux.newProperty((int)3, (boolean)true, null);
|
||||
public static final Property panic = BNtpPlatformServiceLinux.newProperty((int)7, (int)(BOperatingSystemEnum.isOS(BOperatingSystemEnum.qnx) ? 0 : 1000), null);
|
||||
public static final Property revoke = BNtpPlatformServiceLinux.newProperty((int)3, (int)16, (BFacets)BFacets.make((String[])new String[]{"min", "max", "fieldWidth", "units"}, (BIDataValue[])new BIDataValue[]{BInteger.make((int)0), BInteger.make((int)17), BInteger.make((int)3), BNtpPlatformService.LOG_2_SEC_UNIT}));
|
||||
public static final Property autokey = BNtpPlatformServiceLinux.newProperty((int)3, (int)12, (BFacets)BFacets.make((String[])new String[]{"min", "max", "fieldWidth", "units"}, (BIDataValue[])new BIDataValue[]{BInteger.make((int)0), BInteger.make((int)17), BInteger.make((int)3), BNtpPlatformService.LOG_2_SEC_UNIT}));
|
||||
public static final Type TYPE;
|
||||
protected boolean allowUpdate;
|
||||
static /* synthetic */ Class class$com$tridium$platform$linux$BNtpPlatformServiceLinux;
|
||||
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 boolean getAuthentication() {
|
||||
return this.getBoolean(authentication);
|
||||
}
|
||||
|
||||
public void setAuthentication(boolean bl) {
|
||||
this.setBoolean(authentication, bl, null);
|
||||
}
|
||||
|
||||
public boolean getMonitor() {
|
||||
return this.getBoolean(monitor);
|
||||
}
|
||||
|
||||
public void setMonitor(boolean bl) {
|
||||
this.setBoolean(monitor, bl, null);
|
||||
}
|
||||
|
||||
public int getPanic() {
|
||||
return this.getInt(panic);
|
||||
}
|
||||
|
||||
public void setPanic(int n) {
|
||||
this.setInt(panic, n, null);
|
||||
}
|
||||
|
||||
public int getRevoke() {
|
||||
return this.getInt(revoke);
|
||||
}
|
||||
|
||||
public void setRevoke(int n) {
|
||||
this.setInt(revoke, n, null);
|
||||
}
|
||||
|
||||
public int getAutokey() {
|
||||
return this.getInt(autokey);
|
||||
}
|
||||
|
||||
public void setAutokey(int n) {
|
||||
this.setInt(autokey, 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);
|
||||
boolean bl3 = false;
|
||||
if (string.indexOf("auth") == -1) {
|
||||
bl3 = true;
|
||||
}
|
||||
this.setAuthentication(bl3);
|
||||
this.setRevoke(NtpConfUtil.getRevokeInterval());
|
||||
this.setAutokey(NtpConfUtil.getAutokeyInterval());
|
||||
boolean bl4 = false;
|
||||
if (string.indexOf("monitor") == -1) {
|
||||
bl4 = true;
|
||||
}
|
||||
this.setMonitor(bl4);
|
||||
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);
|
||||
boolean bl3 = false;
|
||||
if (string.indexOf("auth") == -1) {
|
||||
bl3 = true;
|
||||
}
|
||||
this.setAuthentication(bl3);
|
||||
this.setRevoke(NtpConfUtil.getRevokeInterval());
|
||||
this.setAutokey(NtpConfUtil.getAutokeyInterval());
|
||||
boolean bl4 = false;
|
||||
if (string.indexOf("monitor") == -1) {
|
||||
bl4 = true;
|
||||
}
|
||||
this.setMonitor(bl4);
|
||||
this.getTimeServers().sync(NtpConfUtil.getNtpServers());
|
||||
this.allowUpdate = true;
|
||||
}
|
||||
|
||||
public void doSavePlatformServiceProperties() throws Exception {
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
super.doSavePlatformServiceProperties();
|
||||
NtpConfUtil.setEnabled(this.getEnabled());
|
||||
NtpConfUtil.setRevokeInterval(this.getRevoke());
|
||||
NtpConfUtil.setAutokeyInterval(this.getAutokey());
|
||||
NtpConfUtil.setPanic(this.getPanic());
|
||||
StringBuffer stringBuffer = new StringBuffer("enable");
|
||||
StringBuffer stringBuffer2 = new StringBuffer("disable");
|
||||
if (!this.getAuthentication()) {
|
||||
stringBuffer2.append(" auth");
|
||||
}
|
||||
if (!this.getNtp()) {
|
||||
stringBuffer2.append(" ntp");
|
||||
}
|
||||
if (!this.getStatistics()) {
|
||||
stringBuffer2.append(" stats");
|
||||
}
|
||||
if (!this.getMonitor()) {
|
||||
stringBuffer2.append(" monitor");
|
||||
}
|
||||
NtpConfUtil.setEnabledString(stringBuffer.toString());
|
||||
NtpConfUtil.setDisabledString(stringBuffer2.toString());
|
||||
Class clazz = class$java$lang$String;
|
||||
if (clazz == null) {
|
||||
clazz = class$java$lang$String = BNtpPlatformServiceLinux.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 BNtpPlatformServiceLinux() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$linux$BNtpPlatformServiceLinux;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$linux$BNtpPlatformServiceLinux = BNtpPlatformServiceLinux.class("[Lcom.tridium.platform.linux.BNtpPlatformServiceLinux;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,283 @@
|
||||
/*
|
||||
* 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
|
||||
* javax.baja.units.BUnit
|
||||
*/
|
||||
package com.tridium.platform.linux;
|
||||
|
||||
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;
|
||||
import javax.baja.units.BUnit;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BNtpServerLinux
|
||||
extends BNtpServer {
|
||||
public static final Property useBurst = BNtpServerLinux.newProperty((int)3, (boolean)false, null);
|
||||
public static final Property serverPreferred = BNtpServerLinux.newProperty((int)3, (boolean)false, null);
|
||||
public static final Property minPollInterval = BNtpServerLinux.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 = BNtpServerLinux.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 useAutokey = BNtpServerLinux.newProperty((int)3, (boolean)false, null);
|
||||
public static final Property useKey = BNtpServerLinux.newProperty((int)3, (int)0, (BFacets)BFacets.make((String[])new String[]{"min", "max", "fieldWidth", "units"}, (BIDataValue[])new BIDataValue[]{BInteger.make((int)0), BInteger.make((int)65536), BInteger.make((int)6), BUnit.getUnit((String)"second")}));
|
||||
public static final Property peerMode = BNtpServerLinux.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 Property additionalArgs = BNtpServerLinux.newProperty((int)3, (String)"", null);
|
||||
public static final Type TYPE;
|
||||
protected String serverString;
|
||||
static /* synthetic */ Class class$com$tridium$platform$linux$BNtpServerLinux;
|
||||
|
||||
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 boolean getUseAutokey() {
|
||||
return this.getBoolean(useAutokey);
|
||||
}
|
||||
|
||||
public void setUseAutokey(boolean bl) {
|
||||
this.setBoolean(useAutokey, bl, null);
|
||||
}
|
||||
|
||||
public int getUseKey() {
|
||||
return this.getInt(useKey);
|
||||
}
|
||||
|
||||
public void setUseKey(int n) {
|
||||
this.setInt(useKey, n, null);
|
||||
}
|
||||
|
||||
public BNtpModePosix getPeerMode() {
|
||||
return (BNtpModePosix)this.get(peerMode);
|
||||
}
|
||||
|
||||
public void setPeerMode(BNtpModePosix bNtpModePosix) {
|
||||
this.set(peerMode, (BValue)bNtpModePosix, null);
|
||||
}
|
||||
|
||||
public String getAdditionalArgs() {
|
||||
return this.getString(additionalArgs);
|
||||
}
|
||||
|
||||
public void setAdditionalArgs(String string) {
|
||||
this.setString(additionalArgs, string, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BNtpServer makeServer(String string) {
|
||||
return new BNtpServerLinux(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.setUseAutokey(false);
|
||||
this.setUseBurst(false);
|
||||
this.setUseKey(0);
|
||||
this.setMaxPollInterval(10);
|
||||
this.setMinPollInterval(6);
|
||||
this.setServerPreferred(false);
|
||||
this.setAdditionalArgs("");
|
||||
string2 = null;
|
||||
block7: while (stringTokenizer.hasMoreTokens()) {
|
||||
string2 = stringTokenizer.nextToken();
|
||||
switch (string2.charAt(0)) {
|
||||
case 'a': {
|
||||
if (!string2.equals("autokey")) continue block7;
|
||||
this.setUseAutokey(true);
|
||||
break;
|
||||
}
|
||||
case 'b': {
|
||||
if (!string2.equals("burst")) continue block7;
|
||||
this.setUseBurst(true);
|
||||
break;
|
||||
}
|
||||
case 'm': {
|
||||
if (string2.equals("minpoll")) {
|
||||
this.setMinPollInterval(Integer.valueOf(stringTokenizer.nextToken()));
|
||||
break;
|
||||
}
|
||||
if (!string2.equals("maxpoll")) continue block7;
|
||||
this.setMaxPollInterval(Integer.valueOf(stringTokenizer.nextToken()));
|
||||
break;
|
||||
}
|
||||
case 'k': {
|
||||
if (!string2.equals("key")) continue block7;
|
||||
this.setUseKey(Integer.valueOf(stringTokenizer.nextToken()));
|
||||
break;
|
||||
}
|
||||
case 'p': {
|
||||
if (!string2.equals("prefer")) continue block7;
|
||||
this.setServerPreferred(true);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
this.setAdditionalArgs(this.getAdditionalArgs().concat(" " + string2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getServerString() {
|
||||
if (this.serverString == null) {
|
||||
this.serverString = this.getServerString(this.getPeerMode(), this.getAddress(), this.getUseAutokey(), this.getUseKey(), this.getUseBurst(), this.getServerPreferred(), this.getMinPollInterval(), this.getMaxPollInterval(), this.getAdditionalArgs());
|
||||
}
|
||||
return this.serverString;
|
||||
}
|
||||
|
||||
public String getServerString(BNtpModePosix bNtpModePosix, String string, boolean bl, int n, boolean bl2, boolean bl3, int n2, int n3, String string2) {
|
||||
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(" autokey");
|
||||
}
|
||||
if (n != 0 && !bl) {
|
||||
stringBuffer.append(" key " + n);
|
||||
}
|
||||
if (bl2) {
|
||||
stringBuffer.append(" burst");
|
||||
}
|
||||
if (bl3 && bNtpModePosix != BNtpModePosix.manycastclient && bNtpModePosix != BNtpModePosix.broadcast) {
|
||||
stringBuffer.append(" prefer");
|
||||
}
|
||||
if (n2 != 6 && n2 >= 4 && n2 < 17 && n2 < n3) {
|
||||
stringBuffer.append(" minpoll " + n2);
|
||||
}
|
||||
if (n3 != 10 && n3 <= 17 && n3 > 4 && n3 > n2) {
|
||||
stringBuffer.append(" maxpoll " + n3);
|
||||
}
|
||||
stringBuffer.append(" " + string2.trim());
|
||||
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 BNtpServerLinux) {
|
||||
return ((BNtpServerLinux)((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 == useAutokey || property == useKey || property == maxPollInterval || property == minPollInterval || property == additionalArgs || 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 BNtpServerLinux() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
public BNtpServerLinux(String string) {
|
||||
this.this();
|
||||
this.updateServerString(string);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$linux$BNtpServerLinux;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$linux$BNtpServerLinux = BNtpServerLinux.class("[Lcom.tridium.platform.linux.BNtpServerLinux;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* 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.linux;
|
||||
|
||||
import com.tridium.platform.BFilesystemAttributes;
|
||||
import com.tridium.platform.BSystemPlatformService;
|
||||
import com.tridium.platform.IPlatformLibrary;
|
||||
import com.tridium.platform.NativePlatformLibraryTridium;
|
||||
import com.tridium.platform.timezone.BDstSupportLevel;
|
||||
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 BSystemPlatformServiceLinux
|
||||
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$linux$BSystemPlatformServiceLinux;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean isValidPlatform() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void loadPlatformServiceProperties() {
|
||||
super.loadPlatformServiceProperties();
|
||||
if (!NativePlatformLibraryTridium.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 (!NativePlatformLibraryTridium.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());
|
||||
if (context != null && context.getFacets().getb("resourceOnly", false)) {
|
||||
return;
|
||||
}
|
||||
super.doPoll(context);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
if (!NativePlatformLibraryTridium.load()) {
|
||||
return null;
|
||||
}
|
||||
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 BSystemPlatformServiceLinux() {
|
||||
this.setTimezoneDayModeSupport(BDstSupportLevel.full);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$linux$BSystemPlatformServiceLinux;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$linux$BSystemPlatformServiceLinux = BSystemPlatformServiceLinux.class("[Lcom.tridium.platform.linux.BSystemPlatformServiceLinux;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
lastFileCheck = 0L;
|
||||
_PLATFORM_LIBRARY_INSTANCE = new NativePlatformLibraryTridium();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user