link start!
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user