284 lines
11 KiB
Java
284 lines
11 KiB
Java
/*
|
|
* 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);
|
|
}
|
|
}
|
|
|