link start!
This commit is contained in:
@@ -0,0 +1,240 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.nre.util.TextUtil
|
||||
* 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
|
||||
* javax.baja.units.BUnit
|
||||
*/
|
||||
package com.tridium.platform.win32;
|
||||
|
||||
import com.tridium.platform.BOperatingSystemEnum;
|
||||
import com.tridium.platform.BSystemPlatformService;
|
||||
import com.tridium.platform.ntp.BNtpPlatformService;
|
||||
import com.tridium.platform.ntp.BNtpServer;
|
||||
import com.tridium.platform.ntp.BNtpServerVector;
|
||||
import com.tridium.platform.win32.BNtpSyncPolicyWin32;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
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;
|
||||
import javax.baja.units.BUnit;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BNtpPlatformServiceWin32
|
||||
extends BNtpPlatformService {
|
||||
public static final Property timeServers = BNtpPlatformServiceWin32.newProperty((int)3, (BValue)new BNtpServerVector(), (BFacets)BFacets.make((String)"elementType", (String)"platform:NtpServerWin32"));
|
||||
public static final Property syncPolicy = BNtpPlatformServiceWin32.newProperty((int)3, (BValue)BNtpSyncPolicyWin32.ntp, null);
|
||||
public static final Property maxPosPhaseCorrection = BNtpPlatformServiceWin32.newProperty((int)3, (int)54000, (BFacets)BFacets.make((String[])new String[]{"min", "fieldWidth", "units"}, (BIDataValue[])new BIDataValue[]{BInteger.make((int)0), BInteger.make((int)8), BUnit.getUnit((String)"second")}));
|
||||
public static final Property maxNegPhaseCorrection = BNtpPlatformServiceWin32.newProperty((int)3, (int)54000, (BFacets)BFacets.make((String[])new String[]{"min", "fieldWidth", "units"}, (BIDataValue[])new BIDataValue[]{BInteger.make((int)0), BInteger.make((int)8), BUnit.getUnit((String)"second")}));
|
||||
public static final Property minPollInterval = BNtpPlatformServiceWin32.newProperty((int)3, (int)10, (BFacets)BFacets.make((String[])new String[]{"min", "fieldWidth", "units"}, (BIDataValue[])new BIDataValue[]{BInteger.make((int)1), BInteger.make((int)8), LOG_2_SEC_UNIT}));
|
||||
public static final Property maxPollInterval = BNtpPlatformServiceWin32.newProperty((int)3, (int)15, (BFacets)BFacets.make((String[])new String[]{"min", "fieldWidth", "units"}, (BIDataValue[])new BIDataValue[]{BInteger.make((int)1), BInteger.make((int)8), LOG_2_SEC_UNIT}));
|
||||
public static final Property specialPollInterval = BNtpPlatformServiceWin32.newProperty((int)3, (int)604800, (BFacets)BFacets.make((String[])new String[]{"min", "fieldWidth", "units"}, (BIDataValue[])new BIDataValue[]{BInteger.make((int)30), BInteger.make((int)8), BUnit.getUnit((String)"second")}));
|
||||
public static final Property domainMember = BNtpPlatformServiceWin32.newProperty((int)7, (boolean)false, null);
|
||||
public static final Type TYPE;
|
||||
protected boolean allowUpdate;
|
||||
static /* synthetic */ Class class$com$tridium$platform$win32$BNtpPlatformServiceWin32;
|
||||
|
||||
public BNtpSyncPolicyWin32 getSyncPolicy() {
|
||||
return (BNtpSyncPolicyWin32)this.get(syncPolicy);
|
||||
}
|
||||
|
||||
public void setSyncPolicy(BNtpSyncPolicyWin32 bNtpSyncPolicyWin32) {
|
||||
this.set(syncPolicy, (BValue)bNtpSyncPolicyWin32, null);
|
||||
}
|
||||
|
||||
public int getMaxPosPhaseCorrection() {
|
||||
return this.getInt(maxPosPhaseCorrection);
|
||||
}
|
||||
|
||||
public void setMaxPosPhaseCorrection(int n) {
|
||||
this.setInt(maxPosPhaseCorrection, n, null);
|
||||
}
|
||||
|
||||
public int getMaxNegPhaseCorrection() {
|
||||
return this.getInt(maxNegPhaseCorrection);
|
||||
}
|
||||
|
||||
public void setMaxNegPhaseCorrection(int n) {
|
||||
this.setInt(maxNegPhaseCorrection, n, 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 int getSpecialPollInterval() {
|
||||
return this.getInt(specialPollInterval);
|
||||
}
|
||||
|
||||
public void setSpecialPollInterval(int n) {
|
||||
this.setInt(specialPollInterval, n, null);
|
||||
}
|
||||
|
||||
public boolean getDomainMember() {
|
||||
return this.getBoolean(domainMember);
|
||||
}
|
||||
|
||||
public void setDomainMember(boolean bl) {
|
||||
this.setBoolean(domainMember, bl, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean isValidPlatform() {
|
||||
return BOperatingSystemEnum.isOS(BOperatingSystemEnum.windows);
|
||||
}
|
||||
|
||||
public int getSlotFlags() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void loadPlatformServiceProperties() {
|
||||
BSystemPlatformService bSystemPlatformService;
|
||||
super.loadPlatformServiceProperties();
|
||||
BSystemPlatformService bSystemPlatformService2 = bSystemPlatformService = Sys.getStation() == null ? null : (BSystemPlatformService)Sys.getService((Type)BSystemPlatformService.TYPE);
|
||||
if (bSystemPlatformService == null || bSystemPlatformService.getPlatformLibrary() == null) {
|
||||
return;
|
||||
}
|
||||
this.allowUpdate = false;
|
||||
this.getTimeServers().sync(TextUtil.split((String)BNtpPlatformServiceWin32.getNtpServers0(), (char)' '));
|
||||
this.setDomainMember(BNtpPlatformServiceWin32.isDomainMember0());
|
||||
this.setSyncPolicy(BNtpSyncPolicyWin32.make(BNtpPlatformServiceWin32.getSyncPolicy0()));
|
||||
boolean bl = false;
|
||||
if (this.getSyncPolicy() != BNtpSyncPolicyWin32.none) {
|
||||
bl = true;
|
||||
}
|
||||
this.setEnabled(bl);
|
||||
this.setSpecialPollInterval(BNtpPlatformServiceWin32.getSpecialPollInterval0());
|
||||
this.setMinPollInterval(BNtpPlatformServiceWin32.getMinPollInterval0());
|
||||
this.setMaxPollInterval(BNtpPlatformServiceWin32.getMaxPollInterval0());
|
||||
int n = BNtpPlatformServiceWin32.getMaxPosPhaseCorrection0();
|
||||
this.setMaxPosPhaseCorrection(n == -1 ? Integer.MAX_VALUE : n);
|
||||
n = BNtpPlatformServiceWin32.getMaxNegPhaseCorrection0();
|
||||
this.setMaxNegPhaseCorrection(n == -1 ? Integer.MAX_VALUE : n);
|
||||
this.allowUpdate = true;
|
||||
}
|
||||
|
||||
public void doPoll(Context context) {
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
super.doPoll(context);
|
||||
this.allowUpdate = false;
|
||||
this.getTimeServers().sync(TextUtil.split((String)BNtpPlatformServiceWin32.getNtpServers0(), (char)' '));
|
||||
this.setDomainMember(BNtpPlatformServiceWin32.isDomainMember0());
|
||||
this.setSyncPolicy(BNtpSyncPolicyWin32.make(BNtpPlatformServiceWin32.getSyncPolicy0()));
|
||||
boolean bl = false;
|
||||
if (this.getSyncPolicy() != BNtpSyncPolicyWin32.none) {
|
||||
bl = true;
|
||||
}
|
||||
this.setEnabled(bl);
|
||||
this.setSpecialPollInterval(BNtpPlatformServiceWin32.getSpecialPollInterval0());
|
||||
this.setMinPollInterval(BNtpPlatformServiceWin32.getMinPollInterval0());
|
||||
this.setMaxPollInterval(BNtpPlatformServiceWin32.getMaxPollInterval0());
|
||||
int n = BNtpPlatformServiceWin32.getMaxPosPhaseCorrection0();
|
||||
this.setMaxPosPhaseCorrection(n == -1 ? Integer.MAX_VALUE : n);
|
||||
n = BNtpPlatformServiceWin32.getMaxNegPhaseCorrection0();
|
||||
this.setMaxNegPhaseCorrection(n == -1 ? Integer.MAX_VALUE : n);
|
||||
this.allowUpdate = true;
|
||||
}
|
||||
|
||||
public void doSavePlatformServiceProperties() throws Exception {
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
super.doSavePlatformServiceProperties();
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
SlotCursor slotCursor = this.getTimeServers().getProperties();
|
||||
while (slotCursor.next()) {
|
||||
if (stringBuffer.length() > 0) {
|
||||
stringBuffer.append(' ');
|
||||
}
|
||||
stringBuffer.append(((BNtpServer)slotCursor.get()).getServerString());
|
||||
}
|
||||
String string = stringBuffer.toString();
|
||||
int n = 0;
|
||||
if (this.getEnabled()) {
|
||||
n = this.getSyncPolicy().getOrdinal();
|
||||
}
|
||||
BNtpPlatformServiceWin32.saveNtpSettings0(string, n, this.getSpecialPollInterval(), this.getMinPollInterval(), this.getMaxPollInterval(), this.getMaxPosPhaseCorrection() == Integer.MAX_VALUE ? -1 : this.getMaxPosPhaseCorrection(), this.getMaxNegPhaseCorrection() == Integer.MAX_VALUE ? -1 : this.getMaxNegPhaseCorrection());
|
||||
}
|
||||
|
||||
protected static native String getNtpServers0();
|
||||
|
||||
protected static native int getSyncPolicy0();
|
||||
|
||||
protected static native int getSpecialPollInterval0();
|
||||
|
||||
protected static native int getMinPollInterval0();
|
||||
|
||||
protected static native int getMaxPollInterval0();
|
||||
|
||||
protected static native int getMaxPosPhaseCorrection0();
|
||||
|
||||
protected static native int getMaxNegPhaseCorrection0();
|
||||
|
||||
protected static native boolean isDomainMember0();
|
||||
|
||||
protected static native void saveNtpSettings0(String var0, int var1, int var2, int var3, int var4, int var5, int var6);
|
||||
|
||||
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 BNtpPlatformServiceWin32() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$win32$BNtpPlatformServiceWin32;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$win32$BNtpPlatformServiceWin32 = BNtpPlatformServiceWin32.class("[Lcom.tridium.platform.win32.BNtpPlatformServiceWin32;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.nre.util.TextUtil
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.platform.win32;
|
||||
|
||||
import com.tridium.platform.ntp.BNtpMode;
|
||||
import com.tridium.platform.ntp.BNtpServer;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
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 BNtpServerWin32
|
||||
extends BNtpServer {
|
||||
public static final Property useSpecialPollInterval = BNtpServerWin32.newProperty((int)3, (boolean)false, null);
|
||||
public static final Property fallbackOnly = BNtpServerWin32.newProperty((int)3, (boolean)false, null);
|
||||
public static final Property peerMode = BNtpServerWin32.newProperty((int)3, (BValue)BNtpMode.unspecified, null);
|
||||
public static final Type TYPE;
|
||||
protected static final int FLAG_USE_SPECIAL_POLL_INTERVAL = 1;
|
||||
protected static final int FLAG_FALLBACK_ONLY = 2;
|
||||
protected static final int FLAG_SYMMETRIC_ACTIVE_MODE = 4;
|
||||
protected static final int FLAG_CLIENT_MODE = 8;
|
||||
protected String serverString;
|
||||
static /* synthetic */ Class class$com$tridium$platform$win32$BNtpServerWin32;
|
||||
|
||||
public boolean getUseSpecialPollInterval() {
|
||||
return this.getBoolean(useSpecialPollInterval);
|
||||
}
|
||||
|
||||
public void setUseSpecialPollInterval(boolean bl) {
|
||||
this.setBoolean(useSpecialPollInterval, bl, null);
|
||||
}
|
||||
|
||||
public boolean getFallbackOnly() {
|
||||
return this.getBoolean(fallbackOnly);
|
||||
}
|
||||
|
||||
public void setFallbackOnly(boolean bl) {
|
||||
this.setBoolean(fallbackOnly, bl, null);
|
||||
}
|
||||
|
||||
public BNtpMode getPeerMode() {
|
||||
return (BNtpMode)this.get(peerMode);
|
||||
}
|
||||
|
||||
public void setPeerMode(BNtpMode bNtpMode) {
|
||||
this.set(peerMode, (BValue)bNtpMode, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BNtpServer makeServer(String string) {
|
||||
return new BNtpServerWin32(string);
|
||||
}
|
||||
|
||||
public void updateServerString(String string) {
|
||||
this.serverString = string;
|
||||
int n = string.indexOf(44);
|
||||
if (n < 0) {
|
||||
this.setAddress(string);
|
||||
} else {
|
||||
this.setAddress(string.substring(0, n));
|
||||
int n2 = TextUtil.hexCharToInt((char)string.charAt(string.length() - 1));
|
||||
boolean bl = false;
|
||||
if ((n2 & 1) > 0) {
|
||||
bl = true;
|
||||
}
|
||||
this.setUseSpecialPollInterval(bl);
|
||||
boolean bl2 = false;
|
||||
if ((n2 & 2) > 0) {
|
||||
bl2 = true;
|
||||
}
|
||||
this.setFallbackOnly(bl2);
|
||||
if ((n2 & 4) > 0) {
|
||||
this.setPeerMode(BNtpMode.symmetricActive);
|
||||
} else if ((n2 & 8) > 0) {
|
||||
this.setPeerMode(BNtpMode.client);
|
||||
} else {
|
||||
this.setPeerMode(BNtpMode.unspecified);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getServerString() {
|
||||
if (this.serverString == null) {
|
||||
this.serverString = this.getServerString(this.getAddress(), this.getUseSpecialPollInterval(), this.getFallbackOnly(), this.getPeerMode());
|
||||
}
|
||||
return this.serverString;
|
||||
}
|
||||
|
||||
public String getServerString(String string, boolean bl, boolean bl2, BNtpMode bNtpMode) {
|
||||
StringBuffer stringBuffer = new StringBuffer(string);
|
||||
int n = 0;
|
||||
if (bl) {
|
||||
n |= 1;
|
||||
}
|
||||
if (bl2) {
|
||||
n |= 2;
|
||||
}
|
||||
if (bNtpMode == BNtpMode.symmetricActive) {
|
||||
n |= 4;
|
||||
} else if (bNtpMode == BNtpMode.client) {
|
||||
n |= 8;
|
||||
}
|
||||
if (n != 0) {
|
||||
stringBuffer.append(",0x");
|
||||
stringBuffer.append(TextUtil.byteToHexString((int)n).charAt(1));
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public String getPropertyName(String string) {
|
||||
int n = string.indexOf(44);
|
||||
if (n < 0) {
|
||||
return SlotPath.escape((String)string);
|
||||
}
|
||||
return SlotPath.escape((String)string.substring(0, n));
|
||||
}
|
||||
|
||||
public synchronized boolean equivalent(Object object) {
|
||||
if (object instanceof String) {
|
||||
return this.getServerString().equals(object);
|
||||
}
|
||||
if (object instanceof BNtpServerWin32) {
|
||||
return ((BNtpServerWin32)((Object)object)).getServerString().equals(this.getServerString());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (property == address || property == useSpecialPollInterval || property == fallbackOnly || 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 BNtpServerWin32() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
public BNtpServerWin32(String string) {
|
||||
this.this();
|
||||
this.updateServerString(string);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$win32$BNtpServerWin32;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$win32$BNtpServerWin32 = BNtpServerWin32.class("[Lcom.tridium.platform.win32.BNtpServerWin32;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BFrozenEnum
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.platform.win32;
|
||||
|
||||
import javax.baja.sys.BFrozenEnum;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BNtpSyncPolicyWin32
|
||||
extends BFrozenEnum {
|
||||
public static final int NONE = 0;
|
||||
public static final int NTP = 1;
|
||||
public static final int DOMAIN = 2;
|
||||
public static final int BOTH = 3;
|
||||
public static final BNtpSyncPolicyWin32 none = new BNtpSyncPolicyWin32(0);
|
||||
public static final BNtpSyncPolicyWin32 ntp = new BNtpSyncPolicyWin32(1);
|
||||
public static final BNtpSyncPolicyWin32 domain = new BNtpSyncPolicyWin32(2);
|
||||
public static final BNtpSyncPolicyWin32 both = new BNtpSyncPolicyWin32(3);
|
||||
public static final Type TYPE;
|
||||
public static final BNtpSyncPolicyWin32 DEFAULT;
|
||||
static /* synthetic */ Class class$com$tridium$platform$win32$BNtpSyncPolicyWin32;
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static final BNtpSyncPolicyWin32 make(int n) {
|
||||
return (BNtpSyncPolicyWin32)none.getRange().get(n, false);
|
||||
}
|
||||
|
||||
public static final BNtpSyncPolicyWin32 make(String string) {
|
||||
return (BNtpSyncPolicyWin32)none.getRange().get(string);
|
||||
}
|
||||
|
||||
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 BNtpSyncPolicyWin32(int n) {
|
||||
super(n);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$win32$BNtpSyncPolicyWin32;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$win32$BNtpSyncPolicyWin32 = BNtpSyncPolicyWin32.class("[Lcom.tridium.platform.win32.BNtpSyncPolicyWin32;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
DEFAULT = none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.platform.win32;
|
||||
|
||||
import com.tridium.platform.win32.BSystemPlatformServiceNxs;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BSystemPlatformServiceEwfFlash
|
||||
extends BSystemPlatformServiceNxs {
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$com$tridium$platform$win32$BSystemPlatformServiceEwfFlash;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$win32$BSystemPlatformServiceEwfFlash;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$win32$BSystemPlatformServiceEwfFlash = BSystemPlatformServiceEwfFlash.class("[Lcom.tridium.platform.win32.BSystemPlatformServiceEwfFlash;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,431 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.units.BUnit
|
||||
* javax.baja.util.BFormat
|
||||
*/
|
||||
package com.tridium.platform.win32;
|
||||
|
||||
import com.tridium.platform.BFilesystemAttributes;
|
||||
import com.tridium.platform.BPlatform;
|
||||
import com.tridium.platform.IPlatformLibrary;
|
||||
import com.tridium.platform.NativePlatformLibraryTridium;
|
||||
import com.tridium.platform.alarm.BPlatformAlarmProxy;
|
||||
import com.tridium.platform.alarm.BPlatformAlarmSupport;
|
||||
import com.tridium.platform.alarm.BPlatformServiceAlarmRecord;
|
||||
import com.tridium.platform.archive.FileArchive;
|
||||
import com.tridium.platform.archive.ZipArchive;
|
||||
import com.tridium.platform.ewf.BEwfBootCommand;
|
||||
import com.tridium.platform.ewf.BEwfEnableState;
|
||||
import com.tridium.platform.ewf.BEwfOverlayAttributes;
|
||||
import com.tridium.platform.win32.BSystemPlatformServiceWin32;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BString;
|
||||
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;
|
||||
import javax.baja.units.BUnit;
|
||||
import javax.baja.util.BFormat;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BSystemPlatformServiceNxs
|
||||
extends BSystemPlatformServiceWin32 {
|
||||
public static final Property osOverlayAttributes = BSystemPlatformServiceNxs.newProperty((int)3, (BValue)new BEwfOverlayAttributes(), null);
|
||||
public static final Property historyOverlayAttributes = BSystemPlatformServiceNxs.newProperty((int)1, (BValue)new BEwfOverlayAttributes(), null);
|
||||
public static final Property lowHistorySpaceAlarmSupport = BSystemPlatformServiceNxs.newProperty((int)0, (BValue)BSystemPlatformServiceNxs.initLowHistorySpaceAlarmSupport(), null);
|
||||
public static final Property lowHistorySpaceAlarmProxy = BSystemPlatformServiceNxs.newProperty((int)6, (BValue)new BPlatformAlarmProxy(), null);
|
||||
public static final Property lowHistorySpaceThreshold = BSystemPlatformServiceNxs.newProperty((int)0, (int)80, (BFacets)BFacets.make((String)"units", (BIDataValue)BUnit.getUnit((String)"percent")));
|
||||
public static final Action setCommitDriveC = BSystemPlatformServiceNxs.newAction((int)0, null);
|
||||
public static final Action setEnableDriveC = BSystemPlatformServiceNxs.newAction((int)0, null);
|
||||
public static final Action setCommitAndDisableDriveC = BSystemPlatformServiceNxs.newAction((int)0, null);
|
||||
public static final Action setNoCmdDriveC = BSystemPlatformServiceNxs.newAction((int)0, null);
|
||||
public static final Type TYPE;
|
||||
public static final char EWF_OS_DRIVE = 'C';
|
||||
public static final char EWF_HISTORY_DRIVE = 'E';
|
||||
static final int EWF_NO_CMD = 0;
|
||||
static final int EWF_ENABLE = 1;
|
||||
static final int EWF_DISABLE = 2;
|
||||
static final int EWF_SET_LEVEL = 3;
|
||||
static final int EWF_COMMIT = 4;
|
||||
private static long lastEwfCheck;
|
||||
private static final String ALARM_TYPE_HISTORY_SPACE = "history storage space";
|
||||
public static Log log;
|
||||
protected boolean nowHistorySpaceOk;
|
||||
protected boolean lastHistorySpaceOk;
|
||||
long totalDriveSize;
|
||||
long freeDriveSize;
|
||||
static /* synthetic */ Class class$com$tridium$platform$win32$BSystemPlatformServiceNxs;
|
||||
|
||||
public BEwfOverlayAttributes getOsOverlayAttributes() {
|
||||
return (BEwfOverlayAttributes)this.get(osOverlayAttributes);
|
||||
}
|
||||
|
||||
public void setOsOverlayAttributes(BEwfOverlayAttributes bEwfOverlayAttributes) {
|
||||
this.set(osOverlayAttributes, (BValue)bEwfOverlayAttributes, null);
|
||||
}
|
||||
|
||||
public BEwfOverlayAttributes getHistoryOverlayAttributes() {
|
||||
return (BEwfOverlayAttributes)this.get(historyOverlayAttributes);
|
||||
}
|
||||
|
||||
public void setHistoryOverlayAttributes(BEwfOverlayAttributes bEwfOverlayAttributes) {
|
||||
this.set(historyOverlayAttributes, (BValue)bEwfOverlayAttributes, null);
|
||||
}
|
||||
|
||||
public BPlatformAlarmSupport getLowHistorySpaceAlarmSupport() {
|
||||
return (BPlatformAlarmSupport)this.get(lowHistorySpaceAlarmSupport);
|
||||
}
|
||||
|
||||
public void setLowHistorySpaceAlarmSupport(BPlatformAlarmSupport bPlatformAlarmSupport) {
|
||||
this.set(lowHistorySpaceAlarmSupport, (BValue)bPlatformAlarmSupport, null);
|
||||
}
|
||||
|
||||
public BPlatformAlarmProxy getLowHistorySpaceAlarmProxy() {
|
||||
return (BPlatformAlarmProxy)this.get(lowHistorySpaceAlarmProxy);
|
||||
}
|
||||
|
||||
public void setLowHistorySpaceAlarmProxy(BPlatformAlarmProxy bPlatformAlarmProxy) {
|
||||
this.set(lowHistorySpaceAlarmProxy, (BValue)bPlatformAlarmProxy, null);
|
||||
}
|
||||
|
||||
public int getLowHistorySpaceThreshold() {
|
||||
return this.getInt(lowHistorySpaceThreshold);
|
||||
}
|
||||
|
||||
public void setLowHistorySpaceThreshold(int n) {
|
||||
this.setInt(lowHistorySpaceThreshold, n, null);
|
||||
}
|
||||
|
||||
public void setCommitDriveC() {
|
||||
this.invoke(setCommitDriveC, null, null);
|
||||
}
|
||||
|
||||
public void setEnableDriveC() {
|
||||
this.invoke(setEnableDriveC, null, null);
|
||||
}
|
||||
|
||||
public void setCommitAndDisableDriveC() {
|
||||
this.invoke(setCommitAndDisableDriveC, null, null);
|
||||
}
|
||||
|
||||
public void setNoCmdDriveC() {
|
||||
this.invoke(setNoCmdDriveC, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean isValidPlatform() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void loadPlatformServiceProperties() {
|
||||
super.loadPlatformServiceProperties();
|
||||
if (!NativePlatformLibraryTridium.load()) {
|
||||
return;
|
||||
}
|
||||
IPlatformLibrary iPlatformLibrary = this.getPlatformLibrary();
|
||||
this.totalDriveSize = iPlatformLibrary.getTotalBytes("E:");
|
||||
this.freeDriveSize = iPlatformLibrary.getFreeBytes("E:");
|
||||
this.lastHistorySpaceOk = this.freeDriveSize / this.totalDriveSize >= (long)this.getLowHistorySpaceThreshold();
|
||||
this.getLowHistorySpaceAlarmProxy().setAlarmSupport(this.getLowHistorySpaceAlarmSupport());
|
||||
this.pollForEwfValues();
|
||||
try {
|
||||
BSystemPlatformServiceNxs.ewfCommand0('E', 4);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.getOsOverlayAttributes().setBootCommand(BEwfBootCommand.unknown);
|
||||
this.getHistoryOverlayAttributes().setBootCommand(BEwfBootCommand.unknown);
|
||||
BPlatform.log.error("Unable to set COMMIT command on protected volume");
|
||||
}
|
||||
}
|
||||
|
||||
void loadFileSystems() {
|
||||
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) {
|
||||
log.trace("EWF OVERLAY for " + this.fileSystems[n] + " : " + (Object)((Object)this.getOverlayStateEwf(this.fileSystems[n].charAt(0))));
|
||||
boolean bl = !this.getOverlayStateEwf(this.fileSystems[n].charAt(0)).equals((Object)BEwfEnableState.enabled);
|
||||
this.filesystemProps[n] = this.getFilesystemAttributes().add(SlotPath.escape((String)this.fileSystems[n]), (BValue)new BFilesystemAttributes(iPlatformLibrary.getTotalBytes(this.fileSystems[n]) / 1024L, iPlatformLibrary.getFreeBytes(this.fileSystems[n]) / 1024L, iPlatformLibrary.getBlockSize(this.fileSystems[n]), bl), 3);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public void doPoll(Context context) {
|
||||
long l;
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
if (!NativePlatformLibraryTridium.load()) {
|
||||
return;
|
||||
}
|
||||
IPlatformLibrary iPlatformLibrary = this.getPlatformLibrary();
|
||||
super.doPoll(context);
|
||||
if ((context == null || context.getFacets().getb("memory", true)) && (l = Clock.ticks()) - lastEwfCheck > 15000L) {
|
||||
lastEwfCheck = l;
|
||||
this.pollForEwfValues();
|
||||
this.freeDriveSize = iPlatformLibrary.getFreeBytes("E:");
|
||||
this.nowHistorySpaceOk = this.freeDriveSize / this.totalDriveSize >= (long)this.getLowHistorySpaceThreshold();
|
||||
if (this.nowHistorySpaceOk != this.lastHistorySpaceOk) {
|
||||
if (!this.nowHistorySpaceOk && this.lastHistorySpaceOk) {
|
||||
log.trace("History Space is LOW");
|
||||
BPlatformServiceAlarmRecord bPlatformServiceAlarmRecord = this.getLowHistorySpaceAlarmSupport().makeNewFaultAlarm();
|
||||
this.getLowHistorySpaceAlarmProxy().firePlatformServiceAlarmEvent(bPlatformServiceAlarmRecord);
|
||||
} else if (this.nowHistorySpaceOk && !this.lastHistorySpaceOk) {
|
||||
log.trace("History Space is OK");
|
||||
BPlatformServiceAlarmRecord bPlatformServiceAlarmRecord = this.getLowHistorySpaceAlarmSupport().makeToNormal();
|
||||
this.getLowHistorySpaceAlarmProxy().firePlatformServiceAlarmEvent(bPlatformServiceAlarmRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BEwfEnableState getOsOverlayState() {
|
||||
return this.getOsOverlayAttributes().getEnableState();
|
||||
}
|
||||
|
||||
public BEwfBootCommand getOsOverlayCommand() {
|
||||
return this.getOsOverlayAttributes().getBootCommand();
|
||||
}
|
||||
|
||||
public double getOsOverlayRamUsage() {
|
||||
return this.getOsOverlayAttributes().getRamUsage();
|
||||
}
|
||||
|
||||
public BEwfEnableState getHistoryOverlayState() {
|
||||
return this.getHistoryOverlayAttributes().getEnableState();
|
||||
}
|
||||
|
||||
public BEwfBootCommand getHistoryOverlayCommand() {
|
||||
return this.getHistoryOverlayAttributes().getBootCommand();
|
||||
}
|
||||
|
||||
public double getHistoryOverlayRamUsage() {
|
||||
return this.getHistoryOverlayAttributes().getRamUsage();
|
||||
}
|
||||
|
||||
private final void pollForEwfValues() {
|
||||
this.getOsOverlayAttributes().setRamUsage(this.getOverlayRamUsageEwf('C'));
|
||||
this.getOsOverlayAttributes().setBootCommand(this.getOverlayCommandEwf('C'));
|
||||
this.getOsOverlayAttributes().setEnableState(this.getOverlayStateEwf('C'));
|
||||
this.getHistoryOverlayAttributes().setRamUsage(this.getOverlayRamUsageEwf('E'));
|
||||
this.getHistoryOverlayAttributes().setBootCommand(this.getOverlayCommandEwf('E'));
|
||||
this.getHistoryOverlayAttributes().setEnableState(this.getOverlayStateEwf('E'));
|
||||
log.trace("OS Overlay RAM Usage:" + this.getOsOverlayRamUsage() + " MB");
|
||||
log.trace("OS Overlay Command:" + (Object)((Object)this.getOsOverlayCommand()));
|
||||
log.trace("OS Overlay State:" + (Object)((Object)this.getOsOverlayState()));
|
||||
log.trace("History Overlay RAM Usage:" + this.getHistoryOverlayRamUsage() + " MB");
|
||||
log.trace("History Overlay Command:" + (Object)((Object)this.getHistoryOverlayCommand()));
|
||||
log.trace("History Overlay State:" + (Object)((Object)this.getHistoryOverlayState()));
|
||||
}
|
||||
|
||||
public void updateWatchdog(String string, int n, int n2, int n3) {
|
||||
}
|
||||
|
||||
public double getOverlayRamUsageEwf(char c) {
|
||||
if (!NativePlatformLibraryTridium.load()) {
|
||||
return -1.0;
|
||||
}
|
||||
try {
|
||||
return (double)BSystemPlatformServiceNxs.getOverlayRamUsage0(c) / 1048576.0;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return -1.0;
|
||||
}
|
||||
}
|
||||
|
||||
public BEwfBootCommand getOverlayCommandEwf(char c) {
|
||||
if (!NativePlatformLibraryTridium.load()) {
|
||||
return BEwfBootCommand.unknown;
|
||||
}
|
||||
try {
|
||||
return BEwfBootCommand.make(BSystemPlatformServiceNxs.getOverlayCommand0(c));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return BEwfBootCommand.unknown;
|
||||
}
|
||||
}
|
||||
|
||||
public BEwfEnableState getOverlayStateEwf(char c) {
|
||||
if (!NativePlatformLibraryTridium.load()) {
|
||||
return BEwfEnableState.unknown;
|
||||
}
|
||||
try {
|
||||
return BEwfEnableState.make(BSystemPlatformServiceNxs.getOverlayState0(c));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return BEwfEnableState.unknown;
|
||||
}
|
||||
}
|
||||
|
||||
public void doSetCommitDriveC() {
|
||||
if (!NativePlatformLibraryTridium.load()) {
|
||||
log.error("Could not load library when setting commit on drive C");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
BSystemPlatformServiceNxs.ewfCommand0('C', 4);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("exception setting commit on drive C", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void doSetEnableDriveC() {
|
||||
if (!NativePlatformLibraryTridium.load()) {
|
||||
log.error("Could not load library when setting enable on drive C");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
BSystemPlatformServiceNxs.ewfCommand0('C', 1);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("exception setting enable on drive C", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void doSetEnableDriveE() {
|
||||
if (!NativePlatformLibraryTridium.load()) {
|
||||
log.error("Could not load library when setting enable on drive E");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
BSystemPlatformServiceNxs.ewfCommand0('E', 1);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("exception setting enable on drive E", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void doSetCommitAndDisableDriveC() {
|
||||
if (!NativePlatformLibraryTridium.load()) {
|
||||
log.error("Could not load library when setting commitAndDisable on drive C");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
BSystemPlatformServiceNxs.ewfCommand0('C', 2);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("exception setting commitAndDisable on drive C", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void doSetNoCmdDriveC() {
|
||||
if (!NativePlatformLibraryTridium.load()) {
|
||||
log.error("Could not load library when setting noCmd on drive C");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
BSystemPlatformServiceNxs.ewfCommand0('C', 0);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("exception setting noCmd on drive C", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean archiveEnabled(String string) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public FileArchive createFileArchive(String string) {
|
||||
String string2 = Sys.getStationHome().getPath() + '/' + string;
|
||||
String string3 = string + ".zip";
|
||||
File file = new File(Sys.getStationHome().getPath() + '/' + string);
|
||||
file.mkdir();
|
||||
return new ZipArchive(string2, string3, 1);
|
||||
}
|
||||
|
||||
public synchronized void extractArchive(String string) {
|
||||
File file = new File("/E:/" + Sys.getStation().getStationName());
|
||||
file.mkdir();
|
||||
File file2 = new File("/E:/" + Sys.getStation().getStationName() + '/' + string);
|
||||
file2.mkdir();
|
||||
try {
|
||||
ZipArchive.unzip(Sys.getStationHome().getPath() + '/' + string, string + ".zip", "/E:/" + Sys.getStation().getStationName() + '/' + string);
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
log.error("unable to unzip archive to runtime overlay");
|
||||
}
|
||||
}
|
||||
|
||||
public String getRuntimeDirectory(String string) {
|
||||
return "/E:/" + Sys.getStation().getStationName() + '/' + string;
|
||||
}
|
||||
|
||||
static BPlatformAlarmSupport initLowHistorySpaceAlarmSupport() {
|
||||
BPlatformAlarmSupport bPlatformAlarmSupport = new BPlatformAlarmSupport();
|
||||
bPlatformAlarmSupport.setSourceName(BFormat.make((String)"%parent.displayName%"));
|
||||
bPlatformAlarmSupport.setToFaultText(BFormat.make((String)"%lexicon(platform:platformNxs.historySpaceLow)%"));
|
||||
bPlatformAlarmSupport.setToNormalText(BFormat.make((String)"%lexicon(platform:platformNxs.historySpaceOk)%"));
|
||||
HashMap<String, BString> hashMap = new HashMap<String, BString>();
|
||||
hashMap.put("alarmType", BString.make((String)ALARM_TYPE_HISTORY_SPACE));
|
||||
bPlatformAlarmSupport.setMetaData(BFacets.make(hashMap));
|
||||
return bPlatformAlarmSupport;
|
||||
}
|
||||
|
||||
private static final native long getOverlayRamUsage0(char var0) throws Exception;
|
||||
|
||||
private static final native int getOverlayCommand0(char var0) throws Exception;
|
||||
|
||||
private static final native int getOverlayState0(char var0) throws Exception;
|
||||
|
||||
protected static native boolean ewfCommand0(char var0, int var1) throws Exception;
|
||||
|
||||
private static final native long dumpEwfProtectedVolumeList0();
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$win32$BSystemPlatformServiceNxs;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$win32$BSystemPlatformServiceNxs = BSystemPlatformServiceNxs.class("[Lcom.tridium.platform.win32.BSystemPlatformServiceNxs;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
lastEwfCheck = 0L;
|
||||
log = Log.getLog((String)"platform.nxs");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.platform.win32;
|
||||
|
||||
import com.tridium.platform.win32.BSystemPlatformServiceNxs;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BSystemPlatformServiceNxtFlash
|
||||
extends BSystemPlatformServiceNxs {
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$com$tridium$platform$win32$BSystemPlatformServiceNxtFlash;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$win32$BSystemPlatformServiceNxtFlash;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$win32$BSystemPlatformServiceNxtFlash = BSystemPlatformServiceNxtFlash.class("[Lcom.tridium.platform.win32.BSystemPlatformServiceNxtFlash;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* 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.win32;
|
||||
|
||||
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 BSystemPlatformServiceWin32
|
||||
extends BSystemPlatformService {
|
||||
public static final Type TYPE;
|
||||
private static long lastFileCheck;
|
||||
private static final IPlatformLibrary _PLATFORM_LIBRARY_INSTANCE;
|
||||
protected String[] fileSystems;
|
||||
protected Property[] filesystemProps;
|
||||
static /* synthetic */ Class class$com$tridium$platform$win32$BSystemPlatformServiceWin32;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean isValidPlatform() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void loadPlatformServiceProperties() {
|
||||
super.loadPlatformServiceProperties();
|
||||
if (!NativePlatformLibraryTridium.load()) {
|
||||
return;
|
||||
}
|
||||
IPlatformLibrary iPlatformLibrary = this.getPlatformLibrary();
|
||||
BSystemPlatformServiceWin32.startThreadDumpListener0(Sys.getStationHome().getName());
|
||||
this.loadFileSystems();
|
||||
this.setTotalPhysicalMemory((int)(iPlatformLibrary.getTotalPhysicalMemoryBytes() / 1024L));
|
||||
this.setFreePhysicalMemory((int)(iPlatformLibrary.getFreePhysicalMemoryBytes() / 1024L));
|
||||
this.setCurrentCpuUsage(iPlatformLibrary.getCurrentCPUUtilization());
|
||||
this.setOverallCpuUsage(iPlatformLibrary.getOverallCPUUtilization());
|
||||
this.setNumCpus(iPlatformLibrary.getNumberCPUs());
|
||||
}
|
||||
|
||||
void loadFileSystems() {
|
||||
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]));
|
||||
this.filesystemProps[n] = this.getFilesystemAttributes().add(SlotPath.escape((String)this.fileSystems[n]), (BValue)bFilesystemAttributes, 3);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
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]));
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void spy(SpyWriter spyWriter) throws Exception {
|
||||
super.spy(spyWriter);
|
||||
spyWriter.startProps();
|
||||
spyWriter.trTitle((Object)"SystemPlatformServiceWin32", 2);
|
||||
if (this.isProxy()) {
|
||||
spyWriter.prop((Object)"lastErrorMessage", (Object)"remote");
|
||||
spyWriter.prop((Object)"systemDir", (Object)"remote");
|
||||
} else if (NativePlatformLibraryTridium.load()) {
|
||||
spyWriter.prop((Object)"systemDir", (Object)BSystemPlatformServiceWin32.getSystemDirectory0());
|
||||
spyWriter.prop((Object)"lastErrorMessage", (Object)this.getPlatformLibrary().getLastErrorMessage());
|
||||
}
|
||||
spyWriter.endProps();
|
||||
}
|
||||
|
||||
public IPlatformLibrary getPlatformLibrary() {
|
||||
if (!NativePlatformLibraryTridium.load()) {
|
||||
return null;
|
||||
}
|
||||
return _PLATFORM_LIBRARY_INSTANCE;
|
||||
}
|
||||
|
||||
private static final native void startThreadDumpListener0(String var0);
|
||||
|
||||
private static final native void stopThreadDumpListener0(String var0);
|
||||
|
||||
private static final native String getSystemDirectory0();
|
||||
|
||||
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 BSystemPlatformServiceWin32() {
|
||||
this.setTimezoneDayModeSupport(BDstSupportLevel.nthWeekday);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$win32$BSystemPlatformServiceWin32;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$win32$BSystemPlatformServiceWin32 = BSystemPlatformServiceWin32.class("[Lcom.tridium.platform.win32.BSystemPlatformServiceWin32;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
lastFileCheck = 0L;
|
||||
_PLATFORM_LIBRARY_INSTANCE = new NativePlatformLibraryTridium();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user