link start!
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.sys.license.Brand
|
||||
* javax.baja.license.Feature
|
||||
* javax.baja.license.LicenseException
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.Sys
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.session.Fox;
|
||||
import com.tridium.fox.session.FoxConnection;
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import com.tridium.fox.sys.BFoxConnection;
|
||||
import com.tridium.fox.sys.BFoxService;
|
||||
import com.tridium.fox.sys.MismatchedStationNamesException;
|
||||
import com.tridium.fox.sys.NiagaraStation;
|
||||
import com.tridium.sys.license.Brand;
|
||||
import javax.baja.license.Feature;
|
||||
import javax.baja.license.LicenseException;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Sys;
|
||||
|
||||
public class Acceptor {
|
||||
public static final Log log = Log.getLog((String)"fox");
|
||||
private static boolean licenseChecked = false;
|
||||
private static boolean foxTunnelingLicensed = false;
|
||||
|
||||
public static void accept(FoxSession foxSession) {
|
||||
boolean bl;
|
||||
boolean bl2 = foxSession.isServer();
|
||||
boolean bl3 = false;
|
||||
if (foxSession.getRemoteHello().getString("station.name", null) != null || foxSession.getRemoteHello().getString("app.name", "").equals("Station")) {
|
||||
bl3 = true;
|
||||
}
|
||||
boolean bl4 = bl3;
|
||||
boolean bl5 = false;
|
||||
if (Sys.getStation() != null) {
|
||||
bl5 = bl = true;
|
||||
}
|
||||
if (bl2) {
|
||||
if (bl4) {
|
||||
Acceptor.acceptStationIn(foxSession);
|
||||
} else {
|
||||
Acceptor.acceptWbIn(foxSession);
|
||||
}
|
||||
} else if (bl) {
|
||||
Acceptor.acceptStationOut(foxSession);
|
||||
} else {
|
||||
Acceptor.acceptWbOut(foxSession);
|
||||
}
|
||||
}
|
||||
|
||||
static final void acceptTunnel(FoxConnection foxConnection) {
|
||||
Object object;
|
||||
int n = -1;
|
||||
if (foxConnection instanceof BObject && (object = ((BObject)foxConnection).fw(803, null, null, null, null)) instanceof Integer) {
|
||||
n = (Integer)object;
|
||||
}
|
||||
if (foxConnection.isTunnelServerConnection() && !Acceptor.foxTunnelingLicensed() && n == -1) {
|
||||
throw new LicenseException("Connection failure, fox tunneling is not licensed.");
|
||||
}
|
||||
}
|
||||
|
||||
private static final void acceptStationIn(FoxSession foxSession) {
|
||||
log.trace("Accept.station.in: " + foxSession);
|
||||
String string = foxSession.getRemoteHello().getString("brandId", null);
|
||||
Brand.checkStationIn((String)string);
|
||||
BFoxConnection bFoxConnection = (BFoxConnection)foxSession.conn();
|
||||
NiagaraStation niagaraStation = bFoxConnection.getParentStation();
|
||||
if (niagaraStation != null && niagaraStation.isFatalFault()) {
|
||||
throw new LicenseException("Station in fatal fault: " + niagaraStation.getFaultCause());
|
||||
}
|
||||
}
|
||||
|
||||
private static final void acceptStationOut(FoxSession foxSession) {
|
||||
String string;
|
||||
log.trace("Accept.station.out: " + foxSession);
|
||||
BFoxConnection bFoxConnection = (BFoxConnection)foxSession.conn();
|
||||
NiagaraStation niagaraStation = bFoxConnection.getParentStation();
|
||||
if (niagaraStation != null) {
|
||||
string = niagaraStation.getStationName();
|
||||
String string2 = foxSession.getRemoteHello().getString("station.name", null);
|
||||
if (string != null && string2 != null && !string.equals(string2)) {
|
||||
throw new MismatchedStationNamesException(string, string2);
|
||||
}
|
||||
}
|
||||
string = foxSession.getRemoteHello().getString("brandId", null);
|
||||
Brand.checkStationOut((String)string);
|
||||
}
|
||||
|
||||
private static final void acceptWbIn(FoxSession foxSession) {
|
||||
log.trace("Accept.wb.in: " + foxSession);
|
||||
String string = foxSession.getRemoteHello().getString("brandId", null);
|
||||
Brand.checkWbIn((String)string);
|
||||
}
|
||||
|
||||
private static final void acceptWbOut(FoxSession foxSession) {
|
||||
log.trace("Accept.wb.out: " + foxSession);
|
||||
String string = foxSession.getRemoteHello().getString("brandId", null);
|
||||
Brand.checkWbOut((String)string);
|
||||
}
|
||||
|
||||
public static final boolean foxTunnelingLicensed() {
|
||||
block4: {
|
||||
if (!licenseChecked) {
|
||||
licenseChecked = true;
|
||||
try {
|
||||
Feature feature = Sys.getLicenseManager().getFeature("tridium", "tunneling");
|
||||
feature.check();
|
||||
foxTunnelingLicensed = feature.getb("fox", false);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
foxTunnelingLicensed = false;
|
||||
if (!Fox.tunnelingEnabled) break block4;
|
||||
BFoxService.log.trace("Fox tunneling not licensed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foxTunnelingLicensed) {
|
||||
Fox.tunnelingEnabled = false;
|
||||
}
|
||||
return foxTunnelingLicensed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,312 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.user.BUserPasswordConfiguration
|
||||
* com.tridium.user.BUserServicePasswordConfiguration
|
||||
* com.tridium.util.ValueByteBuffer
|
||||
* javax.baja.registry.TypeInfo
|
||||
* javax.baja.security.BICredentials
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BInteger
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BasicContext
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Flags
|
||||
* javax.baja.sys.Localizable
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.user.BAuthAgent
|
||||
* javax.baja.user.BUser
|
||||
* javax.baja.user.BUserService
|
||||
* javax.baja.util.BTypeSpec
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.session.FoxAuthenticationException;
|
||||
import com.tridium.fox.session.FoxServer;
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import com.tridium.fox.sys.BFoxServerConnection;
|
||||
import com.tridium.fox.sys.BIFoxAuthAgent;
|
||||
import com.tridium.user.BUserPasswordConfiguration;
|
||||
import com.tridium.user.BUserServicePasswordConfiguration;
|
||||
import com.tridium.util.ValueByteBuffer;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
import javax.baja.registry.TypeInfo;
|
||||
import javax.baja.security.BICredentials;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BasicContext;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Flags;
|
||||
import javax.baja.sys.Localizable;
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.user.BAuthAgent;
|
||||
import javax.baja.user.BUser;
|
||||
import javax.baja.user.BUserService;
|
||||
import javax.baja.util.BTypeSpec;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BFoxAuthAgent
|
||||
extends BAuthAgent
|
||||
implements BIFoxAuthAgent {
|
||||
public static final Type TYPE;
|
||||
private static TypeInfo USER_SYNC_EXT_TYPE;
|
||||
private static int nonceCount;
|
||||
private static Random nonceRandom;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxAuthAgent;
|
||||
static /* synthetic */ Class class$com$tridium$user$BUserServicePasswordConfiguration;
|
||||
static /* synthetic */ Class class$com$tridium$user$BUserPasswordConfiguration;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean authenticate(FoxSession foxSession, FoxServer foxServer) throws Exception {
|
||||
boolean bl = false;
|
||||
boolean bl2 = false;
|
||||
Throwable throwable = null;
|
||||
Throwable throwable2 = null;
|
||||
try {
|
||||
switch (foxServer.getAuthenticationPolicy()) {
|
||||
case 0: {
|
||||
bl = this.authenticateBasic(foxSession);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
bl = this.authenticateDigest(foxSession);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw new IllegalStateException("Unknown authentication policy");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable3) {
|
||||
bl = false;
|
||||
if (!bl2) {
|
||||
throwable = throwable3;
|
||||
}
|
||||
throwable2 = throwable3;
|
||||
}
|
||||
if (bl) {
|
||||
this.acceptAuthentication(foxSession);
|
||||
} else {
|
||||
this.rejectAuthentication(foxSession, throwable, throwable2);
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
protected boolean authenticateBasic(FoxSession foxSession) throws Exception {
|
||||
throw new FoxAuthenticationException("unimplemented method authenticateBasic", foxSession);
|
||||
}
|
||||
|
||||
protected boolean authenticateDigest(FoxSession foxSession) throws Exception {
|
||||
throw new FoxAuthenticationException("unimplemented method authenticateDigest", foxSession);
|
||||
}
|
||||
|
||||
protected boolean authenticateTransactional(FoxSession foxSession) throws Exception {
|
||||
throw new FoxAuthenticationException("unimplemented method authenticateSpecialized", foxSession);
|
||||
}
|
||||
|
||||
public byte[] generateNonce(FoxSession foxSession) throws Exception {
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
|
||||
dataOutputStream.writeUTF("nonce");
|
||||
dataOutputStream.writeInt(nonceCount++);
|
||||
dataOutputStream.writeUTF(foxSession.getRemoteHost());
|
||||
dataOutputStream.writeInt(foxSession.getRemotePort());
|
||||
dataOutputStream.writeLong(System.currentTimeMillis());
|
||||
dataOutputStream.writeInt(nonceRandom.nextInt());
|
||||
return byteArrayOutputStream.toByteArray();
|
||||
}
|
||||
|
||||
public void acceptAuthentication(FoxSession foxSession) throws Exception {
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
boolean bl = false;
|
||||
try {
|
||||
BUserService bUserService = (BUserService)Sys.getService((Type)BUserService.TYPE);
|
||||
BUser bUser = foxSession.getUser();
|
||||
if (bUserService.canUsePasswordFeatures(bUser)) {
|
||||
BObject[] bObjectArray;
|
||||
Class clazz = class$com$tridium$user$BUserServicePasswordConfiguration;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$user$BUserServicePasswordConfiguration = BFoxAuthAgent.class("[Lcom.tridium.user.BUserServicePasswordConfiguration;", false);
|
||||
}
|
||||
if ((bObjectArray = (BObject[])bUserService.getChildren(clazz)).length > 0 && bObjectArray[0].getType().getTypeSpec().equals((Object)BTypeSpec.make((String)"baja:UserServicePasswordConfiguration"))) {
|
||||
BObject[] bObjectArray2;
|
||||
foxMessage.add("userHandle", bUser.getHandle().toString());
|
||||
Class clazz2 = class$com$tridium$user$BUserPasswordConfiguration;
|
||||
if (clazz2 == null) {
|
||||
clazz2 = class$com$tridium$user$BUserPasswordConfiguration = BFoxAuthAgent.class("[Lcom.tridium.user.BUserPasswordConfiguration;", false);
|
||||
}
|
||||
if ((bObjectArray2 = (BObject[])bUser.getChildren(clazz2)).length > 0 && bObjectArray2[0].getType().getTypeSpec().equals((Object)BTypeSpec.make((String)"baja:UserPasswordConfiguration"))) {
|
||||
BBoolean bBoolean;
|
||||
BAbsTime bAbsTime = (BAbsTime)((BUserPasswordConfiguration)bObjectArray2[0]).get("expiration");
|
||||
BRelTime bRelTime = (BRelTime)((BUserServicePasswordConfiguration)bObjectArray[0]).get("warningPeriod");
|
||||
if (!bAbsTime.isNull() && bAbsTime.subtract(bRelTime).isBefore(BAbsTime.now())) {
|
||||
foxMessage.add("passwordExpires", bAbsTime.getMillis());
|
||||
}
|
||||
if ((bBoolean = (BBoolean)((BUserPasswordConfiguration)bObjectArray2[0]).get("forceResetAtNextLogin")).getBoolean()) {
|
||||
if (USER_SYNC_EXT_TYPE == null) {
|
||||
USER_SYNC_EXT_TYPE = BTypeSpec.make((String)"niagaraDriver", (String)"UserSyncExt").getTypeInfo();
|
||||
}
|
||||
Property property = bUser.getProperty("syncExt");
|
||||
boolean bl2 = false;
|
||||
if (bUser.getNetworkUser() && Flags.isReadonly((BComplex)bUser.getParent(), (Slot)bUser.getPropertyInParent()) && property != null && USER_SYNC_EXT_TYPE != null && property.getType().is(USER_SYNC_EXT_TYPE)) {
|
||||
bl2 = true;
|
||||
}
|
||||
bl = bl2;
|
||||
foxMessage.add("forceReset", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
if (bl && (foxSession.getRemoteHello().getString("station.name", null) == null || !foxSession.getRemoteHello().getString("app.name", "").equals("Station"))) {
|
||||
this.rejectAuthentication(foxSession, (Throwable)new LocalizableRuntimeException("fox", "fox.illegal.network.user.passwordReset"), null);
|
||||
} else {
|
||||
foxSession.setState("server.tune sendWelcome");
|
||||
foxSession.sendTuning("welcome", foxMessage);
|
||||
foxSession.setState("server.tune starting");
|
||||
foxSession.start();
|
||||
}
|
||||
}
|
||||
|
||||
public void rejectAuthentication(FoxSession foxSession, Throwable throwable, Throwable throwable2) throws Exception {
|
||||
FoxMessage foxMessage = this.generateRejectedMessage(throwable, throwable2, foxSession.getSessionContext());
|
||||
foxSession.setState("server.tune sendRejected");
|
||||
foxSession.sendTuning("rejected", foxMessage);
|
||||
throw new FoxAuthenticationException("client login failed", foxSession);
|
||||
}
|
||||
|
||||
protected FoxMessage generateRejectedMessage(Throwable throwable, Throwable throwable2, Context context) {
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
if (throwable != null) {
|
||||
foxMessage.add("fatal", this.toFatalMessage(throwable, context));
|
||||
if (throwable instanceof FoxAuthenticationException) {
|
||||
foxMessage.add("data", ((FoxAuthenticationException)throwable).data);
|
||||
}
|
||||
}
|
||||
if (throwable2 != null) {
|
||||
foxMessage.add("msg", this.toFatalMessage(throwable2, context));
|
||||
if (throwable2 instanceof FoxAuthenticationException) {
|
||||
foxMessage.add("data", ((FoxAuthenticationException)throwable).data);
|
||||
}
|
||||
}
|
||||
return foxMessage;
|
||||
}
|
||||
|
||||
public String toFatalMessage(Throwable throwable, Context context) {
|
||||
String string;
|
||||
if (throwable instanceof Localizable) {
|
||||
return ((Localizable)throwable).toString(context);
|
||||
}
|
||||
String string2 = throwable.getClass().getName();
|
||||
int n = string2.lastIndexOf(46);
|
||||
if (n > 0) {
|
||||
string2 = string2.substring(n + 1);
|
||||
}
|
||||
if ((string = throwable.getMessage()) != null && string.length() > 0) {
|
||||
string2 = string2 + ": " + string;
|
||||
}
|
||||
return string2;
|
||||
}
|
||||
|
||||
protected BICredentials extractCredentials(FoxSession foxSession, FoxMessage foxMessage) throws Exception {
|
||||
byte[] byArray = foxMessage.getBlob("credentials", null);
|
||||
if (byArray != null) {
|
||||
foxSession.setState("server.tune receivedLogin data.len=" + byArray.length);
|
||||
BICredentials bICredentials = (BICredentials)ValueByteBuffer.unmarshal((byte[])byArray);
|
||||
return bICredentials;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected BUserService authenticateAttempt(FoxSession foxSession, String string) {
|
||||
BFoxServerConnection bFoxServerConnection = (BFoxServerConnection)foxSession.conn();
|
||||
bFoxServerConnection.setLastLoginTime(Clock.time());
|
||||
if (string != null) {
|
||||
bFoxServerConnection.setLastLoginUsername(string);
|
||||
}
|
||||
bFoxServerConnection.setLastLoginAddress(foxSession.getRemoteHost() + ':' + foxSession.getRemotePort());
|
||||
bFoxServerConnection.setLastLoginApp(foxSession.getRemoteHello().getString("app.name", "") + ' ' + foxSession.getRemoteHello().getString("app.version", ""));
|
||||
return (BUserService)Sys.getService((Type)BUserService.TYPE);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
protected void authenticateSuccess(FoxSession foxSession, BUser bUser) {
|
||||
Object object = foxSession.getSessionStateLock();
|
||||
synchronized (object) {
|
||||
FoxMessage foxMessage = foxSession.getRemoteHello();
|
||||
String string = foxMessage.getString("lang", null);
|
||||
String string2 = foxMessage.getString("vmUuid", null);
|
||||
HashMap<String, Object> hashMap = new HashMap<String, Object>();
|
||||
hashMap.put("foxSessionId", BInteger.make((int)foxSession.getId()));
|
||||
if (string2 != null) {
|
||||
hashMap.put("foxRemoteVmUuid", BString.make((String)string2));
|
||||
}
|
||||
foxSession.setUser(bUser);
|
||||
foxSession.setSessionContext((Context)new BasicContext((Context)new BasicContext(bUser, string), BFacets.make(hashMap)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
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$fox$sys$BFoxAuthAgent;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxAuthAgent = BFoxAuthAgent.class("[Lcom.tridium.fox.sys.BFoxAuthAgent;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
USER_SYNC_EXT_TYPE = null;
|
||||
nonceRandom = new Random();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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.fox.sys;
|
||||
|
||||
import javax.baja.sys.BFrozenEnum;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BFoxAuthenticationPolicy
|
||||
extends BFrozenEnum {
|
||||
public static final int BASIC = 0;
|
||||
public static final int DIGEST = 1;
|
||||
public static final BFoxAuthenticationPolicy basic = new BFoxAuthenticationPolicy(0);
|
||||
public static final BFoxAuthenticationPolicy digest = new BFoxAuthenticationPolicy(1);
|
||||
public static final Type TYPE;
|
||||
public static final BFoxAuthenticationPolicy DEFAULT;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxAuthenticationPolicy;
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static final BFoxAuthenticationPolicy make(int n) {
|
||||
return (BFoxAuthenticationPolicy)basic.getRange().get(n, false);
|
||||
}
|
||||
|
||||
public static final BFoxAuthenticationPolicy make(String string) {
|
||||
return (BFoxAuthenticationPolicy)basic.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 BFoxAuthenticationPolicy(int n) {
|
||||
super(n);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$BFoxAuthenticationPolicy;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxAuthenticationPolicy = BFoxAuthenticationPolicy.class("[Lcom.tridium.fox.sys.BFoxAuthenticationPolicy;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
DEFAULT = basic;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.sys.transfer.TransferListener
|
||||
* javax.baja.net.NotConnectedException
|
||||
* javax.baja.security.BIProtected
|
||||
* javax.baja.security.BPermissions
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.session.FoxCircuit;
|
||||
import com.tridium.fox.session.FoxRequest;
|
||||
import com.tridium.fox.session.FoxResponse;
|
||||
import com.tridium.fox.session.InvalidCommandException;
|
||||
import com.tridium.fox.sys.BFoxClientConnection;
|
||||
import com.tridium.fox.sys.BFoxConnection;
|
||||
import com.tridium.fox.sys.BFoxServerConnection;
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.fox.sys.spy.FoxLog;
|
||||
import com.tridium.sys.transfer.TransferListener;
|
||||
import javax.baja.net.NotConnectedException;
|
||||
import javax.baja.security.BIProtected;
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BFoxChannel
|
||||
extends BComponent {
|
||||
public static final Type TYPE;
|
||||
private static final BIcon icon;
|
||||
public final FoxLog log;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxChannel;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void sessionOpened() throws Exception {
|
||||
}
|
||||
|
||||
public void sessionClosed(Throwable throwable) throws Exception {
|
||||
}
|
||||
|
||||
public abstract FoxResponse process(FoxRequest var1) throws Throwable;
|
||||
|
||||
public void circuitOpened(FoxCircuit foxCircuit) throws Throwable {
|
||||
throw new InvalidCommandException(foxCircuit.command);
|
||||
}
|
||||
|
||||
public final FoxRequest makeRequest(String string) {
|
||||
return new FoxRequest(this.getName(), string);
|
||||
}
|
||||
|
||||
public final FoxCircuit openCircuit(String string) throws Exception {
|
||||
return this.getConnection().session().openCircuit(this.getName(), string);
|
||||
}
|
||||
|
||||
public final FoxResponse sendSync(FoxRequest foxRequest) throws Exception {
|
||||
try {
|
||||
return this.getConnection().sendSync(foxRequest);
|
||||
}
|
||||
catch (NullPointerException nullPointerException) {
|
||||
if (this.getConnection() == null) {
|
||||
throw new NotConnectedException();
|
||||
}
|
||||
throw nullPointerException;
|
||||
}
|
||||
}
|
||||
|
||||
public final void sendAsync(FoxRequest foxRequest) throws Exception {
|
||||
try {
|
||||
this.getConnection().sendAsync(foxRequest);
|
||||
}
|
||||
catch (NullPointerException nullPointerException) {
|
||||
if (this.getConnection() == null) {
|
||||
throw new NotConnectedException();
|
||||
}
|
||||
throw nullPointerException;
|
||||
}
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public final BFoxConnection getConnection() {
|
||||
try {
|
||||
return (BFoxConnection)this.getParent().getParent();
|
||||
}
|
||||
catch (NullPointerException nullPointerException) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public final BFoxClientConnection getClientConnection() {
|
||||
try {
|
||||
return (BFoxClientConnection)this.getParent().getParent();
|
||||
}
|
||||
catch (NullPointerException nullPointerException) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public final BFoxServerConnection getServerConnection() {
|
||||
try {
|
||||
return (BFoxServerConnection)this.getParent().getParent();
|
||||
}
|
||||
catch (NullPointerException nullPointerException) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public final Context getSessionContext() {
|
||||
return this.getServerConnection().getSessionContext();
|
||||
}
|
||||
|
||||
public final BPermissions getPermissionsFor(Object object) {
|
||||
return this.getPermissionsFor(object, true);
|
||||
}
|
||||
|
||||
public final BPermissions getPermissionsFor(Object object, boolean bl) {
|
||||
block3: {
|
||||
try {
|
||||
if (object instanceof BIProtected) {
|
||||
return ((BIProtected)object).getPermissions(this.getSessionContext());
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
if (!bl) break block3;
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
return BPermissions.all;
|
||||
}
|
||||
|
||||
public final BFoxSession getFoxSession() {
|
||||
return this.getClientConnection().getFoxSession();
|
||||
}
|
||||
|
||||
public boolean isTraceOn() {
|
||||
return this.log.isTraceOn();
|
||||
}
|
||||
|
||||
public void trace(String string) {
|
||||
System.out.print("-- ");
|
||||
System.out.print(this.log.getLogName());
|
||||
System.out.print(" ");
|
||||
System.out.println(string);
|
||||
this.log.logRecOnly(0, 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());
|
||||
}
|
||||
}
|
||||
|
||||
protected BFoxChannel(String string) {
|
||||
this.log = FoxLog.make("fox." + string);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$BFoxChannel;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxChannel = BFoxChannel.class("[Lcom.tridium.fox.sys.BFoxChannel;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
icon = BIcon.std((String)"bookmark.png");
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class TransferStatusPipe
|
||||
implements TransferListener {
|
||||
FoxCircuit circuit;
|
||||
|
||||
public void updateStatus(String string) {
|
||||
try {
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("s", string);
|
||||
this.circuit.writeMessage(foxMessage);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public TransferStatusPipe(FoxCircuit foxCircuit) {
|
||||
this.circuit = foxCircuit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.SlotCursor
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import com.tridium.fox.sys.BFoxChannel;
|
||||
import com.tridium.fox.sys.BFoxConnection;
|
||||
import com.tridium.fox.sys.BSysChannel;
|
||||
import com.tridium.fox.sys.data.BDataChannel;
|
||||
import com.tridium.fox.sys.file.BFileChannel;
|
||||
import com.tridium.fox.sys.spy.BSpyChannel;
|
||||
import com.tridium.fox.sys.user.BUserChannel;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.SlotCursor;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFoxChannelRegistry
|
||||
extends BComponent {
|
||||
public static final Type TYPE;
|
||||
private static BFoxChannelRegistry prototype;
|
||||
private static final BIcon icon;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxChannelRegistry;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public final BSysChannel getSysChannel() {
|
||||
return (BSysChannel)this.get("sys");
|
||||
}
|
||||
|
||||
public final BFileChannel getFileChannel() {
|
||||
return (BFileChannel)this.get("file");
|
||||
}
|
||||
|
||||
public final BUserChannel getUserChannel() {
|
||||
return (BUserChannel)this.get("user");
|
||||
}
|
||||
|
||||
public final BFoxChannel get(String string, Type type) {
|
||||
BFoxChannel bFoxChannel = (BFoxChannel)this.get(string);
|
||||
if (bFoxChannel != null) {
|
||||
if (bFoxChannel.getType() != type) {
|
||||
throw new ClassCastException("Type mismatch: " + bFoxChannel.getType() + " != " + type);
|
||||
}
|
||||
} else {
|
||||
bFoxChannel = (BFoxChannel)type.getInstance();
|
||||
this.add(string, (BValue)bFoxChannel, 2);
|
||||
if (((BFoxConnection)this.getParent()).isConnected()) {
|
||||
this.sessionOpened(bFoxChannel);
|
||||
}
|
||||
}
|
||||
return bFoxChannel;
|
||||
}
|
||||
|
||||
public static BFoxChannelRegistry getPrototype() {
|
||||
return prototype;
|
||||
}
|
||||
|
||||
public void sessionOpened() {
|
||||
SlotCursor slotCursor = this.getProperties();
|
||||
while (slotCursor.nextComponent()) {
|
||||
this.sessionOpened((BFoxChannel)slotCursor.get());
|
||||
}
|
||||
}
|
||||
|
||||
public void sessionClosed(Throwable throwable) {
|
||||
SlotCursor slotCursor = this.getProperties();
|
||||
while (slotCursor.nextComponent()) {
|
||||
this.sessionClosed((BFoxChannel)slotCursor.get(), throwable);
|
||||
}
|
||||
}
|
||||
|
||||
private final void sessionOpened(BFoxChannel bFoxChannel) {
|
||||
try {
|
||||
FoxSession foxSession = ((BFoxConnection)this.getParent()).session();
|
||||
bFoxChannel.log.setSession(foxSession);
|
||||
bFoxChannel.sessionOpened();
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private final void sessionClosed(BFoxChannel bFoxChannel, Throwable throwable) {
|
||||
try {
|
||||
bFoxChannel.sessionClosed(throwable);
|
||||
}
|
||||
catch (Throwable throwable2) {
|
||||
throwable2.printStackTrace();
|
||||
}
|
||||
bFoxChannel.log.setSession(null);
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
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$fox$sys$BFoxChannelRegistry;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxChannelRegistry = BFoxChannelRegistry.class("[Lcom.tridium.fox.sys.BFoxChannelRegistry;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
prototype = new BFoxChannelRegistry();
|
||||
prototype.add("data", (BValue)new BDataChannel());
|
||||
prototype.add("file", (BValue)new BFileChannel());
|
||||
prototype.add("spy", (BValue)new BSpyChannel());
|
||||
prototype.add("sys", (BValue)new BSysChannel());
|
||||
prototype.add("user", (BValue)new BUserChannel());
|
||||
try {
|
||||
prototype.add("alarmui", (BValue)((BFoxChannel)((Object)Sys.newInstance((String)"alarm", (String)"com.tridium.alarm.BAlarmConsoleChannel"))));
|
||||
}
|
||||
catch (Throwable throwable) {}
|
||||
icon = BIcon.std((String)"book.png");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,761 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.sys.Nre
|
||||
* javax.baja.naming.BHost
|
||||
* javax.baja.security.BICredentials
|
||||
* javax.baja.security.BPassword
|
||||
* javax.baja.security.BUsernameAndPassword
|
||||
* javax.baja.security.crypto.BTlsEnum
|
||||
* javax.baja.security.crypto.CertManagerFactory
|
||||
* javax.baja.spy.SpyWriter
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Clock$Ticket
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.ServiceNotFoundException
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.CoalesceQueue
|
||||
* javax.baja.util.IFuture
|
||||
* javax.baja.util.Invocation
|
||||
* javax.baja.util.ThreadPoolWorker
|
||||
* javax.baja.util.Worker$ITodo
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.session.Fox;
|
||||
import com.tridium.fox.session.FoxAuthenticationException;
|
||||
import com.tridium.fox.session.FoxConnection;
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import com.tridium.fox.session.FoxsRedirectException;
|
||||
import com.tridium.fox.sys.Acceptor;
|
||||
import com.tridium.fox.sys.BFoxChannelRegistry;
|
||||
import com.tridium.fox.sys.BFoxConnection;
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.fox.sys.NiagaraStation;
|
||||
import com.tridium.sys.Nre;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.naming.BHost;
|
||||
import javax.baja.security.BICredentials;
|
||||
import javax.baja.security.BPassword;
|
||||
import javax.baja.security.BUsernameAndPassword;
|
||||
import javax.baja.security.crypto.BTlsEnum;
|
||||
import javax.baja.security.crypto.CertManagerFactory;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.ServiceNotFoundException;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.CoalesceQueue;
|
||||
import javax.baja.util.IFuture;
|
||||
import javax.baja.util.Invocation;
|
||||
import javax.baja.util.ThreadPoolWorker;
|
||||
import javax.baja.util.Worker;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFoxClientConnection
|
||||
extends BFoxConnection {
|
||||
public static final Property port = BFoxClientConnection.newProperty((int)0, (int)1911, null);
|
||||
public static final Property useFoxs = BFoxClientConnection.newProperty((int)5, (boolean)false, null);
|
||||
public static final Property username = BFoxClientConnection.newProperty((int)0, (String)"", null);
|
||||
public static final Property password = BFoxClientConnection.newProperty((int)0, (BValue)BPassword.DEFAULT, null);
|
||||
public static final Property lastFailureTime = BFoxClientConnection.newProperty((int)1, (BValue)BAbsTime.DEFAULT, null);
|
||||
public static final Property lastFailureCause = BFoxClientConnection.newProperty((int)1, (String)"", null);
|
||||
public static final Property retryPeriod = BFoxClientConnection.newProperty((int)0, (BValue)BRelTime.make((long)300000L), null);
|
||||
public static final Property nextAttemptTime = BFoxClientConnection.newProperty((int)1, (BValue)BAbsTime.DEFAULT, null);
|
||||
public static final Action manualConnect = BFoxClientConnection.newAction((int)0, null);
|
||||
public static final Action manualDisconnect = BFoxClientConnection.newAction((int)0, null);
|
||||
public static final Action lingerTimeout = BFoxClientConnection.newAction((int)20, null);
|
||||
public static final Type TYPE;
|
||||
public static long engageLinger;
|
||||
private static CoalesceQueue queue;
|
||||
private static ThreadPoolWorker threadPool;
|
||||
private BFoxSession foxSession;
|
||||
private BICredentials credentials;
|
||||
private BHost remoteHost;
|
||||
private Object connectLock;
|
||||
private long lastFailureTicks;
|
||||
private Exception lastFailureException;
|
||||
private Object retryLock;
|
||||
private HashMap interests;
|
||||
private ArrayList interestLog;
|
||||
private Clock.Ticket lingerTicket;
|
||||
private boolean checkBrandCompatibility;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxClientConnection;
|
||||
|
||||
public int getPort() {
|
||||
return this.getInt(port);
|
||||
}
|
||||
|
||||
public void setPort(int n) {
|
||||
this.setInt(port, n, null);
|
||||
}
|
||||
|
||||
public boolean getUseFoxs() {
|
||||
return this.getBoolean(useFoxs);
|
||||
}
|
||||
|
||||
public void setUseFoxs(boolean bl) {
|
||||
this.setBoolean(useFoxs, bl, null);
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return this.getString(username);
|
||||
}
|
||||
|
||||
public void setUsername(String string) {
|
||||
this.setString(username, string, null);
|
||||
}
|
||||
|
||||
public BPassword getPassword() {
|
||||
return (BPassword)this.get(password);
|
||||
}
|
||||
|
||||
public void setPassword(BPassword bPassword) {
|
||||
this.set(password, (BValue)bPassword, null);
|
||||
}
|
||||
|
||||
public BAbsTime getLastFailureTime() {
|
||||
return (BAbsTime)this.get(lastFailureTime);
|
||||
}
|
||||
|
||||
public void setLastFailureTime(BAbsTime bAbsTime) {
|
||||
this.set(lastFailureTime, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public String getLastFailureCause() {
|
||||
return this.getString(lastFailureCause);
|
||||
}
|
||||
|
||||
public void setLastFailureCause(String string) {
|
||||
this.setString(lastFailureCause, string, null);
|
||||
}
|
||||
|
||||
public BRelTime getRetryPeriod() {
|
||||
return (BRelTime)this.get(retryPeriod);
|
||||
}
|
||||
|
||||
public void setRetryPeriod(BRelTime bRelTime) {
|
||||
this.set(retryPeriod, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public BAbsTime getNextAttemptTime() {
|
||||
return (BAbsTime)this.get(nextAttemptTime);
|
||||
}
|
||||
|
||||
public void setNextAttemptTime(BAbsTime bAbsTime) {
|
||||
this.set(nextAttemptTime, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public void manualConnect() {
|
||||
this.invoke(manualConnect, null, null);
|
||||
}
|
||||
|
||||
public void manualDisconnect() {
|
||||
this.invoke(manualDisconnect, null, null);
|
||||
}
|
||||
|
||||
public void lingerTimeout() {
|
||||
this.invoke(lingerTimeout, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
private final void init() {
|
||||
if (System.getProperty("java.vm.name").equalsIgnoreCase("J9")) {
|
||||
this.setUseFoxs(false);
|
||||
this.setFlags((Slot)useFoxs, this.getFlags((Slot)useFoxs) | 1 | 4);
|
||||
} else if (Sys.getStation() != null) {
|
||||
try {
|
||||
Nre.serviceManager.getService("platCrypto:CertManagerService");
|
||||
this.setFlags((Slot)useFoxs, this.getFlags((Slot)useFoxs) & 0xFFFFFFFA);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.setUseFoxs(false);
|
||||
this.setFlags((Slot)useFoxs, this.getFlags((Slot)useFoxs) | 1 | 4);
|
||||
}
|
||||
} else {
|
||||
this.setFlags((Slot)useFoxs, this.getFlags((Slot)useFoxs) & 0xFFFFFFFA);
|
||||
}
|
||||
this.set(channels, BFoxChannelRegistry.getPrototype().newCopy());
|
||||
}
|
||||
|
||||
public final BFoxSession getFoxSession() {
|
||||
return this.foxSession;
|
||||
}
|
||||
|
||||
public final NiagaraStation getParentStation() {
|
||||
BComplex bComplex = this.getParent();
|
||||
if (bComplex instanceof NiagaraStation) {
|
||||
return (NiagaraStation)bComplex;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public final BHost getRemoteHost() {
|
||||
if (this.getParent() instanceof NiagaraStation) {
|
||||
return ((NiagaraStation)this.getParent()).getRemoteHost();
|
||||
}
|
||||
return this.remoteHost;
|
||||
}
|
||||
|
||||
public void setRemoteHost(BHost bHost) {
|
||||
this.remoteHost = bHost;
|
||||
}
|
||||
|
||||
public void setRemoteHost(BHost bHost, int n) {
|
||||
this.setRemoteHost(bHost);
|
||||
this.setPort(n);
|
||||
}
|
||||
|
||||
public void setCredentials(BICredentials bICredentials) {
|
||||
this.credentials = bICredentials;
|
||||
}
|
||||
|
||||
public BICredentials getCredentials() {
|
||||
if (this.credentials != null) {
|
||||
return this.credentials;
|
||||
}
|
||||
return new BUsernameAndPassword(this.getUsername(), this.getPassword());
|
||||
}
|
||||
|
||||
public void sessionOpened(FoxSession foxSession) {
|
||||
NiagaraStation niagaraStation;
|
||||
if (this.checkBrandCompatibility) {
|
||||
Acceptor.accept(foxSession);
|
||||
}
|
||||
super.sessionOpened(foxSession);
|
||||
if (this.foxSession != null) {
|
||||
this.foxSession.sessionOpened();
|
||||
}
|
||||
if ((niagaraStation = this.getParentStation()) != null) {
|
||||
niagaraStation.clientOpened();
|
||||
}
|
||||
}
|
||||
|
||||
public void sessionClosed(FoxSession foxSession, Throwable throwable) {
|
||||
NiagaraStation niagaraStation;
|
||||
super.sessionClosed(foxSession, throwable);
|
||||
if (this.foxSession != null) {
|
||||
this.foxSession.sessionClosed();
|
||||
}
|
||||
if ((niagaraStation = this.getParentStation()) != null) {
|
||||
niagaraStation.clientClosed();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isTunnelClientConnection() {
|
||||
boolean bl = false;
|
||||
if (this.foxSession != null && this.foxSession.tunnelAuthorities != null) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public String[] getTunnelAuthorities() {
|
||||
return this.foxSession.tunnelAuthorities;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Unable to fully structure code
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void connect() throws Exception {
|
||||
var1_1 = this.getParentStation();
|
||||
var2_2 = Clock.ticks();
|
||||
var4_3 = this.connectLock;
|
||||
synchronized (var4_3) {
|
||||
block22: {
|
||||
if (this.isConnected()) {
|
||||
return;
|
||||
}
|
||||
if (this.lastFailureTicks > var2_2) {
|
||||
throw this.lastFailureException;
|
||||
}
|
||||
var6_4 = this.getState();
|
||||
var7_5 = FoxSession.createListeners(this);
|
||||
try {
|
||||
if (var1_1 != null && var1_1.isFatalFault()) {
|
||||
throw new Exception(var1_1.getFaultCause());
|
||||
}
|
||||
this.transition("Connecting...");
|
||||
this.setNextAttemptTime(BAbsTime.NULL);
|
||||
var8_6 = this.getRemoteHost();
|
||||
if (var8_6 == null) {
|
||||
throw new IllegalStateException("Remote host not set");
|
||||
}
|
||||
var9_8 = this.getCredentials();
|
||||
var10_10 = null;
|
||||
var11_14 = false;
|
||||
var12_15 = 4911;
|
||||
if (!this.getUseFoxs()) {
|
||||
try {
|
||||
var10_10 = var8_6.openSocket(this.getPort());
|
||||
Fox.open((FoxConnection)this, var10_10, var9_8, var7_5);
|
||||
}
|
||||
catch (FoxsRedirectException var13_16) {
|
||||
var10_10.close();
|
||||
var11_14 = true;
|
||||
var12_15 = var13_16.getPort();
|
||||
this.setPort(var13_16.getPort());
|
||||
this.setUseFoxs(true);
|
||||
this.log.message("received foxs redirect to port " + var12_15);
|
||||
}
|
||||
}
|
||||
if (this.getUseFoxs() || var11_14) {
|
||||
try {
|
||||
var13_17 = CertManagerFactory.getInstanceEx();
|
||||
var14_19 = var13_17.getClientSocketFactory(BTlsEnum.DEFAULT.getTag());
|
||||
var10_10 = var8_6.openSocket(this.getPort(), var14_19);
|
||||
if (this.foxSession != null) {
|
||||
this.foxSession.setUseFoxs(true);
|
||||
this.foxSession.setPort(this.getPort());
|
||||
}
|
||||
Fox.open((FoxConnection)this, var10_10, var9_8, var7_5);
|
||||
}
|
||||
catch (ServiceNotFoundException var13_18) {
|
||||
throw new IOException("CertManagerService not found.");
|
||||
}
|
||||
}
|
||||
this.lastFailureTicks = 0L;
|
||||
this.lastFailureException = null;
|
||||
this.setLastFailureTime(BAbsTime.NULL);
|
||||
this.setLastFailureCause("");
|
||||
this.pingOk();
|
||||
if (this.foxSession != null) {
|
||||
this.foxSession.postConnect();
|
||||
}
|
||||
}
|
||||
catch (Exception var8_7) {
|
||||
var9_9 = var8_7.toString();
|
||||
if (var8_7 instanceof FoxAuthenticationException) {
|
||||
var10_11 = (FoxAuthenticationException)var8_7;
|
||||
var9_9 = "Authentication Failed";
|
||||
if (var10_11.fatal != null) {
|
||||
var9_9 = var9_9 + ": " + var10_11.fatal;
|
||||
}
|
||||
}
|
||||
this.transition(var6_4);
|
||||
this.lastFailureTicks = Clock.ticks();
|
||||
this.lastFailureException = var8_7;
|
||||
this.setLastFailureTime(Clock.time());
|
||||
this.setLastFailureCause(var9_9);
|
||||
this.pingFail(var9_9);
|
||||
if (var7_5 == FoxSession.nullListeners) break block22;
|
||||
var10_12 = 0;
|
||||
if (true) ** GOTO lbl81
|
||||
}
|
||||
return;
|
||||
do {
|
||||
var7_5[var10_12].connectionAborted(var9_9, var8_7);
|
||||
++var10_12;
|
||||
lbl81:
|
||||
// 2 sources
|
||||
|
||||
} while (var10_12 < var7_5.length);
|
||||
}
|
||||
if (var7_5 != FoxSession.nullListeners) {
|
||||
var10_13 = 0;
|
||||
while (var10_13 < var7_5.length) {
|
||||
var7_5[var10_13].connectionAborted(var9_9, var8_7);
|
||||
++var10_13;
|
||||
}
|
||||
}
|
||||
throw var8_7;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public Interest[] getInterests() {
|
||||
HashMap hashMap = this.interests;
|
||||
synchronized (hashMap) {
|
||||
return this.interests.keySet().toArray(new Interest[this.interests.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
boolean hasInterests() {
|
||||
HashMap hashMap = this.interests;
|
||||
synchronized (hashMap) {
|
||||
return this.interests.isEmpty() ^ true;
|
||||
}
|
||||
}
|
||||
|
||||
public InterestLogItem[] getInterestLog() {
|
||||
InterestLogItem[] interestLogItemArray = this.interests.values().toArray(new InterestLogItem[this.interests.size()]);
|
||||
InterestLogItem[] interestLogItemArray2 = this.interestLog.toArray(new InterestLogItem[this.interestLog.size()]);
|
||||
InterestLogItem[] interestLogItemArray3 = new InterestLogItem[interestLogItemArray.length + interestLogItemArray2.length];
|
||||
System.arraycopy(interestLogItemArray, 0, interestLogItemArray3, 0, interestLogItemArray.length);
|
||||
System.arraycopy(interestLogItemArray2, 0, interestLogItemArray3, interestLogItemArray.length, interestLogItemArray2.length);
|
||||
return interestLogItemArray3;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public boolean isEngaged(Interest interest) {
|
||||
Interest interest2 = interest;
|
||||
synchronized (interest2) {
|
||||
boolean bl = false;
|
||||
if (this.interests.get(interest) == null) return bl;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void engageNoRetry(Interest interest) throws Exception {
|
||||
this.engageNoRetry(interest, 5000L);
|
||||
}
|
||||
|
||||
public void engageNoRetry(Interest interest, long l) throws Exception {
|
||||
this.engageNoRetry(interest, l, false);
|
||||
}
|
||||
|
||||
public void engageNoRetry(Interest interest, long l, boolean bl) throws Exception {
|
||||
Exception exception = this.lastFailureException;
|
||||
if (exception != null && Clock.ticks() - this.lastFailureTicks < l) {
|
||||
throw exception;
|
||||
}
|
||||
try {
|
||||
this.engage(interest, false);
|
||||
}
|
||||
catch (Exception exception2) {
|
||||
if (bl) {
|
||||
this.transition("Waiting for retry...");
|
||||
long l2 = this.getRetryPeriod().getMillis();
|
||||
this.setNextAttemptTime(BAbsTime.make((long)(Clock.millis() + l2)));
|
||||
}
|
||||
throw exception2;
|
||||
}
|
||||
}
|
||||
|
||||
public void engageRetry(Interest interest) throws Exception {
|
||||
this.engage(interest, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
private final void engage(Interest interest, boolean bl) throws Exception {
|
||||
HashMap hashMap = this.interests;
|
||||
synchronized (hashMap) {
|
||||
if (this.interests.get(interest) == null) {
|
||||
InterestLogItem interestLogItem = this.logEngaged(interest);
|
||||
this.interests.put(interest, interestLogItem);
|
||||
}
|
||||
if (this.lingerTicket != null) {
|
||||
this.lingerTicket.cancel();
|
||||
}
|
||||
}
|
||||
while (true) {
|
||||
try {
|
||||
this.connect();
|
||||
this.interruptRetries();
|
||||
return;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
if (!bl) {
|
||||
throw exception;
|
||||
}
|
||||
this.transition("Waiting for retry...");
|
||||
long l = this.getRetryPeriod().getMillis();
|
||||
this.setNextAttemptTime(BAbsTime.make((long)(Clock.millis() + l)));
|
||||
Object object = this.retryLock;
|
||||
synchronized (object) {
|
||||
this.retryLock.wait(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void disengage(Interest interest) {
|
||||
HashMap hashMap = this.interests;
|
||||
synchronized (hashMap) {
|
||||
block5: {
|
||||
block6: {
|
||||
int n = this.interests.size();
|
||||
if (interest != null) {
|
||||
InterestLogItem interestLogItem = (InterestLogItem)this.interests.get(interest);
|
||||
if (interestLogItem != null) {
|
||||
this.logDisengaged(interestLogItem);
|
||||
}
|
||||
this.interests.remove(interest);
|
||||
}
|
||||
if (n <= 0 || this.interests.size() != 0) break block5;
|
||||
if (!this.isRunning()) break block6;
|
||||
this.lingerTicket = Clock.schedule((BComponent)this, (BRelTime)BRelTime.make((long)engageLinger), (Action)lingerTimeout, null);
|
||||
break block5;
|
||||
}
|
||||
this.close();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void interruptRetries() {
|
||||
if (this.retryLock == null) {
|
||||
return;
|
||||
}
|
||||
Object object = this.retryLock;
|
||||
synchronized (object) {
|
||||
this.retryLock.notifyAll();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private final void transition(String string) {
|
||||
if (this.log.isTraceOn()) {
|
||||
this.log.trace(this.getState() + " -> " + string);
|
||||
}
|
||||
this.setState(string);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void doLingerTimeout() {
|
||||
HashMap hashMap = this.interests;
|
||||
synchronized (hashMap) {
|
||||
this.lingerTicket = null;
|
||||
if (this.interests.size() == 0) {
|
||||
this.close();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getCheckBrandCompatibility() {
|
||||
return this.checkBrandCompatibility;
|
||||
}
|
||||
|
||||
public void setCheckBrandCompatibility(boolean bl) {
|
||||
this.checkBrandCompatibility = bl;
|
||||
}
|
||||
|
||||
public void pingOk() {
|
||||
if (this.getParent() instanceof NiagaraStation) {
|
||||
((NiagaraStation)this.getParent()).pingOk();
|
||||
}
|
||||
}
|
||||
|
||||
public void pingFail(String string) {
|
||||
if (this.getParent() instanceof NiagaraStation) {
|
||||
((NiagaraStation)this.getParent()).pingFail(string);
|
||||
}
|
||||
}
|
||||
|
||||
public void doManualConnect() throws Exception {
|
||||
this.connect();
|
||||
}
|
||||
|
||||
public void doManualDisconnect() throws Exception {
|
||||
this.close();
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public IFuture post(Action action, BValue bValue, Context context) {
|
||||
if (!action.equals((Object)lingerTimeout)) return super.post(action, bValue, context);
|
||||
try {
|
||||
if (!threadPool.isRunning()) {
|
||||
ThreadPoolWorker threadPoolWorker = threadPool;
|
||||
synchronized (threadPoolWorker) {
|
||||
if (!threadPool.isRunning()) {
|
||||
threadPool.start("foxLingerTimeout");
|
||||
}
|
||||
}
|
||||
}
|
||||
queue.enqueue((Object)new Invocation((BComponent)this, action, bValue, context));
|
||||
return null;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.log.error("Could not invoke lingerTimeout action on fox client connection " + this.toDebugString(), exception);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (property.isFrozen() && (property.getDefaultFlags() & 1) == 0) {
|
||||
this.interruptRetries();
|
||||
}
|
||||
}
|
||||
|
||||
private final InterestLogItem logEngaged(Interest interest) {
|
||||
InterestLogItem interestLogItem = new InterestLogItem();
|
||||
interestLogItem.interest = interest.toString();
|
||||
interestLogItem.startTicks = Clock.ticks();
|
||||
return interestLogItem;
|
||||
}
|
||||
|
||||
private final void logDisengaged(InterestLogItem interestLogItem) {
|
||||
interestLogItem.endTicks = Clock.ticks();
|
||||
while (this.interestLog.size() >= 20) {
|
||||
this.interestLog.remove(0);
|
||||
}
|
||||
this.interestLog.add(interestLogItem);
|
||||
}
|
||||
|
||||
public static void spyThreadPoolWorker(SpyWriter spyWriter) {
|
||||
try {
|
||||
threadPool.spy(spyWriter);
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
}
|
||||
|
||||
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.connectLock = new Object();
|
||||
this.retryLock = new Object();
|
||||
this.interests = new HashMap(5);
|
||||
this.interestLog = new ArrayList(20);
|
||||
this.checkBrandCompatibility = true;
|
||||
}
|
||||
|
||||
public BFoxClientConnection(BFoxSession bFoxSession) {
|
||||
this.this();
|
||||
this.foxSession = bFoxSession;
|
||||
this.setRemoteHost(bFoxSession.getHost());
|
||||
this.setPort(bFoxSession.getPort());
|
||||
this.setUseFoxs(bFoxSession.getUseFoxs());
|
||||
this.init();
|
||||
}
|
||||
|
||||
public BFoxClientConnection() {
|
||||
this.this();
|
||||
this.init();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$BFoxClientConnection;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxClientConnection = BFoxClientConnection.class("[Lcom.tridium.fox.sys.BFoxClientConnection;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
engageLinger = 5000L;
|
||||
try {
|
||||
engageLinger = Long.parseLong(System.getProperty("niagara.fox.engageLinger", "" + engageLinger).trim());
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
queue = new CoalesceQueue(1000);
|
||||
threadPool = new ThreadPoolWorker((Worker.ITodo)queue);
|
||||
threadPool.setMaxThreads(1000);
|
||||
}
|
||||
|
||||
public static interface Interest {
|
||||
public int hashCode();
|
||||
|
||||
public boolean equals(Object var1);
|
||||
|
||||
public String toString();
|
||||
}
|
||||
|
||||
public static class InterestLogItem {
|
||||
public String interest;
|
||||
public long startTicks;
|
||||
public long endTicks;
|
||||
}
|
||||
|
||||
public static class StringInterest
|
||||
implements Interest {
|
||||
private String string;
|
||||
|
||||
public int hashCode() {
|
||||
return this.string.hashCode();
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (object instanceof StringInterest) {
|
||||
return ((StringInterest)object).string.equals(this.string);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.string;
|
||||
}
|
||||
|
||||
public StringInterest(String string) {
|
||||
if (string == null) {
|
||||
throw new IllegalArgumentException("interest string is null");
|
||||
}
|
||||
this.string = string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,338 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.sys.Nre
|
||||
* com.tridium.sys.license.Brand
|
||||
* javax.baja.net.NotConnectedException
|
||||
* javax.baja.spy.Spy
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BStation
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.timezone.BTimeZone
|
||||
* javax.baja.user.BUserService
|
||||
* javax.baja.util.Version
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.encoding.BogCodec;
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.session.FoxAsyncCallbacks;
|
||||
import com.tridium.fox.session.FoxCircuit;
|
||||
import com.tridium.fox.session.FoxConnection;
|
||||
import com.tridium.fox.session.FoxRequest;
|
||||
import com.tridium.fox.session.FoxResponse;
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import com.tridium.fox.session.InvalidChannelException;
|
||||
import com.tridium.fox.sys.BFoxAuthAgent;
|
||||
import com.tridium.fox.sys.BFoxChannel;
|
||||
import com.tridium.fox.sys.BFoxChannelRegistry;
|
||||
import com.tridium.fox.sys.BFoxClientConnection;
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.fox.sys.NiagaraStation;
|
||||
import com.tridium.fox.sys.spy.FoxIndexSpy;
|
||||
import com.tridium.fox.sys.spy.FoxLog;
|
||||
import com.tridium.sys.Nre;
|
||||
import com.tridium.sys.license.Brand;
|
||||
import java.net.Socket;
|
||||
import javax.baja.net.NotConnectedException;
|
||||
import javax.baja.spy.Spy;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BStation;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.timezone.BTimeZone;
|
||||
import javax.baja.user.BUserService;
|
||||
import javax.baja.util.Version;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BFoxConnection
|
||||
extends BComponent
|
||||
implements FoxConnection {
|
||||
public static final Property state = BFoxConnection.newProperty((int)3, (String)"Not connected", null);
|
||||
public static final Property lastConnectTime = BFoxConnection.newProperty((int)65537, (BValue)BAbsTime.DEFAULT, null);
|
||||
public static final Property lastDisconnectTime = BFoxConnection.newProperty((int)65537, (BValue)BAbsTime.DEFAULT, null);
|
||||
public static final Property lastDisconnectCause = BFoxConnection.newProperty((int)1, (String)"", null);
|
||||
public static final Property channels = BFoxConnection.newProperty((int)7, (BValue)new BFoxChannelRegistry(), null);
|
||||
public static final Type TYPE;
|
||||
private static final BIcon icon;
|
||||
protected final FoxLog log;
|
||||
private FoxSession session;
|
||||
private Version remoteVersion;
|
||||
Integer fwConnectionType;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxConnection;
|
||||
|
||||
public String getState() {
|
||||
return this.getString(state);
|
||||
}
|
||||
|
||||
public void setState(String string) {
|
||||
this.setString(state, string, null);
|
||||
}
|
||||
|
||||
public BAbsTime getLastConnectTime() {
|
||||
return (BAbsTime)this.get(lastConnectTime);
|
||||
}
|
||||
|
||||
public void setLastConnectTime(BAbsTime bAbsTime) {
|
||||
this.set(lastConnectTime, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public BAbsTime getLastDisconnectTime() {
|
||||
return (BAbsTime)this.get(lastDisconnectTime);
|
||||
}
|
||||
|
||||
public void setLastDisconnectTime(BAbsTime bAbsTime) {
|
||||
this.set(lastDisconnectTime, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public String getLastDisconnectCause() {
|
||||
return this.getString(lastDisconnectCause);
|
||||
}
|
||||
|
||||
public void setLastDisconnectCause(String string) {
|
||||
this.setString(lastDisconnectCause, string, null);
|
||||
}
|
||||
|
||||
public BFoxChannelRegistry getChannels() {
|
||||
return (BFoxChannelRegistry)this.get(channels);
|
||||
}
|
||||
|
||||
public void setChannels(BFoxChannelRegistry bFoxChannelRegistry) {
|
||||
this.set(channels, (BValue)bFoxChannelRegistry, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public final boolean isConnected() {
|
||||
boolean bl = false;
|
||||
if (this.session != null && !this.session.isClosed()) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public void assertConnected() throws NotConnectedException {
|
||||
if (this.session == null || this.session.isClosed()) {
|
||||
throw new NotConnectedException();
|
||||
}
|
||||
}
|
||||
|
||||
public FoxSession session() {
|
||||
return this.session;
|
||||
}
|
||||
|
||||
public Version getRemoteVersion() {
|
||||
return this.remoteVersion;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
this.setState("Not connected");
|
||||
if (this.session != null) {
|
||||
this.session.close(null);
|
||||
}
|
||||
}
|
||||
|
||||
public NiagaraStation getParentStation() {
|
||||
if (this.getParent() instanceof NiagaraStation) {
|
||||
return (NiagaraStation)this.getParent();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void initHello(FoxMessage foxMessage) throws Exception {
|
||||
NiagaraStation niagaraStation;
|
||||
BStation bStation;
|
||||
BFoxSession bFoxSession = null;
|
||||
if (this instanceof BFoxClientConnection) {
|
||||
bFoxSession = ((BFoxClientConnection)this).getFoxSession();
|
||||
bStation = this.get("httpSession");
|
||||
if (bStation instanceof BString) {
|
||||
foxMessage.add("httpSession", ((BString)bStation).getString());
|
||||
}
|
||||
}
|
||||
if ((bStation = Sys.getStation()) != null && bFoxSession == null) {
|
||||
foxMessage.add("station.name", bStation.getStationName());
|
||||
}
|
||||
if ((niagaraStation = this.getParentStation()) != null) {
|
||||
niagaraStation.initHello(foxMessage);
|
||||
}
|
||||
foxMessage.add("lang", Sys.getLanguage());
|
||||
foxMessage.add("timeZone", BTimeZone.getLocal().encodeToString());
|
||||
foxMessage.add("hostId", Nre.getHostId());
|
||||
foxMessage.add("vmUuid", Nre.vmUuid);
|
||||
try {
|
||||
foxMessage.add("brandId", Brand.getBrandId());
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
if (bStation != null) {
|
||||
BFoxAuthAgent bFoxAuthAgent;
|
||||
BUserService bUserService;
|
||||
BFacets bFacets = bStation.getSysInfo();
|
||||
BogCodec.add(foxMessage, "sysInfo", (BValue)bFacets, null);
|
||||
String string = bFacets.gets("realms", null);
|
||||
if (string != null) {
|
||||
foxMessage.add("realms", string);
|
||||
}
|
||||
if ((bUserService = BUserService.getService()) != null && (bFoxAuthAgent = (BFoxAuthAgent)bUserService.getAuthAgent(BFoxAuthAgent.TYPE)) != null) {
|
||||
foxMessage.add("authAgentTypeSpecs", bFoxAuthAgent.getType().getTypeSpec().encodeToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sessionOpened(FoxSession foxSession) {
|
||||
this.session = foxSession;
|
||||
this.log.opened(foxSession);
|
||||
this.setState("Connected [" + foxSession.getId() + ']');
|
||||
this.setLastConnectTime(Clock.time());
|
||||
this.getChannels().sessionOpened();
|
||||
try {
|
||||
this.remoteVersion = new Version(foxSession.getRemoteHello().getString("app.version"));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void sessionClosed(FoxSession foxSession, Throwable throwable) {
|
||||
this.log.closed(foxSession, throwable);
|
||||
this.session = null;
|
||||
this.setState("Not connected");
|
||||
this.setLastDisconnectTime(Clock.time());
|
||||
this.setLastDisconnectCause(throwable == null ? "" : throwable.toString());
|
||||
this.getChannels().sessionClosed(throwable);
|
||||
}
|
||||
|
||||
public FoxResponse process(FoxRequest foxRequest) throws Throwable {
|
||||
return this.getChannel(foxRequest.channel).process(foxRequest);
|
||||
}
|
||||
|
||||
public void circuitOpened(FoxCircuit foxCircuit) throws Throwable {
|
||||
this.getChannel(foxCircuit.channel).circuitOpened(foxCircuit);
|
||||
}
|
||||
|
||||
private final BFoxChannel getChannel(String string) {
|
||||
BFoxChannel bFoxChannel = (BFoxChannel)this.getChannels().get(string);
|
||||
if (bFoxChannel != null) {
|
||||
return bFoxChannel;
|
||||
}
|
||||
BFoxChannel bFoxChannel2 = (BFoxChannel)BFoxChannelRegistry.getPrototype().get(string);
|
||||
if (bFoxChannel2 != null) {
|
||||
bFoxChannel = (BFoxChannel)bFoxChannel2.newCopy();
|
||||
this.getChannels().add(string, (BValue)bFoxChannel);
|
||||
return bFoxChannel;
|
||||
}
|
||||
throw new InvalidChannelException(string);
|
||||
}
|
||||
|
||||
public Thread makeThread(ThreadGroup threadGroup, Runnable runnable, String string) {
|
||||
return new Thread(threadGroup, runnable, string);
|
||||
}
|
||||
|
||||
public void error(String string, Throwable throwable) {
|
||||
this.log.error(string, throwable);
|
||||
}
|
||||
|
||||
public boolean isTunnelClientConnection() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isTunnelServerConnection() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String[] getTunnelAuthorities() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Socket createTunnelSocket(String string, boolean bl) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
public FoxResponse sendSync(FoxRequest foxRequest) throws Exception {
|
||||
FoxSession foxSession = this.session;
|
||||
if (foxSession == null) {
|
||||
throw new NotConnectedException();
|
||||
}
|
||||
return foxSession.sendSync(foxRequest);
|
||||
}
|
||||
|
||||
public void sendAsync(FoxRequest foxRequest) throws Exception {
|
||||
this.sendAsync(foxRequest, null);
|
||||
}
|
||||
|
||||
public void sendAsync(FoxRequest foxRequest, FoxAsyncCallbacks foxAsyncCallbacks) throws Exception {
|
||||
FoxSession foxSession = this.session;
|
||||
if (foxSession == null) {
|
||||
throw new NotConnectedException();
|
||||
}
|
||||
foxSession.sendAsync(foxRequest, foxAsyncCallbacks);
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public final Object fw(int n, Object object, Object object2, Object object3, Object object4) {
|
||||
if (n == 803) {
|
||||
if (object instanceof Integer) {
|
||||
this.fwConnectionType = (Integer)object;
|
||||
}
|
||||
return this.fwConnectionType;
|
||||
}
|
||||
return super.fw(n, object, object2, object3, object4);
|
||||
}
|
||||
|
||||
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.log = FoxLog.make("fox");
|
||||
this.fwConnectionType = FoxSession.NON_FW_FOX_SESSION;
|
||||
}
|
||||
|
||||
public BFoxConnection() {
|
||||
this.this();
|
||||
this.set(channels, BFoxChannelRegistry.getPrototype().newCopy());
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$BFoxConnection;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxConnection = BFoxConnection.class("[Lcom.tridium.fox.sys.BFoxConnection;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
icon = BIcon.std((String)"connection.png");
|
||||
Spy.ROOT.add("fox", (Spy)new FoxIndexSpy());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.nre.auth.ScramSha256Server
|
||||
* com.tridium.nre.auth.ScramSha256Server$IUserKeyFactory
|
||||
* com.tridium.util.ValueByteBuffer
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.security.AuthenticationException
|
||||
* javax.baja.security.BHttpFoxCredentials
|
||||
* javax.baja.security.BICredentials
|
||||
* javax.baja.security.BPassword
|
||||
* javax.baja.security.BPbkdf2HmacSha256PasswordEncoder
|
||||
* javax.baja.security.BUsernameAndPassword
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.user.AuthenticateUtil
|
||||
* javax.baja.user.BUser
|
||||
* javax.baja.user.BUserService
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.session.FoxAuthenticationException;
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import com.tridium.fox.sys.Acceptor;
|
||||
import com.tridium.fox.sys.BFoxAuthAgent;
|
||||
import com.tridium.fox.sys.BFoxServerConnection;
|
||||
import com.tridium.fox.sys.BFoxService;
|
||||
import com.tridium.fox.sys.FatalAuthenticationException;
|
||||
import com.tridium.nre.auth.ScramSha256Server;
|
||||
import com.tridium.util.ValueByteBuffer;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.security.AuthenticationException;
|
||||
import javax.baja.security.BHttpFoxCredentials;
|
||||
import javax.baja.security.BICredentials;
|
||||
import javax.baja.security.BPassword;
|
||||
import javax.baja.security.BPbkdf2HmacSha256PasswordEncoder;
|
||||
import javax.baja.security.BUsernameAndPassword;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.user.AuthenticateUtil;
|
||||
import javax.baja.user.BUser;
|
||||
import javax.baja.user.BUserService;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFoxDefaultAuthAgent
|
||||
extends BFoxAuthAgent {
|
||||
public static final BFoxDefaultAuthAgent INSTANCE = new BFoxDefaultAuthAgent();
|
||||
public static final Type TYPE;
|
||||
Lexicon lex;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxDefaultAuthAgent;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
protected boolean authenticateBasic(FoxSession foxSession) throws Exception {
|
||||
BUsernameAndPassword bUsernameAndPassword;
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("method", "basic");
|
||||
foxSession.setState("server.tune sendChallenge basic");
|
||||
foxSession.sendTuning("challenge", foxMessage);
|
||||
foxSession.setState("server.tune receiveLogin");
|
||||
FoxMessage foxMessage2 = foxSession.receiveTuning("login");
|
||||
String string = foxMessage2.getString("username");
|
||||
String string2 = foxMessage2.getString("password", null);
|
||||
BICredentials bICredentials = this.extractCredentials(foxSession, foxMessage2);
|
||||
if (bICredentials != null) {
|
||||
if (bICredentials instanceof BUsernameAndPassword) {
|
||||
bUsernameAndPassword = (BUsernameAndPassword)bICredentials;
|
||||
string = bUsernameAndPassword.getUsername();
|
||||
string2 = bUsernameAndPassword.getPassword().encodeToString();
|
||||
} else if (bICredentials instanceof BHttpFoxCredentials) {
|
||||
bUsernameAndPassword = (BHttpFoxCredentials)bICredentials;
|
||||
string = bUsernameAndPassword.getUsername();
|
||||
string2 = "";
|
||||
} else {
|
||||
throw new FoxAuthenticationException("Unsupported credential type: " + bICredentials.getType().getTypeName(), foxSession);
|
||||
}
|
||||
}
|
||||
foxSession.setState("server.tune receivedLogin user=" + string + " pass.len=" + string2.length());
|
||||
Acceptor.accept(foxSession);
|
||||
bUsernameAndPassword = this.authenticateAttempt(foxSession, string);
|
||||
Context context = this.getAuditContext(foxSession);
|
||||
BUser bUser = null;
|
||||
if (bICredentials instanceof BHttpFoxCredentials) {
|
||||
try {
|
||||
bUser = BUserService.httpHandler.processCredentials((BHttpFoxCredentials)bICredentials, foxSession.getRemoteHost());
|
||||
bUser.authenticateOk((BUserService)bUsernameAndPassword);
|
||||
bUsernameAndPassword.auditLoginAttempt(true, bUser, context);
|
||||
}
|
||||
catch (AuthenticationException authenticationException) {
|
||||
if (bUser != null) {
|
||||
bUser.authenticateFailed((BUserService)bUsernameAndPassword);
|
||||
bUsernameAndPassword.auditLoginAttempt(false, bUser, context);
|
||||
}
|
||||
if (authenticationException.getMessage().startsWith("Fatal")) {
|
||||
throw authenticationException;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
try {
|
||||
bUser = this.authenticateUser((BUserService)bUsernameAndPassword, string, string2, context);
|
||||
}
|
||||
catch (AuthenticationException authenticationException) {
|
||||
return false;
|
||||
}
|
||||
this.authenticateSuccess(foxSession, bUser);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean authenticateDigest(FoxSession foxSession) throws Exception {
|
||||
FoxMessage foxMessage = foxSession.getRemoteHello();
|
||||
if (foxMessage.getString("fox.version", "1.0").compareTo("1.0.1") < 0) {
|
||||
BFoxService bFoxService = (BFoxService)Sys.getService((Type)BFoxService.TYPE);
|
||||
BAbsTime bAbsTime = bFoxService.getLegacyAuthentication();
|
||||
if (!bAbsTime.isNull() && bAbsTime.isAfter(BAbsTime.now())) {
|
||||
return this.authenticateBasic(foxSession);
|
||||
}
|
||||
Log log = Log.getLog((String)"fox");
|
||||
if (log.isTraceOn()) {
|
||||
log.error(this.lex.getText("fox.legacy.cannotAuth"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
FoxMessage foxMessage2 = new FoxMessage();
|
||||
foxMessage2.add("method", "digest");
|
||||
foxSession.setState("server.tune sendChallenge digest");
|
||||
foxSession.sendTuning("challenge", foxMessage2);
|
||||
BUserService bUserService = (BUserService)Sys.getService((Type)BUserService.TYPE);
|
||||
BUser bUser = null;
|
||||
Context context = this.getAuditContext(foxSession);
|
||||
try {
|
||||
Acceptor.accept(foxSession);
|
||||
ScramSha256Server scramSha256Server = new ScramSha256Server((ScramSha256Server.IUserKeyFactory)new FoxUserKeyFactory(foxSession));
|
||||
bUserService = this.authenticateAttempt(foxSession, scramSha256Server.getUserName());
|
||||
foxSession.setState("server.tune receive firstMessage");
|
||||
FoxMessage foxMessage3 = foxSession.receiveTuning("authMessage1");
|
||||
String string = foxMessage3.getString("authInput");
|
||||
if (string.equals("authInputHttp")) {
|
||||
try {
|
||||
byte[] byArray = foxMessage3.getBlob("credentials");
|
||||
BHttpFoxCredentials bHttpFoxCredentials = (BHttpFoxCredentials)ValueByteBuffer.unmarshal((byte[])byArray);
|
||||
bUser = BUserService.httpHandler.processCredentials(bHttpFoxCredentials, foxSession.getRemoteHost());
|
||||
}
|
||||
catch (AuthenticationException authenticationException) {
|
||||
if (authenticationException.getMessage().startsWith("Fatal")) {
|
||||
throw new FatalAuthenticationException(authenticationException.getMessage());
|
||||
}
|
||||
throw authenticationException;
|
||||
}
|
||||
} else if (string.equals("authInputScram")) {
|
||||
String string2 = foxMessage3.getString("authHandshake1");
|
||||
String string3 = scramSha256Server.createServerFirstMessage(string2);
|
||||
bUser = bUserService.getUser(scramSha256Server.getUserName());
|
||||
FoxMessage foxMessage4 = new FoxMessage();
|
||||
foxMessage4.add("authHandshake1", string3);
|
||||
foxSession.setState("server.tune send scramsha1-serverFirstMessage");
|
||||
foxSession.sendTuning("authMessage1", foxMessage4);
|
||||
foxSession.setState("server.tune receive scramsha1-clientFinalMessage");
|
||||
foxMessage3 = foxSession.receiveTuning("authMessage2");
|
||||
String string4 = foxMessage3.getString("authHandshake2");
|
||||
String string5 = scramSha256Server.createServerFinalMessage(string4);
|
||||
foxMessage4 = new FoxMessage();
|
||||
foxMessage4.add("authHandshake2", string5);
|
||||
foxSession.setState("server.tune send scramsha1-serverFinalMessage");
|
||||
foxSession.sendTuning("authMessage2", foxMessage4);
|
||||
} else if (string.equals("authInputRetrieve")) {
|
||||
throw new IllegalStateException("Password retrieval is not supported.");
|
||||
}
|
||||
bUser.authenticateOk(bUserService);
|
||||
bUserService.auditLoginAttempt(true, bUser, context);
|
||||
this.authenticateSuccess(foxSession, bUser);
|
||||
return true;
|
||||
}
|
||||
catch (FatalAuthenticationException fatalAuthenticationException) {
|
||||
throw fatalAuthenticationException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
if (bUser != null) {
|
||||
bUser.authenticateFailed(bUserService);
|
||||
bUserService.auditLoginAttempt(false, bUser, context);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected Context getAuditContext(FoxSession foxSession) {
|
||||
BFacets bFacets = null;
|
||||
if (BFoxService.auditConnection(foxSession)) {
|
||||
bFacets = BFacets.make((String)"target", (BIDataValue)BString.make((String)((BFoxServerConnection)foxSession.conn()).toPathString()), (String)"slotName", (BIDataValue)BString.make((String)foxSession.getRemoteHost()));
|
||||
}
|
||||
return bFacets;
|
||||
}
|
||||
|
||||
protected BUser authenticateUser(BUserService bUserService, String string, String string2, Context context) {
|
||||
return AuthenticateUtil.authenticateUsernameAndPassword((String)string, (String)string2, (BUserService)bUserService, (Context)context);
|
||||
}
|
||||
|
||||
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() {
|
||||
Class clazz = class$com$tridium$fox$sys$BFoxDefaultAuthAgent;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxDefaultAuthAgent = BFoxDefaultAuthAgent.class("[Lcom.tridium.fox.sys.BFoxDefaultAuthAgent;", false);
|
||||
}
|
||||
this.lex = Lexicon.make((Class)clazz);
|
||||
}
|
||||
|
||||
public BFoxDefaultAuthAgent() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$BFoxDefaultAuthAgent;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxDefaultAuthAgent = BFoxDefaultAuthAgent.class("[Lcom.tridium.fox.sys.BFoxDefaultAuthAgent;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
protected class FoxUserKeyFactory
|
||||
implements ScramSha256Server.IUserKeyFactory {
|
||||
private FoxSession session;
|
||||
|
||||
public String getUserKey(String string) {
|
||||
BUserService bUserService = BFoxDefaultAuthAgent.this.authenticateAttempt(this.session, string);
|
||||
BUser bUser = bUserService.getUser(string);
|
||||
if (bUser == null || !bUserService.canLogin(bUser)) {
|
||||
BPbkdf2HmacSha256PasswordEncoder bPbkdf2HmacSha256PasswordEncoder = BPbkdf2HmacSha256PasswordEncoder.makeFake((String)string);
|
||||
return bPbkdf2HmacSha256PasswordEncoder.getValue();
|
||||
}
|
||||
BPbkdf2HmacSha256PasswordEncoder.makeFake((String)string);
|
||||
BPassword bPassword = bUser.getPassword();
|
||||
BPbkdf2HmacSha256PasswordEncoder bPbkdf2HmacSha256PasswordEncoder = (BPbkdf2HmacSha256PasswordEncoder)bPassword.getPasswordEncoder();
|
||||
return bPbkdf2HmacSha256PasswordEncoder.getValue();
|
||||
}
|
||||
|
||||
public FoxUserKeyFactory(FoxSession foxSession) {
|
||||
this.session = foxSession;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.net.HttpUtil
|
||||
* javax.baja.naming.BHost
|
||||
* javax.baja.naming.BIpHost
|
||||
* javax.baja.naming.BStationSessionScheme
|
||||
* javax.baja.naming.OrdQuery
|
||||
* javax.baja.naming.OrdQueryList
|
||||
* javax.baja.naming.OrdTarget
|
||||
* javax.baja.naming.SyntaxException
|
||||
* javax.baja.naming.UnresolvedException
|
||||
* javax.baja.nre.util.TextUtil
|
||||
* javax.baja.security.AuthenticationException
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.fox.sys.LocalizableServerException;
|
||||
import com.tridium.net.HttpUtil;
|
||||
import javax.baja.naming.BHost;
|
||||
import javax.baja.naming.BIpHost;
|
||||
import javax.baja.naming.BStationSessionScheme;
|
||||
import javax.baja.naming.OrdQuery;
|
||||
import javax.baja.naming.OrdQueryList;
|
||||
import javax.baja.naming.OrdTarget;
|
||||
import javax.baja.naming.SyntaxException;
|
||||
import javax.baja.naming.UnresolvedException;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
import javax.baja.security.AuthenticationException;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFoxScheme
|
||||
extends BStationSessionScheme {
|
||||
public static final int DEFAULT_PORT = 1911;
|
||||
public static final String SCHEME_NAME = "fox";
|
||||
public static final BFoxScheme INSTANCE = new BFoxScheme();
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxScheme;
|
||||
|
||||
public OrdQuery parse(String string) {
|
||||
return new FoxQuery(string);
|
||||
}
|
||||
|
||||
public OrdTarget resolve(OrdTarget ordTarget, OrdQuery ordQuery) throws SyntaxException, UnresolvedException {
|
||||
Object object;
|
||||
BHost bHost;
|
||||
BHost bHost2 = null;
|
||||
BObject bObject = ordTarget.get();
|
||||
bHost2 = bObject instanceof BHost ? (BHost)bObject : ((BComponent)bObject).getHost();
|
||||
FoxQuery foxQuery = (FoxQuery)ordQuery;
|
||||
int n = foxQuery.port;
|
||||
String[] stringArray = foxQuery.tunnelAuthorities;
|
||||
BFoxSession bFoxSession = BFoxSession.make(null, bHost2, n, false, stringArray);
|
||||
if (Sys.isStationStarted() && stringArray != null && stringArray.length > 0 && (bHost = BHost.getHost((String)(object = BFoxScheme.parseHost(stringArray[stringArray.length - 1])))) == null) {
|
||||
bHost = new BIpHost((String)object);
|
||||
BHost.mount((BHost)bHost);
|
||||
}
|
||||
try {
|
||||
bFoxSession.connect();
|
||||
if (bFoxSession.getUseFoxs() && (object = (BFoxSession)bHost2.getNavChild(BFoxSession.buildNavName(bFoxSession.getPort(), true, stringArray))) != null) {
|
||||
((BFoxSession)object).close();
|
||||
}
|
||||
return new OrdTarget(ordTarget, (BObject)bFoxSession);
|
||||
}
|
||||
catch (LocalizableServerException localizableServerException) {
|
||||
if (localizableServerException.getLexiconModule().equals(SCHEME_NAME) && localizableServerException.getLexiconKey().equals("error.NoPermissionForStation")) {
|
||||
bFoxSession.disconnect();
|
||||
}
|
||||
throw localizableServerException;
|
||||
}
|
||||
catch (AuthenticationException authenticationException) {
|
||||
throw authenticationException;
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
throw new UnresolvedException(ordQuery.toString(), throwable);
|
||||
}
|
||||
}
|
||||
|
||||
public int getDefaultPort() {
|
||||
return 1911;
|
||||
}
|
||||
|
||||
static String parseHost(String string) {
|
||||
return HttpUtil.parseHost((String)string);
|
||||
}
|
||||
|
||||
static int parsePort(String string) {
|
||||
return HttpUtil.parsePort((String)string, (int)1911);
|
||||
}
|
||||
|
||||
static String[] validateAuthorities(String[] stringArray) {
|
||||
if (stringArray == null) {
|
||||
return null;
|
||||
}
|
||||
int n = stringArray.length;
|
||||
if (n < 1) {
|
||||
return null;
|
||||
}
|
||||
String[] stringArray2 = new String[n];
|
||||
int n2 = 0;
|
||||
int n3 = 0;
|
||||
while (n3 < n) {
|
||||
if (stringArray[n3] != null && !stringArray[n3].equals("")) {
|
||||
stringArray2[n2] = stringArray[n3];
|
||||
++n2;
|
||||
}
|
||||
++n3;
|
||||
}
|
||||
String[] stringArray3 = new String[n2];
|
||||
System.arraycopy(stringArray2, 0, stringArray3, 0, n2);
|
||||
return stringArray3;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
private BFoxScheme() {
|
||||
super(SCHEME_NAME);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$BFoxScheme;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxScheme = BFoxScheme.class("[Lcom.tridium.fox.sys.BFoxScheme;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public static class FoxQuery
|
||||
implements OrdQuery {
|
||||
int port;
|
||||
String[] tunnelAuthorities;
|
||||
|
||||
public boolean isHost() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSession() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void normalize(OrdQueryList ordQueryList, int n) {
|
||||
ordQueryList.shiftToHost(n);
|
||||
}
|
||||
|
||||
public String getScheme() {
|
||||
return BFoxScheme.SCHEME_NAME;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
if (this.port != 1911) {
|
||||
stringBuffer.append(String.valueOf(this.port));
|
||||
}
|
||||
if (this.tunnelAuthorities != null) {
|
||||
int n = 0;
|
||||
while (n < this.tunnelAuthorities.length) {
|
||||
if (this.tunnelAuthorities[n] != null && !this.tunnelAuthorities[n].equals("")) {
|
||||
stringBuffer.append("/").append(this.tunnelAuthorities[n]);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "fox:" + this.getBody();
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public String[] getTunnelAuthorities() {
|
||||
return this.tunnelAuthorities;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.tunnelAuthorities = null;
|
||||
}
|
||||
|
||||
FoxQuery(String string) {
|
||||
this.this();
|
||||
string = string.trim();
|
||||
if (string.length() == 0) {
|
||||
this.port = 1911;
|
||||
} else {
|
||||
int n = string.indexOf(47);
|
||||
if (n >= 0) {
|
||||
this.port = n == 0 ? 1911 : Integer.parseInt(string.substring(0, n));
|
||||
string = string.substring(n);
|
||||
this.tunnelAuthorities = BFoxScheme.validateAuthorities(TextUtil.splitAndTrim((String)string, (char)'/'));
|
||||
} else {
|
||||
this.port = Integer.parseInt(string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FoxQuery(int n) {
|
||||
this.this();
|
||||
this.port = n;
|
||||
}
|
||||
|
||||
FoxQuery(int n, String[] stringArray) {
|
||||
this.this();
|
||||
this.port = n;
|
||||
this.tunnelAuthorities = BFoxScheme.validateAuthorities(stringArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.util.ContextThread
|
||||
* javax.baja.security.AuditEvent
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.user.BUser
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import com.tridium.fox.sys.BFoxConnection;
|
||||
import com.tridium.fox.sys.BFoxService;
|
||||
import com.tridium.fox.sys.BServerConnections;
|
||||
import com.tridium.fox.sys.NiagaraStation;
|
||||
import com.tridium.util.ContextThread;
|
||||
import javax.baja.security.AuditEvent;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
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.user.BUser;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFoxServerConnection
|
||||
extends BFoxConnection {
|
||||
public static final Property lastLoginTime = BFoxServerConnection.newProperty((int)3, (BValue)BAbsTime.NULL, null);
|
||||
public static final Property lastLoginAddress = BFoxServerConnection.newProperty((int)3, (String)"-", null);
|
||||
public static final Property lastLoginUsername = BFoxServerConnection.newProperty((int)3, (String)"-", null);
|
||||
public static final Property lastLoginApp = BFoxServerConnection.newProperty((int)3, (String)"-", null);
|
||||
public static final Action forceDisconnect = BFoxServerConnection.newAction((int)0, null);
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxServerConnection;
|
||||
|
||||
public BAbsTime getLastLoginTime() {
|
||||
return (BAbsTime)this.get(lastLoginTime);
|
||||
}
|
||||
|
||||
public void setLastLoginTime(BAbsTime bAbsTime) {
|
||||
this.set(lastLoginTime, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public String getLastLoginAddress() {
|
||||
return this.getString(lastLoginAddress);
|
||||
}
|
||||
|
||||
public void setLastLoginAddress(String string) {
|
||||
this.setString(lastLoginAddress, string, null);
|
||||
}
|
||||
|
||||
public String getLastLoginUsername() {
|
||||
return this.getString(lastLoginUsername);
|
||||
}
|
||||
|
||||
public void setLastLoginUsername(String string) {
|
||||
this.setString(lastLoginUsername, string, null);
|
||||
}
|
||||
|
||||
public String getLastLoginApp() {
|
||||
return this.getString(lastLoginApp);
|
||||
}
|
||||
|
||||
public void setLastLoginApp(String string) {
|
||||
this.setString(lastLoginApp, string, null);
|
||||
}
|
||||
|
||||
public void forceDisconnect() {
|
||||
this.invoke(forceDisconnect, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void stopped() throws Exception {
|
||||
if (this.session() != null) {
|
||||
this.session().close(null);
|
||||
}
|
||||
}
|
||||
|
||||
public final BUser getUser() {
|
||||
FoxSession foxSession = this.session();
|
||||
if (foxSession != null) {
|
||||
return foxSession.getUser();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public final Context getSessionContext() {
|
||||
FoxSession foxSession = this.session();
|
||||
if (foxSession != null) {
|
||||
return foxSession.getSessionContext();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void sessionOpened(FoxSession foxSession) {
|
||||
if (this.session() != null) {
|
||||
this.session().close(new Exception("Reconnect while still server still connected"));
|
||||
}
|
||||
super.sessionOpened(foxSession);
|
||||
NiagaraStation niagaraStation = this.getParentStation();
|
||||
if (niagaraStation != null) {
|
||||
niagaraStation.serverOpened();
|
||||
}
|
||||
}
|
||||
|
||||
public void sessionClosed(FoxSession foxSession, Throwable throwable) {
|
||||
Object object;
|
||||
if (BFoxService.auditConnection(foxSession)) {
|
||||
try {
|
||||
object = Sys.getAuditor();
|
||||
if (object != null && foxSession.getUser() != null) {
|
||||
object.audit(new AuditEvent("Logout", this.toPathString(), foxSession.getRemoteHost(), "", "", foxSession.getUser().getUsername()));
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable2) {
|
||||
throwable2.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (this.session() != foxSession) {
|
||||
this.log.warning("Closing session [" + foxSession + " doesn't match opened session [" + this.session() + ']');
|
||||
if (this.getParent() instanceof BServerConnections) {
|
||||
this.getParent().asComponent().remove(this.getPropertyInParent());
|
||||
}
|
||||
return;
|
||||
}
|
||||
super.sessionClosed(foxSession, throwable);
|
||||
object = this.getParentStation();
|
||||
if (object != null) {
|
||||
object.serverClosed();
|
||||
} else if (this.getParent() instanceof BServerConnections) {
|
||||
this.getParent().asComponent().remove(this.getPropertyInParent());
|
||||
}
|
||||
}
|
||||
|
||||
public Thread makeThread(ThreadGroup threadGroup, Runnable runnable, String string) {
|
||||
return new FoxServerThread(threadGroup, runnable, string);
|
||||
}
|
||||
|
||||
public void doForceDisconnect() throws Exception {
|
||||
this.close();
|
||||
}
|
||||
|
||||
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$fox$sys$BFoxServerConnection;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxServerConnection = BFoxServerConnection.class("[Lcom.tridium.fox.sys.BFoxServerConnection;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class FoxServerThread
|
||||
extends Thread
|
||||
implements ContextThread {
|
||||
public Context getContext() {
|
||||
return BFoxServerConnection.this.getSessionContext();
|
||||
}
|
||||
|
||||
FoxServerThread(ThreadGroup threadGroup, Runnable runnable, String string) {
|
||||
super(threadGroup, runnable, string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,815 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.sys.Nre
|
||||
* com.tridium.sys.NreLib
|
||||
* com.tridium.sys.license.Brand
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.io.net.IServerSocketFactory
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.security.AuthenticationException
|
||||
* javax.baja.security.DigestFactory
|
||||
* javax.baja.security.crypto.BSslTlsEnum
|
||||
* javax.baja.security.crypto.BTlsEnum
|
||||
* javax.baja.security.crypto.CertManagerFactory
|
||||
* javax.baja.security.crypto.ICryptoManagerEx
|
||||
* javax.baja.space.BComponentSpace
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BIService
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BInteger
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Clock$Ticket
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.Lexicon
|
||||
* javax.baja.util.Version
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.session.Fox;
|
||||
import com.tridium.fox.session.FoxConnection;
|
||||
import com.tridium.fox.session.FoxServer;
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import com.tridium.fox.session.Tuner;
|
||||
import com.tridium.fox.sys.Acceptor;
|
||||
import com.tridium.fox.sys.BFoxAuthenticationPolicy;
|
||||
import com.tridium.fox.sys.BFoxServerConnection;
|
||||
import com.tridium.fox.sys.BFoxTunnelServerConnection;
|
||||
import com.tridium.fox.sys.BServerConnections;
|
||||
import com.tridium.fox.sys.NiagaraNetwork;
|
||||
import com.tridium.sys.Nre;
|
||||
import com.tridium.sys.NreLib;
|
||||
import com.tridium.sys.license.Brand;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.BindException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.util.ArrayList;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.io.net.IServerSocketFactory;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.security.AuthenticationException;
|
||||
import javax.baja.security.DigestFactory;
|
||||
import javax.baja.security.crypto.BSslTlsEnum;
|
||||
import javax.baja.security.crypto.BTlsEnum;
|
||||
import javax.baja.security.crypto.CertManagerFactory;
|
||||
import javax.baja.security.crypto.ICryptoManagerEx;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BIService;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.Lexicon;
|
||||
import javax.baja.util.Version;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFoxService
|
||||
extends BComponent
|
||||
implements BIService {
|
||||
public static final Property port = BFoxService.newProperty((int)0, (int)1911, null);
|
||||
public static final Property foxEnabled = BFoxService.newProperty((int)0, (boolean)true, null);
|
||||
public static final Property foxsPort = BFoxService.newProperty((int)0, (int)4911, null);
|
||||
public static final Property foxsEnabled = BFoxService.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property foxsOnly = BFoxService.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property foxsMinProtocol = BFoxService.newProperty((int)5, (BValue)BSslTlsEnum.tlsv1, null);
|
||||
public static final Property tlsMinProtocol = BFoxService.newProperty((int)4, (BValue)BTlsEnum.tlsv1, null);
|
||||
public static final Property foxsCert = BFoxService.newProperty((int)0, (String)"tridium", (BFacets)BFacets.make((String)"fieldEditor", (BIDataValue)BString.make((String)"workbench:CertificateAliasFE")));
|
||||
public static final Property authenticationPolicy = BFoxService.newProperty((int)0, (BValue)BFoxAuthenticationPolicy.digest, null);
|
||||
public static final Property legacyAuthentication = BFoxService.newProperty((int)0, (BValue)BAbsTime.NULL, (BFacets)BFacets.make((String)"fieldEditor", (String)"workbench:RelaxedFE"));
|
||||
public static final Property requestTimeout = BFoxService.newProperty((int)0, (BValue)BRelTime.make((long)Fox.requestTimeout), (BFacets)BFacets.make((String)"min", (BIDataValue)BRelTime.make((long)1L)));
|
||||
public static final Property socketOptionTimeout = BFoxService.newProperty((int)0, (BValue)BRelTime.make((long)Fox.soTimeout), (BFacets)BFacets.make((String)"min", (BIDataValue)BRelTime.make((long)1L)));
|
||||
public static final Property socketTcpNoDelay = BFoxService.newProperty((int)0, (boolean)true, null);
|
||||
public static final Property keepAliveInterval = BFoxService.newProperty((int)0, (BValue)BRelTime.make((long)Fox.keepAliveInterval), null);
|
||||
public static final Property maxServerSessions = BFoxService.newProperty((int)0, (int)Fox.maxServerSessions, null);
|
||||
public static final Property multicastEnabled = BFoxService.newProperty((int)0, (boolean)true, null);
|
||||
public static final Property enableAnnouncement = BFoxService.newProperty((int)0, (boolean)true, null);
|
||||
public static final Property multicastTimeToLive = BFoxService.newProperty((int)0, (int)Fox.multicastTimeToLive, null);
|
||||
public static final Property serverConnections = BFoxService.newProperty((int)0, (BValue)new BServerConnections(), null);
|
||||
public static final Property traceSessionStates = BFoxService.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property traceReadFrame = BFoxService.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property traceWriteFrame = BFoxService.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property traceMulticast = BFoxService.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property tunnelingEnabled = BFoxService.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property onlyTunnelKnownStations = BFoxService.newProperty((int)0, (boolean)false, null);
|
||||
public static final Action delayStationStarted = BFoxService.newAction((int)4, null);
|
||||
public static final Action checkLegacyAuth = BFoxService.newAction((int)4, null);
|
||||
public static final Type TYPE;
|
||||
private static final Type[] serviceTypes;
|
||||
private static final BIcon icon;
|
||||
public static final Log log;
|
||||
private static final Version FOXS_MIN_PROTOCOL_VERSION;
|
||||
private Daemon daemon;
|
||||
private Clock.Ticket restartTicket;
|
||||
private Clock.Ticket legacyAuthCheckTicket;
|
||||
private boolean tlsMinProtocolChecked;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxService;
|
||||
static /* synthetic */ Class class$java$lang$String;
|
||||
|
||||
public int getPort() {
|
||||
return this.getInt(port);
|
||||
}
|
||||
|
||||
public void setPort(int n) {
|
||||
this.setInt(port, n, null);
|
||||
}
|
||||
|
||||
public boolean getFoxEnabled() {
|
||||
return this.getBoolean(foxEnabled);
|
||||
}
|
||||
|
||||
public void setFoxEnabled(boolean bl) {
|
||||
this.setBoolean(foxEnabled, bl, null);
|
||||
}
|
||||
|
||||
public int getFoxsPort() {
|
||||
return this.getInt(foxsPort);
|
||||
}
|
||||
|
||||
public void setFoxsPort(int n) {
|
||||
this.setInt(foxsPort, n, null);
|
||||
}
|
||||
|
||||
public boolean getFoxsEnabled() {
|
||||
return this.getBoolean(foxsEnabled);
|
||||
}
|
||||
|
||||
public void setFoxsEnabled(boolean bl) {
|
||||
this.setBoolean(foxsEnabled, bl, null);
|
||||
}
|
||||
|
||||
public boolean getFoxsOnly() {
|
||||
return this.getBoolean(foxsOnly);
|
||||
}
|
||||
|
||||
public void setFoxsOnly(boolean bl) {
|
||||
this.setBoolean(foxsOnly, bl, null);
|
||||
}
|
||||
|
||||
public BSslTlsEnum getFoxsMinProtocol() {
|
||||
return (BSslTlsEnum)this.get(foxsMinProtocol);
|
||||
}
|
||||
|
||||
public void setFoxsMinProtocol(BSslTlsEnum bSslTlsEnum) {
|
||||
this.set(foxsMinProtocol, (BValue)bSslTlsEnum, null);
|
||||
}
|
||||
|
||||
public BTlsEnum getTlsMinProtocol() {
|
||||
return (BTlsEnum)this.get(tlsMinProtocol);
|
||||
}
|
||||
|
||||
public void setTlsMinProtocol(BTlsEnum bTlsEnum) {
|
||||
this.set(tlsMinProtocol, (BValue)bTlsEnum, null);
|
||||
}
|
||||
|
||||
public String getFoxsCert() {
|
||||
return this.getString(foxsCert);
|
||||
}
|
||||
|
||||
public void setFoxsCert(String string) {
|
||||
this.setString(foxsCert, string, null);
|
||||
}
|
||||
|
||||
public BFoxAuthenticationPolicy getAuthenticationPolicy() {
|
||||
return (BFoxAuthenticationPolicy)this.get(authenticationPolicy);
|
||||
}
|
||||
|
||||
public void setAuthenticationPolicy(BFoxAuthenticationPolicy bFoxAuthenticationPolicy) {
|
||||
this.set(authenticationPolicy, (BValue)bFoxAuthenticationPolicy, null);
|
||||
}
|
||||
|
||||
public BAbsTime getLegacyAuthentication() {
|
||||
return (BAbsTime)this.get(legacyAuthentication);
|
||||
}
|
||||
|
||||
public void setLegacyAuthentication(BAbsTime bAbsTime) {
|
||||
this.set(legacyAuthentication, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public BRelTime getRequestTimeout() {
|
||||
return (BRelTime)this.get(requestTimeout);
|
||||
}
|
||||
|
||||
public void setRequestTimeout(BRelTime bRelTime) {
|
||||
this.set(requestTimeout, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public BRelTime getSocketOptionTimeout() {
|
||||
return (BRelTime)this.get(socketOptionTimeout);
|
||||
}
|
||||
|
||||
public void setSocketOptionTimeout(BRelTime bRelTime) {
|
||||
this.set(socketOptionTimeout, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public boolean getSocketTcpNoDelay() {
|
||||
return this.getBoolean(socketTcpNoDelay);
|
||||
}
|
||||
|
||||
public void setSocketTcpNoDelay(boolean bl) {
|
||||
this.setBoolean(socketTcpNoDelay, bl, null);
|
||||
}
|
||||
|
||||
public BRelTime getKeepAliveInterval() {
|
||||
return (BRelTime)this.get(keepAliveInterval);
|
||||
}
|
||||
|
||||
public void setKeepAliveInterval(BRelTime bRelTime) {
|
||||
this.set(keepAliveInterval, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public int getMaxServerSessions() {
|
||||
return this.getInt(maxServerSessions);
|
||||
}
|
||||
|
||||
public void setMaxServerSessions(int n) {
|
||||
this.setInt(maxServerSessions, n, null);
|
||||
}
|
||||
|
||||
public boolean getMulticastEnabled() {
|
||||
return this.getBoolean(multicastEnabled);
|
||||
}
|
||||
|
||||
public void setMulticastEnabled(boolean bl) {
|
||||
this.setBoolean(multicastEnabled, bl, null);
|
||||
}
|
||||
|
||||
public boolean getEnableAnnouncement() {
|
||||
return this.getBoolean(enableAnnouncement);
|
||||
}
|
||||
|
||||
public void setEnableAnnouncement(boolean bl) {
|
||||
this.setBoolean(enableAnnouncement, bl, null);
|
||||
}
|
||||
|
||||
public int getMulticastTimeToLive() {
|
||||
return this.getInt(multicastTimeToLive);
|
||||
}
|
||||
|
||||
public void setMulticastTimeToLive(int n) {
|
||||
this.setInt(multicastTimeToLive, n, null);
|
||||
}
|
||||
|
||||
public BServerConnections getServerConnections() {
|
||||
return (BServerConnections)this.get(serverConnections);
|
||||
}
|
||||
|
||||
public void setServerConnections(BServerConnections bServerConnections) {
|
||||
this.set(serverConnections, (BValue)bServerConnections, null);
|
||||
}
|
||||
|
||||
public boolean getTraceSessionStates() {
|
||||
return this.getBoolean(traceSessionStates);
|
||||
}
|
||||
|
||||
public void setTraceSessionStates(boolean bl) {
|
||||
this.setBoolean(traceSessionStates, bl, null);
|
||||
}
|
||||
|
||||
public boolean getTraceReadFrame() {
|
||||
return this.getBoolean(traceReadFrame);
|
||||
}
|
||||
|
||||
public void setTraceReadFrame(boolean bl) {
|
||||
this.setBoolean(traceReadFrame, bl, null);
|
||||
}
|
||||
|
||||
public boolean getTraceWriteFrame() {
|
||||
return this.getBoolean(traceWriteFrame);
|
||||
}
|
||||
|
||||
public void setTraceWriteFrame(boolean bl) {
|
||||
this.setBoolean(traceWriteFrame, bl, null);
|
||||
}
|
||||
|
||||
public boolean getTraceMulticast() {
|
||||
return this.getBoolean(traceMulticast);
|
||||
}
|
||||
|
||||
public void setTraceMulticast(boolean bl) {
|
||||
this.setBoolean(traceMulticast, bl, null);
|
||||
}
|
||||
|
||||
public boolean getTunnelingEnabled() {
|
||||
return this.getBoolean(tunnelingEnabled);
|
||||
}
|
||||
|
||||
public void setTunnelingEnabled(boolean bl) {
|
||||
this.setBoolean(tunnelingEnabled, bl, null);
|
||||
}
|
||||
|
||||
public boolean getOnlyTunnelKnownStations() {
|
||||
return this.getBoolean(onlyTunnelKnownStations);
|
||||
}
|
||||
|
||||
public void setOnlyTunnelKnownStations(boolean bl) {
|
||||
this.setBoolean(onlyTunnelKnownStations, bl, null);
|
||||
}
|
||||
|
||||
public void delayStationStarted() {
|
||||
this.invoke(delayStationStarted, null, null);
|
||||
}
|
||||
|
||||
public void checkLegacyAuth() {
|
||||
this.invoke(checkLegacyAuth, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public Type[] getServiceTypes() {
|
||||
return serviceTypes;
|
||||
}
|
||||
|
||||
public boolean isServing() {
|
||||
Daemon daemon = this.daemon;
|
||||
boolean bl = false;
|
||||
if (daemon != null && daemon.isServing()) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public void stationStarted() {
|
||||
int n = -1;
|
||||
int n2 = -1;
|
||||
try {
|
||||
ArrayList<String> arrayList = new ArrayList<String>();
|
||||
ArrayList<String> arrayList2 = new ArrayList<String>();
|
||||
this.serviceStopped();
|
||||
this.initOptions();
|
||||
if (this.getFoxEnabled()) {
|
||||
n = this.getFoxPort();
|
||||
}
|
||||
if (this.getFoxsEnabled()) {
|
||||
n2 = this.getFoxsPort();
|
||||
}
|
||||
this.daemon = new Daemon(this, n, n2);
|
||||
this.daemon.run();
|
||||
arrayList.add("foxport");
|
||||
arrayList2.add(String.valueOf(n));
|
||||
arrayList.add("foxsport");
|
||||
arrayList2.add(String.valueOf(n2));
|
||||
Nre.getPlatform().reportSummaryFields(arrayList.toArray(new String[0]), arrayList2.toArray(new String[0]));
|
||||
this.doCheckLegacyAuth();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("Cannot start", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void serviceStarted() {
|
||||
try {
|
||||
Nre.serviceManager.getService("platCrypto:CertManagerService");
|
||||
this.setFacets((Slot)tlsMinProtocol, BFacets.make((String)"supportsTlsMinProtocol", (boolean)true));
|
||||
this.setFlags((Slot)tlsMinProtocol, this.getFlags((Slot)tlsMinProtocol) & 0xFFFFFFFB);
|
||||
this.setFlags((Slot)foxsPort, this.getFlags((Slot)foxsPort) & 0xFFFFFFFA);
|
||||
this.setFlags((Slot)foxsEnabled, this.getFlags((Slot)foxsEnabled) & 0xFFFFFFFA);
|
||||
this.setFlags((Slot)foxsOnly, this.getFlags((Slot)foxsOnly) & 0xFFFFFFFA);
|
||||
this.setFlags((Slot)foxsCert, this.getFlags((Slot)foxsCert) & 0xFFFFFFFA);
|
||||
try {
|
||||
Class<?> clazz = Class.forName("javax.net.ssl.SSLContext");
|
||||
Class[] classArray = new Class[1];
|
||||
Class clazz2 = class$java$lang$String;
|
||||
if (clazz2 == null) {
|
||||
clazz2 = class$java$lang$String = BFoxService.class("[Ljava.lang.String;", false);
|
||||
}
|
||||
classArray[0] = clazz2;
|
||||
Method method = clazz.getMethod("getInstance", classArray);
|
||||
method.invoke(null, "TLSv1.1");
|
||||
this.setFlags((Slot)tlsMinProtocol, this.getFlags((Slot)tlsMinProtocol) & 0xFFFFFFFA);
|
||||
this.setFacets((Slot)tlsMinProtocol, BFacets.make((String)"supportsTls11AndAbove", (boolean)true));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.setTlsMinProtocol(BTlsEnum.tlsv1);
|
||||
this.setFlags((Slot)tlsMinProtocol, this.getFlags((Slot)tlsMinProtocol) | 1);
|
||||
this.setFacets((Slot)tlsMinProtocol, BFacets.make((String)"supportsTls11AndAbove", (boolean)false));
|
||||
log.message("Only TLSv1 is supported on this platform, forcing to TLSv1");
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
if (this.getFoxsEnabled()) {
|
||||
log.warning("Foxs is unsupported on this device. Using fox instead.");
|
||||
}
|
||||
this.setFoxEnabled(true);
|
||||
this.setFlags((Slot)foxsPort, this.getFlags((Slot)foxsPort) | 1 | 4);
|
||||
this.setFoxsEnabled(false);
|
||||
this.setFlags((Slot)foxsEnabled, this.getFlags((Slot)foxsEnabled) | 1 | 4);
|
||||
this.setFoxsOnly(false);
|
||||
this.setFlags((Slot)foxsOnly, this.getFlags((Slot)foxsOnly) | 1 | 4);
|
||||
this.setFlags((Slot)tlsMinProtocol, this.getFlags((Slot)tlsMinProtocol) | 1 | 4);
|
||||
this.setFlags((Slot)foxsCert, this.getFlags((Slot)foxsCert) | 1 | 4);
|
||||
}
|
||||
}
|
||||
|
||||
public void serviceStopped() {
|
||||
if (this.daemon != null) {
|
||||
log.message("Service stopped");
|
||||
this.daemon.stop();
|
||||
}
|
||||
this.daemon = null;
|
||||
}
|
||||
|
||||
private final void initOptions() {
|
||||
Fox.appName = "Station";
|
||||
Fox.appVersion = "" + Sys.getBajaModule().getVendorVersion();
|
||||
Fox.hostName = Sys.getLocalHost().getHostName();
|
||||
Fox.hostAddress = Sys.getLocalHost().getHostAddress();
|
||||
Fox.ipv4Enabled = NreLib.getLocalHost((boolean)false).isLoopbackAddress() ^ true;
|
||||
boolean bl = false;
|
||||
if (Fox.ipv6Enabled && !NreLib.getLocalHost((boolean)true).isLoopbackAddress()) {
|
||||
bl = true;
|
||||
}
|
||||
Fox.ipv6Enabled = bl;
|
||||
Fox.requestTimeout = (int)this.getRequestTimeout().getMillis();
|
||||
Fox.keepAliveInterval = (int)this.getKeepAliveInterval().getMillis();
|
||||
Fox.soTimeout = (int)this.getSocketOptionTimeout().getMillis();
|
||||
Fox.tcpNoDelay = this.getSocketTcpNoDelay();
|
||||
Fox.multicastEnabled = this.getMulticastEnabled();
|
||||
Fox.multicastTimeToLive = this.getMulticastTimeToLive();
|
||||
Fox.maxServerSessions = this.getMaxServerSessions();
|
||||
Fox.traceSessionStates = this.getTraceSessionStates();
|
||||
Fox.traceReadFrame = this.getTraceReadFrame();
|
||||
Fox.traceWriteFrame = this.getTraceWriteFrame();
|
||||
Fox.traceMulticast = this.getTraceMulticast();
|
||||
Fox.tunnelingEnabled = this.getTunnelingEnabled();
|
||||
Fox.onlyTunnelKnownStations = this.getOnlyTunnelKnownStations();
|
||||
Acceptor.foxTunnelingLicensed();
|
||||
}
|
||||
|
||||
public static BFoxService waitUntilPortOpen(long l) {
|
||||
try {
|
||||
BFoxService bFoxService = (BFoxService)Sys.getService((Type)TYPE);
|
||||
long l2 = Clock.ticks();
|
||||
while (!bFoxService.isServing()) {
|
||||
if (Clock.ticks() - l2 > l) {
|
||||
throw new BajaRuntimeException("BFoxService.waitUntilPortOpen timed out");
|
||||
}
|
||||
Thread.sleep(100L);
|
||||
}
|
||||
return bFoxService;
|
||||
}
|
||||
catch (BajaRuntimeException bajaRuntimeException) {
|
||||
throw bajaRuntimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
System.out.println("ERROR: BFoxService.waitUntilPortOpen failed");
|
||||
exception.printStackTrace();
|
||||
throw new BajaRuntimeException("FoxService.waitUntilPortOpen", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isNavChild() {
|
||||
BComponentSpace bComponentSpace;
|
||||
if (!this.tlsMinProtocolChecked && (bComponentSpace = this.getComponentSpace()) != null && bComponentSpace.isProxyComponentSpace()) {
|
||||
this.tlsMinProtocolChecked = true;
|
||||
Version version = (Version)this.fw(404, "baja", null, null, null);
|
||||
if (version != null && !version.isNull() && version.compareTo((Object)FOXS_MIN_PROTOCOL_VERSION) >= 0) {
|
||||
this.loadSlots();
|
||||
this.setFoxsMinProtocol(BSslTlsEnum.tlsv1);
|
||||
this.setFlags((Slot)foxsMinProtocol, 5);
|
||||
BFacets bFacets = this.getSlotFacets((Slot)tlsMinProtocol);
|
||||
if (bFacets != null) {
|
||||
boolean bl = bFacets.getb("supportsTlsMinProtocol", false);
|
||||
if (!bl) {
|
||||
this.setFlags((Slot)tlsMinProtocol, 5, Context.commit);
|
||||
} else {
|
||||
boolean bl2 = bFacets.getb("supportsTls11AndAbove", false);
|
||||
if (bl2) {
|
||||
this.setFlags((Slot)tlsMinProtocol, this.getFlags((Slot)tlsMinProtocol) & 0xFFFFFFFA);
|
||||
} else {
|
||||
this.setFlags((Slot)tlsMinProtocol, this.getFlags((Slot)tlsMinProtocol) & 0xFFFFFFFB | 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setFlags((Slot)tlsMinProtocol, 4, Context.commit);
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.isNavChild();
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
if (property == port || property == foxsPort) {
|
||||
this.triggerDelayedStationStarted();
|
||||
} else if (property == foxsCert || property == tlsMinProtocol || property == foxsOnly) {
|
||||
if (this.getFoxsEnabled()) {
|
||||
this.triggerDelayedStationStarted();
|
||||
}
|
||||
} else if (property == foxEnabled || property == foxsEnabled || property == multicastEnabled) {
|
||||
this.triggerDelayedStationStarted();
|
||||
} else {
|
||||
this.initOptions();
|
||||
}
|
||||
}
|
||||
|
||||
private final synchronized void triggerDelayedStationStarted() {
|
||||
this.triggerDelayedStationStarted(500L);
|
||||
}
|
||||
|
||||
private final synchronized void triggerDelayedStationStarted(long l) {
|
||||
if (this.restartTicket == null) {
|
||||
this.restartTicket = Clock.schedule((BComponent)this, (BRelTime)BRelTime.make((long)l), (Action)delayStationStarted, null);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void doDelayStationStarted() {
|
||||
BFoxService bFoxService = this;
|
||||
synchronized (bFoxService) {
|
||||
this.restartTicket = null;
|
||||
// MONITOREXIT @DISABLED, blocks:[0, 1] lbl5 : MonitorExitStatement: MONITOREXIT : var1_1
|
||||
this.stationStarted();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void doCheckLegacyAuth() {
|
||||
BAbsTime bAbsTime;
|
||||
Class clazz = class$com$tridium$fox$sys$BFoxService;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxService = BFoxService.class("[Lcom.tridium.fox.sys.BFoxService;", false);
|
||||
}
|
||||
Lexicon lexicon = Lexicon.make((Class)clazz);
|
||||
if (this.legacyAuthCheckTicket != null) {
|
||||
this.legacyAuthCheckTicket.cancel();
|
||||
}
|
||||
if (!(bAbsTime = this.getLegacyAuthentication()).isNull()) {
|
||||
if (bAbsTime.isBefore(BAbsTime.now())) {
|
||||
log.warning(lexicon.getText("fox.legacy.relaxed.expired"));
|
||||
} else {
|
||||
log.warning(lexicon.getText("fox.legacy.relaxed"));
|
||||
if (BAbsTime.now().delta(bAbsTime).getDays() < 7) {
|
||||
log.warning(lexicon.getText("fox.legacy.relaxed.expiring", new Object[]{bAbsTime}));
|
||||
}
|
||||
}
|
||||
}
|
||||
BAbsTime bAbsTime2 = Clock.time().timeOfDay(1, 0, 0, 0).nextDay();
|
||||
this.legacyAuthCheckTicket = Clock.schedule((BComponent)this, (BAbsTime)bAbsTime2, (Action)checkLegacyAuth, null);
|
||||
}
|
||||
|
||||
public BFoxServerConnection makeServerConnection(FoxSession foxSession, FoxMessage foxMessage) throws Exception {
|
||||
BFoxServerConnection bFoxServerConnection = new BFoxServerConnection();
|
||||
this.getServerConnections().add("Session" + foxSession.getId(), (BValue)bFoxServerConnection, 3);
|
||||
return bFoxServerConnection;
|
||||
}
|
||||
|
||||
public FoxServer getFoxServer() {
|
||||
return this.daemon;
|
||||
}
|
||||
|
||||
public int getFoxPort() {
|
||||
return this.getPort();
|
||||
}
|
||||
|
||||
public static NiagaraNetwork getNiagaraNetwork() {
|
||||
BFoxService bFoxService = (BFoxService)Sys.getService((Type)TYPE);
|
||||
BComplex bComplex = bFoxService.getParent();
|
||||
while (bComplex != null) {
|
||||
if (bComplex instanceof NiagaraNetwork) {
|
||||
return (NiagaraNetwork)bComplex;
|
||||
}
|
||||
bComplex = bComplex.getParent();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void httpSessionClosed(String string) {
|
||||
if (string == null) {
|
||||
return;
|
||||
}
|
||||
BFoxService bFoxService = (BFoxService)Sys.getService((Type)TYPE);
|
||||
BComponent[] bComponentArray = bFoxService.getServerConnections().getChildComponents();
|
||||
if (bComponentArray == null) {
|
||||
return;
|
||||
}
|
||||
int n = 0;
|
||||
while (n < bComponentArray.length) {
|
||||
String string2;
|
||||
BFoxServerConnection bFoxServerConnection = (BFoxServerConnection)bComponentArray[n];
|
||||
if (bFoxServerConnection != null && string.equals(string2 = bFoxServerConnection.session().getRemoteHello().getString("httpSession", null))) {
|
||||
bFoxServerConnection.close();
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getHttpPort() {
|
||||
try {
|
||||
Type type = Sys.getType((String)"web:WebService");
|
||||
BComponent bComponent = Sys.getService((Type)type);
|
||||
BInteger bInteger = (BInteger)bComponent.get("httpPort");
|
||||
return bInteger.getInt();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean auditConnection(FoxSession foxSession) {
|
||||
String string = foxSession.getRemoteHello().getString("app.name", "Station");
|
||||
return string.equals("Station") ^ true;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
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.restartTicket = null;
|
||||
this.legacyAuthCheckTicket = null;
|
||||
this.tlsMinProtocolChecked = false;
|
||||
}
|
||||
|
||||
public BFoxService() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$BFoxService;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxService = BFoxService.class("[Lcom.tridium.fox.sys.BFoxService;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
serviceTypes = new Type[]{TYPE};
|
||||
icon = BIcon.std((String)"fox.png");
|
||||
log = Log.getLog((String)"fox");
|
||||
FOXS_MIN_PROTOCOL_VERSION = new Version("3.7.0");
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class Daemon
|
||||
extends FoxServer {
|
||||
private BFoxService service;
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
super.run();
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
}
|
||||
|
||||
public ServerSocket getFoxsServerSocket() throws IOException {
|
||||
ICryptoManagerEx iCryptoManagerEx;
|
||||
try {
|
||||
iCryptoManagerEx = CertManagerFactory.getInstanceEx();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new IOException("Unable to get crypto service instance");
|
||||
}
|
||||
try {
|
||||
IServerSocketFactory iServerSocketFactory = iCryptoManagerEx.getServerSocketFactory(this.service.getTlsMinProtocol().getTag(), false, this.service.getFoxsCert());
|
||||
return iServerSocketFactory.createServerSocket(BFoxService.this.getFoxsPort(), 10);
|
||||
}
|
||||
catch (BindException bindException) {
|
||||
throw bindException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
if (log.isTraceOn()) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
if (!BFoxService.this.getFoxEnabled() || BFoxService.this.getFoxsOnly()) {
|
||||
log.warning("Unable to start foxs, enabling fox connectivity!");
|
||||
BFoxService.this.setFoxEnabled(true);
|
||||
BFoxService.this.setFoxsOnly(false);
|
||||
}
|
||||
throw new IOException("Unable to create socket: " + exception.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public FoxConnection makeConnection(FoxSession foxSession, FoxMessage foxMessage) throws Exception {
|
||||
if (foxSession == null) {
|
||||
return new BFoxTunnelServerConnection();
|
||||
}
|
||||
return BFoxService.this.makeServerConnection(foxSession, foxMessage);
|
||||
}
|
||||
|
||||
public FoxMessage getAnnouncement() {
|
||||
InetAddress inetAddress;
|
||||
if (!BFoxService.this.getEnableAnnouncement()) {
|
||||
return null;
|
||||
}
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("station", Sys.getStation().getStationName());
|
||||
if (Fox.ipv4Enabled && !(inetAddress = NreLib.getLocalHost((boolean)false)).isLoopbackAddress()) {
|
||||
foxMessage.add("hostName", inetAddress.getHostName());
|
||||
foxMessage.add("hostAddress", inetAddress.getHostAddress());
|
||||
}
|
||||
if (Fox.ipv6Enabled && !(inetAddress = NreLib.getLocalHost((boolean)true)).isLoopbackAddress()) {
|
||||
foxMessage.add("hostNameIPv6", inetAddress.getHostName());
|
||||
foxMessage.add("hostAddressIPv6", inetAddress.getHostAddress());
|
||||
}
|
||||
if (BFoxService.this.getFoxEnabled()) {
|
||||
foxMessage.add("foxPort", BFoxService.this.getFoxPort());
|
||||
}
|
||||
if (BFoxService.this.getFoxsEnabled()) {
|
||||
foxMessage.add("foxsPort", BFoxService.this.getFoxsPort());
|
||||
}
|
||||
foxMessage.add("httpPort", BFoxService.getHttpPort());
|
||||
foxMessage.add("version", Sys.getBajaModule().getVendorVersion().toString());
|
||||
foxMessage.add("hostId", Nre.getHostId());
|
||||
foxMessage.add("hostModel", Nre.getHostModel());
|
||||
foxMessage.add("brandId", Brand.getBrandId());
|
||||
foxMessage.add("vmName", Fox.vmName);
|
||||
foxMessage.add("vmVersion", Fox.vmVersion);
|
||||
foxMessage.add("osName", Fox.osName);
|
||||
foxMessage.add("osVersion", Fox.osVersion);
|
||||
return foxMessage;
|
||||
}
|
||||
|
||||
public int getAuthenticationPolicy() {
|
||||
return BFoxService.this.getAuthenticationPolicy().getOrdinal();
|
||||
}
|
||||
|
||||
public boolean authenticateBasic(FoxSession foxSession, String string, String string2) throws Exception {
|
||||
throw new AuthenticationException("Unsupported method call authenticateBasic in BFoxService. This call should be handled by an Authentication Agent.");
|
||||
}
|
||||
|
||||
public boolean authenticateDigest(FoxSession foxSession, String string, byte[] byArray, byte[] byArray2) throws Exception {
|
||||
throw new AuthenticationException("Unsupported method call authenticateDigest in BFoxService. This call should be handled by an Authentication Agent.");
|
||||
}
|
||||
|
||||
public Daemon(BFoxService bFoxService2, int n, int n2) {
|
||||
super(n, n2);
|
||||
this.service = bFoxService2;
|
||||
}
|
||||
}
|
||||
|
||||
static class FoxDigestFactory
|
||||
implements DigestFactory {
|
||||
byte[] nonce;
|
||||
|
||||
public byte[] makeDigest(String string, String string2) {
|
||||
try {
|
||||
return Tuner.generateDigest(string, string2, this.nonce);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] getNonce() {
|
||||
return this.nonce;
|
||||
}
|
||||
|
||||
FoxDigestFactory(byte[] byArray) {
|
||||
this.nonce = byArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,735 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.util.ArrayUtil
|
||||
* com.tridium.util.BSessionInfo
|
||||
* com.tridium.util.IFoxSession
|
||||
* javax.baja.agent.AgentList
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.naming.BHost
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.BServiceScheme$ServiceSession
|
||||
* javax.baja.naming.OrdQuery
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.nav.BINavNode
|
||||
* javax.baja.nav.BNavFileSpace
|
||||
* javax.baja.nav.NavFileDecoder
|
||||
* javax.baja.registry.TypeInfo
|
||||
* javax.baja.security.AuthenticationException
|
||||
* javax.baja.security.AuthenticationRealm
|
||||
* javax.baja.security.BICredentials
|
||||
* javax.baja.security.BIUserCredentials
|
||||
* javax.baja.security.BPassword
|
||||
* javax.baja.security.BUsernameAndPassword
|
||||
* javax.baja.space.BSpace
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.ModuleNotFoundException
|
||||
* javax.baja.sys.ServiceNotFoundException
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.timezone.BTimeZone
|
||||
* javax.baja.util.LexiconText
|
||||
* javax.baja.util.Version
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.session.Fox;
|
||||
import com.tridium.fox.session.FoxAuthenticationException;
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import com.tridium.fox.sys.BFoxClientConnection;
|
||||
import com.tridium.fox.sys.BFoxScheme;
|
||||
import com.tridium.fox.sys.BFoxsScheme;
|
||||
import com.tridium.fox.sys.BIFoxProxySpace;
|
||||
import com.tridium.fox.sys.BSysChannel;
|
||||
import com.tridium.fox.sys.FatalAuthenticationException;
|
||||
import com.tridium.fox.sys.LocalizableExceptionTranslator;
|
||||
import com.tridium.fox.sys.LocalizableServerException;
|
||||
import com.tridium.fox.sys.ModuleNotFoundLocalException;
|
||||
import com.tridium.fox.sys.ModuleNotFoundRemoteException;
|
||||
import com.tridium.fox.sys.broker.BBrokerChannel;
|
||||
import com.tridium.util.ArrayUtil;
|
||||
import com.tridium.util.BSessionInfo;
|
||||
import com.tridium.util.IFoxSession;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.agent.AgentList;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.fox.BFoxProxySession;
|
||||
import javax.baja.naming.BHost;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.BServiceScheme;
|
||||
import javax.baja.naming.OrdQuery;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.nav.BNavFileSpace;
|
||||
import javax.baja.nav.NavFileDecoder;
|
||||
import javax.baja.registry.TypeInfo;
|
||||
import javax.baja.security.AuthenticationException;
|
||||
import javax.baja.security.AuthenticationRealm;
|
||||
import javax.baja.security.BICredentials;
|
||||
import javax.baja.security.BIUserCredentials;
|
||||
import javax.baja.security.BPassword;
|
||||
import javax.baja.security.BUsernameAndPassword;
|
||||
import javax.baja.space.BSpace;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.ModuleNotFoundException;
|
||||
import javax.baja.sys.ServiceNotFoundException;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.timezone.BTimeZone;
|
||||
import javax.baja.util.LexiconText;
|
||||
import javax.baja.util.Version;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFoxSession
|
||||
extends BFoxProxySession
|
||||
implements AuthenticationRealm,
|
||||
BServiceScheme.ServiceSession,
|
||||
IFoxSession,
|
||||
BFoxClientConnection.Interest {
|
||||
public static final Type TYPE;
|
||||
private static final BIcon iconConnected;
|
||||
private static final BIcon iconDisconnected;
|
||||
private static final BIcon tunnelIconConnected;
|
||||
private static final BIcon tunnelIconDisconnected;
|
||||
private static final BIcon secureBadgeConnected;
|
||||
private static final BIcon secureBadgeDisconnected;
|
||||
String[] tunnelAuthorities;
|
||||
private final BHost host;
|
||||
private boolean useFoxs;
|
||||
private int port;
|
||||
private final BFoxClientConnection connection;
|
||||
private boolean connected;
|
||||
private BOrd absOrd;
|
||||
private BOrd ordInHost;
|
||||
private String stationName;
|
||||
private BIUserCredentials credentials;
|
||||
private String authenticationScheme;
|
||||
private Context sessionContext;
|
||||
String stationFault;
|
||||
public Object uiCache;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxSession;
|
||||
static /* synthetic */ Class class$java$lang$String;
|
||||
static /* synthetic */ Class class$javax$baja$sys$BAbsTime;
|
||||
static /* synthetic */ Class class$java$net$Socket;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static BFoxSession[] list() {
|
||||
ArrayList<BINavNode> arrayList = new ArrayList<BINavNode>();
|
||||
BHost[] bHostArray = BHost.getAllHosts();
|
||||
int n = 0;
|
||||
while (n < bHostArray.length) {
|
||||
BHost bHost = bHostArray[n];
|
||||
BINavNode[] bINavNodeArray = bHost.getNavChildren();
|
||||
int n2 = 0;
|
||||
while (n2 < bINavNodeArray.length) {
|
||||
if (bINavNodeArray[n2] instanceof BFoxSession) {
|
||||
arrayList.add(bINavNodeArray[n2]);
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return arrayList.toArray(new BFoxSession[arrayList.size()]);
|
||||
}
|
||||
|
||||
public static BFoxSession make(BHost bHost, int n) {
|
||||
return BFoxSession.make(null, bHost, n, false);
|
||||
}
|
||||
|
||||
public static BFoxSession make(BHost bHost, int n, boolean bl) {
|
||||
return BFoxSession.make(null, bHost, n, bl);
|
||||
}
|
||||
|
||||
public static BFoxSession make(String string, BHost bHost, int n, boolean bl) {
|
||||
return BFoxSession.make(string, bHost, n, bl, null);
|
||||
}
|
||||
|
||||
public static BFoxSession make(String string, BHost bHost, int n, boolean bl, String string2) {
|
||||
String[] stringArray = null;
|
||||
if (string2 != null) {
|
||||
stringArray = new String[]{string2};
|
||||
}
|
||||
return BFoxSession.make(string, bHost, n, bl, stringArray);
|
||||
}
|
||||
|
||||
public static BFoxSession make(String string, BHost bHost, int n, boolean bl, String[] stringArray) {
|
||||
String string2 = BFoxSession.buildNavName(n, bl, stringArray);
|
||||
BFoxSession bFoxSession = (BFoxSession)bHost.getNavChild(string2);
|
||||
if (bFoxSession == null) {
|
||||
bFoxSession = new BFoxSession(string2, string, bHost, n, bl, stringArray);
|
||||
bHost.addNavChild((BINavNode)bFoxSession);
|
||||
}
|
||||
return bFoxSession;
|
||||
}
|
||||
|
||||
protected static String buildNavName(int n, boolean bl, String[] stringArray) {
|
||||
int n2;
|
||||
String string = bl ? "foxs" : "fox";
|
||||
int n3 = n2 = bl ? 4911 : 1911;
|
||||
if (n != n2) {
|
||||
string = string + ':' + n;
|
||||
}
|
||||
if (stringArray != null) {
|
||||
int n4 = 0;
|
||||
while (n4 < stringArray.length) {
|
||||
if (stringArray[n4] != null) {
|
||||
string = string + '/' + stringArray[n4];
|
||||
}
|
||||
++n4;
|
||||
}
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
public BHost getHost() {
|
||||
return this.host;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public void setPort(int n) {
|
||||
this.port = n;
|
||||
}
|
||||
|
||||
public boolean getUseFoxs() {
|
||||
return this.useFoxs;
|
||||
}
|
||||
|
||||
public void setUseFoxs(boolean bl) {
|
||||
this.useFoxs = bl;
|
||||
}
|
||||
|
||||
public String[] getTunnelAuthorities() {
|
||||
return this.tunnelAuthorities;
|
||||
}
|
||||
|
||||
public BFoxClientConnection getConnection() {
|
||||
return this.connection;
|
||||
}
|
||||
|
||||
public String getStationName() {
|
||||
return this.stationName;
|
||||
}
|
||||
|
||||
public BSessionInfo getSessionInfo() {
|
||||
BSessionInfo bSessionInfo;
|
||||
FoxSession foxSession = this.connection.session();
|
||||
BAbsTime bAbsTime = BAbsTime.make((long)foxSession.getConnectTime());
|
||||
Type type = BSessionInfo.TYPE;
|
||||
if (this.useFoxs) {
|
||||
type = Sys.getType((String)"platCrypto:SslSessionInfo");
|
||||
}
|
||||
Class clazz = type.getTypeClass();
|
||||
String string = null;
|
||||
if (this.getCredentials() instanceof BIUserCredentials) {
|
||||
string = ((BIUserCredentials)this.getCredentials()).getUsername();
|
||||
}
|
||||
try {
|
||||
Class clazz2;
|
||||
Class clazz3;
|
||||
Class clazz4;
|
||||
Class[] classArray = new Class[4];
|
||||
Class clazz5 = class$java$lang$String;
|
||||
if (clazz5 == null) {
|
||||
clazz5 = classArray[0] = (class$java$lang$String = BFoxSession.class("[Ljava.lang.String;", false));
|
||||
}
|
||||
if ((clazz4 = class$javax$baja$sys$BAbsTime) == null) {
|
||||
clazz4 = classArray[1] = (class$javax$baja$sys$BAbsTime = BFoxSession.class("[Ljavax.baja.sys.BAbsTime;", false));
|
||||
}
|
||||
if ((clazz3 = class$java$net$Socket) == null) {
|
||||
clazz3 = classArray[2] = (class$java$net$Socket = BFoxSession.class("[Ljava.net.Socket;", false));
|
||||
}
|
||||
if ((clazz2 = class$java$lang$String) == null) {
|
||||
clazz2 = class$java$lang$String = BFoxSession.class("[Ljava.lang.String;", false);
|
||||
}
|
||||
classArray[3] = clazz2;
|
||||
Method method = clazz.getMethod("make", classArray);
|
||||
Socket socket = foxSession.getSocket();
|
||||
bSessionInfo = (BSessionInfo)method.invoke(null, this.stationName, bAbsTime, socket, string);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
bSessionInfo = null;
|
||||
}
|
||||
return bSessionInfo;
|
||||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return this.connected;
|
||||
}
|
||||
|
||||
public synchronized void connect() throws Exception {
|
||||
if (this.connected) {
|
||||
return;
|
||||
}
|
||||
if (this.credentials == null) {
|
||||
this.credentials = new BUsernameAndPassword();
|
||||
}
|
||||
this.connection.setCredentials((BICredentials)this.credentials);
|
||||
this.connection.setUsername(this.credentials.getUsername());
|
||||
try {
|
||||
this.connection.connect();
|
||||
BOrd bOrd = null;
|
||||
if (this.tunnelAuthorities != null) {
|
||||
this.setLexiconText(LexiconText.make((String)"fox", (String)"nav.foxTunnelSession"));
|
||||
bOrd = this.useFoxs ? BOrd.make((OrdQuery)new BFoxsScheme.FoxQuery(this.port, this.tunnelAuthorities)) : BOrd.make((OrdQuery)new BFoxScheme.FoxQuery(this.port, this.tunnelAuthorities));
|
||||
} else {
|
||||
bOrd = this.useFoxs ? BOrd.make((OrdQuery)new BFoxsScheme.FoxQuery(this.port)) : BOrd.make((OrdQuery)new BFoxScheme.FoxQuery(this.port));
|
||||
}
|
||||
if (!bOrd.equivalent((Object)this.ordInHost)) {
|
||||
this.ordInHost = bOrd;
|
||||
this.absOrd = BOrd.make((BOrd)this.host.getAbsoluteOrd(), (BOrd)this.ordInHost);
|
||||
}
|
||||
if (!this.connection.hasInterests()) {
|
||||
this.connection.engageNoRetry(this, 0L);
|
||||
}
|
||||
}
|
||||
catch (FoxAuthenticationException foxAuthenticationException) {
|
||||
if (foxAuthenticationException.fatal != null) {
|
||||
throw new FatalAuthenticationException(foxAuthenticationException.fatal);
|
||||
}
|
||||
this.authenticationScheme = foxAuthenticationException.method == null ? "Fox" : "Fox (" + foxAuthenticationException.method + ')';
|
||||
throw new AuthenticationException((AuthenticationRealm)this, (Throwable)foxAuthenticationException);
|
||||
}
|
||||
}
|
||||
|
||||
void postConnect() throws Exception {
|
||||
FoxMessage foxMessage = this.connection.session().getRemoteHello();
|
||||
this.stationName = null;
|
||||
try {
|
||||
this.stationName = foxMessage.getString("station.name");
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
this.connection.getChannels().getUserChannel().fetchPrefs();
|
||||
this.connection.getChannels().getSysChannel().subscribeNavEvents();
|
||||
this.loadSubSpaces();
|
||||
this.loadNavFileSpace();
|
||||
BTimeZone bTimeZone = BTimeZone.getLocal();
|
||||
try {
|
||||
bTimeZone = (BTimeZone)BTimeZone.DEFAULT.decodeFromString(foxMessage.getString("timeZone"));
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
this.sessionContext = BFacets.make((String)"TimeZone", (BIDataValue)bTimeZone, (String)"username", (BIDataValue)BString.make((String)this.getUsername()));
|
||||
this.connected = true;
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
this.connection.disengage(this);
|
||||
this.connection.close();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
this.disconnect();
|
||||
this.host.removeNavChild((BINavNode)this);
|
||||
}
|
||||
|
||||
public String getStationFault() {
|
||||
return this.stationFault;
|
||||
}
|
||||
|
||||
public Context getSessionContext() {
|
||||
return this.sessionContext;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return this.connection.getUsername();
|
||||
}
|
||||
|
||||
public BAbsTime getLastFailureTime() {
|
||||
return this.connection.getLastFailureTime();
|
||||
}
|
||||
|
||||
public String getLastFailureCause() {
|
||||
return this.connection.getLastFailureCause();
|
||||
}
|
||||
|
||||
public BRelTime getRetryPeriod() {
|
||||
return this.connection.getRetryPeriod();
|
||||
}
|
||||
|
||||
public void setRetryPeriod(BRelTime bRelTime) {
|
||||
this.connection.setRetryPeriod(bRelTime);
|
||||
}
|
||||
|
||||
public BAbsTime getNextAttemptTime() {
|
||||
return this.connection.getNextAttemptTime();
|
||||
}
|
||||
|
||||
public boolean isEngaged(String string) {
|
||||
return this.connection.isEngaged(this.toInterest(string));
|
||||
}
|
||||
|
||||
public void engageNoRetry(String string) throws Exception {
|
||||
this.connection.engageNoRetry(this.toInterest(string));
|
||||
}
|
||||
|
||||
public void engageNoRetry(String string, long l) throws Exception {
|
||||
this.connection.engageNoRetry(this.toInterest(string), l);
|
||||
}
|
||||
|
||||
public void engageRetry(String string) throws Exception {
|
||||
this.connection.engageRetry(this.toInterest(string));
|
||||
}
|
||||
|
||||
public void disengage(String string) {
|
||||
this.connection.disengage(this.toInterest(string));
|
||||
}
|
||||
|
||||
private final BFoxClientConnection.Interest toInterest(String string) {
|
||||
return new BFoxClientConnection.StringInterest(string);
|
||||
}
|
||||
|
||||
synchronized void sessionOpened() {
|
||||
}
|
||||
|
||||
synchronized void sessionClosed() {
|
||||
this.connected = false;
|
||||
this.stationFault = null;
|
||||
this.unloadSubSpaces();
|
||||
this.credentials = null;
|
||||
this.connection.setUsername("");
|
||||
this.connection.setPassword(BPassword.DEFAULT);
|
||||
}
|
||||
|
||||
public String getAuthenticationRealmName() {
|
||||
return this.absOrd.toString();
|
||||
}
|
||||
|
||||
public String getAuthenticationScheme() {
|
||||
return this.authenticationScheme;
|
||||
}
|
||||
|
||||
public BICredentials makeCredentials() {
|
||||
return new BUsernameAndPassword();
|
||||
}
|
||||
|
||||
public BICredentials getCredentials() {
|
||||
return this.credentials;
|
||||
}
|
||||
|
||||
public void setCredentials(BICredentials bICredentials) {
|
||||
if (!(bICredentials instanceof BIUserCredentials)) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.credentials = (BIUserCredentials)bICredentials;
|
||||
}
|
||||
|
||||
public void loadSubSpaces() {
|
||||
try {
|
||||
BSysChannel bSysChannel = this.getConnection().getChannels().getSysChannel();
|
||||
HashMap hashMap = bSysChannel.listLocalSpaces();
|
||||
TypeInfo[] typeInfoArray = Sys.getRegistry().getTypes(BIFoxProxySpace.TYPE.getTypeInfo());
|
||||
int n = 0;
|
||||
while (n < typeInfoArray.length) {
|
||||
TypeInfo typeInfo = typeInfoArray[n];
|
||||
if (!typeInfo.isInterface() && !typeInfo.isAbstract()) {
|
||||
try {
|
||||
BSpace bSpace = (BSpace)typeInfoArray[n].getInstance();
|
||||
if (hashMap.containsKey(bSpace.getNavName()) && this.getNavChild(bSpace.getNavName()) == null) {
|
||||
((BIFoxProxySpace)bSpace).init(this);
|
||||
this.addNavChild((BINavNode)bSpace);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
catch (LocalizableServerException localizableServerException) {
|
||||
if (localizableServerException.getLexiconModule().equals("fox") && localizableServerException.getLexiconKey().equals("error.NoPermissionForStation")) {
|
||||
throw localizableServerException;
|
||||
}
|
||||
localizableServerException.printStackTrace();
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void loadNavFileSpace() {
|
||||
BOrd bOrd = null;
|
||||
try {
|
||||
Object[] objectArray = this.getNavChildren();
|
||||
int n = 0;
|
||||
while (n < objectArray.length) {
|
||||
if (objectArray[n] instanceof BNavFileSpace) {
|
||||
this.removeNavChild(objectArray[n]);
|
||||
break;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
bOrd = this.connection.getChannels().getUserChannel().getNavFile();
|
||||
if (bOrd.isNull()) {
|
||||
return;
|
||||
}
|
||||
BIFile bIFile = (BIFile)bOrd.get((BObject)this);
|
||||
BNavFileSpace bNavFileSpace = new NavFileDecoder(bIFile).decodeDocument();
|
||||
this.addNavChild((BINavNode)bNavFileSpace);
|
||||
objectArray = this.getNavChildren();
|
||||
objectArray = (BINavNode[])ArrayUtil.toTop((Object[])objectArray, (int)(objectArray.length - 1));
|
||||
this.reorderNavChildren((BINavNode[])objectArray);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
System.out.println("ERROR: Cannot load nav file \"" + bOrd + "\": " + throwable);
|
||||
}
|
||||
}
|
||||
|
||||
public void unloadSubSpaces() {
|
||||
try {
|
||||
BINavNode[] bINavNodeArray = this.getNavChildren();
|
||||
int n = 0;
|
||||
while (n < bINavNodeArray.length) {
|
||||
try {
|
||||
BINavNode bINavNode = bINavNodeArray[n];
|
||||
if (bINavNode instanceof BIFoxProxySpace) {
|
||||
BIFoxProxySpace bIFoxProxySpace = (BIFoxProxySpace)bINavNode;
|
||||
bIFoxProxySpace.cleanup(this);
|
||||
}
|
||||
this.removeNavChild(bINavNode);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public BOrd getAbsoluteOrd() {
|
||||
return this.absOrd;
|
||||
}
|
||||
|
||||
public BOrd getOrdInHost() {
|
||||
return this.ordInHost;
|
||||
}
|
||||
|
||||
public String getNavDisplayName(Context context) {
|
||||
String string = super.getNavDisplayName(context);
|
||||
if (!this.useFoxs) {
|
||||
if (this.connection.getPort() != 1911) {
|
||||
string = string + ':' + this.connection.getPort();
|
||||
}
|
||||
} else if (this.connection.getPort() != 4911) {
|
||||
string = string + ':' + this.connection.getPort();
|
||||
}
|
||||
if (this.stationName != null) {
|
||||
string = string + " (" + this.stationName + ')';
|
||||
return string;
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
public BOrd getNavOrd() {
|
||||
return this.absOrd;
|
||||
}
|
||||
|
||||
public BComponent getService(Type type) {
|
||||
try {
|
||||
BBrokerChannel bBrokerChannel = (BBrokerChannel)this.connection.getChannels().get("station", BBrokerChannel.TYPE);
|
||||
SlotPath slotPath = bBrokerChannel.serviceToPath(type.toString());
|
||||
BOrd bOrd = BOrd.make((String)("station:|" + slotPath));
|
||||
return (BComponent)bOrd.get((BObject)this);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new ServiceNotFoundException(type.toString(), (Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public AgentList getAgents(Context context) {
|
||||
AgentList agentList = super.getAgents(context);
|
||||
if (this.tunnelAuthorities != null) {
|
||||
agentList.toTop("workbench:FoxTunnelSessionAgent");
|
||||
} else {
|
||||
agentList.toTop("workbench:FoxSessionAgent");
|
||||
}
|
||||
agentList.toTop("workbench:StationSummary");
|
||||
agentList.remove("workbench:NavContainerView");
|
||||
return agentList;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
BIcon bIcon = null;
|
||||
if (this.isConnected()) {
|
||||
BIcon bIcon2 = bIcon = this.tunnelAuthorities == null ? iconConnected : tunnelIconConnected;
|
||||
if (this.useFoxs) {
|
||||
return BIcon.make((BIcon)bIcon, (BIcon)secureBadgeConnected);
|
||||
}
|
||||
} else {
|
||||
BIcon bIcon3 = bIcon = this.tunnelAuthorities == null ? iconDisconnected : tunnelIconDisconnected;
|
||||
if (this.useFoxs) {
|
||||
return BIcon.make((BIcon)bIcon, (BIcon)secureBadgeDisconnected);
|
||||
}
|
||||
}
|
||||
return bIcon;
|
||||
}
|
||||
|
||||
public static RuntimeException toException(Throwable throwable) {
|
||||
if (throwable instanceof ModuleNotFoundLocalException) {
|
||||
return (RuntimeException)throwable;
|
||||
}
|
||||
if (throwable instanceof ModuleNotFoundRemoteException) {
|
||||
return (RuntimeException)throwable;
|
||||
}
|
||||
ModuleNotFoundException moduleNotFoundException = LocalizableExceptionTranslator.getModuleNotFoundException(throwable);
|
||||
if (moduleNotFoundException != null) {
|
||||
return new ModuleNotFoundLocalException(moduleNotFoundException.getModuleName(), throwable);
|
||||
}
|
||||
if (throwable instanceof RuntimeException) {
|
||||
return (RuntimeException)throwable;
|
||||
}
|
||||
return new BajaRuntimeException(throwable);
|
||||
}
|
||||
|
||||
public final Object fw(int n, Object object, Object object2, Object object3, Object object4) {
|
||||
boolean bl = false;
|
||||
switch (n) {
|
||||
case 805:
|
||||
case 806: {
|
||||
bl = true;
|
||||
}
|
||||
case 801:
|
||||
case 802: {
|
||||
String string = (String)object;
|
||||
BHost bHost = (BHost)object2;
|
||||
String string2 = bl ? "fwFoxs-" + bHost.getHostname() : "fwFox-" + bHost.getHostname();
|
||||
int n2 = bl ? 4911 : 1911;
|
||||
int n3 = object3 != null ? (Integer)object3 : n2;
|
||||
String[] stringArray = (String[])object4;
|
||||
if (n3 != n2) {
|
||||
string2 = string2 + ':' + n3;
|
||||
}
|
||||
if (stringArray != null) {
|
||||
int n4 = 0;
|
||||
while (n4 < stringArray.length) {
|
||||
if (stringArray[n4] != null) {
|
||||
string2 = string2 + '/' + stringArray[n4];
|
||||
}
|
||||
++n4;
|
||||
}
|
||||
}
|
||||
BFoxSession bFoxSession = new BFoxSession(string2, string, bHost, n3, bl, stringArray);
|
||||
Integer n5 = n == 801 || n == 805 ? FoxSession.FW_FOX_SESSION : FoxSession.FW_STATION_FOX_SESSION;
|
||||
bFoxSession.connection.fw(803, n5, null, null, null);
|
||||
return bFoxSession;
|
||||
}
|
||||
case 404: {
|
||||
if (object == null || ((String)object).equalsIgnoreCase("baja")) {
|
||||
return this.getConnection().getRemoteVersion();
|
||||
}
|
||||
if (this.getConnection().getRemoteVersion().compareTo((Object)new Version(new int[]{3, 6, 13})) != -1) {
|
||||
BSysChannel bSysChannel = this.getConnection().getChannels().getSysChannel();
|
||||
try {
|
||||
byte[] byArray = bSysChannel.stationCall("module.version", ((String)object).getBytes());
|
||||
return new Version(new String(byArray));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return super.fw(n, object, object2, object3, object4);
|
||||
}
|
||||
|
||||
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.tunnelAuthorities = null;
|
||||
this.authenticationScheme = "Fox";
|
||||
this.uiCache = null;
|
||||
}
|
||||
|
||||
private BFoxSession(String string, String string2, BHost bHost, int n, boolean bl, String[] stringArray) {
|
||||
super(string);
|
||||
this.this();
|
||||
this.stationName = string2;
|
||||
this.host = bHost;
|
||||
this.port = n;
|
||||
this.useFoxs = bl;
|
||||
this.tunnelAuthorities = stringArray;
|
||||
if (stringArray != null) {
|
||||
this.setLexiconText(LexiconText.make((String)"fox", (String)"nav.foxTunnelSession"));
|
||||
this.ordInHost = bl ? BOrd.make((OrdQuery)new BFoxsScheme.FoxQuery(n, stringArray)) : BOrd.make((OrdQuery)new BFoxScheme.FoxQuery(n, stringArray));
|
||||
} else {
|
||||
this.ordInHost = bl ? BOrd.make((OrdQuery)new BFoxsScheme.FoxQuery(n)) : BOrd.make((OrdQuery)new BFoxScheme.FoxQuery(n));
|
||||
}
|
||||
this.absOrd = BOrd.make((BOrd)bHost.getAbsoluteOrd(), (BOrd)this.ordInHost);
|
||||
this.connection = new BFoxClientConnection(this);
|
||||
if (Fox.appVersion == "unknown") {
|
||||
try {
|
||||
Fox.appVersion = "" + Sys.getBajaModule().getVendorVersion();
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
try {
|
||||
Fox.hostName = Sys.getLocalHost().getHostName();
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
try {
|
||||
Fox.hostAddress = Sys.getLocalHost().getHostAddress();
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$BFoxSession;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxSession = BFoxSession.class("[Lcom.tridium.fox.sys.BFoxSession;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
iconConnected = BIcon.std((String)"fox.png");
|
||||
iconDisconnected = BIcon.std((String)"foxDisconnected.png");
|
||||
tunnelIconConnected = BIcon.std((String)"foxTunnel.png");
|
||||
tunnelIconDisconnected = BIcon.std((String)"foxTunnelDisconnected.png");
|
||||
secureBadgeConnected = BIcon.std((String)"badges/lock.png");
|
||||
secureBadgeDisconnected = BIcon.std((String)"badges/lockDisconnected.png");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.io.net.IClientSocketFactory
|
||||
* javax.baja.naming.BHost
|
||||
* javax.baja.naming.BIpHost
|
||||
* javax.baja.security.crypto.BTlsEnum
|
||||
* javax.baja.security.crypto.CertManagerFactory
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.session.Fox;
|
||||
import com.tridium.fox.session.FoxCircuit;
|
||||
import com.tridium.fox.session.FoxRequest;
|
||||
import com.tridium.fox.session.FoxResponse;
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import com.tridium.fox.sys.Acceptor;
|
||||
import com.tridium.fox.sys.BFoxConnection;
|
||||
import com.tridium.fox.sys.BFoxScheme;
|
||||
import com.tridium.fox.sys.BFoxService;
|
||||
import com.tridium.fox.sys.BFoxsScheme;
|
||||
import com.tridium.fox.sys.NiagaraNetwork;
|
||||
import com.tridium.fox.sys.NiagaraStation;
|
||||
import java.net.Socket;
|
||||
import javax.baja.io.net.IClientSocketFactory;
|
||||
import javax.baja.naming.BHost;
|
||||
import javax.baja.naming.BIpHost;
|
||||
import javax.baja.security.crypto.BTlsEnum;
|
||||
import javax.baja.security.crypto.CertManagerFactory;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFoxTunnelServerConnection
|
||||
extends BFoxConnection {
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxTunnelServerConnection;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void initHello(FoxMessage foxMessage) throws Exception {
|
||||
}
|
||||
|
||||
public final void sessionOpened(FoxSession foxSession) {
|
||||
Acceptor.acceptTunnel(this);
|
||||
this.log.opened(foxSession);
|
||||
this.setState("Connected Tunnel [" + foxSession.getId() + ']');
|
||||
this.setLastConnectTime(Clock.time());
|
||||
}
|
||||
|
||||
public FoxResponse process(FoxRequest foxRequest) throws Throwable {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void circuitOpened(FoxCircuit foxCircuit) throws Throwable {
|
||||
}
|
||||
|
||||
public void sessionClosed(FoxSession foxSession, Throwable throwable) {
|
||||
this.log.closed(foxSession, throwable);
|
||||
this.setState("Not connected");
|
||||
this.setLastDisconnectTime(Clock.time());
|
||||
this.setLastDisconnectCause(throwable == null ? "" : throwable.toString());
|
||||
}
|
||||
|
||||
public final boolean isTunnelServerConnection() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled force condition propagation
|
||||
* Lifted jumps to return sites
|
||||
*/
|
||||
public Socket createTunnelSocket(String string, boolean bl) throws Exception {
|
||||
NiagaraStation niagaraStation;
|
||||
NiagaraNetwork niagaraNetwork;
|
||||
boolean bl2 = bl;
|
||||
String string2 = BFoxScheme.parseHost(string);
|
||||
int n = bl2 ? BFoxsScheme.parsePort(string) : BFoxScheme.parsePort(string);
|
||||
BHost bHost = null;
|
||||
if (Fox.onlyTunnelKnownStations || this.fwConnectionType != -1) {
|
||||
niagaraNetwork = BFoxService.getNiagaraNetwork();
|
||||
if (niagaraNetwork == null) {
|
||||
throw new BajaRuntimeException("NiagaraNetwork not found. Cannot create tunnel socket to " + string);
|
||||
}
|
||||
niagaraStation = niagaraNetwork.getStation(string2);
|
||||
if (niagaraStation == null) {
|
||||
if (this.fwConnectionType == -1) throw new BajaRuntimeException("NiagaraStation '" + string2 + "' not found. Cannot create tunnel socket to " + string);
|
||||
bHost = BHost.getHost((String)string2);
|
||||
if (bHost == null) {
|
||||
bHost = new BIpHost(string2);
|
||||
}
|
||||
} else {
|
||||
bHost = niagaraStation.getRemoteHost();
|
||||
n = niagaraStation.getFoxPort();
|
||||
String string3 = niagaraStation.getScheme();
|
||||
bl2 = string3.equalsIgnoreCase("foxs");
|
||||
}
|
||||
} else {
|
||||
bHost = BHost.getHost((String)string2);
|
||||
if (bHost == null) {
|
||||
bHost = new BIpHost(string2);
|
||||
BHost.mount((BHost)bHost);
|
||||
}
|
||||
}
|
||||
if (!bl2) return bHost.openSocket(n);
|
||||
niagaraNetwork = CertManagerFactory.getInstanceEx();
|
||||
niagaraStation = niagaraNetwork.getClientSocketFactory(BTlsEnum.DEFAULT.getTag());
|
||||
return bHost.openSocket(n, (IClientSocketFactory)niagaraStation);
|
||||
}
|
||||
|
||||
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$fox$sys$BFoxTunnelServerConnection;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxTunnelServerConnection = BFoxTunnelServerConnection.class("[Lcom.tridium.fox.sys.BFoxTunnelServerConnection;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.user.AuthenticateUtil
|
||||
* javax.baja.user.BUser
|
||||
* javax.baja.user.BUserService
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import com.tridium.fox.sys.BFoxDefaultAuthAgent;
|
||||
import com.tridium.fox.sys.BIFoxAuthAgent;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.user.AuthenticateUtil;
|
||||
import javax.baja.user.BUser;
|
||||
import javax.baja.user.BUserService;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFoxUsernamePasswordAuthAgent
|
||||
extends BFoxDefaultAuthAgent
|
||||
implements BIFoxAuthAgent {
|
||||
public static final BFoxUsernamePasswordAuthAgent INSTANCE = new BFoxUsernamePasswordAuthAgent();
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxUsernamePasswordAuthAgent;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
protected boolean authenticateBasic(FoxSession foxSession) throws Exception {
|
||||
return super.authenticateBasic(foxSession);
|
||||
}
|
||||
|
||||
protected boolean authenticateDigest(FoxSession foxSession) throws Exception {
|
||||
return super.authenticateDigest(foxSession);
|
||||
}
|
||||
|
||||
protected BUser authenticateUser(BUserService bUserService, String string, String string2, Context context) {
|
||||
return AuthenticateUtil.authenticateUsernameAndPassword((String)string, (String)string2, (BUserService)bUserService, (Context)context);
|
||||
}
|
||||
|
||||
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$fox$sys$BFoxUsernamePasswordAuthAgent;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxUsernamePasswordAuthAgent = BFoxUsernamePasswordAuthAgent.class("[Lcom.tridium.fox.sys.BFoxUsernamePasswordAuthAgent;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.net.HttpUtil
|
||||
* javax.baja.naming.BHost
|
||||
* javax.baja.naming.BIpHost
|
||||
* javax.baja.naming.BStationSessionScheme
|
||||
* javax.baja.naming.OrdQuery
|
||||
* javax.baja.naming.OrdQueryList
|
||||
* javax.baja.naming.OrdTarget
|
||||
* javax.baja.naming.SyntaxException
|
||||
* javax.baja.naming.UnresolvedException
|
||||
* javax.baja.nre.util.TextUtil
|
||||
* javax.baja.security.AuthenticationException
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.fox.sys.LocalizableServerException;
|
||||
import com.tridium.net.HttpUtil;
|
||||
import javax.baja.naming.BHost;
|
||||
import javax.baja.naming.BIpHost;
|
||||
import javax.baja.naming.BStationSessionScheme;
|
||||
import javax.baja.naming.OrdQuery;
|
||||
import javax.baja.naming.OrdQueryList;
|
||||
import javax.baja.naming.OrdTarget;
|
||||
import javax.baja.naming.SyntaxException;
|
||||
import javax.baja.naming.UnresolvedException;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
import javax.baja.security.AuthenticationException;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFoxsScheme
|
||||
extends BStationSessionScheme {
|
||||
public static final int DEFAULT_PORT = 4911;
|
||||
public static final String SCHEME_NAME = "foxs";
|
||||
public static final BFoxsScheme INSTANCE = new BFoxsScheme();
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxsScheme;
|
||||
|
||||
public OrdQuery parse(String string) {
|
||||
return new FoxQuery(string);
|
||||
}
|
||||
|
||||
public OrdTarget resolve(OrdTarget ordTarget, OrdQuery ordQuery) throws SyntaxException, UnresolvedException {
|
||||
String string;
|
||||
BHost bHost;
|
||||
BHost bHost2 = null;
|
||||
BObject bObject = ordTarget.get();
|
||||
bHost2 = bObject instanceof BHost ? (BHost)bObject : ((BComponent)bObject).getHost();
|
||||
FoxQuery foxQuery = (FoxQuery)ordQuery;
|
||||
int n = foxQuery.port;
|
||||
String[] stringArray = foxQuery.tunnelAuthorities;
|
||||
BFoxSession bFoxSession = BFoxSession.make(null, bHost2, n, true, stringArray);
|
||||
if (Sys.isStationStarted() && stringArray != null && stringArray.length > 0 && (bHost = BHost.getHost((String)(string = BFoxsScheme.parseHost(stringArray[stringArray.length - 1])))) == null) {
|
||||
bHost = new BIpHost(string);
|
||||
BHost.mount((BHost)bHost);
|
||||
}
|
||||
try {
|
||||
bFoxSession.connect();
|
||||
return new OrdTarget(ordTarget, (BObject)bFoxSession);
|
||||
}
|
||||
catch (LocalizableServerException localizableServerException) {
|
||||
if (localizableServerException.getLexiconModule().equals("fox") && localizableServerException.getLexiconKey().equals("error.NoPermissionForStation")) {
|
||||
bFoxSession.disconnect();
|
||||
}
|
||||
throw localizableServerException;
|
||||
}
|
||||
catch (AuthenticationException authenticationException) {
|
||||
throw authenticationException;
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
throw new UnresolvedException(ordQuery.toString(), throwable);
|
||||
}
|
||||
}
|
||||
|
||||
public int getDefaultPort() {
|
||||
return 4911;
|
||||
}
|
||||
|
||||
static String parseHost(String string) {
|
||||
return HttpUtil.parseHost((String)string);
|
||||
}
|
||||
|
||||
static int parsePort(String string) {
|
||||
return HttpUtil.parsePort((String)string, (int)4911);
|
||||
}
|
||||
|
||||
static String[] validateAuthorities(String[] stringArray) {
|
||||
if (stringArray == null) {
|
||||
return null;
|
||||
}
|
||||
int n = stringArray.length;
|
||||
if (n < 1) {
|
||||
return null;
|
||||
}
|
||||
String[] stringArray2 = new String[n];
|
||||
int n2 = 0;
|
||||
int n3 = 0;
|
||||
while (n3 < n) {
|
||||
if (stringArray[n3] != null && !stringArray[n3].equals("")) {
|
||||
stringArray2[n2] = stringArray[n3];
|
||||
++n2;
|
||||
}
|
||||
++n3;
|
||||
}
|
||||
String[] stringArray3 = new String[n2];
|
||||
System.arraycopy(stringArray2, 0, stringArray3, 0, n2);
|
||||
return stringArray3;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
private BFoxsScheme() {
|
||||
super(SCHEME_NAME);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$BFoxsScheme;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BFoxsScheme = BFoxsScheme.class("[Lcom.tridium.fox.sys.BFoxsScheme;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public static class FoxQuery
|
||||
implements OrdQuery {
|
||||
int port;
|
||||
String[] tunnelAuthorities;
|
||||
|
||||
public boolean isHost() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSession() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void normalize(OrdQueryList ordQueryList, int n) {
|
||||
ordQueryList.shiftToHost(n);
|
||||
}
|
||||
|
||||
public String getScheme() {
|
||||
return BFoxsScheme.SCHEME_NAME;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
if (this.port != 4911) {
|
||||
stringBuffer.append(String.valueOf(this.port));
|
||||
}
|
||||
if (this.tunnelAuthorities != null) {
|
||||
int n = 0;
|
||||
while (n < this.tunnelAuthorities.length) {
|
||||
if (this.tunnelAuthorities[n] != null && !this.tunnelAuthorities[n].equals("")) {
|
||||
stringBuffer.append("/").append(this.tunnelAuthorities[n]);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "foxs:" + this.getBody();
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public String[] getTunnelAuthorities() {
|
||||
return this.tunnelAuthorities;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.tunnelAuthorities = null;
|
||||
}
|
||||
|
||||
FoxQuery(String string) {
|
||||
this.this();
|
||||
string = string.trim();
|
||||
if (string.length() == 0) {
|
||||
this.port = 4911;
|
||||
} else {
|
||||
int n = string.indexOf(47);
|
||||
if (n >= 0) {
|
||||
this.port = n == 0 ? 4911 : Integer.parseInt(string.substring(0, n));
|
||||
string = string.substring(n);
|
||||
this.tunnelAuthorities = BFoxsScheme.validateAuthorities(TextUtil.splitAndTrim((String)string, (char)'/'));
|
||||
} else {
|
||||
this.port = Integer.parseInt(string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FoxQuery(int n) {
|
||||
this.this();
|
||||
this.port = n;
|
||||
}
|
||||
|
||||
FoxQuery(int n, String[] stringArray) {
|
||||
this.this();
|
||||
this.port = n;
|
||||
this.tunnelAuthorities = BFoxsScheme.validateAuthorities(stringArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BInterface
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.session.FoxServer;
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import javax.baja.sys.BInterface;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIFoxAuthAgent
|
||||
extends BInterface {
|
||||
public static final Type TYPE;
|
||||
|
||||
public boolean authenticate(FoxSession var1, FoxServer var2) throws Exception;
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$com$tridium$fox$sys$BIFoxAuthAgent;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$com$tridium$fox$sys$BIFoxAuthAgent = 1.class("[Lcom.tridium.fox.sys.BIFoxAuthAgent;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.space.BGateway
|
||||
* javax.baja.agent.BIAgent
|
||||
* javax.baja.space.BSpace
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.space.BGateway;
|
||||
import javax.baja.agent.BIAgent;
|
||||
import javax.baja.space.BSpace;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIFoxGatewayProxyFactory
|
||||
extends BIAgent {
|
||||
public static final Type TYPE;
|
||||
|
||||
public BSpace makeFoxGatewayProxySpace(BGateway var1);
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$com$tridium$fox$sys$BIFoxGatewayProxyFactory;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$com$tridium$fox$sys$BIFoxGatewayProxyFactory = 1.class("[Lcom.tridium.fox.sys.BIFoxGatewayProxyFactory;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nav.BINavNode
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIFoxProxySpace
|
||||
extends BINavNode {
|
||||
public static final Type TYPE;
|
||||
|
||||
public void init(BFoxSession var1) throws Exception;
|
||||
|
||||
public void cleanup(BFoxSession var1) throws Exception;
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$com$tridium$fox$sys$BIFoxProxySpace;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$com$tridium$fox$sys$BIFoxProxySpace = 1.class("[Lcom.tridium.fox.sys.BIFoxProxySpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.BStruct
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.session.MulticastUtil;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.BStruct;
|
||||
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 BLearnStation
|
||||
extends BStruct {
|
||||
public static final Property stationName = BLearnStation.newProperty((int)8, (String)"", null);
|
||||
public static final Property scheme = BLearnStation.newProperty((int)8, (String)"fox", null);
|
||||
public static final Property address = BLearnStation.newProperty((int)8, (String)"", null);
|
||||
public static final Property hostName = BLearnStation.newProperty((int)0, (String)"", null);
|
||||
public static final Property hostAddress = BLearnStation.newProperty((int)0, (String)"", null);
|
||||
public static final Property foxPort = BLearnStation.newProperty((int)0, (int)0, null);
|
||||
public static final Property version = BLearnStation.newProperty((int)8, (String)"", null);
|
||||
public static final Property hostModel = BLearnStation.newProperty((int)8, (String)"", null);
|
||||
public static final Property hostId = BLearnStation.newProperty((int)0, (String)"", null);
|
||||
public static final Property vmName = BLearnStation.newProperty((int)0, (String)"", null);
|
||||
public static final Property vmVersion = BLearnStation.newProperty((int)0, (String)"", null);
|
||||
public static final Property osName = BLearnStation.newProperty((int)0, (String)"", null);
|
||||
public static final Property osVersion = BLearnStation.newProperty((int)0, (String)"", null);
|
||||
public static final Type TYPE;
|
||||
private String key;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BLearnStation;
|
||||
|
||||
public String getStationName() {
|
||||
return this.getString(stationName);
|
||||
}
|
||||
|
||||
public void setStationName(String string) {
|
||||
this.setString(stationName, string, null);
|
||||
}
|
||||
|
||||
public String getScheme() {
|
||||
return this.getString(scheme);
|
||||
}
|
||||
|
||||
public void setScheme(String string) {
|
||||
this.setString(scheme, string, null);
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return this.getString(address);
|
||||
}
|
||||
|
||||
public void setAddress(String string) {
|
||||
this.setString(address, string, null);
|
||||
}
|
||||
|
||||
public String getHostName() {
|
||||
return this.getString(hostName);
|
||||
}
|
||||
|
||||
public void setHostName(String string) {
|
||||
this.setString(hostName, string, null);
|
||||
}
|
||||
|
||||
public String getHostAddress() {
|
||||
return this.getString(hostAddress);
|
||||
}
|
||||
|
||||
public void setHostAddress(String string) {
|
||||
this.setString(hostAddress, string, null);
|
||||
}
|
||||
|
||||
public int getFoxPort() {
|
||||
return this.getInt(foxPort);
|
||||
}
|
||||
|
||||
public void setFoxPort(int n) {
|
||||
this.setInt(foxPort, n, null);
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return this.getString(version);
|
||||
}
|
||||
|
||||
public void setVersion(String string) {
|
||||
this.setString(version, string, null);
|
||||
}
|
||||
|
||||
public String getHostModel() {
|
||||
return this.getString(hostModel);
|
||||
}
|
||||
|
||||
public void setHostModel(String string) {
|
||||
this.setString(hostModel, string, null);
|
||||
}
|
||||
|
||||
public String getHostId() {
|
||||
return this.getString(hostId);
|
||||
}
|
||||
|
||||
public void setHostId(String string) {
|
||||
this.setString(hostId, string, null);
|
||||
}
|
||||
|
||||
public String getVmName() {
|
||||
return this.getString(vmName);
|
||||
}
|
||||
|
||||
public void setVmName(String string) {
|
||||
this.setString(vmName, string, null);
|
||||
}
|
||||
|
||||
public String getVmVersion() {
|
||||
return this.getString(vmVersion);
|
||||
}
|
||||
|
||||
public void setVmVersion(String string) {
|
||||
this.setString(vmVersion, string, null);
|
||||
}
|
||||
|
||||
public String getOsName() {
|
||||
return this.getString(osName);
|
||||
}
|
||||
|
||||
public void setOsName(String string) {
|
||||
this.setString(osName, string, null);
|
||||
}
|
||||
|
||||
public String getOsVersion() {
|
||||
return this.getString(osVersion);
|
||||
}
|
||||
|
||||
public void setOsVersion(String string) {
|
||||
this.setString(osVersion, string, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static BLearnStation[] make(FoxMessage foxMessage) throws Exception {
|
||||
BLearnStation bLearnStation;
|
||||
Class clazz = class$com$tridium$fox$sys$BLearnStation;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BLearnStation = BLearnStation.class("[Lcom.tridium.fox.sys.BLearnStation;", false);
|
||||
}
|
||||
Array array = new Array(clazz);
|
||||
BLearnStation bLearnStation2 = new BLearnStation();
|
||||
bLearnStation2.setStationName(foxMessage.getString("station"));
|
||||
if (MulticastUtil.isIpv6Message(foxMessage)) {
|
||||
bLearnStation2.setHostName(foxMessage.getString("hostNameIPv6", foxMessage.getString("hostName", "unknown")));
|
||||
bLearnStation2.setHostAddress(foxMessage.getString("hostAddressIPv6", foxMessage.getString("hostAddress", "unknown")));
|
||||
} else {
|
||||
bLearnStation2.setHostName(foxMessage.getString("hostName"));
|
||||
bLearnStation2.setHostAddress(foxMessage.getString("hostAddress"));
|
||||
}
|
||||
bLearnStation2.setVersion(foxMessage.getString("version", "unknown"));
|
||||
bLearnStation2.setHostModel(foxMessage.getString("hostModel", "unknown"));
|
||||
bLearnStation2.setHostId(foxMessage.getString("hostId", "unknown"));
|
||||
bLearnStation2.setVmName(foxMessage.getString("vmName", "unknown"));
|
||||
bLearnStation2.setVmVersion(foxMessage.getString("vmVersion", "unknown"));
|
||||
bLearnStation2.setOsName(foxMessage.getString("osName", "unknown"));
|
||||
bLearnStation2.setOsVersion(foxMessage.getString("osVersion", "unknown"));
|
||||
bLearnStation2.invariant(false);
|
||||
if (foxMessage.getInt("foxPort", 0) != 0) {
|
||||
bLearnStation = (BLearnStation)bLearnStation2.newCopy();
|
||||
bLearnStation.setScheme("fox");
|
||||
bLearnStation.setFoxPort(foxMessage.getInt("foxPort", 0));
|
||||
bLearnStation.invariant(false);
|
||||
array.add((Object)bLearnStation);
|
||||
}
|
||||
if (foxMessage.getInt("foxsPort", 0) != 0) {
|
||||
bLearnStation = (BLearnStation)bLearnStation2.newCopy();
|
||||
bLearnStation.setScheme("foxs");
|
||||
bLearnStation.setFoxPort(foxMessage.getInt("foxsPort", 0));
|
||||
bLearnStation.invariant(false);
|
||||
array.add((Object)bLearnStation);
|
||||
}
|
||||
return (BLearnStation[])array.trim();
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public void invariant(boolean bl) {
|
||||
String string;
|
||||
String string2 = string = bl ? this.getHostName() : this.getHostAddress();
|
||||
if (string.indexOf(58) != -1) {
|
||||
string = "[" + string + ']';
|
||||
}
|
||||
if (this.getScheme().equalsIgnoreCase("fox") && this.getFoxPort() != 1911) {
|
||||
string = string + ':' + this.getFoxPort();
|
||||
} else if (this.getScheme().equalsIgnoreCase("foxs") && this.getFoxPort() != 4911) {
|
||||
string = string + ':' + this.getFoxPort();
|
||||
}
|
||||
this.setAddress(string);
|
||||
this.key = this.getStationName() + ':' + this.getScheme() + '@' + this.getHostAddress() + ':' + this.getFoxPort();
|
||||
}
|
||||
|
||||
public String toString(Context context) {
|
||||
String string = this.getHostAddress();
|
||||
if (string.indexOf(58) != -1) {
|
||||
string = "[" + string + ']';
|
||||
}
|
||||
return this.getStationName() + ':' + this.getScheme() + " @ " + this.getHostName() + '/' + string + ':' + this.getFoxPort() + " [" + this.getVersion() + "; " + this.getHostId() + "; " + this.getHostModel() + "; " + this.getOsName() + ' ' + this.getOsVersion() + "; " + this.getVmName() + ' ' + this.getVmVersion() + ']';
|
||||
}
|
||||
|
||||
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$fox$sys$BLearnStation;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BLearnStation = BLearnStation.class("[Lcom.tridium.fox.sys.BLearnStation;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BServerConnections
|
||||
extends BComponent {
|
||||
public static final Type TYPE;
|
||||
private static final BIcon icon;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BServerConnections;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
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$fox$sys$BServerConnections;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BServerConnections = BServerConnections.class("[Lcom.tridium.fox.sys.BServerConnections;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
icon = BIcon.std((String)"connections.png");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,488 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.space.BIGatewaySpace
|
||||
* com.tridium.sys.Nre
|
||||
* com.tridium.sys.station.Station
|
||||
* com.tridium.sys.station.Station$Message
|
||||
* com.tridium.sys.station.Station$RemoteListener
|
||||
* javax.baja.naming.BLocalHost
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.nav.BINavNode
|
||||
* javax.baja.nav.BNavRoot
|
||||
* javax.baja.nav.NavEvent
|
||||
* javax.baja.nav.NavListener
|
||||
* javax.baja.net.NotConnectedException
|
||||
* javax.baja.security.BIProtected
|
||||
* javax.baja.space.BComponentSpace
|
||||
* javax.baja.space.BSpace
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.Lexicon
|
||||
* javax.baja.virtual.BVirtualComponentSpace
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.message.FoxString;
|
||||
import com.tridium.fox.message.FoxTuple;
|
||||
import com.tridium.fox.session.FoxRequest;
|
||||
import com.tridium.fox.session.FoxResponse;
|
||||
import com.tridium.fox.session.InvalidCommandException;
|
||||
import com.tridium.fox.sys.BFoxChannel;
|
||||
import com.tridium.fox.sys.BFoxChannelRegistry;
|
||||
import com.tridium.fox.sys.BFoxServerConnection;
|
||||
import com.tridium.fox.sys.broker.BBrokerChannel;
|
||||
import com.tridium.fox.sys.broker.BFoxComponentSpace;
|
||||
import com.tridium.space.BIGatewaySpace;
|
||||
import com.tridium.sys.Nre;
|
||||
import com.tridium.sys.station.Station;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
import javax.baja.naming.BLocalHost;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.nav.BNavRoot;
|
||||
import javax.baja.nav.NavEvent;
|
||||
import javax.baja.nav.NavListener;
|
||||
import javax.baja.net.NotConnectedException;
|
||||
import javax.baja.security.BIProtected;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.space.BSpace;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.Lexicon;
|
||||
import javax.baja.virtual.BVirtualComponentSpace;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BSysChannel
|
||||
extends BFoxChannel
|
||||
implements NavListener,
|
||||
Station.RemoteListener {
|
||||
public static final Type TYPE;
|
||||
static byte[] noPayload;
|
||||
private Type[] stationMixIns;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$BSysChannel;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public FoxResponse process(FoxRequest foxRequest) throws Exception {
|
||||
String string = foxRequest.command;
|
||||
if (string == "navEvent") {
|
||||
return this.navEvent(foxRequest);
|
||||
}
|
||||
if (string == "summary") {
|
||||
return this.summary(foxRequest);
|
||||
}
|
||||
if (string == "stationCall") {
|
||||
return this.stationCall(foxRequest);
|
||||
}
|
||||
if (string == "stationEvent") {
|
||||
return this.stationEvent(foxRequest);
|
||||
}
|
||||
if (string == "listLocalSpaces") {
|
||||
return this.listLocalSpaces(foxRequest);
|
||||
}
|
||||
if (string == "makeBrokerChannel") {
|
||||
return this.makeBrokerChannel(foxRequest);
|
||||
}
|
||||
if (string == "subNavEvents") {
|
||||
return this.subscribeNavEvents(foxRequest);
|
||||
}
|
||||
if (string == "unsubNavEvents") {
|
||||
return this.unsubscribeNavEvents(foxRequest);
|
||||
}
|
||||
throw new InvalidCommandException(string);
|
||||
}
|
||||
|
||||
public void sessionClosed(Throwable throwable) throws Exception {
|
||||
BNavRoot.INSTANCE.removeNavListener((NavListener)this);
|
||||
Station.removeRemoteListener((Station.RemoteListener)this);
|
||||
}
|
||||
|
||||
public String[][] summary() throws Exception {
|
||||
FoxRequest foxRequest = this.makeRequest("summary");
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:summary");
|
||||
}
|
||||
FoxResponse foxResponse = this.sendSync(foxRequest);
|
||||
String[][] stringArray = new String[foxResponse.count][];
|
||||
int n = 0;
|
||||
while (n < foxResponse.count) {
|
||||
FoxString foxString = (FoxString)foxResponse.tuples[n];
|
||||
stringArray[n] = new String[]{foxString.name, foxString.value};
|
||||
++n;
|
||||
}
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
public FoxResponse summary(FoxRequest foxRequest) throws Exception {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:listLocalSpaces");
|
||||
}
|
||||
Context context = this.getSessionContext();
|
||||
FoxResponse foxResponse = new FoxResponse(foxRequest);
|
||||
foxResponse.add("stationName", Sys.getStation().getStationName());
|
||||
foxResponse.add("host", "" + Sys.getLocalHost());
|
||||
foxResponse.add("hostModel", Nre.getHostModel());
|
||||
foxResponse.add("hostId", Nre.getHostId());
|
||||
foxResponse.add("niagaraVersion", "" + Sys.getBajaModule().getVendorVersion());
|
||||
foxResponse.add("javaVersion", System.getProperty("java.vm.name") + ' ' + System.getProperty("java.vm.version"));
|
||||
foxResponse.add("osVersion", System.getProperty("os.arch") + ' ' + System.getProperty("os.name") + ' ' + System.getProperty("os.version"));
|
||||
foxResponse.add("locale", "" + Locale.getDefault());
|
||||
foxResponse.add("currentTime", BAbsTime.make().toString(context));
|
||||
return foxResponse;
|
||||
}
|
||||
|
||||
public byte[] stationCall(String string, byte[] byArray) throws Exception {
|
||||
if (byArray == null) {
|
||||
byArray = noPayload;
|
||||
}
|
||||
FoxRequest foxRequest = this.makeRequest("stationCall");
|
||||
foxRequest.add("id", string);
|
||||
foxRequest.add("payload", byArray);
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:stationCall " + string);
|
||||
}
|
||||
FoxResponse foxResponse = this.sendSync(foxRequest);
|
||||
return foxResponse.getBlob("payload");
|
||||
}
|
||||
|
||||
public FoxResponse stationCall(FoxRequest foxRequest) throws Exception {
|
||||
Station.Message message;
|
||||
String string = foxRequest.getString("id");
|
||||
byte[] byArray = foxRequest.getBlob("payload");
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:stationCall " + string);
|
||||
}
|
||||
if ((message = Station.remoteCall((Station.Message)new Station.Message(string, byArray))) != null) {
|
||||
byArray = message.payload;
|
||||
}
|
||||
if (byArray == null) {
|
||||
byArray = noPayload;
|
||||
}
|
||||
FoxResponse foxResponse = new FoxResponse(foxRequest);
|
||||
foxResponse.add("payload", byArray);
|
||||
return foxResponse;
|
||||
}
|
||||
|
||||
public void stationEvent(Station.Message message) throws Exception {
|
||||
FoxRequest foxRequest = this.makeRequest("stationEvent");
|
||||
foxRequest.add("id", message.id);
|
||||
foxRequest.add("payload", message.payload);
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:stationEvent " + message.id);
|
||||
}
|
||||
this.sendAsync(foxRequest);
|
||||
}
|
||||
|
||||
public FoxResponse stationEvent(FoxRequest foxRequest) throws Exception {
|
||||
String string = foxRequest.getString("id");
|
||||
byte[] byArray = foxRequest.getBlob("payload");
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:stationEvent " + string);
|
||||
}
|
||||
if (string.equals("stationFault")) {
|
||||
String string2 = null;
|
||||
if (byArray.length > 0) {
|
||||
string2 = Lexicon.make((String)"baja").getText(new String(byArray));
|
||||
}
|
||||
this.getFoxSession().stationFault = string2;
|
||||
} else if (string.equals("mixIns")) {
|
||||
this.stationMixIns = Station.decodeMixIns((byte[])byArray);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Type[] getStationMixIns() {
|
||||
return (Type[])this.stationMixIns.clone();
|
||||
}
|
||||
|
||||
public HashMap listLocalSpaces() throws Exception {
|
||||
FoxRequest foxRequest = this.makeRequest("listLocalSpaces");
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:listLocalSpaces");
|
||||
}
|
||||
FoxResponse foxResponse = this.sendSync(foxRequest);
|
||||
FoxTuple[] foxTupleArray = foxResponse.list("space");
|
||||
String[] stringArray = new String[foxTupleArray.length];
|
||||
HashMap<String, String> hashMap = new HashMap<String, String>();
|
||||
int n = 0;
|
||||
while (n < foxTupleArray.length) {
|
||||
FoxMessage foxMessage = (FoxMessage)foxTupleArray[n];
|
||||
String string = foxMessage.getString("schemeId");
|
||||
hashMap.put(string, string);
|
||||
++n;
|
||||
}
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
public FoxResponse listLocalSpaces(FoxRequest foxRequest) throws Exception {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:listLocalSpaces");
|
||||
}
|
||||
FoxResponse foxResponse = new FoxResponse(foxRequest);
|
||||
BINavNode[] bINavNodeArray = BLocalHost.INSTANCE.getNavChildren();
|
||||
int n = 0;
|
||||
while (n < bINavNodeArray.length) {
|
||||
BINavNode bINavNode = bINavNodeArray[n];
|
||||
if (bINavNode instanceof BSpace) {
|
||||
Object[] objectArray;
|
||||
BSpace bSpace = (BSpace)bINavNode;
|
||||
if (bSpace instanceof BIProtected && !this.getPermissionsFor(bSpace).hasOperatorRead()) {
|
||||
if (bSpace.getNavName().equals("station")) {
|
||||
objectArray = new String[]{this.getConnection() instanceof BFoxServerConnection ? this.getServerConnection().getUser().getUsername() : this.getClientConnection().getUsername()};
|
||||
throw new LocalizableRuntimeException("fox", "error.NoPermissionForStation", objectArray);
|
||||
}
|
||||
} else {
|
||||
objectArray = new FoxMessage("space");
|
||||
objectArray.add("schemeId", bSpace.getNavName());
|
||||
objectArray.add("type", bSpace.getType().toString());
|
||||
foxResponse.add((FoxTuple)objectArray);
|
||||
}
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return foxResponse;
|
||||
}
|
||||
|
||||
public BBrokerChannel makeBrokerChannel(BFoxComponentSpace bFoxComponentSpace) throws Exception {
|
||||
FoxRequest foxRequest = this.makeRequest("makeBrokerChannel");
|
||||
foxRequest.add("ord", "" + bFoxComponentSpace.getOrdInSession());
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:makebrokerChannel");
|
||||
}
|
||||
FoxResponse foxResponse = this.sendSync(foxRequest);
|
||||
String string = foxResponse.getString("channelName");
|
||||
BFoxChannelRegistry bFoxChannelRegistry = this.getConnection().getChannels();
|
||||
BBrokerChannel bBrokerChannel = (BBrokerChannel)bFoxChannelRegistry.get(string, BBrokerChannel.TYPE);
|
||||
bBrokerChannel.initClient(bFoxComponentSpace);
|
||||
return bBrokerChannel;
|
||||
}
|
||||
|
||||
public FoxResponse makeBrokerChannel(FoxRequest foxRequest) throws Exception {
|
||||
String string;
|
||||
Object object;
|
||||
BOrd bOrd = BOrd.make((String)foxRequest.getString("ord"));
|
||||
BComponentSpace bComponentSpace = (BComponentSpace)bOrd.get();
|
||||
if (bComponentSpace instanceof BVirtualComponentSpace) {
|
||||
object = ((BVirtualComponentSpace)bComponentSpace).getVirtualGateway();
|
||||
string = "virt_" + object.getHandle();
|
||||
} else {
|
||||
string = bComponentSpace instanceof BIGatewaySpace ? "gw_" + ((BIGatewaySpace)bComponentSpace).getGateway().getHandle() : bComponentSpace.getNavName();
|
||||
}
|
||||
object = this.getConnection().getChannels();
|
||||
BBrokerChannel bBrokerChannel = (BBrokerChannel)((BFoxChannelRegistry)((Object)object)).get(string, BBrokerChannel.TYPE);
|
||||
bBrokerChannel.initServer(bComponentSpace);
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:makebrokerChannel " + bOrd + " -> " + string);
|
||||
}
|
||||
FoxResponse foxResponse = new FoxResponse(foxRequest);
|
||||
foxResponse.add("channelName", string);
|
||||
return foxResponse;
|
||||
}
|
||||
|
||||
public void subscribeNavEvents() throws Exception {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:subNavEvents");
|
||||
}
|
||||
this.sendAsync(this.makeRequest("subNavEvents"));
|
||||
}
|
||||
|
||||
private final FoxResponse subscribeNavEvents(FoxRequest foxRequest) {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:subNavEvents");
|
||||
}
|
||||
BNavRoot.INSTANCE.addNavListener((NavListener)this);
|
||||
Station.addRemoteListener((Station.RemoteListener)this);
|
||||
Station.broadcastStationFault();
|
||||
Station.broadcastStationMixIns();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void unsubscribeNavEvents() throws Exception {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:unsubNavEvents");
|
||||
}
|
||||
try {
|
||||
this.sendAsync(this.makeRequest("unsubNavEvents"));
|
||||
}
|
||||
catch (NotConnectedException notConnectedException) {}
|
||||
}
|
||||
|
||||
private final FoxResponse unsubscribeNavEvents(FoxRequest foxRequest) {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:unsubNavEvents");
|
||||
}
|
||||
BNavRoot.INSTANCE.removeNavListener((NavListener)this);
|
||||
Station.removeRemoteListener((Station.RemoteListener)this);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void navEvent(NavEvent navEvent) {
|
||||
block16: {
|
||||
try {
|
||||
String string;
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:navEvent " + navEvent);
|
||||
}
|
||||
if (!(string = navEvent.getParentOrd().toString()).startsWith("local:")) {
|
||||
return;
|
||||
}
|
||||
if (string.startsWith("local:|fox:") || string.startsWith("local:|foxs:")) {
|
||||
return;
|
||||
}
|
||||
if (navEvent.getParent() instanceof BComponent) {
|
||||
return;
|
||||
}
|
||||
int n = string.indexOf(124);
|
||||
if (n < 0) {
|
||||
return;
|
||||
}
|
||||
String string2 = string.substring(n + 1);
|
||||
FoxRequest foxRequest = this.makeRequest("navEvent");
|
||||
foxRequest.add("ord", string2);
|
||||
switch (navEvent.getId()) {
|
||||
case 1: {
|
||||
foxRequest.add("id", "a");
|
||||
foxRequest.add("n", navEvent.getNewChildName());
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
foxRequest.add("id", "v");
|
||||
foxRequest.add("o", navEvent.getOldChildName());
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
foxRequest.add("id", "r");
|
||||
foxRequest.add("o", navEvent.getOldChildName());
|
||||
foxRequest.add("n", navEvent.getNewChildName());
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
String[] stringArray = navEvent.getNewOrder();
|
||||
int n2 = 0;
|
||||
while (n2 < stringArray.length) {
|
||||
stringBuffer.append(stringArray[n2]).append('|');
|
||||
++n2;
|
||||
}
|
||||
foxRequest.add("id", "o");
|
||||
foxRequest.add("o", stringBuffer.toString());
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
foxRequest.add("id", "p");
|
||||
foxRequest.add("o", navEvent.getOldChildName());
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
foxRequest.add("id", "c");
|
||||
foxRequest.add("o", navEvent.getOldChildName());
|
||||
foxRequest.add("n", navEvent.getNewChildName());
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw new IllegalStateException(navEvent.toString());
|
||||
}
|
||||
}
|
||||
this.sendAsync(foxRequest);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
if (!this.getConnection().isConnected()) break block16;
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final FoxResponse navEvent(FoxRequest foxRequest) throws Exception {
|
||||
String string = foxRequest.getString("ord");
|
||||
BOrd bOrd = BOrd.make((BOrd)this.getFoxSession().getAbsoluteOrd(), (String)string);
|
||||
String string2 = foxRequest.getString("id");
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:navEvent " + string2 + ' ' + bOrd);
|
||||
}
|
||||
NavEvent navEvent = null;
|
||||
if (string2.equals("a")) {
|
||||
String string3 = foxRequest.getString("n");
|
||||
navEvent = NavEvent.makeAdded((BOrd)bOrd, (String)string3, null);
|
||||
} else if (string2.equals("v")) {
|
||||
String string4 = foxRequest.getString("o");
|
||||
navEvent = NavEvent.makeRemoved((BOrd)bOrd, (String)string4, null);
|
||||
} else if (string2.equals("r")) {
|
||||
String string5 = foxRequest.getString("o");
|
||||
String string6 = foxRequest.getString("n");
|
||||
navEvent = NavEvent.makeRenamed((BOrd)bOrd, (String)string5, (String)string6, null);
|
||||
} else if (string2.equals("o")) {
|
||||
String string7 = foxRequest.getString("o");
|
||||
ArrayList<String> arrayList = new ArrayList<String>();
|
||||
StringTokenizer stringTokenizer = new StringTokenizer(string7, "|");
|
||||
while (stringTokenizer.hasMoreTokens()) {
|
||||
arrayList.add(stringTokenizer.nextToken());
|
||||
}
|
||||
String[] stringArray = arrayList.toArray(new String[arrayList.size()]);
|
||||
navEvent = NavEvent.makeReordered((BOrd)bOrd, (String[])stringArray, null);
|
||||
} else if (string2.equals("p")) {
|
||||
String string8 = foxRequest.getString("o");
|
||||
navEvent = NavEvent.makeReplaced((BOrd)bOrd, (String)string8, null);
|
||||
} else if (string2.equals("c")) {
|
||||
String string9 = foxRequest.getString("o");
|
||||
String string10 = foxRequest.getString("n");
|
||||
navEvent = NavEvent.makeRecategorized((BOrd)bOrd, (String)string9, (String)string10, null);
|
||||
} else {
|
||||
System.out.println("ERROR: Unknown event type: " + string2);
|
||||
Thread.dumpStack();
|
||||
}
|
||||
if (navEvent != null) {
|
||||
BNavRoot.INSTANCE.fireNavEvent(navEvent);
|
||||
}
|
||||
return 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.stationMixIns = new Type[0];
|
||||
}
|
||||
|
||||
public BSysChannel() {
|
||||
super("sys");
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$BSysChannel;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$BSysChannel = BSysChannel.class("[Lcom.tridium.fox.sys.BSysChannel;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
noPayload = new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
|
||||
public class EngageTimeoutException
|
||||
extends BajaRuntimeException {
|
||||
public EngageTimeoutException(String string) {
|
||||
super(string);
|
||||
}
|
||||
|
||||
public EngageTimeoutException() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
|
||||
public class FatalAuthenticationException
|
||||
extends LocalizableRuntimeException {
|
||||
public FatalAuthenticationException(String string) {
|
||||
super("fox", "FatalAuthenticationException", new Object[]{string}, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.session.MulticastServer;
|
||||
import com.tridium.fox.sys.BLearnStation;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class Learn {
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public static BLearnStation[] learn(long l, MulticastServer.RollcallCallback rollcallCallback) throws Exception {
|
||||
MulticastServer multicastServer = null;
|
||||
try {
|
||||
multicastServer = new MulticastServer(null);
|
||||
multicastServer.start();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
System.err.println("ERROR: Could not create Fox MulticastServer: " + exception);
|
||||
throw exception;
|
||||
}
|
||||
try {
|
||||
BLearnStation[] bLearnStationArray = Learn.learn(multicastServer, l, rollcallCallback);
|
||||
Object var5_6 = null;
|
||||
multicastServer.kill();
|
||||
return bLearnStationArray;
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var5_7 = null;
|
||||
multicastServer.kill();
|
||||
throw throwable;
|
||||
}
|
||||
}
|
||||
|
||||
public static BLearnStation[] learn(MulticastServer multicastServer, long l, MulticastServer.RollcallCallback rollcallCallback) throws Exception {
|
||||
if (multicastServer == null) {
|
||||
return Learn.learn(l, rollcallCallback);
|
||||
}
|
||||
FoxMessage[] foxMessageArray = multicastServer.rollcall(new FoxMessage(), l, rollcallCallback);
|
||||
HashMap<String, BLearnStation> hashMap = new HashMap<String, BLearnStation>();
|
||||
int n = 0;
|
||||
while (n < foxMessageArray.length) {
|
||||
try {
|
||||
BLearnStation[] bLearnStationArray = BLearnStation.make(foxMessageArray[n]);
|
||||
int n2 = 0;
|
||||
while (n2 < bLearnStationArray.length) {
|
||||
if (hashMap.get(bLearnStationArray[n2].getKey()) == null) {
|
||||
hashMap.put(bLearnStationArray[n2].getKey(), bLearnStationArray[n2]);
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
try {
|
||||
foxMessageArray[n].dump();
|
||||
}
|
||||
catch (Exception exception2) {}
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return hashMap.values().toArray(new BLearnStation[hashMap.values().size()]);
|
||||
}
|
||||
|
||||
public static void main(String[] stringArray) throws Exception {
|
||||
long l = 5000L;
|
||||
System.out.println("Searching (" + l + "ms)...");
|
||||
BLearnStation[] bLearnStationArray = Learn.learn(l, null);
|
||||
System.out.println("Found " + bLearnStationArray.length + " Stations");
|
||||
int n = 0;
|
||||
while (n < bLearnStationArray.length) {
|
||||
System.out.println((Object)bLearnStationArray[n]);
|
||||
++n;
|
||||
}
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.util.ThrowableUtil
|
||||
* javax.baja.sys.LocalizableException
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
* javax.baja.sys.ModuleNotFoundException
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.message.FoxString;
|
||||
import com.tridium.fox.message.FoxTuple;
|
||||
import com.tridium.fox.session.Fox;
|
||||
import com.tridium.fox.session.ServerException;
|
||||
import com.tridium.fox.sys.LocalizableServerException;
|
||||
import com.tridium.fox.sys.ModuleNotFoundRemoteException;
|
||||
import com.tridium.util.ThrowableUtil;
|
||||
import java.io.IOException;
|
||||
import javax.baja.sys.LocalizableException;
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
import javax.baja.sys.ModuleNotFoundException;
|
||||
|
||||
public class LocalizableExceptionTranslator
|
||||
extends Fox.ExceptionTranslator {
|
||||
public FoxMessage exceptionToMessage(Throwable throwable) {
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("exception", throwable.toString());
|
||||
try {
|
||||
ModuleNotFoundException moduleNotFoundException = LocalizableExceptionTranslator.getModuleNotFoundException(throwable);
|
||||
if (moduleNotFoundException != null) {
|
||||
foxMessage.add("moduleNotFound", moduleNotFoundException.getModuleName());
|
||||
return foxMessage;
|
||||
}
|
||||
if (throwable instanceof LocalizableException) {
|
||||
LocalizableException localizableException = (LocalizableException)throwable;
|
||||
foxMessage.add("lexModule", localizableException.getLexiconModule());
|
||||
foxMessage.add("lexKey", localizableException.getLexiconKey());
|
||||
Object[] objectArray = localizableException.getLexiconArguments();
|
||||
if (objectArray != null && objectArray.length > 0) {
|
||||
foxMessage.add(this.argsToMessage(objectArray));
|
||||
}
|
||||
} else if (throwable instanceof LocalizableRuntimeException) {
|
||||
LocalizableRuntimeException localizableRuntimeException = (LocalizableRuntimeException)throwable;
|
||||
foxMessage.add("lexModule", localizableRuntimeException.getLexiconModule());
|
||||
foxMessage.add("lexKey", localizableRuntimeException.getLexiconKey());
|
||||
Object[] objectArray = localizableRuntimeException.getLexiconArguments();
|
||||
if (objectArray != null && objectArray.length > 0) {
|
||||
foxMessage.add(this.argsToMessage(objectArray));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable2) {
|
||||
throwable2.printStackTrace();
|
||||
}
|
||||
return foxMessage;
|
||||
}
|
||||
|
||||
public Exception messageToException(FoxMessage foxMessage) throws IOException {
|
||||
try {
|
||||
String string = foxMessage.getString("moduleNotFound", null);
|
||||
if (string != null) {
|
||||
return new ModuleNotFoundRemoteException(string);
|
||||
}
|
||||
String string2 = foxMessage.getString("lexModule", null);
|
||||
if (string2 != null) {
|
||||
String string3 = foxMessage.getString("lexKey", null);
|
||||
Object[] objectArray = this.messageToArgs((FoxMessage)foxMessage.getOptional("lexArgs"));
|
||||
return new LocalizableServerException(string2, string3, objectArray);
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
if (foxMessage == null) {
|
||||
return new ServerException("cause unknown");
|
||||
}
|
||||
return new ServerException(foxMessage.getString("exception", "cause unknown"));
|
||||
}
|
||||
|
||||
FoxMessage argsToMessage(Object[] objectArray) {
|
||||
FoxMessage foxMessage = new FoxMessage("lexArgs");
|
||||
int n = 0;
|
||||
while (n < objectArray.length) {
|
||||
foxMessage.add("a", String.valueOf(objectArray[n]));
|
||||
++n;
|
||||
}
|
||||
return foxMessage;
|
||||
}
|
||||
|
||||
Object[] messageToArgs(FoxMessage foxMessage) {
|
||||
if (foxMessage == null) {
|
||||
return null;
|
||||
}
|
||||
FoxTuple[] foxTupleArray = foxMessage.list("a");
|
||||
Object[] objectArray = new Object[foxTupleArray.length];
|
||||
int n = 0;
|
||||
while (n < objectArray.length) {
|
||||
objectArray[n] = ((FoxString)foxTupleArray[n]).value;
|
||||
++n;
|
||||
}
|
||||
return objectArray;
|
||||
}
|
||||
|
||||
static ModuleNotFoundException getModuleNotFoundException(Throwable throwable) {
|
||||
while (throwable != null) {
|
||||
if (throwable instanceof ModuleNotFoundException) {
|
||||
return (ModuleNotFoundException)throwable;
|
||||
}
|
||||
throwable = ThrowableUtil.getCause((Throwable)throwable);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
|
||||
public class LocalizableServerException
|
||||
extends LocalizableRuntimeException {
|
||||
public LocalizableServerException(String string, String string2, Object[] objectArray) {
|
||||
super(string, string2, objectArray, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
|
||||
public class MismatchedStationNamesException
|
||||
extends BajaRuntimeException {
|
||||
public String toString() {
|
||||
return "Mismatched station names: " + this.getMessage();
|
||||
}
|
||||
|
||||
public MismatchedStationNamesException(String string, String string2) {
|
||||
super(string + " != " + string2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
|
||||
public class ModuleNotFoundLocalException
|
||||
extends LocalizableRuntimeException {
|
||||
public ModuleNotFoundLocalException(String string, Throwable throwable) {
|
||||
super("fox", "ModuleNotFoundLocalException", new Object[]{string}, throwable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
|
||||
public class ModuleNotFoundRemoteException
|
||||
extends LocalizableRuntimeException {
|
||||
public ModuleNotFoundRemoteException(String string) {
|
||||
super("fox", "ModuleNotFoundRemoteException", new Object[]{string});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.sys.NiagaraStation;
|
||||
|
||||
public interface NiagaraNetwork {
|
||||
public NiagaraStation getStation(String var1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.naming.BHost
|
||||
*/
|
||||
package com.tridium.fox.sys;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import javax.baja.naming.BHost;
|
||||
|
||||
public interface NiagaraStation {
|
||||
public String getStationName();
|
||||
|
||||
public BHost getRemoteHost();
|
||||
|
||||
public int getFoxPort();
|
||||
|
||||
public String getScheme();
|
||||
|
||||
public void clientOpened();
|
||||
|
||||
public void clientClosed();
|
||||
|
||||
public void serverOpened();
|
||||
|
||||
public void serverClosed();
|
||||
|
||||
public void initHello(FoxMessage var1) throws Exception;
|
||||
|
||||
public void pingOk();
|
||||
|
||||
public void pingFail(String var1);
|
||||
|
||||
public boolean isFatalFault();
|
||||
|
||||
public String getFaultCause();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,563 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.sys.schema.ComponentSlotMap
|
||||
* com.tridium.sys.transfer.DeleteOp
|
||||
* com.tridium.sys.transfer.RemoteTransferSpace
|
||||
* com.tridium.sys.transfer.TransferResult
|
||||
* com.tridium.sys.transfer.TransferStrategy
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.OrdQuery
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.naming.UnresolvedException
|
||||
* javax.baja.net.NotConnectedException
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.space.BComponentSpace
|
||||
* javax.baja.space.LoadCallbacks
|
||||
* javax.baja.space.SubscribeCallbacks
|
||||
* javax.baja.space.TrapCallbacks
|
||||
* javax.baja.spy.SpyWriter
|
||||
* javax.baja.sync.BProxyComponentSpace
|
||||
* javax.baja.sync.SyncBuffer
|
||||
* javax.baja.sync.SyncOp
|
||||
* javax.baja.sync.Transaction
|
||||
* javax.baja.sync.TrapToSyncBuffer
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.ActionInvokeException
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.CopyHints
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.LexiconText
|
||||
* javax.baja.virtual.BVirtualComponent
|
||||
* javax.baja.virtual.VirtualPath
|
||||
*/
|
||||
package com.tridium.fox.sys.broker;
|
||||
|
||||
import com.tridium.fox.sys.BFoxChannelRegistry;
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.fox.sys.BIFoxProxySpace;
|
||||
import com.tridium.fox.sys.broker.BBrokerChannel;
|
||||
import com.tridium.sys.schema.ComponentSlotMap;
|
||||
import com.tridium.sys.transfer.DeleteOp;
|
||||
import com.tridium.sys.transfer.RemoteTransferSpace;
|
||||
import com.tridium.sys.transfer.TransferResult;
|
||||
import com.tridium.sys.transfer.TransferStrategy;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.OrdQuery;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.naming.UnresolvedException;
|
||||
import javax.baja.net.NotConnectedException;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.space.LoadCallbacks;
|
||||
import javax.baja.space.SubscribeCallbacks;
|
||||
import javax.baja.space.TrapCallbacks;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sync.BProxyComponentSpace;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sync.Transaction;
|
||||
import javax.baja.sync.TrapToSyncBuffer;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.ActionInvokeException;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.CopyHints;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.LexiconText;
|
||||
import javax.baja.virtual.BVirtualComponent;
|
||||
import javax.baja.virtual.VirtualPath;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BFoxComponentSpace
|
||||
extends BProxyComponentSpace
|
||||
implements RemoteTransferSpace,
|
||||
BIFoxProxySpace {
|
||||
public static final Type TYPE;
|
||||
public static final Log log;
|
||||
BBrokerChannel channel;
|
||||
HashMap subscribed;
|
||||
boolean spaceReadonly;
|
||||
long defaultLeaseTime;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$broker$BFoxComponentSpace;
|
||||
static /* synthetic */ Class class$java$lang$String;
|
||||
static /* synthetic */ Class class$javax$baja$sys$BComponent;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void init(BFoxSession bFoxSession) throws Exception {
|
||||
BFoxChannelRegistry bFoxChannelRegistry = bFoxSession.getConnection().getChannels();
|
||||
this.channel = bFoxChannelRegistry.getSysChannel().makeBrokerChannel(this);
|
||||
}
|
||||
|
||||
public void cleanup(BFoxSession bFoxSession) throws Exception {
|
||||
BFoxChannelRegistry bFoxChannelRegistry = bFoxSession.getConnection().getChannels();
|
||||
this.channel.cleanupClient();
|
||||
bFoxChannelRegistry.remove(this.channel.getPropertyInParent());
|
||||
this.channel = null;
|
||||
}
|
||||
|
||||
public boolean isSpaceReadonly() {
|
||||
return this.spaceReadonly;
|
||||
}
|
||||
|
||||
public long getDefaultLeaseTime() {
|
||||
return this.defaultLeaseTime;
|
||||
}
|
||||
|
||||
protected BComponent loadByHandle(Object object) {
|
||||
SlotPath slotPath = this.handleToSlotPath(object);
|
||||
if (slotPath == null) {
|
||||
throw new UnresolvedException(String.valueOf(object));
|
||||
}
|
||||
try {
|
||||
return (BComponent)BOrd.make((OrdQuery)slotPath).get((BObject)this);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("loadByHandle(" + object + "): " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
public SlotPath handleToSlotPath(Object object) {
|
||||
SlotPath slotPath = super.handleToSlotPath(object);
|
||||
if (slotPath != null) {
|
||||
return slotPath;
|
||||
}
|
||||
try {
|
||||
return this.channel().handleToPath(new Object[]{object})[0];
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("handleToSlotPath(" + object + "): " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
public SlotPath[] handlesToSlotPaths(Object[] objectArray) {
|
||||
boolean bl = true;
|
||||
SlotPath[] slotPathArray = new SlotPath[objectArray.length];
|
||||
int n = 0;
|
||||
while (n < slotPathArray.length) {
|
||||
slotPathArray[n] = super.handleToSlotPath(objectArray[n]);
|
||||
if (slotPathArray[n] == null) {
|
||||
bl = false;
|
||||
break;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
if (bl) {
|
||||
return slotPathArray;
|
||||
}
|
||||
try {
|
||||
return this.channel().handleToPath(objectArray);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("handlesToSlotPaths(" + objectArray.length + "): " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
public Object fw(int n, Object object, Object object2, Object object3, Object object4) {
|
||||
switch (n) {
|
||||
case 103: {
|
||||
return this.generateHandles((Integer)object);
|
||||
}
|
||||
case 104: {
|
||||
this.ensureLoaded((SlotPath[])object);
|
||||
return null;
|
||||
}
|
||||
case 106: {
|
||||
return this.delete((DeleteOp)object, false);
|
||||
}
|
||||
case 107: {
|
||||
return this.delete((DeleteOp)object, true);
|
||||
}
|
||||
case 109: {
|
||||
return this.rpc((BComponent)object, (String)object2, (BValue)object3);
|
||||
}
|
||||
}
|
||||
return super.fw(n, object, object2, object3, object4);
|
||||
}
|
||||
|
||||
private final Object[] generateHandles(int n) {
|
||||
try {
|
||||
return this.channel().generateHandles(n);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("generateHandles(): " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
private final DeleteOp delete(DeleteOp deleteOp, boolean bl) {
|
||||
try {
|
||||
deleteOp = this.channel().delete(deleteOp, bl);
|
||||
this.sync();
|
||||
return deleteOp;
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("deleteOp(): " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
private final BValue rpc(BComponent bComponent, String string, BValue bValue) {
|
||||
try {
|
||||
return this.channel().rpc(bComponent, string, bValue);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("rpc(): " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
public final BBrokerChannel channel() throws Exception {
|
||||
if (this.channel == null) {
|
||||
throw new NotConnectedException();
|
||||
}
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
public void ensureLoaded(SlotPath[] slotPathArray) {
|
||||
try {
|
||||
Class clazz = class$java$lang$String;
|
||||
if (clazz == null) {
|
||||
clazz = class$java$lang$String = BFoxComponentSpace.class("[Ljava.lang.String;", false);
|
||||
}
|
||||
Array array = new Array(clazz);
|
||||
HashMap<Slot, Slot> hashMap = new HashMap<Slot, Slot>();
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
int n = 0;
|
||||
while (n < slotPathArray.length) {
|
||||
SlotPath slotPath = slotPathArray[n];
|
||||
boolean bl = slotPath instanceof VirtualPath;
|
||||
stringBuffer.setLength(0);
|
||||
if (bl) {
|
||||
stringBuffer.append("virtual:");
|
||||
} else {
|
||||
stringBuffer.append("slot:");
|
||||
}
|
||||
BComponent bComponent = this.getRootComponent();
|
||||
int n2 = 0;
|
||||
while (n2 < slotPath.depth()) {
|
||||
Object object;
|
||||
String string = slotPath.nameAt(n2);
|
||||
stringBuffer.append('/').append(string);
|
||||
if (bl) {
|
||||
string = SlotPath.escape((String)string);
|
||||
}
|
||||
if (bComponent instanceof BComplex) {
|
||||
ComponentSlotMap componentSlotMap;
|
||||
object = ((BComplex)bComponent).getSlot(string);
|
||||
if (object instanceof Property) {
|
||||
bComponent = ((BComplex)bComponent).get((Property)object);
|
||||
} else if (object == null) {
|
||||
bComponent = null;
|
||||
}
|
||||
if (bComponent instanceof BComponent && !(componentSlotMap = (ComponentSlotMap)bComponent.fw(1)).isBrokerPropsLoaded() && !(bComponent instanceof BVirtualComponent)) {
|
||||
bComponent = null;
|
||||
}
|
||||
}
|
||||
if (bComponent == null && hashMap.get(object = stringBuffer.toString()) == null) {
|
||||
hashMap.put((Slot)object, (Slot)object);
|
||||
array.add(object);
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
if (array.size() == 0) {
|
||||
return;
|
||||
}
|
||||
this.channel().ensureLoaded((String[])array.trim(), 0);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("ensureLoaded(): " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
public Transaction newTransaction(Context context) {
|
||||
return new Transaction((BComponentSpace)this, context){
|
||||
|
||||
public final void commit(Context context) throws Exception {
|
||||
BFoxComponentSpace.this.channel().syncToMaster((SyncBuffer)this);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void sync() throws Exception {
|
||||
this.channel().syncFromMaster();
|
||||
}
|
||||
|
||||
public boolean fireDirectCallbacks() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public TransferResult transfer(TransferStrategy transferStrategy) throws Exception {
|
||||
try {
|
||||
return this.channel().transfer(transferStrategy);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw BFoxSession.toException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void spy(SpyWriter spyWriter) throws Exception {
|
||||
super.spy(spyWriter);
|
||||
spyWriter.startProps("Subscribed");
|
||||
Iterator iterator = this.subscribed.keySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BComponent bComponent = (BComponent)iterator.next();
|
||||
BAbsTime bAbsTime = (BAbsTime)this.subscribed.get(bComponent);
|
||||
spyWriter.tr((Object)bComponent.toPathString(), (Object)bAbsTime);
|
||||
}
|
||||
spyWriter.endProps();
|
||||
}
|
||||
|
||||
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.subscribed = new HashMap();
|
||||
this.spaceReadonly = false;
|
||||
this.defaultLeaseTime = 60000L;
|
||||
}
|
||||
|
||||
public BFoxComponentSpace(String string, LexiconText lexiconText, BOrd bOrd) {
|
||||
super(string, lexiconText, bOrd);
|
||||
this.this();
|
||||
this.setLoadCallbacks(new FoxLoadCallbacks());
|
||||
this.setTrapCallbacks((TrapCallbacks)new FoxTrapCallbacks());
|
||||
this.setSubscribeCallbacks(new FoxSubscribeCallbacks());
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$broker$BFoxComponentSpace;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$broker$BFoxComponentSpace = BFoxComponentSpace.class("[Lcom.tridium.fox.sys.broker.BFoxComponentSpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
log = Log.getLog((String)"FoxSpace");
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class FoxLoadCallbacks
|
||||
extends LoadCallbacks {
|
||||
public boolean isLazyLoad() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void loadSlots(BComponent bComponent) {
|
||||
try {
|
||||
BFoxComponentSpace.this.channel().load(bComponent, 0);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("loadSlots(" + bComponent.toPathString() + "): " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
public BValue[] newCopy(BValue[] bValueArray, CopyHints copyHints) {
|
||||
try {
|
||||
return BFoxComponentSpace.this.channel().copy(bValueArray, copyHints);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("newCopy():" + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
FoxLoadCallbacks() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class FoxTrapCallbacks
|
||||
extends TrapToSyncBuffer {
|
||||
public SyncBuffer getBuffer() {
|
||||
return new AutoCommitSyncBuffer((BComponentSpace)BFoxComponentSpace.this);
|
||||
}
|
||||
|
||||
public BValue invoke(BComponent bComponent, Action action, BValue bValue, Context context) {
|
||||
try {
|
||||
return BFoxComponentSpace.this.channel().invoke(bComponent, action, bValue);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("Cannot invoke: " + bComponent.toPathString() + '.' + action);
|
||||
throw new ActionInvokeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
FoxTrapCallbacks() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class FoxSubscribeCallbacks
|
||||
extends SubscribeCallbacks {
|
||||
public void update(BComponent bComponent, int n) {
|
||||
try {
|
||||
BFoxComponentSpace.this.channel().load(bComponent, n);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("update(" + bComponent.toPathString() + "): " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void subscribe(BComponent[] bComponentArray, int n) {
|
||||
HashMap hashMap;
|
||||
if (n == 0) {
|
||||
hashMap = BFoxComponentSpace.this.subscribed;
|
||||
synchronized (hashMap) {
|
||||
Class clazz = class$javax$baja$sys$BComponent;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$sys$BComponent = BFoxComponentSpace.class("[Ljavax.baja.sys.BComponent;", false);
|
||||
}
|
||||
Array array = new Array(clazz);
|
||||
int n2 = 0;
|
||||
while (true) {
|
||||
if (n2 >= bComponentArray.length) {
|
||||
if (array.size() != 0) break;
|
||||
return;
|
||||
}
|
||||
if (BFoxComponentSpace.this.subscribed.get(bComponentArray[n2]) == null) {
|
||||
array.add((Object)bComponentArray[n2]);
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
bComponentArray = (BComponent[])array.trim();
|
||||
}
|
||||
}
|
||||
try {
|
||||
BFoxComponentSpace.this.channel().subscribe(bComponentArray, n);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("subscribe(" + bComponentArray[0].toPathString() + "): " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
hashMap = BFoxComponentSpace.this.subscribed;
|
||||
synchronized (hashMap) {
|
||||
int n3 = 0;
|
||||
while (n3 < bComponentArray.length) {
|
||||
this.addToSubscribed(bComponentArray[n3], n);
|
||||
++n3;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void addToSubscribed(BComponent bComponent, int n) {
|
||||
BFoxComponentSpace.this.subscribed.put(bComponent, Clock.time());
|
||||
if (n > 0) {
|
||||
BComponent[] bComponentArray = bComponent.getChildComponents();
|
||||
int n2 = 0;
|
||||
while (n2 < bComponentArray.length) {
|
||||
this.addToSubscribed(bComponentArray[n2], n - 1);
|
||||
++n2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void unsubscribe(BComponent[] bComponentArray) {
|
||||
HashMap hashMap = BFoxComponentSpace.this.subscribed;
|
||||
synchronized (hashMap) {
|
||||
int n = 0;
|
||||
while (n < bComponentArray.length) {
|
||||
BFoxComponentSpace.this.subscribed.remove(bComponentArray[n]);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
try {
|
||||
BFoxComponentSpace.this.channel().unsubscribe(bComponentArray);
|
||||
return;
|
||||
}
|
||||
catch (NotConnectedException notConnectedException) {
|
||||
return;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("Cannot unsubscribe: " + bComponentArray[0].toPathString(), (Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
FoxSubscribeCallbacks() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class AutoCommitSyncBuffer
|
||||
extends SyncBuffer {
|
||||
public void add(SyncOp syncOp) {
|
||||
super.add(syncOp);
|
||||
try {
|
||||
BFoxComponentSpace.this.channel().syncToMaster(this);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("AutoCommitSyncBuffer: " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
AutoCommitSyncBuffer(BComponentSpace bComponentSpace) {
|
||||
super(bComponentSpace, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.space.BGateway
|
||||
* com.tridium.space.BIGatewaySpace
|
||||
* javax.baja.naming.BHost
|
||||
* javax.baja.naming.BISession
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.nav.BINavNode
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.LexiconText
|
||||
*/
|
||||
package com.tridium.fox.sys.broker;
|
||||
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.fox.sys.broker.BFoxComponentSpace;
|
||||
import com.tridium.space.BGateway;
|
||||
import com.tridium.space.BIGatewaySpace;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.naming.BHost;
|
||||
import javax.baja.naming.BISession;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.LexiconText;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFoxGatewaySpace
|
||||
extends BFoxComponentSpace
|
||||
implements BIGatewaySpace {
|
||||
public static final Type TYPE;
|
||||
protected final BGateway gateway;
|
||||
private boolean touchEnabled;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$broker$BFoxGatewaySpace;
|
||||
static /* synthetic */ Class class$java$lang$String;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BGateway getGateway() {
|
||||
return this.gateway;
|
||||
}
|
||||
|
||||
public BFoxSession getFoxSession() {
|
||||
return ((BFoxComponentSpace)this.gateway.getSpace()).channel.getFoxSession();
|
||||
}
|
||||
|
||||
public BComponent getRootComponent() {
|
||||
BComponent bComponent = super.getRootComponent();
|
||||
if (bComponent == null) {
|
||||
try {
|
||||
BFoxSession bFoxSession = this.getFoxSession();
|
||||
this.init(bFoxSession);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
return super.getRootComponent();
|
||||
}
|
||||
|
||||
public void setTouchEnabled(boolean bl) {
|
||||
this.touchEnabled = bl;
|
||||
}
|
||||
|
||||
public BHost getHost() {
|
||||
return this.gateway.getSpace().getHost();
|
||||
}
|
||||
|
||||
public BISession getSession() {
|
||||
return this.gateway.getSpace().getSession();
|
||||
}
|
||||
|
||||
public BOrd getOrdInSession() {
|
||||
return BOrd.make((BOrd)this.gateway.getOrdInSession(), (BOrd)this.gateway.getGatewaySchemeOrd());
|
||||
}
|
||||
|
||||
public BOrd getAbsoluteOrd() {
|
||||
return BOrd.make((BOrd)this.gateway.getAbsoluteOrd(), (BOrd)this.gateway.getGatewaySchemeOrd());
|
||||
}
|
||||
|
||||
public BOrd getOrdInHost() {
|
||||
return BOrd.make((BOrd)this.gateway.getOrdInHost(), (BOrd)this.gateway.getGatewaySchemeOrd());
|
||||
}
|
||||
|
||||
public BOrd getNavOrd() {
|
||||
return this.gateway.getNavOrd();
|
||||
}
|
||||
|
||||
public BINavNode getNavParent() {
|
||||
return this.gateway;
|
||||
}
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
boolean bl = false;
|
||||
if (this.getRootComponent() != null) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public BINavNode getNavChild(String string) {
|
||||
return this.getRootComponent().getNavChild(string);
|
||||
}
|
||||
|
||||
public BINavNode resolveNavChild(String string) {
|
||||
return this.getRootComponent().resolveNavChild(string);
|
||||
}
|
||||
|
||||
public BINavNode[] getNavChildren() {
|
||||
return this.getRootComponent().getNavChildren();
|
||||
}
|
||||
|
||||
public Object fw(int n, Object object, Object object2, Object object3, Object object4) {
|
||||
if (n == 110 && this.touchEnabled) {
|
||||
this.touch((BOrd[])object);
|
||||
}
|
||||
return super.fw(n, object, object2, object3, object4);
|
||||
}
|
||||
|
||||
protected void touch(BOrd[] bOrdArray) {
|
||||
try {
|
||||
Class clazz = class$java$lang$String;
|
||||
if (clazz == null) {
|
||||
clazz = class$java$lang$String = BFoxGatewaySpace.class("[Ljava.lang.String;", false);
|
||||
}
|
||||
Array array = new Array(clazz);
|
||||
HashMap<String, String> hashMap = new HashMap<String, String>();
|
||||
int n = 0;
|
||||
while (n < bOrdArray.length) {
|
||||
String string = bOrdArray[n].encodeToString();
|
||||
if (hashMap.get(string) == null) {
|
||||
hashMap.put(string, string);
|
||||
array.add((Object)string);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
if (array.size() == 0) {
|
||||
return;
|
||||
}
|
||||
this.channel().touch((String[])array.trim());
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("touch(): " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
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.touchEnabled = false;
|
||||
}
|
||||
|
||||
public BFoxGatewaySpace() {
|
||||
super("foxgatewayspace", null, BOrd.NULL);
|
||||
this.this();
|
||||
this.gateway = null;
|
||||
}
|
||||
|
||||
public BFoxGatewaySpace(BGateway bGateway, LexiconText lexiconText) {
|
||||
super(bGateway.getGatewaySchemeId(), lexiconText, bGateway.getGatewaySchemeOrd());
|
||||
this.this();
|
||||
this.gateway = bGateway;
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$broker$BFoxGatewaySpace;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$broker$BFoxGatewaySpace = BFoxGatewaySpace.class("[Lcom.tridium.fox.sys.broker.BFoxGatewaySpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.space.BGateway
|
||||
* com.tridium.sys.schema.ComponentSlotMap
|
||||
* javax.baja.agent.AgentFilter
|
||||
* javax.baja.agent.AgentList
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.space.BSpace
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.LexiconText
|
||||
* javax.baja.virtual.BVirtualGateway
|
||||
*/
|
||||
package com.tridium.fox.sys.broker;
|
||||
|
||||
import com.tridium.fox.sys.BIFoxGatewayProxyFactory;
|
||||
import com.tridium.fox.sys.BIFoxProxySpace;
|
||||
import com.tridium.fox.sys.broker.BFoxComponentSpace;
|
||||
import com.tridium.fox.sys.broker.BFoxVirtualSpace;
|
||||
import com.tridium.space.BGateway;
|
||||
import com.tridium.sys.schema.ComponentSlotMap;
|
||||
import javax.baja.agent.AgentFilter;
|
||||
import javax.baja.agent.AgentList;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.space.BSpace;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.LexiconText;
|
||||
import javax.baja.virtual.BVirtualGateway;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFoxStationSpace
|
||||
extends BFoxComponentSpace {
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$broker$BFoxStationSpace;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public Type[] getEnabledMixIns() {
|
||||
return this.channel.getConnection().getChannels().getSysChannel().getStationMixIns();
|
||||
}
|
||||
|
||||
public Object fw(int n, Object object, Object object2, Object object3, Object object4) {
|
||||
if (n == 101) {
|
||||
super.fw(n, object, object2, object3, object4);
|
||||
this.fwMount((ComponentSlotMap)object);
|
||||
return null;
|
||||
}
|
||||
return super.fw(n, object, object2, object3, object4);
|
||||
}
|
||||
|
||||
private final void fwMount(ComponentSlotMap componentSlotMap) {
|
||||
BComponent bComponent = (BComponent)componentSlotMap.getInstance();
|
||||
if (bComponent instanceof BVirtualGateway) {
|
||||
BVirtualGateway bVirtualGateway = (BVirtualGateway)bComponent;
|
||||
bVirtualGateway.fw(108, (Object)new BFoxVirtualSpace(bVirtualGateway), null, null, null);
|
||||
} else if (bComponent instanceof BGateway) {
|
||||
BSpace bSpace = null;
|
||||
BGateway bGateway = (BGateway)bComponent;
|
||||
AgentList agentList = bGateway.getAgents();
|
||||
if ((agentList = agentList.filter(AgentFilter.is((Type)BIFoxGatewayProxyFactory.TYPE))).size() != 0) {
|
||||
bSpace = ((BIFoxGatewayProxyFactory)agentList.getDefault().getInstance()).makeFoxGatewayProxySpace(bGateway);
|
||||
if (!(bSpace instanceof BIFoxProxySpace)) {
|
||||
throw new IllegalStateException("Fox gateway proxy space must implement BIFoxProxySpace");
|
||||
}
|
||||
bGateway.fw(108, (Object)bSpace, null, null, null);
|
||||
} else {
|
||||
throw new IllegalStateException("Could not find BIFoxGatewayProxyFactory for " + bComponent.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 BFoxStationSpace() {
|
||||
super("station", LexiconText.make((String)"baja", (String)"nav.station"), BOrd.make((String)"station:"));
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$broker$BFoxStationSpace;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$broker$BFoxStationSpace = BFoxStationSpace.class("[Lcom.tridium.fox.sys.broker.BFoxStationSpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.sys.schema.ComponentSlotMap
|
||||
* javax.baja.naming.BHost
|
||||
* javax.baja.naming.BISession
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.nav.BINavNode
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.LexiconText
|
||||
* javax.baja.virtual.BVirtualComponent
|
||||
* javax.baja.virtual.BVirtualGateway
|
||||
*/
|
||||
package com.tridium.fox.sys.broker;
|
||||
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.fox.sys.broker.BFoxComponentSpace;
|
||||
import com.tridium.sys.schema.ComponentSlotMap;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.naming.BHost;
|
||||
import javax.baja.naming.BISession;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.LexiconText;
|
||||
import javax.baja.virtual.BVirtualComponent;
|
||||
import javax.baja.virtual.BVirtualGateway;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFoxVirtualSpace
|
||||
extends BFoxComponentSpace {
|
||||
public static final Type TYPE;
|
||||
BVirtualGateway gateway;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$broker$BFoxVirtualSpace;
|
||||
static /* synthetic */ Class class$java$lang$String;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BVirtualGateway getVirtualGateway() {
|
||||
return this.gateway;
|
||||
}
|
||||
|
||||
public BFoxSession getFoxSession() {
|
||||
return ((BFoxComponentSpace)this.gateway.getSpace()).channel.getFoxSession();
|
||||
}
|
||||
|
||||
public BComponent getRootComponent() {
|
||||
BComponent bComponent = super.getRootComponent();
|
||||
if (bComponent == null) {
|
||||
try {
|
||||
BFoxSession bFoxSession = this.getFoxSession();
|
||||
this.init(bFoxSession);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
return super.getRootComponent();
|
||||
}
|
||||
|
||||
public void childUnparented(BComponent bComponent, Property property, BValue bValue, Context context) {
|
||||
super.childUnparented(bComponent, property, bValue, context);
|
||||
if (bComponent instanceof BVirtualComponent) {
|
||||
((ComponentSlotMap)bComponent.fw(1)).setBrokerPropsLoaded(false);
|
||||
}
|
||||
}
|
||||
|
||||
public BHost getHost() {
|
||||
return this.gateway.getSpace().getHost();
|
||||
}
|
||||
|
||||
public BISession getSession() {
|
||||
return this.gateway.getSpace().getSession();
|
||||
}
|
||||
|
||||
public BOrd getOrdInSession() {
|
||||
return BOrd.make((BOrd)this.gateway.getOrdInSession(), (String)"virtual:");
|
||||
}
|
||||
|
||||
public BOrd getAbsoluteOrd() {
|
||||
return BOrd.make((BOrd)this.gateway.getAbsoluteOrd(), (String)"virtual:");
|
||||
}
|
||||
|
||||
public BOrd getOrdInHost() {
|
||||
return BOrd.make((BOrd)this.gateway.getOrdInHost(), (String)"virtual:");
|
||||
}
|
||||
|
||||
public final BOrd getNavOrd() {
|
||||
return this.gateway.getNavOrd();
|
||||
}
|
||||
|
||||
public final BINavNode getNavParent() {
|
||||
return this.gateway;
|
||||
}
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BINavNode getNavChild(String string) {
|
||||
this.getRootComponent();
|
||||
return super.getNavChild(string);
|
||||
}
|
||||
|
||||
public BINavNode resolveNavChild(String string) {
|
||||
this.getRootComponent();
|
||||
return super.resolveNavChild(string);
|
||||
}
|
||||
|
||||
public BINavNode[] getNavChildren() {
|
||||
this.getRootComponent();
|
||||
return super.getNavChildren();
|
||||
}
|
||||
|
||||
public Object fw(int n, Object object, Object object2, Object object3, Object object4) {
|
||||
if (n == 110) {
|
||||
this.touch((BOrd[])object);
|
||||
}
|
||||
return super.fw(n, object, object2, object3, object4);
|
||||
}
|
||||
|
||||
void touch(BOrd[] bOrdArray) {
|
||||
try {
|
||||
Class clazz = class$java$lang$String;
|
||||
if (clazz == null) {
|
||||
clazz = class$java$lang$String = BFoxVirtualSpace.class("[Ljava.lang.String;", false);
|
||||
}
|
||||
Array array = new Array(clazz);
|
||||
HashMap<String, String> hashMap = new HashMap<String, String>();
|
||||
int n = 0;
|
||||
while (n < bOrdArray.length) {
|
||||
String string = bOrdArray[n].encodeToString();
|
||||
if (hashMap.get(string) == null) {
|
||||
hashMap.put(string, string);
|
||||
array.add((Object)string);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
if (array.size() == 0) {
|
||||
return;
|
||||
}
|
||||
this.channel().touch((String[])array.trim());
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("touch(): " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
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 BFoxVirtualSpace(BVirtualGateway bVirtualGateway) {
|
||||
super("virtual", LexiconText.make((String)"baja", (String)"nav.virtual"), BOrd.make((String)"virtual:"));
|
||||
this.setLoadCallbacks(new FoxVirtualLoadCallbacks());
|
||||
this.setSubscribeCallbacks(new FoxVirtualSubscribeCallbacks());
|
||||
this.gateway = bVirtualGateway;
|
||||
}
|
||||
|
||||
public BFoxVirtualSpace() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$broker$BFoxVirtualSpace;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$broker$BFoxVirtualSpace = BFoxVirtualSpace.class("[Lcom.tridium.fox.sys.broker.BFoxVirtualSpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class FoxVirtualLoadCallbacks
|
||||
extends BFoxComponentSpace.FoxLoadCallbacks {
|
||||
/*
|
||||
* Enabled force condition propagation
|
||||
* Lifted jumps to return sites
|
||||
*/
|
||||
public Slot loadSlot(BComponent bComponent, String string) {
|
||||
block7: {
|
||||
Slot slot = bComponent.getSlot(string);
|
||||
if (slot == null) break block7;
|
||||
if (!slot.isProperty()) return slot;
|
||||
BValue bValue = bComponent.get(slot.asProperty());
|
||||
if (!bValue.isComponent()) return slot;
|
||||
if (bValue.asComponent().getComponentSpace() != null) {
|
||||
return slot;
|
||||
}
|
||||
try {
|
||||
}
|
||||
catch (Throwable throwable) {}
|
||||
}
|
||||
try {
|
||||
return BFoxVirtualSpace.this.channel().loadSlot(bComponent, string, 0);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("loadSlot(" + bComponent.toPathString() + ", " + string + "): " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
FoxVirtualLoadCallbacks() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class FoxVirtualSubscribeCallbacks
|
||||
extends BFoxComponentSpace.FoxSubscribeCallbacks {
|
||||
public void update(BComponent bComponent, int n) {
|
||||
try {
|
||||
BFoxVirtualSpace.this.channel().load(bComponent, n, true);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
log.error("update(" + bComponent.toPathString() + "): " + throwable);
|
||||
throw BFoxSession.toException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
FoxVirtualSubscribeCallbacks() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.agent.AgentInfo
|
||||
* javax.baja.agent.AgentList
|
||||
* javax.baja.registry.TypeInfo
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.BTypeSpec
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package com.tridium.fox.sys.broker;
|
||||
|
||||
import javax.baja.agent.AgentInfo;
|
||||
import javax.baja.agent.AgentList;
|
||||
import javax.baja.registry.TypeInfo;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.BTypeSpec;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public class SyntheticTypeInfo
|
||||
implements TypeInfo {
|
||||
private Type type;
|
||||
Lexicon lexicon;
|
||||
|
||||
public AgentInfo getAgentInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getDisplayName(Context context) {
|
||||
return this.type.getTypeSpec().getTypeName();
|
||||
}
|
||||
|
||||
public BIcon getIcon(Context context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public BObject getInstance() {
|
||||
return this.type.getInstance();
|
||||
}
|
||||
|
||||
public TypeInfo[] getInterfaces() {
|
||||
return new TypeInfo[0];
|
||||
}
|
||||
|
||||
public Lexicon getLexicon(Context context) {
|
||||
return this.lexicon;
|
||||
}
|
||||
|
||||
public String getModuleName() {
|
||||
return this.type.getTypeSpec().getModuleName();
|
||||
}
|
||||
|
||||
public TypeInfo getSuperType() {
|
||||
return this.type.getSuperType().getTypeInfo();
|
||||
}
|
||||
|
||||
public String getTypeClassName() {
|
||||
return this.type.getTypeSpec().getResolvedType().getTypeClass().getName();
|
||||
}
|
||||
|
||||
public String getTypeName() {
|
||||
return this.type.getTypeName();
|
||||
}
|
||||
|
||||
public BTypeSpec getTypeSpec() {
|
||||
return this.type.getTypeSpec();
|
||||
}
|
||||
|
||||
public boolean is(TypeInfo typeInfo) {
|
||||
boolean bl = false;
|
||||
if (typeInfo == this || this.type.getSuperType().is(typeInfo)) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public boolean is(Type type) {
|
||||
boolean bl = false;
|
||||
if (type.getTypeInfo() == this || this.type.getSuperType().is(type)) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public boolean isAbstract() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFinal() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInterface() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isTransient() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public AgentList getAgents() {
|
||||
return BComponent.TYPE.getTypeInfo().getAgents();
|
||||
}
|
||||
|
||||
public SyntheticTypeInfo(Type type) {
|
||||
this.type = type;
|
||||
this.lexicon = Lexicon.make((String)"baja");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.sys.transfer.CompTransferResult
|
||||
* com.tridium.sys.transfer.TransferResult
|
||||
* com.tridium.sys.transfer.TransferStrategy
|
||||
* javax.baja.naming.BLocalHost
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.space.BISpaceNode
|
||||
* javax.baja.space.Mark
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
*/
|
||||
package com.tridium.fox.sys.broker;
|
||||
|
||||
import com.tridium.fox.encoding.BogCodec;
|
||||
import com.tridium.fox.encoding.DecoderFactory;
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.message.FoxTuple;
|
||||
import com.tridium.fox.session.FoxRequest;
|
||||
import com.tridium.fox.session.FoxResponse;
|
||||
import com.tridium.sys.transfer.CompTransferResult;
|
||||
import com.tridium.sys.transfer.TransferResult;
|
||||
import com.tridium.sys.transfer.TransferStrategy;
|
||||
import javax.baja.naming.BLocalHost;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.space.BISpaceNode;
|
||||
import javax.baja.space.Mark;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
|
||||
public class TransferCodec {
|
||||
public static FoxRequest transferToMessage(FoxRequest foxRequest, TransferStrategy transferStrategy) throws Exception {
|
||||
foxRequest.add("target", ((BISpaceNode)transferStrategy.getTarget()).getOrdInSession().toString());
|
||||
Mark mark = transferStrategy.getMark();
|
||||
BObject[] bObjectArray = mark.getValues();
|
||||
String[] stringArray = mark.getNames();
|
||||
int n = 0;
|
||||
while (n < bObjectArray.length) {
|
||||
FoxMessage foxMessage = new FoxMessage("mark");
|
||||
foxMessage.add("ord", ((BISpaceNode)bObjectArray[n]).getOrdInSession().toString());
|
||||
foxMessage.add("name", stringArray[n]);
|
||||
foxRequest.add(foxMessage);
|
||||
++n;
|
||||
}
|
||||
foxRequest.add("action", transferStrategy.getAction());
|
||||
BogCodec.add(foxRequest, "params", (BValue)transferStrategy.getParameters(), null);
|
||||
return foxRequest;
|
||||
}
|
||||
|
||||
public static TransferStrategy messageToTransfer(FoxMessage foxMessage, Context context) throws Exception {
|
||||
BObject bObject = BOrd.make((String)foxMessage.getString("target")).get((BObject)BLocalHost.INSTANCE, context);
|
||||
FoxTuple[] foxTupleArray = foxMessage.list("mark");
|
||||
BObject[] bObjectArray = new BObject[foxTupleArray.length];
|
||||
String[] stringArray = new String[foxTupleArray.length];
|
||||
int n = 0;
|
||||
while (n < foxTupleArray.length) {
|
||||
FoxMessage foxMessage2 = (FoxMessage)foxTupleArray[n];
|
||||
bObjectArray[n] = BOrd.make((String)foxMessage2.getString("ord")).get((BObject)BLocalHost.INSTANCE, context);
|
||||
stringArray[n] = foxMessage2.getString("name");
|
||||
++n;
|
||||
}
|
||||
Mark mark = new Mark(bObjectArray, stringArray);
|
||||
int n2 = foxMessage.getInt("action");
|
||||
BComponent bComponent = (BComponent)DecoderFactory.decode(foxMessage, "params", null);
|
||||
return TransferStrategy.make((int)n2, (Mark)mark, (BObject)bObject, (BComponent)bComponent, (Context)context);
|
||||
}
|
||||
|
||||
public static FoxResponse resultToMessage(FoxResponse foxResponse, TransferResult transferResult) throws Exception {
|
||||
if (!(transferResult instanceof CompTransferResult)) {
|
||||
return null;
|
||||
}
|
||||
CompTransferResult compTransferResult = (CompTransferResult)transferResult;
|
||||
foxResponse.add("class", compTransferResult.getClass().getName());
|
||||
foxResponse.add("action", compTransferResult.action);
|
||||
foxResponse.add("origParent", compTransferResult.origParent.getOrdInSession().toString());
|
||||
int n = 0;
|
||||
while (n < compTransferResult.origNames.length) {
|
||||
foxResponse.add("origName", compTransferResult.origNames[n]);
|
||||
++n;
|
||||
}
|
||||
foxResponse.add("target", compTransferResult.target.getOrdInSession().toString());
|
||||
n = 0;
|
||||
while (n < compTransferResult.insertNames.length) {
|
||||
foxResponse.add("insertName", compTransferResult.insertNames[n]);
|
||||
++n;
|
||||
}
|
||||
return foxResponse;
|
||||
}
|
||||
|
||||
public static TransferResult messageToResult(BObject bObject, FoxMessage foxMessage) throws Exception {
|
||||
if (foxMessage == null) {
|
||||
return null;
|
||||
}
|
||||
int n = foxMessage.getInt("action");
|
||||
BOrd bOrd = BOrd.make((String)foxMessage.getString("origParent"));
|
||||
String[] stringArray = foxMessage.listStrings("origName");
|
||||
BOrd bOrd2 = BOrd.make((String)foxMessage.getString("target"));
|
||||
String[] stringArray2 = foxMessage.listStrings("insertName");
|
||||
BComponent bComponent = (BComponent)bOrd.get(bObject);
|
||||
BComponent bComponent2 = (BComponent)bOrd2.get(bObject);
|
||||
return new CompTransferResult(n, bComponent, stringArray, bComponent2, stringArray2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.data.BToDataTable
|
||||
* com.tridium.data.DataTableDecoder
|
||||
* com.tridium.data.DataTableEncoder
|
||||
* javax.baja.collection.BICollection
|
||||
* javax.baja.collection.BITable
|
||||
* javax.baja.data.BIDataTable
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.UnresolvedException
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.BTypeSpec
|
||||
*/
|
||||
package com.tridium.fox.sys.data;
|
||||
|
||||
import com.tridium.data.BToDataTable;
|
||||
import com.tridium.data.DataTableDecoder;
|
||||
import com.tridium.data.DataTableEncoder;
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.session.Fox;
|
||||
import com.tridium.fox.session.FoxCircuit;
|
||||
import com.tridium.fox.session.FoxRequest;
|
||||
import com.tridium.fox.session.FoxResponse;
|
||||
import com.tridium.fox.session.InvalidCommandException;
|
||||
import com.tridium.fox.sys.BFoxChannel;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutput;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.FilterOutputStream;
|
||||
import javax.baja.collection.BICollection;
|
||||
import javax.baja.collection.BITable;
|
||||
import javax.baja.data.BIDataTable;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.UnresolvedException;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.BTypeSpec;
|
||||
|
||||
public class BDataChannel
|
||||
extends BFoxChannel {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$fox$sys$data$BDataChannel == null ? (class$com$tridium$fox$sys$data$BDataChannel = BDataChannel.class$("com.tridium.fox.sys.data.BDataChannel")) : class$com$tridium$fox$sys$data$BDataChannel));
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$data$BDataChannel;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BDataChannel() {
|
||||
super("data");
|
||||
}
|
||||
|
||||
public FoxResponse process(FoxRequest foxRequest) throws Exception {
|
||||
String string = foxRequest.command;
|
||||
throw new InvalidCommandException(string);
|
||||
}
|
||||
|
||||
public void circuitOpened(FoxCircuit foxCircuit) throws Exception {
|
||||
String string = foxCircuit.command;
|
||||
if (string == "resolve") {
|
||||
this.resolve(foxCircuit);
|
||||
return;
|
||||
}
|
||||
throw new InvalidCommandException(string);
|
||||
}
|
||||
|
||||
public BObject resolve(BOrd bOrd) throws Exception {
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("ord", bOrd.toString());
|
||||
FoxCircuit foxCircuit = this.openCircuit("resolve");
|
||||
foxCircuit.writeMessage(foxMessage);
|
||||
foxCircuit.flush();
|
||||
FoxMessage foxMessage2 = foxCircuit.readMessage();
|
||||
if (foxMessage2.getString("exception", null) != null) {
|
||||
throw Fox.exceptionTranslator.messageToException(foxMessage2);
|
||||
}
|
||||
boolean bl = foxMessage2.getBoolean("resolved", false);
|
||||
if (!bl) {
|
||||
throw new UnresolvedException(bOrd.toString());
|
||||
}
|
||||
String string = foxMessage2.getString("targetType");
|
||||
if (string.equals("table")) {
|
||||
BIDataTable bIDataTable = DataTableDecoder.decode((DataInput)new DataInputStream(foxCircuit.getInputStream()));
|
||||
foxCircuit.close();
|
||||
return (BObject)bIDataTable;
|
||||
}
|
||||
if (string.equals("value")) {
|
||||
String string2 = foxMessage2.getString("valueType");
|
||||
Type type = BTypeSpec.make((String)string2).getResolvedType();
|
||||
BObject bObject = type.getInstance();
|
||||
BObject bObject2 = ((BIDataValue)bObject).decode((DataInput)new DataInputStream(foxCircuit.getInputStream()));
|
||||
foxCircuit.close();
|
||||
return bObject2;
|
||||
}
|
||||
throw new UnresolvedException("Unsupported result type (" + string + ") for " + bOrd.toString());
|
||||
}
|
||||
|
||||
public void resolve(FoxCircuit foxCircuit) throws Exception {
|
||||
Object object;
|
||||
Object object2;
|
||||
FoxMessage foxMessage = foxCircuit.readMessage();
|
||||
String string = foxMessage.getString("ord", null);
|
||||
if (string == null) {
|
||||
foxCircuit.writeMessage(BDataChannel.unresolved());
|
||||
foxCircuit.flush();
|
||||
return;
|
||||
}
|
||||
BObject bObject = null;
|
||||
try {
|
||||
object2 = BOrd.make((String)("local:|" + string));
|
||||
bObject = object2.resolve(null, this.getSessionContext()).get();
|
||||
}
|
||||
catch (UnresolvedException unresolvedException) {
|
||||
unresolvedException.printStackTrace();
|
||||
foxCircuit.writeMessage(BDataChannel.unresolved());
|
||||
foxCircuit.flush();
|
||||
return;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
foxCircuit.writeMessage(Fox.exceptionTranslator.exceptionToMessage(exception));
|
||||
foxCircuit.flush();
|
||||
return;
|
||||
}
|
||||
object2 = new FoxMessage();
|
||||
((FoxMessage)object2).add("resolved", true);
|
||||
BObject bObject2 = null;
|
||||
if (bObject instanceof BICollection) {
|
||||
((FoxMessage)object2).add("targetType", "table");
|
||||
if (bObject instanceof BIDataTable) {
|
||||
bObject2 = bObject;
|
||||
} else {
|
||||
object = ((BICollection)bObject).toTable();
|
||||
bObject2 = (BObject)BToDataTable.toDataTable((BITable)object);
|
||||
}
|
||||
} else {
|
||||
((FoxMessage)object2).add("targetType", "value");
|
||||
bObject2 = (BObject)bObject.toDataValue();
|
||||
((FoxMessage)object2).add("valueType", bObject2.getType().getTypeSpec().toString());
|
||||
}
|
||||
foxCircuit.writeMessage((FoxMessage)object2);
|
||||
foxCircuit.flush();
|
||||
object = new DataOutputStream(foxCircuit.getOutputStream());
|
||||
if (bObject2 instanceof BIDataTable) {
|
||||
DataTableEncoder.encode((BIDataTable)((BIDataTable)bObject2), (DataOutput)object, (Context)this.getSessionContext());
|
||||
} else {
|
||||
((BIDataValue)bObject2).encode((DataOutput)object);
|
||||
}
|
||||
((DataOutputStream)object).flush();
|
||||
((FilterOutputStream)object).close();
|
||||
}
|
||||
|
||||
private static FoxMessage unresolved() {
|
||||
return BDataChannel.unresolved(null, null);
|
||||
}
|
||||
|
||||
private static FoxMessage unresolved(String string, String string2) {
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("resolved", false);
|
||||
if (string2 != null) {
|
||||
foxMessage.add("msg", string2);
|
||||
}
|
||||
return foxMessage;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,703 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.sys.transfer.TransferListener
|
||||
* com.tridium.sys.transfer.TransferResult
|
||||
* com.tridium.sys.transfer.TransferStrategy
|
||||
* com.tridium.util.BRestrictedFileSpace
|
||||
* javax.baja.file.BAbstractFileStore
|
||||
* javax.baja.file.BDirectory
|
||||
* javax.baja.file.BFileSpace
|
||||
* javax.baja.file.BFileSystem
|
||||
* javax.baja.file.BIDirectory
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.file.BIFileStore
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.file.FileUtil
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.security.BPermissions
|
||||
* javax.baja.security.PermissionException
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.fox.sys.file;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.message.FoxTuple;
|
||||
import com.tridium.fox.session.Fox;
|
||||
import com.tridium.fox.session.FoxCircuit;
|
||||
import com.tridium.fox.session.FoxRequest;
|
||||
import com.tridium.fox.session.FoxResponse;
|
||||
import com.tridium.fox.session.InvalidCommandException;
|
||||
import com.tridium.fox.sys.BFoxChannel;
|
||||
import com.tridium.fox.sys.BFoxClientConnection;
|
||||
import com.tridium.fox.sys.broker.TransferCodec;
|
||||
import com.tridium.fox.sys.file.BFoxFileSpace;
|
||||
import com.tridium.fox.sys.file.BFoxFileStore;
|
||||
import com.tridium.sys.transfer.TransferListener;
|
||||
import com.tridium.sys.transfer.TransferResult;
|
||||
import com.tridium.sys.transfer.TransferStrategy;
|
||||
import com.tridium.util.BRestrictedFileSpace;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.file.BAbstractFileStore;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.BIDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.file.FileUtil;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.security.PermissionException;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class BFileChannel
|
||||
extends BFoxChannel {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$fox$sys$file$BFileChannel == null ? (class$com$tridium$fox$sys$file$BFileChannel = BFileChannel.class$("com.tridium.fox.sys.file.BFileChannel")) : class$com$tridium$fox$sys$file$BFileChannel));
|
||||
public static int CHUNK_SIZE = 16384;
|
||||
private Array unrestrictedFilePaths = new Array(class$java$lang$String == null ? (class$java$lang$String = BFileChannel.class$("java.lang.String")) : class$java$lang$String);
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$file$BFileChannel;
|
||||
static /* synthetic */ Class class$java$lang$String;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BFileChannel() {
|
||||
super("file");
|
||||
}
|
||||
|
||||
public FoxResponse process(FoxRequest foxRequest) throws Exception {
|
||||
String string = foxRequest.command;
|
||||
if (string == "head") {
|
||||
return this.head(foxRequest);
|
||||
}
|
||||
if (string == "list") {
|
||||
return this.list(foxRequest);
|
||||
}
|
||||
if (string == "delete") {
|
||||
return this.delete(foxRequest);
|
||||
}
|
||||
if (string == "makeFile") {
|
||||
return this.makeFile(foxRequest);
|
||||
}
|
||||
if (string == "makeDir") {
|
||||
return this.makeDir(foxRequest);
|
||||
}
|
||||
if (string == "move") {
|
||||
return this.move(foxRequest);
|
||||
}
|
||||
if (string == "setLastModified") {
|
||||
return this.setLastModified(foxRequest);
|
||||
}
|
||||
if (string == "getCrc") {
|
||||
return this.getCrc(foxRequest);
|
||||
}
|
||||
throw new InvalidCommandException(string);
|
||||
}
|
||||
|
||||
public void circuitOpened(FoxCircuit foxCircuit) throws Exception {
|
||||
String string = foxCircuit.command;
|
||||
if (string == "read") {
|
||||
this.read(foxCircuit);
|
||||
return;
|
||||
}
|
||||
if (string == "write") {
|
||||
this.write(foxCircuit);
|
||||
return;
|
||||
}
|
||||
if (string == "transfer") {
|
||||
this.transfer(foxCircuit);
|
||||
return;
|
||||
}
|
||||
throw new InvalidCommandException(string);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void sessionClosed(Throwable throwable) throws Exception {
|
||||
Array array = this.unrestrictedFilePaths;
|
||||
synchronized (array) {
|
||||
this.unrestrictedFilePaths.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public BFoxFileStore head(BFoxFileSpace bFoxFileSpace, FilePath filePath) throws Exception {
|
||||
FoxResponse foxResponse;
|
||||
FoxRequest foxRequest = this.makeRequest("head");
|
||||
foxRequest.add("path", filePath.getBody());
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:head \"" + filePath.getBody() + "\"");
|
||||
}
|
||||
if ((foxResponse = this.sendSync(foxRequest)) == null) {
|
||||
return null;
|
||||
}
|
||||
return BFileChannel.msgToStore(bFoxFileSpace, filePath, foxResponse);
|
||||
}
|
||||
|
||||
public FoxResponse head(FoxRequest foxRequest) throws Exception {
|
||||
BIFile bIFile;
|
||||
FilePath filePath = new FilePath(foxRequest.getString("path"));
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:head \"" + filePath.getBody() + "\"");
|
||||
}
|
||||
if ((bIFile = this.getFileSpaceForPath(filePath).findFile(filePath)) == null) {
|
||||
return null;
|
||||
}
|
||||
BPermissions bPermissions = this.getPermissionsFor(bIFile);
|
||||
if (!bPermissions.has(BPermissions.operatorRead)) {
|
||||
throw new PermissionException();
|
||||
}
|
||||
FoxResponse foxResponse = new FoxResponse(foxRequest);
|
||||
BFileChannel.storeToMsg(bIFile.getStore(), bPermissions, foxResponse);
|
||||
return foxResponse;
|
||||
}
|
||||
|
||||
public BFoxFileStore[] list(BFoxFileSpace bFoxFileSpace, FilePath filePath) throws Exception {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:list \"" + filePath.getBody() + "\"");
|
||||
}
|
||||
FoxRequest foxRequest = this.makeRequest("list");
|
||||
foxRequest.add("path", filePath.getBody());
|
||||
FoxResponse foxResponse = this.sendSync(foxRequest);
|
||||
FoxTuple[] foxTupleArray = foxResponse.list("file");
|
||||
BFoxFileStore[] bFoxFileStoreArray = new BFoxFileStore[foxTupleArray.length];
|
||||
for (int i = 0; i < bFoxFileStoreArray.length; ++i) {
|
||||
FoxMessage foxMessage = (FoxMessage)foxTupleArray[i];
|
||||
String string = foxMessage.getString("name");
|
||||
bFoxFileStoreArray[i] = BFileChannel.msgToStore(bFoxFileSpace, filePath.merge(string), foxMessage);
|
||||
}
|
||||
return bFoxFileStoreArray;
|
||||
}
|
||||
|
||||
public FoxResponse list(FoxRequest foxRequest) throws Exception {
|
||||
FilePath filePath = new FilePath(foxRequest.getString("path"));
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:list \"" + filePath + "\"");
|
||||
}
|
||||
FoxResponse foxResponse = new FoxResponse(foxRequest);
|
||||
BIFile bIFile = this.getFileSpaceForPath(filePath).resolveFile(filePath);
|
||||
if (!this.getPermissionsFor(bIFile).has(BPermissions.operatorRead)) {
|
||||
throw new PermissionException();
|
||||
}
|
||||
if (bIFile instanceof BIDirectory) {
|
||||
BIDirectory bIDirectory = (BIDirectory)bIFile;
|
||||
BIFile[] bIFileArray = bIDirectory.listFiles();
|
||||
for (int i = 0; i < bIFileArray.length; ++i) {
|
||||
BPermissions bPermissions = this.getPermissionsFor(bIFileArray[i]);
|
||||
if (!bPermissions.has(BPermissions.operatorRead) || BRestrictedFileSpace.INSTANCE.isBlacklisted(bIFileArray[i])) continue;
|
||||
FoxMessage foxMessage = new FoxMessage("file");
|
||||
BFileChannel.storeToMsg(bIFileArray[i].getStore(), bPermissions, foxMessage);
|
||||
foxResponse.add(foxMessage);
|
||||
}
|
||||
}
|
||||
return foxResponse;
|
||||
}
|
||||
|
||||
public void move(BFoxFileSpace bFoxFileSpace, FilePath filePath, FilePath filePath2) throws Exception {
|
||||
FoxRequest foxRequest = this.makeRequest("move");
|
||||
foxRequest.add("from", filePath.getBody());
|
||||
foxRequest.add("to", filePath2.getBody());
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:move \"" + filePath + "\" -> \"" + filePath2 + "\"");
|
||||
}
|
||||
this.sendSync(foxRequest);
|
||||
}
|
||||
|
||||
public FoxResponse move(FoxRequest foxRequest) throws Exception {
|
||||
FilePath filePath = new FilePath(foxRequest.getString("from"));
|
||||
FilePath filePath2 = new FilePath(foxRequest.getString("to"));
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:move \"" + filePath + "\" -> \"" + filePath2 + "\"");
|
||||
}
|
||||
BRestrictedFileSpace.INSTANCE.move(filePath, filePath2, this.getSessionContext());
|
||||
return null;
|
||||
}
|
||||
|
||||
public void delete(BFoxFileSpace bFoxFileSpace, FilePath filePath) throws Exception {
|
||||
FoxRequest foxRequest = this.makeRequest("delete");
|
||||
foxRequest.add("path", filePath.getBody());
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:delete \"" + filePath.getBody() + "\"");
|
||||
}
|
||||
this.sendSync(foxRequest);
|
||||
}
|
||||
|
||||
public FoxResponse delete(FoxRequest foxRequest) throws Exception {
|
||||
FilePath filePath = new FilePath(foxRequest.getString("path"));
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:delete \"" + filePath.getBody() + "\"");
|
||||
}
|
||||
BRestrictedFileSpace.INSTANCE.delete(filePath, this.getSessionContext());
|
||||
return null;
|
||||
}
|
||||
|
||||
public BFoxFileStore makeFile(BFoxFileSpace bFoxFileSpace, FilePath filePath) throws Exception {
|
||||
FoxRequest foxRequest = this.makeRequest("makeFile");
|
||||
foxRequest.add("path", filePath.getBody());
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:makeFile \"" + filePath.getBody() + "\"");
|
||||
}
|
||||
FoxResponse foxResponse = this.sendSync(foxRequest);
|
||||
return BFileChannel.msgToStore(bFoxFileSpace, filePath, foxResponse);
|
||||
}
|
||||
|
||||
public FoxResponse makeFile(FoxRequest foxRequest) throws Exception {
|
||||
Context context;
|
||||
FilePath filePath = new FilePath(foxRequest.getString("path"));
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:makeFile \"" + filePath.getBody() + "\"");
|
||||
}
|
||||
try {
|
||||
context = this.getSessionContext();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
context = null;
|
||||
}
|
||||
BIFile bIFile = this.getFileSpaceForPath(filePath).makeFile(filePath, context);
|
||||
BPermissions bPermissions = context != null ? this.getPermissionsFor(bIFile) : BPermissions.all;
|
||||
FoxResponse foxResponse = new FoxResponse(foxRequest);
|
||||
BFileChannel.storeToMsg(bIFile.getStore(), bPermissions, foxResponse);
|
||||
return foxResponse;
|
||||
}
|
||||
|
||||
public BFoxFileStore makeDir(BFoxFileSpace bFoxFileSpace, FilePath filePath) throws Exception {
|
||||
FoxRequest foxRequest = this.makeRequest("makeDir");
|
||||
foxRequest.add("path", filePath.getBody());
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:makeDir \"" + filePath.getBody() + "\"");
|
||||
}
|
||||
FoxResponse foxResponse = this.sendSync(foxRequest);
|
||||
return BFileChannel.msgToStore(bFoxFileSpace, filePath, foxResponse);
|
||||
}
|
||||
|
||||
public FoxResponse makeDir(FoxRequest foxRequest) throws Exception {
|
||||
FilePath filePath = new FilePath(foxRequest.getString("path"));
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:makeDir \"" + filePath.getBody() + "\"");
|
||||
}
|
||||
BDirectory bDirectory = this.getFileSpaceForPath(filePath).makeDir(filePath, this.getSessionContext());
|
||||
BPermissions bPermissions = this.getPermissionsFor(bDirectory);
|
||||
FoxResponse foxResponse = new FoxResponse(foxRequest);
|
||||
BFileChannel.storeToMsg(bDirectory.getStore(), bPermissions, foxResponse);
|
||||
return foxResponse;
|
||||
}
|
||||
|
||||
public TransferResult transfer(TransferStrategy transferStrategy) throws Exception {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:transfer");
|
||||
transferStrategy.dump();
|
||||
}
|
||||
FoxRequest foxRequest = this.makeRequest("transfer");
|
||||
TransferCodec.transferToMessage(foxRequest, transferStrategy);
|
||||
FoxCircuit foxCircuit = this.openCircuit("transfer");
|
||||
foxCircuit.writeMessage(foxRequest);
|
||||
while (true) {
|
||||
FoxMessage foxMessage = null;
|
||||
foxMessage = foxCircuit.readMessage();
|
||||
String string = foxMessage.getString("s", null);
|
||||
if (string != null) {
|
||||
transferStrategy.updateStatus(string);
|
||||
continue;
|
||||
}
|
||||
if (foxMessage.getString("exception", null) != null) {
|
||||
throw Fox.exceptionTranslator.messageToException(foxMessage);
|
||||
}
|
||||
if (foxMessage.getBoolean("done", false)) break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void transfer(FoxCircuit foxCircuit) throws Exception {
|
||||
try {
|
||||
Context context = this.getSessionContext();
|
||||
FoxMessage foxMessage = foxCircuit.readMessage();
|
||||
TransferStrategy transferStrategy = TransferCodec.messageToTransfer(foxMessage, context);
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:transfer");
|
||||
transferStrategy.dump();
|
||||
}
|
||||
transferStrategy.setListener((TransferListener)new BFoxChannel.TransferStatusPipe(foxCircuit));
|
||||
transferStrategy.transfer();
|
||||
FoxMessage foxMessage2 = new FoxMessage();
|
||||
foxMessage2.add("done", true);
|
||||
foxCircuit.writeMessage(foxMessage2);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
foxCircuit.writeMessage(Fox.exceptionTranslator.exceptionToMessage(exception));
|
||||
}
|
||||
foxCircuit.close();
|
||||
}
|
||||
|
||||
public InputStream read(BFoxFileStore bFoxFileStore) throws Exception {
|
||||
FilePath filePath = bFoxFileStore.getFilePath();
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:read \"" + filePath.getBody() + "\"");
|
||||
}
|
||||
FoxCircuit foxCircuit = this.openCircuit("read");
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("path", bFoxFileStore.getFilePath().getBody());
|
||||
foxCircuit.writeMessage(foxMessage);
|
||||
foxCircuit.flush();
|
||||
FoxMessage foxMessage2 = foxCircuit.readMessage();
|
||||
long l = Long.parseLong(foxMessage2.getString("size", "-1"));
|
||||
if (l > -1L && l != bFoxFileStore.size) {
|
||||
bFoxFileStore.size = l;
|
||||
}
|
||||
return foxCircuit.getInputStream();
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void read(FoxCircuit foxCircuit) throws Exception {
|
||||
BIFile bIFile;
|
||||
FoxMessage foxMessage = foxCircuit.readMessage();
|
||||
FilePath filePath = new FilePath(foxMessage.getString("path"));
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:read \"" + filePath.getBody() + "\"");
|
||||
}
|
||||
if (!this.getPermissionsFor(bIFile = this.getFileSpaceForPath(filePath).resolveFile(filePath)).has(BPermissions.operatorRead)) {
|
||||
throw new PermissionException();
|
||||
}
|
||||
long l = bIFile.getSize();
|
||||
FoxMessage foxMessage2 = new FoxMessage();
|
||||
foxMessage2.add("size", String.valueOf(l));
|
||||
foxCircuit.writeMessage(foxMessage2);
|
||||
InputStream inputStream = bIFile.getInputStream();
|
||||
OutputStream outputStream = foxCircuit.getOutputStream();
|
||||
try {
|
||||
FileUtil.pipe((InputStream)inputStream, (long)l, (OutputStream)outputStream);
|
||||
}
|
||||
finally {
|
||||
inputStream.close();
|
||||
foxCircuit.close();
|
||||
}
|
||||
}
|
||||
|
||||
public OutputStream write(BFoxFileStore bFoxFileStore) throws Exception {
|
||||
FilePath filePath = bFoxFileStore.getFilePath();
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:write \"" + filePath.getBody() + "\"");
|
||||
}
|
||||
FoxCircuit foxCircuit = this.openCircuit("write");
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("path", bFoxFileStore.getFilePath().getBody());
|
||||
foxCircuit.writeMessage(foxMessage);
|
||||
foxCircuit.flush();
|
||||
return new ChunckedOutputStream(this, bFoxFileStore, foxCircuit);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void write(FoxCircuit foxCircuit) throws Exception {
|
||||
FoxMessage foxMessage = foxCircuit.readMessage();
|
||||
FilePath filePath = new FilePath(foxMessage.getString("path"));
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:write \"" + filePath.getBody() + "\"");
|
||||
}
|
||||
BIFile bIFile = this.getFileSpaceForPath(filePath).resolveFile(filePath);
|
||||
FoxMessage foxMessage2 = new FoxMessage();
|
||||
if (!this.getPermissionsFor(bIFile, false).has(BPermissions.operatorWrite)) {
|
||||
foxMessage2.add("error", "No Permission");
|
||||
foxCircuit.writeMessage(foxMessage2);
|
||||
return;
|
||||
}
|
||||
OutputStream outputStream = bIFile.getOutputStream();
|
||||
boolean bl = true;
|
||||
try {
|
||||
FoxMessage foxMessage3;
|
||||
byte[] byArray;
|
||||
while ((byArray = (foxMessage3 = foxCircuit.readMessage()).getBlob("chunk")).length != 0) {
|
||||
outputStream.write(byArray);
|
||||
}
|
||||
bl = false;
|
||||
outputStream.close();
|
||||
foxMessage2.add("size", String.valueOf(bIFile.getSize()));
|
||||
foxMessage2.add("modified", bIFile.getLastModified().getMillis());
|
||||
foxCircuit.writeMessage(foxMessage2);
|
||||
}
|
||||
finally {
|
||||
if (bl) {
|
||||
outputStream.close();
|
||||
}
|
||||
foxCircuit.close();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setLastModified(FilePath filePath, BAbsTime bAbsTime) throws Exception {
|
||||
Object object;
|
||||
FoxRequest foxRequest = this.makeRequest("setLastModified");
|
||||
foxRequest.add("path", filePath.getBody());
|
||||
foxRequest.add("lastModified", bAbsTime.getMillis());
|
||||
if (this.isTraceOn()) {
|
||||
object = new StringBuffer();
|
||||
((StringBuffer)object).append("c:setLastModified \"");
|
||||
((StringBuffer)object).append(filePath.getBody());
|
||||
((StringBuffer)object).append("\" (");
|
||||
((StringBuffer)object).append(bAbsTime);
|
||||
((StringBuffer)object).append(")");
|
||||
this.trace(((StringBuffer)object).toString());
|
||||
}
|
||||
object = this.sendSync(foxRequest);
|
||||
return ((FoxMessage)object).getBoolean("done");
|
||||
}
|
||||
|
||||
public FoxResponse setLastModified(FoxRequest foxRequest) throws IOException {
|
||||
StringBuffer stringBuffer;
|
||||
FilePath filePath = new FilePath(foxRequest.getString("path"));
|
||||
BAbsTime bAbsTime = BAbsTime.make((long)foxRequest.getTime("lastModified"));
|
||||
if (this.isTraceOn()) {
|
||||
stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("s:setLastModified \"");
|
||||
stringBuffer.append(filePath.getBody());
|
||||
stringBuffer.append("\" (");
|
||||
stringBuffer.append(bAbsTime);
|
||||
stringBuffer.append(")");
|
||||
this.trace(stringBuffer.toString());
|
||||
}
|
||||
if ((stringBuffer = this.getFileSpaceForPath(filePath).resolveFile(filePath)).getStore().isReadonly()) {
|
||||
throw new IOException("File Store is readonly");
|
||||
}
|
||||
if (!this.getPermissionsFor(stringBuffer).hasOperatorWrite()) {
|
||||
throw new PermissionException();
|
||||
}
|
||||
boolean bl = false;
|
||||
if (!(stringBuffer.getStore() instanceof BAbstractFileStore)) {
|
||||
throw new IOException("Unsupported File Store");
|
||||
}
|
||||
Object object = (BAbstractFileStore)stringBuffer.getStore();
|
||||
bl = object.setLastModified(bAbsTime);
|
||||
object = new FoxResponse(foxRequest);
|
||||
((FoxMessage)object).add("done", bl);
|
||||
return object;
|
||||
}
|
||||
|
||||
public long getCrc(FilePath filePath) throws Exception {
|
||||
Object object;
|
||||
FoxRequest foxRequest = this.makeRequest("getCrc");
|
||||
foxRequest.add("path", filePath.getBody());
|
||||
if (this.isTraceOn()) {
|
||||
object = new StringBuffer();
|
||||
((StringBuffer)object).append("c:getCrc \"");
|
||||
((StringBuffer)object).append(filePath.getBody());
|
||||
((StringBuffer)object).append("\"");
|
||||
this.trace(((StringBuffer)object).toString());
|
||||
}
|
||||
object = this.sendSync(foxRequest);
|
||||
return ((FoxMessage)object).getTime("crc");
|
||||
}
|
||||
|
||||
public FoxResponse getCrc(FoxRequest foxRequest) throws IOException {
|
||||
StringBuffer stringBuffer;
|
||||
FilePath filePath = new FilePath(foxRequest.getString("path"));
|
||||
if (this.isTraceOn()) {
|
||||
stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("s:getCrc \"");
|
||||
stringBuffer.append(filePath.getBody());
|
||||
stringBuffer.append("\"");
|
||||
this.trace(stringBuffer.toString());
|
||||
}
|
||||
if (!this.getPermissionsFor(stringBuffer = this.getFileSpaceForPath(filePath).resolveFile(filePath)).hasOperatorRead()) {
|
||||
throw new PermissionException();
|
||||
}
|
||||
long l = -1L;
|
||||
if (!(stringBuffer.getStore() instanceof BAbstractFileStore)) {
|
||||
throw new IOException("Unsupported File Store");
|
||||
}
|
||||
Object object = (BAbstractFileStore)stringBuffer.getStore();
|
||||
l = object.getCrc();
|
||||
object = new FoxResponse(foxRequest);
|
||||
((FoxMessage)object).add("crc", l);
|
||||
return object;
|
||||
}
|
||||
|
||||
public static BFoxFileStore msgToStore(BFoxFileSpace bFoxFileSpace, FilePath filePath, FoxMessage foxMessage) throws IOException {
|
||||
BFoxFileStore bFoxFileStore = new BFoxFileStore(bFoxFileSpace, filePath);
|
||||
bFoxFileStore.isDirectory = foxMessage.getBoolean("dir");
|
||||
bFoxFileStore.isReadonly = foxMessage.getBoolean("readonly");
|
||||
bFoxFileStore.modified = BAbsTime.make((long)foxMessage.getTime("modified"));
|
||||
bFoxFileStore.size = Long.parseLong(foxMessage.getString("size"));
|
||||
bFoxFileStore.permissions = BPermissions.make((String)foxMessage.getString("permissions", "rw"));
|
||||
return bFoxFileStore;
|
||||
}
|
||||
|
||||
public static void storeToMsg(BIFileStore bIFileStore, BPermissions bPermissions, FoxMessage foxMessage) {
|
||||
foxMessage.add("name", bIFileStore.getFileName());
|
||||
foxMessage.add("dir", bIFileStore.isDirectory());
|
||||
foxMessage.add("readonly", bIFileStore.isReadonly() || !bPermissions.has(BPermissions.operatorWrite));
|
||||
foxMessage.add("modified", bIFileStore.getLastModified().getMillis());
|
||||
foxMessage.add("size", String.valueOf(bIFileStore.getSize()));
|
||||
foxMessage.add("permissions", bPermissions.encodeToString());
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public final Object fw(int n, Object object, Object object2, Object object3, Object object4) {
|
||||
if (n == 901) {
|
||||
String string = null;
|
||||
FilePath filePath = null;
|
||||
if (object instanceof String) {
|
||||
string = (String)object;
|
||||
filePath = new FilePath(string);
|
||||
} else if (object instanceof FilePath) {
|
||||
filePath = (FilePath)object;
|
||||
string = filePath.getBody();
|
||||
}
|
||||
if (string != null && !BRestrictedFileSpace.INSTANCE.inScope(filePath)) {
|
||||
Array array = this.unrestrictedFilePaths;
|
||||
synchronized (array) {
|
||||
if (!this.unrestrictedFilePaths.contains((Object)string) && this.getConnection().isConnected()) {
|
||||
this.unrestrictedFilePaths.add((Object)string);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (n == 902) {
|
||||
String string = null;
|
||||
if (object instanceof String) {
|
||||
string = (String)object;
|
||||
} else if (object instanceof FilePath) {
|
||||
string = ((FilePath)object).getBody();
|
||||
}
|
||||
if (string != null) {
|
||||
Array array = this.unrestrictedFilePaths;
|
||||
synchronized (array) {
|
||||
this.unrestrictedFilePaths.remove((Object)string);
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.fw(n, object, object2, object3, object4);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
private BFileSpace getFileSpaceForPath(FilePath filePath) {
|
||||
Array array = this.unrestrictedFilePaths;
|
||||
synchronized (array) {
|
||||
if (this.unrestrictedFilePaths.contains((Object)filePath.getBody())) {
|
||||
return BFileSystem.INSTANCE;
|
||||
}
|
||||
if (this.getConnection() instanceof BFoxClientConnection) {
|
||||
throw new PermissionException("Illegal file operation (server cannot make file request to client)");
|
||||
}
|
||||
return BRestrictedFileSpace.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
static class ChunckedOutputStream
|
||||
extends OutputStream {
|
||||
BFileChannel channel;
|
||||
BFoxFileStore store;
|
||||
FoxCircuit circuit;
|
||||
byte[] buf = new byte[Fox.circuitChunkSize - 256];
|
||||
int n;
|
||||
|
||||
ChunckedOutputStream(BFileChannel bFileChannel, BFoxFileStore bFoxFileStore, FoxCircuit foxCircuit) {
|
||||
this.channel = bFileChannel;
|
||||
this.store = bFoxFileStore;
|
||||
this.circuit = foxCircuit;
|
||||
}
|
||||
|
||||
public void write(int n) throws IOException {
|
||||
this.buf[this.n++] = (byte)(0xFF & n);
|
||||
if (this.n >= this.buf.length) {
|
||||
this.flush();
|
||||
}
|
||||
}
|
||||
|
||||
public void flush() throws IOException {
|
||||
if (this.n > 0) {
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("chunk", this.buf, this.n);
|
||||
this.writeMessage(foxMessage);
|
||||
this.n = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
block7: {
|
||||
this.flush();
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("chunk", this.buf, 0);
|
||||
this.writeMessage(foxMessage);
|
||||
FoxMessage foxMessage2 = this.readMessage();
|
||||
this.circuit.close();
|
||||
String string = foxMessage2.getString("error", null);
|
||||
if (string != null) {
|
||||
throw new IOException(string);
|
||||
}
|
||||
String string2 = foxMessage2.getString("size", null);
|
||||
if (string2 != null) {
|
||||
this.store.size = Long.parseLong(string2);
|
||||
this.store.modified = BAbsTime.make((long)foxMessage2.getTime("modified"));
|
||||
} else {
|
||||
try {
|
||||
FoxResponse foxResponse;
|
||||
FoxRequest foxRequest = this.channel.makeRequest("head");
|
||||
foxRequest.add("path", this.store.getFilePath().getBody());
|
||||
if (this.channel.isTraceOn()) {
|
||||
this.channel.trace("c:head \"" + this.store.getFilePath().getBody() + "\"");
|
||||
}
|
||||
if ((foxResponse = this.channel.sendSync(foxRequest)) != null && (string2 = foxResponse.getString("size", null)) != null) {
|
||||
this.store.size = Long.parseLong(string2);
|
||||
this.store.modified = BAbsTime.make((long)foxResponse.getTime("modified"));
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
if (!this.channel.isTraceOn()) break block7;
|
||||
this.channel.trace("Error retrieving file info for \"" + this.store.getFilePath().getBody() + "\" " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private FoxMessage readMessage() throws IOException {
|
||||
try {
|
||||
return this.circuit.readMessage();
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw iOException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new IOException(exception.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private void writeMessage(FoxMessage foxMessage) throws IOException {
|
||||
try {
|
||||
this.circuit.writeMessage(foxMessage);
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw iOException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new IOException(exception.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.sys.transfer.RemoteTransferSpace
|
||||
* com.tridium.sys.transfer.TransferResult
|
||||
* com.tridium.sys.transfer.TransferStrategy
|
||||
* javax.baja.file.BDirectory
|
||||
* javax.baja.file.BFileSpace
|
||||
* javax.baja.file.BIDirectory
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.file.BIFileStore
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.nav.BINavNode
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.LexiconText
|
||||
*/
|
||||
package com.tridium.fox.sys.file;
|
||||
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.fox.sys.BIFoxProxySpace;
|
||||
import com.tridium.fox.sys.file.BFileChannel;
|
||||
import com.tridium.fox.sys.file.BFoxFileStore;
|
||||
import com.tridium.fox.sys.file.FoxFileException;
|
||||
import com.tridium.sys.transfer.RemoteTransferSpace;
|
||||
import com.tridium.sys.transfer.TransferResult;
|
||||
import com.tridium.sys.transfer.TransferStrategy;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BIDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.LexiconText;
|
||||
|
||||
public class BFoxFileSpace
|
||||
extends BFileSpace
|
||||
implements BIDirectory,
|
||||
BIFoxProxySpace,
|
||||
RemoteTransferSpace {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$fox$sys$file$BFoxFileSpace == null ? (class$com$tridium$fox$sys$file$BFoxFileSpace = BFoxFileSpace.class$("com.tridium.fox.sys.file.BFoxFileSpace")) : class$com$tridium$fox$sys$file$BFoxFileSpace));
|
||||
private BOrd ordInSession = BOrd.make((String)"file:");
|
||||
private BIFile[] roots;
|
||||
private BIFile stationHome;
|
||||
private BFileChannel channel;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$file$BFoxFileSpace;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BFoxFileSpace() {
|
||||
super("file", LexiconText.make((String)"fox", (String)"nav.fileSystem"));
|
||||
}
|
||||
|
||||
public BFoxFileSpace(BFileChannel bFileChannel) {
|
||||
this();
|
||||
this.channel = bFileChannel;
|
||||
}
|
||||
|
||||
public void init(BFoxSession bFoxSession) {
|
||||
}
|
||||
|
||||
public void cleanup(BFoxSession bFoxSession) {
|
||||
}
|
||||
|
||||
public BDirectory makeDir(FilePath filePath, Context context) throws IOException {
|
||||
try {
|
||||
BFoxFileStore bFoxFileStore = this.channel().makeDir(this, filePath);
|
||||
return new BDirectory((BIFileStore)bFoxFileStore);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
throw new FoxFileException(filePath.toString(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
public BIFile makeFile(FilePath filePath, Context context) throws IOException {
|
||||
try {
|
||||
BFoxFileStore bFoxFileStore = this.channel().makeFile(this, filePath);
|
||||
return this.makeFile((BIFileStore)bFoxFileStore);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
throw new FoxFileException(filePath.toString(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void move(FilePath filePath, FilePath filePath2, Context context) throws IOException {
|
||||
try {
|
||||
this.channel().move(this, filePath, filePath2);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
throw new FoxFileException("" + filePath + "->" + filePath2, exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void delete(FilePath filePath, Context context) throws IOException {
|
||||
try {
|
||||
this.channel().delete(this, filePath);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
throw new FoxFileException(filePath.toString(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
public BIFile[] listFiles() {
|
||||
if (this.roots == null) {
|
||||
BFoxFileStore bFoxFileStore = new BFoxFileStore(this, new FilePath("!"));
|
||||
BDirectory bDirectory = new BDirectory((BIFileStore)bFoxFileStore, LexiconText.make((String)"baja", (String)"nav.sysHome"));
|
||||
bDirectory.setIcon(BIcon.std((String)"home.png"));
|
||||
BFoxFileStore bFoxFileStore2 = new BFoxFileStore(this, new FilePath("^"));
|
||||
BDirectory bDirectory2 = new BDirectory((BIFileStore)bFoxFileStore2, LexiconText.make((String)"baja", (String)"nav.stationHome"));
|
||||
bDirectory2.setIcon(BIcon.std((String)"database.png"));
|
||||
ArrayList arrayList = new ArrayList();
|
||||
this.addRoot(arrayList, "!", "nav.sysHome", "home.png");
|
||||
this.addRoot(arrayList, "^", "nav.stationHome", "database.png");
|
||||
return arrayList.toArray(new BIFile[arrayList.size()]);
|
||||
}
|
||||
return this.roots;
|
||||
}
|
||||
|
||||
private void addRoot(ArrayList arrayList, String string, String string2, String string3) {
|
||||
try {
|
||||
FilePath filePath = new FilePath(string);
|
||||
BFoxFileStore bFoxFileStore = this.channel().head(this, filePath);
|
||||
BDirectory bDirectory = new BDirectory((BIFileStore)bFoxFileStore, LexiconText.make((String)"baja", (String)string2));
|
||||
bDirectory.setIcon(BIcon.std((String)string3));
|
||||
arrayList.add(bDirectory);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
System.out.println("FoxFileSpace \"" + string + "\" unsupported");
|
||||
}
|
||||
}
|
||||
|
||||
public BOrd getOrdInSession() {
|
||||
return this.ordInSession;
|
||||
}
|
||||
|
||||
public BIFileStore findStore(FilePath filePath) {
|
||||
try {
|
||||
return this.channel().head(this, filePath);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
throw new FoxFileException(filePath.toString(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
public BIFile getChild(BIFile bIFile, String string) {
|
||||
return this.findFile(bIFile.getFilePath().merge(string));
|
||||
}
|
||||
|
||||
public BIFile[] getChildren(BIFile bIFile) {
|
||||
return this.list(bIFile.getFilePath());
|
||||
}
|
||||
|
||||
private BIFile[] list(FilePath filePath) {
|
||||
try {
|
||||
BFoxFileStore[] bFoxFileStoreArray = this.channel().list(this, filePath);
|
||||
BIFile[] bIFileArray = new BIFile[bFoxFileStoreArray.length];
|
||||
for (int i = 0; i < bIFileArray.length; ++i) {
|
||||
bIFileArray[i] = this.makeFile((BIFileStore)bFoxFileStoreArray[i]);
|
||||
}
|
||||
return bIFileArray;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new FoxFileException(filePath.toString(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
public TransferResult transfer(TransferStrategy transferStrategy) throws Exception {
|
||||
return this.channel().transfer(transferStrategy);
|
||||
}
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BOrd getNavOrd() {
|
||||
return BOrd.make((String)(super.getNavOrd().toString() + "^"));
|
||||
}
|
||||
|
||||
public BINavNode getNavChild(String string) {
|
||||
return this.getStationHome().getNavChild(string);
|
||||
}
|
||||
|
||||
public BINavNode[] getNavChildren() {
|
||||
return this.getStationHome().getNavChildren();
|
||||
}
|
||||
|
||||
public BIFile getStationHome() {
|
||||
if (this.stationHome == null) {
|
||||
this.stationHome = this.findFile(new FilePath("^"));
|
||||
}
|
||||
return this.stationHome;
|
||||
}
|
||||
|
||||
public BFoxSession getFoxSession() {
|
||||
if (this.channel != null) {
|
||||
return null;
|
||||
}
|
||||
return (BFoxSession)this.getNavParent();
|
||||
}
|
||||
|
||||
public BFileChannel channel() {
|
||||
if (this.channel != null) {
|
||||
return this.channel;
|
||||
}
|
||||
return (BFileChannel)this.getFoxSession().getConnection().getChannels().get("file");
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.BAbstractFileStore
|
||||
* javax.baja.file.BFileSpace
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.io.BajaIOException
|
||||
* javax.baja.security.BPermissions
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.fox.sys.file;
|
||||
|
||||
import com.tridium.fox.sys.file.BFileChannel;
|
||||
import com.tridium.fox.sys.file.BFoxFileSpace;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.file.BAbstractFileStore;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.io.BajaIOException;
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class BFoxFileStore
|
||||
extends BAbstractFileStore {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$fox$sys$file$BFoxFileStore == null ? (class$com$tridium$fox$sys$file$BFoxFileStore = BFoxFileStore.class$("com.tridium.fox.sys.file.BFoxFileStore")) : class$com$tridium$fox$sys$file$BFoxFileStore));
|
||||
BAbsTime modified;
|
||||
boolean isDirectory;
|
||||
boolean isReadonly;
|
||||
long size;
|
||||
int hashCode;
|
||||
BPermissions permissions;
|
||||
long crc = -1L;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$file$BFoxFileStore;
|
||||
|
||||
public BFoxFileStore(BFoxFileSpace bFoxFileSpace, FilePath filePath) {
|
||||
super((BFileSpace)bFoxFileSpace, filePath);
|
||||
}
|
||||
|
||||
public boolean isDirectory() {
|
||||
return this.isDirectory;
|
||||
}
|
||||
|
||||
public boolean isReadonly() {
|
||||
return this.isReadonly;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
public BAbsTime getLastModified() {
|
||||
return this.modified;
|
||||
}
|
||||
|
||||
protected boolean doSetLastModified(BAbsTime bAbsTime) throws IOException {
|
||||
try {
|
||||
if (this.channel().setLastModified(this.getFilePath(), bAbsTime)) {
|
||||
this.modified = bAbsTime;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new IOException("Cannot update setLastModified: " + this.getFilePath());
|
||||
}
|
||||
}
|
||||
|
||||
public BPermissions getPermissions(BIFile bIFile, Context context) {
|
||||
return this.permissions;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.hashCode;
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (object instanceof BFoxFileStore) {
|
||||
BFoxFileStore bFoxFileStore = (BFoxFileStore)((Object)object);
|
||||
return this.getFileSpace() == bFoxFileStore.getFileSpace() && this.getFilePath().equals((Object)bFoxFileStore.getFilePath());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
try {
|
||||
return this.channel().read(this);
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw iOException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaIOException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() throws IOException {
|
||||
try {
|
||||
return this.channel().write(this);
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw iOException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaIOException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public long getCrc() throws IOException {
|
||||
if (this.crc == -1L && !this.isDirectory()) {
|
||||
try {
|
||||
this.crc = this.channel().getCrc(this.getFilePath());
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new IOException("Cannot get CRC: " + this.getFilePath());
|
||||
}
|
||||
}
|
||||
return this.crc;
|
||||
}
|
||||
|
||||
public BFileChannel channel() {
|
||||
return ((BFoxFileSpace)this.getFileSpace()).channel();
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
*/
|
||||
package com.tridium.fox.sys.file;
|
||||
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
|
||||
public class FoxFileException
|
||||
extends BajaRuntimeException {
|
||||
public FoxFileException(String string, Throwable throwable) {
|
||||
super(string, throwable);
|
||||
}
|
||||
|
||||
public FoxFileException(String string) {
|
||||
super(string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.naming.UnresolvedException
|
||||
* javax.baja.spy.BSpy
|
||||
* javax.baja.spy.BSpySpace
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.LexiconText
|
||||
*/
|
||||
package com.tridium.fox.sys.spy;
|
||||
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.fox.sys.BIFoxProxySpace;
|
||||
import com.tridium.fox.sys.spy.BSpyChannel;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.naming.UnresolvedException;
|
||||
import javax.baja.spy.BSpy;
|
||||
import javax.baja.spy.BSpySpace;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.LexiconText;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFoxSpySpace
|
||||
extends BSpySpace
|
||||
implements BIFoxProxySpace {
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$spy$BFoxSpySpace;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void init(BFoxSession bFoxSession) {
|
||||
}
|
||||
|
||||
public void cleanup(BFoxSession bFoxSession) {
|
||||
}
|
||||
|
||||
public BSpy resolveSpy(FilePath filePath) {
|
||||
try {
|
||||
return this.channel().get(filePath);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
throw new UnresolvedException(filePath.toString(), (Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public BFoxSession getFoxSession() {
|
||||
return (BFoxSession)this.getNavParent();
|
||||
}
|
||||
|
||||
public BSpyChannel channel() {
|
||||
return (BSpyChannel)this.getFoxSession().getConnection().getChannels().get("spy");
|
||||
}
|
||||
|
||||
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 BFoxSpySpace() {
|
||||
super("spy", LexiconText.make((String)"fox", (String)"nav.spy"));
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$spy$BFoxSpySpace;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$spy$BFoxSpySpace = BFoxSpySpace.class("[Lcom.tridium.fox.sys.spy.BFoxSpySpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.security.PermissionException
|
||||
* javax.baja.spy.BSpy
|
||||
* javax.baja.spy.BSpySpace
|
||||
* javax.baja.spy.Spy
|
||||
* javax.baja.spy.SpyWriter
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.fox.sys.spy;
|
||||
|
||||
import com.tridium.fox.session.FoxRequest;
|
||||
import com.tridium.fox.session.FoxResponse;
|
||||
import com.tridium.fox.session.InvalidCommandException;
|
||||
import com.tridium.fox.sys.BFoxChannel;
|
||||
import com.tridium.fox.sys.spy.FoxSpy;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.security.PermissionException;
|
||||
import javax.baja.spy.BSpy;
|
||||
import javax.baja.spy.BSpySpace;
|
||||
import javax.baja.spy.Spy;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BSpyChannel
|
||||
extends BFoxChannel {
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$spy$BSpyChannel;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public FoxResponse process(FoxRequest foxRequest) throws Exception {
|
||||
String string = foxRequest.command;
|
||||
if (string == "get") {
|
||||
return this.get(foxRequest);
|
||||
}
|
||||
throw new InvalidCommandException(string);
|
||||
}
|
||||
|
||||
public BSpy get(FilePath filePath) throws Exception {
|
||||
FoxRequest foxRequest = this.makeRequest("get");
|
||||
foxRequest.add("path", filePath.getBody());
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:get \"" + filePath.getBody() + '\"');
|
||||
}
|
||||
FoxResponse foxResponse = this.sendSync(foxRequest);
|
||||
String string = foxResponse.getString("title");
|
||||
byte[] byArray = foxResponse.getBlob("content");
|
||||
return BSpy.make((FilePath)filePath, (Spy)new FoxSpy(string, new String(byArray)));
|
||||
}
|
||||
|
||||
public FoxResponse get(FoxRequest foxRequest) throws Exception {
|
||||
BSpy bSpy;
|
||||
FilePath filePath = new FilePath(foxRequest.getString("path"));
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:get \"" + filePath.getBody() + '\"');
|
||||
}
|
||||
if (!this.getPermissionsFor(bSpy = BSpySpace.INSTANCE.resolveSpy(filePath)).hasOperatorRead()) {
|
||||
throw new PermissionException();
|
||||
}
|
||||
Spy spy = bSpy.get();
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
SpyWriter spyWriter = new SpyWriter((OutputStream)byteArrayOutputStream, filePath, this.getSessionContext());
|
||||
spy.write(spyWriter);
|
||||
spyWriter.flush();
|
||||
byte[] byArray = byteArrayOutputStream.toByteArray();
|
||||
FoxResponse foxResponse = new FoxResponse(foxRequest);
|
||||
foxResponse.add("title", spy.getTitle());
|
||||
foxResponse.add("content", byArray);
|
||||
return foxResponse;
|
||||
}
|
||||
|
||||
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 BSpyChannel() {
|
||||
super("spy");
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$fox$sys$spy$BSpyChannel;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$fox$sys$spy$BSpyChannel = BSpyChannel.class("[Lcom.tridium.fox.sys.spy.BSpyChannel;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.spy.Spy
|
||||
* javax.baja.spy.SpyDir
|
||||
* javax.baja.spy.SpyWriter
|
||||
* javax.baja.sys.BObject
|
||||
*/
|
||||
package com.tridium.fox.sys.spy;
|
||||
|
||||
import com.tridium.fox.session.Fox;
|
||||
import com.tridium.fox.session.FoxConnection;
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import com.tridium.fox.sys.Acceptor;
|
||||
import com.tridium.fox.sys.BFoxClientConnection;
|
||||
import com.tridium.fox.sys.spy.FoxLog;
|
||||
import com.tridium.fox.sys.spy.FoxSessionSpy;
|
||||
import javax.baja.spy.Spy;
|
||||
import javax.baja.spy.SpyDir;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sys.BObject;
|
||||
|
||||
public class FoxIndexSpy
|
||||
extends SpyDir {
|
||||
public Spy find(String string) {
|
||||
if (string.equals("log")) {
|
||||
return new FoxLog.Index();
|
||||
}
|
||||
int n = Integer.parseInt(string.substring("session-".length()));
|
||||
FoxSession foxSession = Fox.getSession(n);
|
||||
return new FoxSessionSpy(foxSession);
|
||||
}
|
||||
|
||||
public void write(SpyWriter spyWriter) {
|
||||
FoxSession[] foxSessionArray = Fox.getSessions();
|
||||
spyWriter.startProps();
|
||||
spyWriter.trTitle((Object)"Fox", 2);
|
||||
spyWriter.prop((Object)"requestTimeout", Fox.requestTimeout);
|
||||
spyWriter.prop((Object)"keepAliveInterval", Fox.keepAliveInterval);
|
||||
spyWriter.prop((Object)"soTimeout", Fox.soTimeout);
|
||||
spyWriter.prop((Object)"tcpNoDelay", Fox.tcpNoDelay);
|
||||
spyWriter.prop((Object)"failsafeTimeouts", Fox.failsafeTimeouts);
|
||||
spyWriter.prop((Object)"foxDeadlocks", Fox.deadlocks);
|
||||
spyWriter.prop((Object)"maxServerSessions", Fox.maxServerSessions);
|
||||
spyWriter.prop((Object)"maxQueueSize", Fox.maxQueueSize);
|
||||
spyWriter.prop((Object)"circuitChunkSize", Fox.circuitChunkSize);
|
||||
spyWriter.prop((Object)"circuitMaxReceiveBuffer", Fox.circuitMaxReceiveBuffer);
|
||||
spyWriter.prop((Object)"hostName", (Object)Fox.hostName);
|
||||
spyWriter.prop((Object)"hostAddress", (Object)Fox.hostAddress);
|
||||
spyWriter.prop((Object)"app", (Object)(Fox.appName + ' ' + Fox.appVersion));
|
||||
spyWriter.prop((Object)"vm", (Object)(Fox.vmName + ' ' + Fox.vmVersion));
|
||||
spyWriter.prop((Object)"os", (Object)(Fox.osName + ' ' + Fox.osVersion));
|
||||
spyWriter.prop((Object)"exceptionTranslator", (Object)Fox.exceptionTranslator.getClass().getName());
|
||||
spyWriter.prop((Object)"engageLinger", (Object)("" + BFoxClientConnection.engageLinger));
|
||||
spyWriter.prop((Object)"license.tunneling.fox", Acceptor.foxTunnelingLicensed());
|
||||
spyWriter.trTitle((Object)"Fox Log", 2);
|
||||
spyWriter.prop((Object)"<a href='log'>Fox Log Index</a>", (Object)("size=" + FoxLog.size));
|
||||
spyWriter.trTitle((Object)"Client Sessions", 2);
|
||||
int n = 0;
|
||||
while (n < foxSessionArray.length) {
|
||||
if (!foxSessionArray[n].isServer()) {
|
||||
this.prop(spyWriter, foxSessionArray[n]);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
spyWriter.trTitle((Object)("Server Sessions [cached count=" + Fox.getServerSessionCount() + ']'), 2);
|
||||
n = 0;
|
||||
while (n < foxSessionArray.length) {
|
||||
if (foxSessionArray[n].isServer()) {
|
||||
this.prop(spyWriter, foxSessionArray[n]);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
spyWriter.trTitle((Object)"Fox Thread Pool Worker", 2);
|
||||
spyWriter.endProps();
|
||||
BFoxClientConnection.spyThreadPoolWorker(spyWriter);
|
||||
}
|
||||
|
||||
private final void prop(SpyWriter spyWriter, FoxSession foxSession) {
|
||||
Object object;
|
||||
String string = "session-" + foxSession.getId();
|
||||
FoxConnection foxConnection = foxSession.conn();
|
||||
int n = -1;
|
||||
if (foxConnection instanceof BObject && (object = ((BObject)foxConnection).fw(803, null, null, null, null)) instanceof Integer) {
|
||||
n = (Integer)object;
|
||||
}
|
||||
object = n != -1 ? string + "-fw" : string;
|
||||
spyWriter.prop((Object)("<a href='" + spyWriter.href(string) + "'>" + (String)object + "</a>"), (Object)foxSession);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,618 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.util.ThrowableUtil
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.nre.util.IntHashMap
|
||||
* javax.baja.nre.util.SortUtil
|
||||
* javax.baja.spy.Spy
|
||||
* javax.baja.spy.SpyDir
|
||||
* javax.baja.spy.SpyWriter
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Sys
|
||||
*/
|
||||
package com.tridium.fox.sys.spy;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.session.Fox;
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import com.tridium.util.ThrowableUtil;
|
||||
import java.io.Writer;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.nre.util.IntHashMap;
|
||||
import javax.baja.nre.util.SortUtil;
|
||||
import javax.baja.spy.Spy;
|
||||
import javax.baja.spy.SpyDir;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Sys;
|
||||
|
||||
public class FoxLog {
|
||||
static int nextWhoId = 0;
|
||||
static final int SERVER = 1;
|
||||
static final int ERROR = 3;
|
||||
static final int WARNING = 2;
|
||||
static final int MESSAGE = 1;
|
||||
static final int TRACE = 0;
|
||||
static final int OPENED = 10;
|
||||
static final int CLOSED = 11;
|
||||
static final int REJECTED = 12;
|
||||
static DateFormat format = new SimpleDateFormat("HH:mm:ss dd-MMM-yy z");
|
||||
static Object lock = new Object();
|
||||
static final int max;
|
||||
static int size;
|
||||
static Rec head;
|
||||
static Rec tail;
|
||||
static HashMap whoHistory;
|
||||
Log log;
|
||||
String logName;
|
||||
FoxSession session;
|
||||
|
||||
public static FoxLog make(String string) {
|
||||
return new FoxLog(Log.getLog((String)string));
|
||||
}
|
||||
|
||||
public Log log() {
|
||||
return this.log;
|
||||
}
|
||||
|
||||
public String getLogName() {
|
||||
return this.logName;
|
||||
}
|
||||
|
||||
public boolean isTraceOn() {
|
||||
return this.log.isTraceOn();
|
||||
}
|
||||
|
||||
public void error(String string) {
|
||||
this.log(3, string, null);
|
||||
}
|
||||
|
||||
public void error(String string, Throwable throwable) {
|
||||
this.log(3, string, throwable);
|
||||
}
|
||||
|
||||
public void warning(String string) {
|
||||
this.log(2, string, null);
|
||||
}
|
||||
|
||||
public void warning(String string, Throwable throwable) {
|
||||
this.log(2, string, throwable);
|
||||
}
|
||||
|
||||
public void message(String string) {
|
||||
this.log(1, string, null);
|
||||
}
|
||||
|
||||
public void message(String string, Throwable throwable) {
|
||||
this.log(1, string, throwable);
|
||||
}
|
||||
|
||||
public void trace(String string) {
|
||||
this.log(0, string, null);
|
||||
}
|
||||
|
||||
public void trace(String string, Throwable throwable) {
|
||||
this.log(0, string, throwable);
|
||||
}
|
||||
|
||||
public void log(int n, String string, Throwable throwable) {
|
||||
if (this.log.isLoggable(n)) {
|
||||
this.log.log(n, string, throwable);
|
||||
FoxLog.add(new Rec(n, this.session, this.logName, string, throwable));
|
||||
}
|
||||
}
|
||||
|
||||
public void logRecOnly(int n, String string) {
|
||||
if (this.log.isLoggable(n)) {
|
||||
FoxLog.add(new Rec(n, this.session, this.logName, string, null));
|
||||
}
|
||||
}
|
||||
|
||||
public FoxSession session() {
|
||||
return this.session;
|
||||
}
|
||||
|
||||
public void setSession(FoxSession foxSession) {
|
||||
this.session = foxSession;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void opened(FoxSession foxSession) {
|
||||
this.session = foxSession;
|
||||
String string = "Opened: " + FoxLog.toString(foxSession);
|
||||
if (!FoxLog.stationToStationConnection(foxSession)) {
|
||||
this.log.message(string);
|
||||
} else if (this.log.isTraceOn()) {
|
||||
this.log.trace(string);
|
||||
}
|
||||
FoxLog.add(new Rec(10, foxSession, this.logName, string, null));
|
||||
String string2 = FoxLog.toWho(foxSession);
|
||||
Object object = lock;
|
||||
synchronized (object) {
|
||||
Who who = (Who)whoHistory.get(string2);
|
||||
if (who == null) {
|
||||
who = new Who(string2);
|
||||
whoHistory.put(string2, who);
|
||||
}
|
||||
who.opened(foxSession);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void closed(FoxSession foxSession, Throwable throwable) {
|
||||
block10: {
|
||||
String string;
|
||||
int n;
|
||||
if (this.session == foxSession) {
|
||||
n = 11;
|
||||
string = "Closed: " + FoxLog.toString(foxSession);
|
||||
} else {
|
||||
n = 12;
|
||||
string = "Rejected: " + FoxLog.toString(foxSession);
|
||||
}
|
||||
if (!FoxLog.stationToStationConnection(foxSession)) {
|
||||
this.log.message(string);
|
||||
} else if (this.log.isTraceOn()) {
|
||||
this.log.trace(string);
|
||||
}
|
||||
FoxLog.add(new Rec(n, foxSession, this.logName, string, throwable));
|
||||
String string2 = FoxLog.toWho(foxSession);
|
||||
Object object = lock;
|
||||
synchronized (object) {
|
||||
Who who;
|
||||
block9: {
|
||||
who = (Who)whoHistory.get(string2);
|
||||
if (who == null) {
|
||||
who = new Who(string2);
|
||||
whoHistory.put(string2, who);
|
||||
}
|
||||
if (n != 11) break block9;
|
||||
who.closed(foxSession);
|
||||
break block10;
|
||||
}
|
||||
who.rejected(foxSession);
|
||||
}
|
||||
}
|
||||
this.session = null;
|
||||
}
|
||||
|
||||
public static String toWho(FoxSession foxSession) {
|
||||
if (foxSession == null) {
|
||||
return "null";
|
||||
}
|
||||
try {
|
||||
String string;
|
||||
FoxMessage foxMessage = foxSession.getRemoteHello();
|
||||
if (foxMessage == null) {
|
||||
foxMessage = new FoxMessage();
|
||||
try {
|
||||
string = foxSession.getSocket().getInetAddress().toString();
|
||||
}
|
||||
catch (NullPointerException nullPointerException) {
|
||||
string = "unknown";
|
||||
}
|
||||
} else {
|
||||
string = foxMessage.getString("hostName", "unknown");
|
||||
}
|
||||
String string2 = foxMessage.getString("app.name", "unknown");
|
||||
String string3 = foxMessage.getString("station.name", null);
|
||||
String string4 = foxMessage.getString("user", null);
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append(string2);
|
||||
if (string3 != null) {
|
||||
stringBuffer.append(" [").append(string3).append("]");
|
||||
} else if (string4 != null) {
|
||||
stringBuffer.append(" [").append(string4).append("]");
|
||||
}
|
||||
stringBuffer.append(" @ ").append(string);
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return "err";
|
||||
}
|
||||
}
|
||||
|
||||
public static String toString(FoxSession foxSession) {
|
||||
if (foxSession == null) {
|
||||
return "null";
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append(foxSession.getId());
|
||||
stringBuffer.append(foxSession.isServer() ? " <- " : " -> ");
|
||||
stringBuffer.append(foxSession.getRemoteId());
|
||||
stringBuffer.append(" :: ");
|
||||
stringBuffer.append(FoxLog.toWho(foxSession));
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
static String toTime(long l) {
|
||||
if (l <= 0L) {
|
||||
return "null";
|
||||
}
|
||||
return format.format(new Date(Clock.millis() - Clock.ticks() + l));
|
||||
}
|
||||
|
||||
static String toAge(long l) {
|
||||
return BRelTime.toString((long)(Clock.ticks() - l));
|
||||
}
|
||||
|
||||
static String toDuration(long l) {
|
||||
return BRelTime.toString((long)l);
|
||||
}
|
||||
|
||||
static boolean stationToStationConnection(FoxSession foxSession) {
|
||||
try {
|
||||
String string = foxSession.getRemoteHello().getString("app.name", "");
|
||||
boolean bl = false;
|
||||
if (string.equals("Station") && string.equals(Fox.appName)) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void header(SpyWriter spyWriter) {
|
||||
spyWriter.w((Object)"\n");
|
||||
spyWriter.w((Object)Fox.appName).w((Object)" ").w((Object)Fox.appVersion);
|
||||
if (Sys.getStation() != null) {
|
||||
spyWriter.w((Object)(" [" + Sys.getStation().getStationName() + ']'));
|
||||
}
|
||||
spyWriter.w((Object)(" | " + FoxLog.toTime(Clock.ticks())));
|
||||
spyWriter.w((Object)" | <a href='/fox/log'>Log Index</a>");
|
||||
spyWriter.w((Object)(" | <a href='/fox/log/all'>All Records [" + size + "]</a>"));
|
||||
spyWriter.w((Object)"<hr>\n");
|
||||
}
|
||||
|
||||
static Who findWho(int n) {
|
||||
Iterator iterator = whoHistory.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Who who = (Who)iterator.next();
|
||||
if (who.id != n) continue;
|
||||
return who;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static Rec findRec(int n) {
|
||||
Rec rec = head;
|
||||
while (rec != null) {
|
||||
if (rec.id == n) {
|
||||
return rec;
|
||||
}
|
||||
rec = rec.next;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
static void add(Rec rec) {
|
||||
Object object = lock;
|
||||
synchronized (object) {
|
||||
block5: {
|
||||
while (true) {
|
||||
if (size < max) {
|
||||
if (head != null) break;
|
||||
head = tail = rec;
|
||||
break block5;
|
||||
}
|
||||
head = FoxLog.head.next;
|
||||
--size;
|
||||
}
|
||||
rec.id = FoxLog.tail.id + 1;
|
||||
FoxLog.tail.next = rec;
|
||||
tail = rec;
|
||||
}
|
||||
++size;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static String typeToString(int n) {
|
||||
switch (n) {
|
||||
case 3: {
|
||||
return "Error";
|
||||
}
|
||||
case 2: {
|
||||
return "Warning";
|
||||
}
|
||||
case 1: {
|
||||
return "Message";
|
||||
}
|
||||
case 0: {
|
||||
return "Trace";
|
||||
}
|
||||
case 10: {
|
||||
return "Opened";
|
||||
}
|
||||
case 11: {
|
||||
return "Closed";
|
||||
}
|
||||
case 12: {
|
||||
return "Rejected";
|
||||
}
|
||||
}
|
||||
return "?" + n + '?';
|
||||
}
|
||||
|
||||
private FoxLog(Log log) {
|
||||
this.log = log;
|
||||
this.logName = log.getLogName();
|
||||
}
|
||||
|
||||
static {
|
||||
int n = 1000;
|
||||
try {
|
||||
n = Integer.parseInt(System.getProperty("niagara.fox.logMax", "" + n));
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
max = n;
|
||||
whoHistory = new HashMap();
|
||||
FoxLog.add(new Rec(1, null, "fox", "Booted", null));
|
||||
}
|
||||
|
||||
static class Rec
|
||||
extends Spy {
|
||||
Rec next;
|
||||
int id;
|
||||
long ticks = Clock.ticks();
|
||||
int sessionId;
|
||||
int type;
|
||||
String logName;
|
||||
String msg;
|
||||
Throwable ex;
|
||||
|
||||
public void write(SpyWriter spyWriter) throws Exception {
|
||||
FoxLog.header(spyWriter);
|
||||
spyWriter.startProps("Fox Log Record");
|
||||
spyWriter.prop((Object)"Id", (Object)("" + this.id));
|
||||
spyWriter.prop((Object)"Time", (Object)FoxLog.toTime(this.ticks));
|
||||
spyWriter.prop((Object)"Age", (Object)FoxLog.toAge(this.ticks));
|
||||
spyWriter.prop((Object)"Session", this.sessionId);
|
||||
spyWriter.prop((Object)"Type", (Object)FoxLog.typeToString(this.type));
|
||||
spyWriter.prop((Object)"LogName", (Object)this.logName);
|
||||
spyWriter.prop((Object)"Message", (Object)this.msg);
|
||||
spyWriter.endProps();
|
||||
if (this.ex != null) {
|
||||
spyWriter.w((Object)"<pre>");
|
||||
ThrowableUtil.dump((Writer)spyWriter, (Throwable)this.ex);
|
||||
spyWriter.w((Object)"</pre>");
|
||||
}
|
||||
}
|
||||
|
||||
Rec(int n, FoxSession foxSession, String string, String string2, Throwable throwable) {
|
||||
this.type = n;
|
||||
this.sessionId = foxSession == null ? -1 : foxSession.getId();
|
||||
this.logName = string;
|
||||
this.msg = string2;
|
||||
this.ex = throwable;
|
||||
}
|
||||
}
|
||||
|
||||
static class Who {
|
||||
int id = nextWhoId++;
|
||||
String key;
|
||||
int[] sessionIds;
|
||||
int[] remoteIds;
|
||||
long[] openTicks;
|
||||
long[] closeTicks;
|
||||
byte[] flags;
|
||||
|
||||
void opened(FoxSession foxSession) {
|
||||
System.arraycopy(this.sessionIds, 0, this.sessionIds, 1, this.sessionIds.length - 1);
|
||||
System.arraycopy(this.remoteIds, 0, this.remoteIds, 1, this.remoteIds.length - 1);
|
||||
System.arraycopy(this.openTicks, 0, this.openTicks, 1, this.openTicks.length - 1);
|
||||
System.arraycopy(this.closeTicks, 0, this.closeTicks, 1, this.closeTicks.length - 1);
|
||||
System.arraycopy(this.flags, 0, this.flags, 1, this.flags.length - 1);
|
||||
this.sessionIds[0] = foxSession.getId();
|
||||
this.remoteIds[0] = foxSession.getRemoteId();
|
||||
this.openTicks[0] = Clock.ticks();
|
||||
this.closeTicks[0] = -1;
|
||||
this.flags[0] = (byte)(foxSession.isServer() ? 1 : 0);
|
||||
}
|
||||
|
||||
void closed(FoxSession foxSession) {
|
||||
int n = foxSession.getId();
|
||||
int n2 = 0;
|
||||
while (n2 < this.sessionIds.length) {
|
||||
if (this.sessionIds[n2] == n) {
|
||||
this.closeTicks[n2] = Clock.ticks();
|
||||
break;
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
}
|
||||
|
||||
void rejected(FoxSession foxSession) {
|
||||
this.opened(foxSession);
|
||||
this.closeTicks[0] = Long.MAX_VALUE;
|
||||
}
|
||||
|
||||
IntHashMap sessionsToIntHashMap() {
|
||||
IntHashMap intHashMap = new IntHashMap();
|
||||
int n = 0;
|
||||
while (n < this.sessionIds.length) {
|
||||
int n2 = this.sessionIds[n];
|
||||
if (n2 >= 0) {
|
||||
intHashMap.put(n2, (Object)this);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return intHashMap;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
Who(String string) {
|
||||
this.key = string;
|
||||
this.sessionIds = new int[20];
|
||||
this.remoteIds = new int[20];
|
||||
this.openTicks = new long[20];
|
||||
this.closeTicks = new long[20];
|
||||
this.flags = new byte[20];
|
||||
int n = 0;
|
||||
while (n < 20) {
|
||||
this.sessionIds[n] = -1;
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class SpyRecs
|
||||
extends SpyDir {
|
||||
String title;
|
||||
IntHashMap sessions;
|
||||
|
||||
public Spy find(String string) {
|
||||
return FoxLog.findRec(Integer.parseInt(string));
|
||||
}
|
||||
|
||||
public void write(SpyWriter spyWriter) throws Exception {
|
||||
FoxLog.header(spyWriter);
|
||||
spyWriter.startTable(true);
|
||||
spyWriter.trTitle((Object)this.title, 6);
|
||||
spyWriter.w((Object)"<tr><th>Time</th><th>Age</th><th>Sid</th><th>Log</th><th>Message</th><th>Exception</th></tr>\n");
|
||||
Rec rec = head;
|
||||
while (rec != null) {
|
||||
if (this.include(rec)) {
|
||||
spyWriter.w((Object)"<tr");
|
||||
switch (rec.type) {
|
||||
case 3: {
|
||||
spyWriter.w((Object)" bgcolor='#FFAA26'");
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
spyWriter.w((Object)" bgcolor='#FFFF00'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
spyWriter.w((Object)">").td((Object)("<a href='" + rec.id + "'>" + FoxLog.toTime(rec.ticks) + "</a>")).td((Object)FoxLog.toAge(rec.ticks)).td((Object)("" + rec.sessionId)).td((Object)rec.logName).w((Object)"<td align='left' nowrap='true'>").safe(rec.msg).w((Object)"</td>").td((Object)(rec.ex == null ? "" : rec.ex.toString()));
|
||||
spyWriter.w((Object)"</tr>\n");
|
||||
}
|
||||
rec = rec.next;
|
||||
}
|
||||
spyWriter.endTable();
|
||||
}
|
||||
|
||||
boolean include(Rec rec) {
|
||||
if (this.sessions == null) {
|
||||
return true;
|
||||
}
|
||||
boolean bl = false;
|
||||
if (this.sessions.get(rec.sessionId) != null) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
SpyRecs(String string, IntHashMap intHashMap) {
|
||||
this.title = string;
|
||||
this.sessions = intHashMap;
|
||||
}
|
||||
}
|
||||
|
||||
static class Index
|
||||
extends SpyDir {
|
||||
public Spy find(String string) {
|
||||
IntHashMap intHashMap;
|
||||
String string2;
|
||||
if (string.equals("all")) {
|
||||
string2 = "All Records";
|
||||
intHashMap = null;
|
||||
} else if (string.startsWith("byWho-")) {
|
||||
Who who = FoxLog.findWho(Integer.parseInt(string.substring(6)));
|
||||
string2 = "Records for " + who.key;
|
||||
intHashMap = who.sessionsToIntHashMap();
|
||||
} else if (string.startsWith("bySession-")) {
|
||||
int n = Integer.parseInt(string.substring(10));
|
||||
string2 = "Records for FoxSession " + n;
|
||||
intHashMap = new IntHashMap();
|
||||
intHashMap.put(n, (Object)this);
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return new SpyRecs(string2, intHashMap);
|
||||
}
|
||||
|
||||
public void write(SpyWriter spyWriter) throws Exception {
|
||||
FoxLog.header(spyWriter);
|
||||
Object[] objectArray = whoHistory.values().toArray(new Who[whoHistory.size()]);
|
||||
SortUtil.sort((Object[])objectArray);
|
||||
spyWriter.startTable(true);
|
||||
spyWriter.trTitle((Object)("Log of who has made fox connections [" + objectArray.length + ']'), 4);
|
||||
spyWriter.w((Object)"<tr><th>Session</th><th>Opened</th><th>Closed</th><th>Duration</th></tr>\n");
|
||||
int n = 0;
|
||||
while (n < objectArray.length) {
|
||||
Object object = objectArray[n];
|
||||
spyWriter.trTitle((Object)("<a href='byWho-" + ((Who)object).id + "'>" + object), 4);
|
||||
int n2 = ((Who)object).sessionIds.length - 1;
|
||||
while (n2 >= 0) {
|
||||
int n3 = ((Who)object).sessionIds[n2];
|
||||
if (n3 >= 0) {
|
||||
String string;
|
||||
String string2;
|
||||
int n4 = ((Who)object).remoteIds[n2];
|
||||
long l = ((Who)object).openTicks[n2];
|
||||
long l2 = ((Who)object).closeTicks[n2];
|
||||
boolean bl = false;
|
||||
if ((((Who)object).flags[n2] & 1) != 0) {
|
||||
bl = true;
|
||||
}
|
||||
boolean bl2 = bl;
|
||||
String string3 = n3 + (bl2 ? " <- " : " -> ") + n4;
|
||||
boolean bl3 = false;
|
||||
if (l2 <= 0L) {
|
||||
string2 = "Open";
|
||||
string = FoxLog.toDuration(Clock.ticks() - l);
|
||||
bl3 = true;
|
||||
} else if (l2 == Long.MAX_VALUE) {
|
||||
string2 = "Rejected";
|
||||
string = "-";
|
||||
} else {
|
||||
string2 = FoxLog.toTime(l2);
|
||||
string = FoxLog.toDuration(l2 - l);
|
||||
}
|
||||
spyWriter.w((Object)"<tr").w((Object)(bl3 ? " bgcolor='#00ff00'" : "")).w((Object)">").td((Object)("<a href='bySession-" + n3 + "'>" + string3 + "</a>")).td((Object)FoxLog.toTime(l)).td((Object)string2).td((Object)string).w((Object)"</tr>\n");
|
||||
}
|
||||
--n2;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
spyWriter.endTable();
|
||||
}
|
||||
|
||||
Index() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.spy.ObjectSpy
|
||||
* javax.baja.spy.Spy
|
||||
* javax.baja.spy.SpyDir
|
||||
* javax.baja.spy.SpyWriter
|
||||
* javax.baja.sys.BObject
|
||||
*/
|
||||
package com.tridium.fox.sys.spy;
|
||||
|
||||
import com.tridium.fox.session.FoxSession;
|
||||
import java.io.PrintWriter;
|
||||
import javax.baja.spy.ObjectSpy;
|
||||
import javax.baja.spy.Spy;
|
||||
import javax.baja.spy.SpyDir;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sys.BObject;
|
||||
|
||||
public class FoxSessionSpy
|
||||
extends SpyDir {
|
||||
private FoxSession session;
|
||||
|
||||
public void write(SpyWriter spyWriter) throws Exception {
|
||||
spyWriter.a("connection", "Session Connection Info");
|
||||
this.session.spy((PrintWriter)spyWriter);
|
||||
}
|
||||
|
||||
public Spy find(String string) {
|
||||
if (string.equals("connection") && this.session != null && this.session.conn() instanceof BObject) {
|
||||
return new ObjectSpy((BObject)this.session.conn());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public FoxSessionSpy(FoxSession foxSession) {
|
||||
this.session = foxSession;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.spy.Spy
|
||||
* javax.baja.spy.SpyWriter
|
||||
*/
|
||||
package com.tridium.fox.sys.spy;
|
||||
|
||||
import javax.baja.spy.Spy;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
|
||||
public class FoxSpy
|
||||
extends Spy {
|
||||
String title;
|
||||
String content;
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public void write(SpyWriter spyWriter) {
|
||||
spyWriter.write(this.content);
|
||||
}
|
||||
|
||||
public FoxSpy(String string, String string2) {
|
||||
this.title = string;
|
||||
this.content = string2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.user.BUserPasswordConfiguration
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.security.BPassword
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
* javax.baja.sys.LocalizableException
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.user.BPasswordStrength
|
||||
* javax.baja.user.BUser
|
||||
* javax.baja.user.BUserService
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package com.tridium.fox.sys.user;
|
||||
|
||||
import com.tridium.fox.session.FoxRequest;
|
||||
import com.tridium.fox.session.FoxResponse;
|
||||
import com.tridium.fox.session.InvalidCommandException;
|
||||
import com.tridium.fox.sys.BFoxChannel;
|
||||
import com.tridium.user.BUserPasswordConfiguration;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.security.BPassword;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.LocalizableException;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.user.BPasswordStrength;
|
||||
import javax.baja.user.BUser;
|
||||
import javax.baja.user.BUserService;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public class BUserChannel
|
||||
extends BFoxChannel {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$fox$sys$user$BUserChannel == null ? (class$com$tridium$fox$sys$user$BUserChannel = BUserChannel.class$("com.tridium.fox.sys.user.BUserChannel")) : class$com$tridium$fox$sys$user$BUserChannel));
|
||||
private BOrd homePage;
|
||||
private BOrd navFile;
|
||||
private BPasswordStrength passwordStrength;
|
||||
static /* synthetic */ Class class$com$tridium$fox$sys$user$BUserChannel;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BUserChannel() {
|
||||
super("user");
|
||||
}
|
||||
|
||||
public FoxResponse process(FoxRequest foxRequest) throws Exception {
|
||||
String string = foxRequest.command;
|
||||
if (string == "fetchPrefs") {
|
||||
return this.fetchPrefs(foxRequest);
|
||||
}
|
||||
if (string == "setPassword") {
|
||||
return this.setPassword(foxRequest);
|
||||
}
|
||||
throw new InvalidCommandException(string);
|
||||
}
|
||||
|
||||
public BOrd getHomePage() {
|
||||
return this.homePage;
|
||||
}
|
||||
|
||||
public BOrd getNavFile() {
|
||||
return this.navFile;
|
||||
}
|
||||
|
||||
public BPasswordStrength getPasswordStrength() {
|
||||
return this.passwordStrength;
|
||||
}
|
||||
|
||||
public void fetchPrefs() throws Exception {
|
||||
FoxResponse foxResponse = this.sendSync(this.makeRequest("fetchPrefs"));
|
||||
this.homePage = BOrd.make((String)foxResponse.getString("homePage"));
|
||||
this.navFile = BOrd.make((String)foxResponse.getString("navFile"));
|
||||
this.passwordStrength = new BPasswordStrength(foxResponse.getInt("minLength", 8), foxResponse.getInt("minLowerCase", 0), foxResponse.getInt("minUpperCase", 0), foxResponse.getInt("minDigits", 1), foxResponse.getInt("minSpecial", 0));
|
||||
}
|
||||
|
||||
private FoxResponse fetchPrefs(FoxRequest foxRequest) throws Exception {
|
||||
BUser bUser = this.getServerConnection().getUser();
|
||||
FoxResponse foxResponse = new FoxResponse(foxRequest);
|
||||
foxResponse.add("homePage", bUser.getHomePage().toString());
|
||||
foxResponse.add("navFile", bUser.getNavFile().toString());
|
||||
BUserService bUserService = (BUserService)Sys.getService((Type)BUserService.TYPE);
|
||||
BPasswordStrength bPasswordStrength = bUserService.getPasswordStrength();
|
||||
foxResponse.add("minLength", bPasswordStrength.getMinimumLength());
|
||||
foxResponse.add("minDigits", bPasswordStrength.getMinimumDigits());
|
||||
foxResponse.add("minUpperCase", bPasswordStrength.getMinimumUpperCase());
|
||||
foxResponse.add("minLowerCase", bPasswordStrength.getMinimumLowerCase());
|
||||
foxResponse.add("minSpecial", bPasswordStrength.getMinimumSpecial());
|
||||
return foxResponse;
|
||||
}
|
||||
|
||||
public void setPassword(BPassword bPassword) throws Exception {
|
||||
this.setPassword(bPassword, false);
|
||||
}
|
||||
|
||||
public void setPassword(BPassword bPassword, boolean bl) throws Exception {
|
||||
FoxRequest foxRequest = this.makeRequest("setPassword");
|
||||
foxRequest.add("password", bPassword.encodeToString());
|
||||
foxRequest.add("forceChange", bl);
|
||||
FoxResponse foxResponse = this.sendSync(foxRequest);
|
||||
String string = foxResponse.getString("err", null);
|
||||
if (string != null) {
|
||||
throw new BajaRuntimeException(string);
|
||||
}
|
||||
}
|
||||
|
||||
private FoxResponse setPassword(FoxRequest foxRequest) throws Exception {
|
||||
try {
|
||||
BUserPasswordConfiguration bUserPasswordConfiguration;
|
||||
BUser bUser = this.getServerConnection().getUser();
|
||||
BPassword bPassword = (BPassword)BPassword.DEFAULT.decodeFromString(foxRequest.getString("password"));
|
||||
if (bUser.getPassword().validate(bPassword.getValue()) && foxRequest.getBoolean("forceChange", false)) {
|
||||
throw new LocalizableException(Lexicon.make((String)"baja"), "user.strongPassword.alreadyUsed");
|
||||
}
|
||||
BUserService bUserService = (BUserService)Sys.getService((Type)BUserService.TYPE);
|
||||
bUserService.checkPassword(bPassword.getValue());
|
||||
if (bUserService.canUsePasswordFeatures(bUser) && (bUserPasswordConfiguration = bUserService.getUserPasswordConfig(bUser)) != null) {
|
||||
if (bUserService.isDuplicatePassword(bPassword.getValue(), bUser)) {
|
||||
throw new LocalizableException(Lexicon.make((String)"baja"), "user.strongPassword.alreadyUsed");
|
||||
}
|
||||
bUserPasswordConfiguration.setForceResetAtNextLogin(false);
|
||||
}
|
||||
bUser.setPassword(bPassword);
|
||||
return new FoxResponse(foxRequest);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
FoxResponse foxResponse = new FoxResponse(foxRequest);
|
||||
foxResponse.add("err", exception.getMessage());
|
||||
return foxResponse;
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user