2026-03-17 13:31:18 -07:00

1228 lines
44 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.Array
*/
package javax.baja.space;
import com.tridium.dataRecovery.BDataRecoveryComponentRecorder;
import com.tridium.sys.Nre;
import com.tridium.sys.schema.ComponentSlotMap;
import com.tridium.sys.station.Station;
import com.tridium.sys.transfer.DeleteOp;
import com.tridium.sys.transfer.IntraCompSpaceMove;
import com.tridium.util.ArrayUtil;
import com.tridium.util.ObjectUtil;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Iterator;
import javax.baja.category.BCategoryMask;
import javax.baja.category.BICategorizable;
import javax.baja.collection.BICollection;
import javax.baja.collection.BITable;
import javax.baja.collection.Column;
import javax.baja.collection.TableCursor;
import javax.baja.dataRecovery.BIDataRecoverySource;
import javax.baja.dataRecovery.IDataRecoveryRecord;
import javax.baja.log.Log;
import javax.baja.naming.BOrd;
import javax.baja.naming.BatchResolve;
import javax.baja.naming.OrdTarget;
import javax.baja.naming.SlotPath;
import javax.baja.naming.UnresolvedException;
import javax.baja.nav.BINavNode;
import javax.baja.nre.util.Array;
import javax.baja.registry.Registry;
import javax.baja.registry.TypeInfo;
import javax.baja.security.BIProtected;
import javax.baja.security.BPermissions;
import javax.baja.space.BSpace;
import javax.baja.space.LoadCallbacks;
import javax.baja.space.Mark;
import javax.baja.space.SubscribeCallbacks;
import javax.baja.space.TrapCallbacks;
import javax.baja.spy.SpyWriter;
import javax.baja.sync.Transaction;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BComponentEvent;
import javax.baja.sys.BDouble;
import javax.baja.sys.BFloat;
import javax.baja.sys.BIMixIn;
import javax.baja.sys.BIPropertyContainer;
import javax.baja.sys.BIPropertySpace;
import javax.baja.sys.BIcon;
import javax.baja.sys.BInteger;
import javax.baja.sys.BLong;
import javax.baja.sys.BObject;
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.Cursor;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.SlotCursor;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.sys.TypeSubscriber;
import javax.baja.util.LexiconText;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BComponentSpace
extends BSpace
implements BICategorizable,
BIProtected,
BIPropertySpace,
BIDataRecoverySource {
public static final Type TYPE;
static Log mixInLog;
static TypeInfo nullProxyExt;
HashMap map;
long nextHandle;
LoadCallbacks loadCallbacks;
TrapCallbacks trapCallbacks;
SubscribeCallbacks subscribeCallbacks;
BComponent root;
BOrd ordInSession;
Type[] mixIns;
boolean holdMixInUpdates;
private BDataRecoveryComponentRecorder dataRecoveryRestorer;
long nextHandleOnCriticalStart;
Array reassignedHandles;
HashMap typeSubscriptionMap;
static /* synthetic */ Class class$javax$baja$space$BComponentSpace;
static /* synthetic */ Class class$javax$baja$sys$TypeSubscriber;
static /* synthetic */ Class class$javax$baja$naming$BOrd;
static /* synthetic */ Class class$java$lang$Object;
static /* synthetic */ Class class$javax$baja$sys$Context;
static /* synthetic */ Class class$java$lang$String;
static /* synthetic */ Class class$java$lang$Integer;
static /* synthetic */ Class class$java$lang$Long;
static /* synthetic */ Class class$java$lang$Float;
static /* synthetic */ Class class$java$lang$Double;
static /* synthetic */ Class class$java$lang$Boolean;
public Type getType() {
return TYPE;
}
public BComponent getRootComponent() {
return this.root;
}
public synchronized void setRootComponent(BComponent bComponent) {
this.root = bComponent;
this.map.clear();
if (bComponent != null && bComponent.getComponentSpace() == null) {
((ComponentSlotMap)bComponent.fw(1)).mount(this, null, null);
}
}
public boolean isSpaceReadonly() {
return false;
}
public int getComponentCount() {
return this.map.size();
}
public BComponent[] getAllComponents() {
return this.map.values().toArray(new BComponent[this.map.size()]);
}
public long getDefaultLeaseTime() {
return 60000L;
}
/*
* Exception decompiling
*/
public void subscribe(Type[] var1_1, TypeSubscriber var2_2) {
/*
* This method has failed to decompile. When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
*
* org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 0[TRYBLOCK] [1 : 20->79)] java.lang.Throwable
* at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
* at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
* at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
* at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
* at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
* at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
* at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
* at org.benf.cfr.reader.Main.main(Main.java:54)
*/
throw new IllegalStateException("Decompilation failed");
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Converted monitor instructions to comments
* Lifted jumps to return sites
*/
public void unsubscribe(Type[] typeArray, TypeSubscriber typeSubscriber) {
int n = 0;
while (n < typeArray.length) {
Array[] arrayArray = (Array[])this.typeSubscriptionMap.get(typeArray[n]);
if (arrayArray != null) {
Array[] arrayArray2 = arrayArray;
// MONITORENTER : arrayArray
int n2 = 0;
while (true) {
if (n2 >= arrayArray.length) {
// MONITOREXIT : arrayArray2
break;
}
if (arrayArray[n2] != null) {
arrayArray[n2].remove((Object)typeSubscriber);
if (arrayArray[n2].isEmpty()) {
arrayArray[n2] = null;
}
}
++n2;
}
}
++n;
}
}
/*
* Exception decompiling
*/
public void updateSubscription(Type[] var1_1, TypeSubscriber var2_2) {
/*
* This method has failed to decompile. When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
*
* org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 0[TRYBLOCK] [1 : 20->79)] java.lang.Throwable
* at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
* at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
* at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
* at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
* at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
* at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
* at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
* at org.benf.cfr.reader.Main.main(Main.java:54)
*/
throw new IllegalStateException("Decompilation failed");
}
public boolean isSubscribed(Type type) {
if (type == null) {
return false;
}
if (this.typeSubscriptionMap.containsKey(type)) {
Array[] arrayArray = (Array[])this.typeSubscriptionMap.get(type);
int n = 0;
while (n < arrayArray.length) {
if (arrayArray[n] != null && arrayArray[n].size() > 0) {
return true;
}
++n;
}
}
return this.isSubscribed(type.getSuperType());
}
public boolean isSubscribed(Type type, int n) {
if (type == null) {
return false;
}
if (n == -1) {
return false;
}
if (!this.typeSubscriptionMap.containsKey(type)) {
return this.isSubscribed(type.getSuperType(), n);
}
Array[] arrayArray = (Array[])this.typeSubscriptionMap.get(type);
if (arrayArray[n] == null || arrayArray[n].size() == 0) {
return this.isSubscribed(type.getSuperType(), n);
}
return true;
}
public void event(BComponentEvent bComponentEvent) {
this.event(bComponentEvent, bComponentEvent.getSourceComponent().getType());
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Converted monitor instructions to comments
* Lifted jumps to return sites
*/
private final void event(BComponentEvent bComponentEvent, Type type) {
if (type == null) return;
if (type.getModule().getModuleName().equals("event")) {
return;
}
Array[] arrayArray = (Array[])this.typeSubscriptionMap.get(type);
if (arrayArray != null) {
block6: {
Array[] arrayArray2 = arrayArray;
// MONITORENTER : arrayArray
if (arrayArray[bComponentEvent.getId()] == null || arrayArray[bComponentEvent.getId()].size() <= 0) break block6;
int n = 0;
while (n < arrayArray[bComponentEvent.getId()].size()) {
((TypeSubscriber)arrayArray[bComponentEvent.getId()].get(n)).event(bComponentEvent);
++n;
}
}
// MONITOREXIT : arrayArray2
}
this.event(bComponentEvent, type.getSuperType());
}
public BOrd getOrdInSession() {
return this.ordInSession;
}
public LoadCallbacks getLoadCallbacks() {
return this.loadCallbacks;
}
public void setLoadCallbacks(LoadCallbacks loadCallbacks) {
this.loadCallbacks = loadCallbacks;
}
public TrapCallbacks getTrapCallbacks() {
return this.trapCallbacks;
}
public void setTrapCallbacks(TrapCallbacks trapCallbacks) {
this.trapCallbacks = trapCallbacks;
}
public SubscribeCallbacks getSubscribeCallbacks() {
return this.subscribeCallbacks;
}
public void setSubscribeCallbacks(SubscribeCallbacks subscribeCallbacks) {
this.subscribeCallbacks = subscribeCallbacks;
}
public final void update(BComponent bComponent, int n) {
this.getSubscribeCallbacks().update(bComponent, n);
}
public final Transaction newTransaction() {
return this.newTransaction(null);
}
public Transaction newTransaction(Context context) {
return new Transaction(this, context){};
}
public void modified(BComponent bComponent, Context context) {
}
public void childParented(BComponent bComponent, Property property, BValue bValue, Context context) {
}
public void childUnparented(BComponent bComponent, Property property, BValue bValue, Context context) {
}
public boolean fireDirectCallbacks() {
return true;
}
public boolean isProxyComponentSpace() {
return false;
}
public void sync() throws Exception {
}
public final BComponent findByHandle(Object object) {
return this.findByHandle(object, true);
}
public BComponent findByHandle(Object object, boolean bl) {
return this.doFindByHandle(object, bl);
}
protected BComponent doFindByHandle(Object object, boolean bl) {
return (BComponent)this.map.get(object);
}
public final BComponent resolveByHandle(Object object) {
BComponent bComponent = this.findByHandle(object);
if (bComponent != null) {
return bComponent;
}
throw new UnresolvedException(String.valueOf(object));
}
public SlotPath handleToSlotPath(Object object) {
BComponent bComponent = (BComponent)this.map.get(object);
if (bComponent == null) {
return null;
}
return bComponent.getSlotPath();
}
public SlotPath[] handlesToSlotPaths(Object[] objectArray) {
SlotPath[] slotPathArray = new SlotPath[objectArray.length];
int n = 0;
while (n < objectArray.length) {
slotPathArray[n] = this.handleToSlotPath(objectArray[n]);
++n;
}
return slotPathArray;
}
public Type[] getEnabledMixIns() {
return (Type[])this.mixIns.clone();
}
public synchronized void enableMixIn(Type type) {
if (this.isProxyComponentSpace()) {
throw new IllegalStateException("Cannot call on proxy space");
}
if (!type.is(BIMixIn.TYPE)) {
throw new IllegalArgumentException(type.toString() + " does not implement baja:IMixIn");
}
int n = 0;
while (n < this.mixIns.length) {
if (this.mixIns[n] == type) {
return;
}
++n;
}
this.mixIns = (Type[])ArrayUtil.addOne(this.mixIns, type);
this.updateMixIns();
if (Sys.getStation() == this.root) {
Station.broadcastStationMixIns();
}
}
public synchronized void disableMixIn(Type type) {
if (this.isProxyComponentSpace()) {
throw new IllegalStateException("Cannot call on proxy space");
}
int n = -1;
int n2 = 0;
while (n2 < this.mixIns.length) {
if (this.mixIns[n2] == type) {
n = n2;
break;
}
++n2;
}
if (n < 0) {
return;
}
this.mixIns = (Type[])ArrayUtil.removeOne((Object[])this.mixIns, n);
if (Sys.getStation() == this.root) {
Station.broadcastStationMixIns();
}
}
private final synchronized void updateMixIns() {
if (this.holdMixInUpdates) {
return;
}
long l = Clock.ticks();
if (this.isProxyComponentSpace()) {
throw new IllegalStateException("Cannot call on proxy space");
}
BComponent[] bComponentArray = new BComponent[this.map.size()];
this.map.values().toArray(bComponentArray);
int n = 0;
while (n < bComponentArray.length) {
this.updateMixIns(bComponentArray[n]);
++n;
}
long l2 = Clock.ticks();
mixInLog.message("Updated [" + (l2 - l) + "ms]");
}
private final synchronized void updateMixIns(BComponent bComponent) {
if (this.holdMixInUpdates) {
return;
}
TypeInfo typeInfo = bComponent.getType().getTypeInfo();
Registry registry = Sys.getRegistry();
int n = this.mixIns.length;
int n2 = 0;
while (n2 < n) {
if (registry.isAgent(this.mixIns[n2].getTypeInfo(), typeInfo)) {
this.addMixInIfNeeded(bComponent, this.mixIns[n2]);
}
++n2;
}
}
private final void addMixInIfNeeded(BComponent bComponent, Type type) {
try {
if (bComponent.getMixIn(type) != null) {
return;
}
if (mixInLog.isTraceOn()) {
mixInLog.trace("Add " + type + " to " + bComponent.toPathString());
}
BValue bValue = (BValue)type.getInstance();
bComponent.add(type.toString().replace(':', '_'), bValue);
}
catch (Exception exception) {
mixInLog.error("Cannot add mix in " + type + " to " + bComponent.toPathString(), exception);
}
}
private final synchronized void setHoldMixInUpdates(boolean bl) {
this.holdMixInUpdates = bl;
if (!bl && this.mixIns.length > 0) {
this.updateMixIns();
}
}
public BCategoryMask getCategoryMask() {
BCategoryMask bCategoryMask = this.root.getCategoryMask();
if (bCategoryMask == null || bCategoryMask.isNull()) {
return BCategoryMask.make("1");
}
return bCategoryMask;
}
public BCategoryMask getAppliedCategoryMask() {
return this.getCategoryMask();
}
public BPermissions getPermissions(Context context) {
if (context != null && context.getUser() != null) {
return context.getUser().getPermissionsFor(this);
}
return BPermissions.all;
}
public boolean canRead(OrdTarget ordTarget) {
return ordTarget.getPermissionsForTarget().hasOperatorRead();
}
public boolean canWrite(OrdTarget ordTarget) {
return ordTarget.getPermissionsForTarget().hasOperatorWrite();
}
public boolean canInvoke(OrdTarget ordTarget) {
return ordTarget.getPermissionsForTarget().hasOperatorInvoke();
}
public Cursor findObjects(Type type, BOrd bOrd, String string, Context context) {
return this.findObjects(type, bOrd, string, (Type)null, context);
}
public Cursor findObjects(Type type, BOrd bOrd, String string, Type type2, Context context) {
return new ContainerCursor(this.findContainers(type, bOrd, context), string, type2, context);
}
public Cursor findObjects(Type type, BOrd bOrd, String string, BValue bValue, Context context) {
return new ContainerCursor(this.findContainers(type, bOrd, context), string, bValue, context);
}
public Cursor findDistinctValues(Type type, BOrd bOrd, String string, Context context) {
return this.findDistinctValues(type, bOrd, string, null, context);
}
public Cursor findDistinctValues(Type type, BOrd bOrd, String string, Type type2, Context context) {
return new DistinctPropertyCursor(this.findContainers(type, bOrd, context), string, type2, context);
}
public boolean addIndex(String string, Context context) {
throw new UnsupportedOperationException();
}
public void removeIndex(String string, Context context) {
throw new UnsupportedOperationException();
}
private final Cursor findContainers(Type type, BOrd bOrd, Context context) {
Type type2 = type != null ? type : BComponent.TYPE;
boolean bl = false;
if (this.isProxyComponentSpace() && type2.is(BComponent.TYPE)) {
bl = true;
}
boolean bl2 = bl;
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("bql:select ");
if (bl2) {
stringBuffer.append("navOrd");
} else {
stringBuffer.append("*");
}
stringBuffer.append(" from ").append(type2.toString());
BOrd bOrd2 = null;
bOrd2 = bOrd == null || bOrd.isNull() ? BOrd.make(this.getNavOrd(), stringBuffer.toString()) : BOrd.make(bOrd, stringBuffer.toString());
BITable bITable = ((BICollection)((Object)bOrd2.resolve(this).get())).toTable();
Column column = bITable.getColumns().get(0);
TableCursor tableCursor = (TableCursor)bITable.cursor();
if (!bl2) {
return tableCursor;
}
Class clazz = class$javax$baja$naming$BOrd;
if (clazz == null) {
clazz = class$javax$baja$naming$BOrd = BComponentSpace.class("[Ljavax.baja.naming.BOrd;", false);
}
Array array = new Array(clazz);
while (tableCursor.next()) {
array.add((Object)BOrd.make(tableCursor.get(column).toString(null)).relativizeToSession());
}
BOrd[] bOrdArray = (BOrd[])array.trim();
BatchResolve batchResolve = new BatchResolve(bOrdArray).resolve(this);
BObject[] bObjectArray = batchResolve.getTargetComponents();
BComponent.lease((BComponent[])bObjectArray, 0);
return new ArrayCursor(bObjectArray, context);
}
public Object fw(int n, Object object, Object object2, Object object3, Object object4) {
switch (n) {
case 101: {
this.mount(object);
return null;
}
case 102: {
this.unmount(object);
return null;
}
case 103: {
return this.generateHandles((Integer)object);
}
case 111: {
return this.generateUniqueName((String)object, (ObjectUtil.NameContainer)object2);
}
case 104: {
return null;
}
case 105: {
this.setHoldMixInUpdates((Boolean)object);
return null;
}
case 112: {
return DeleteOp.make((Mark)object, (Context)object2);
}
case 106: {
return ((DeleteOp)object).doDelete();
}
case 107: {
return ((DeleteOp)object).doUndelete();
}
case 109: {
return this.rpc((BComponent)object, (String)object2, object3, (Context)object4);
}
case 113: {
return new IntraCompSpaceMove();
}
case 1002: {
this.dataRecoveryRestorer = (BDataRecoveryComponentRecorder)object;
if (this.dataRecoveryRestorer != null) {
this.nextHandleOnCriticalStart = this.nextHandle;
this.reassignedHandles = new Array();
} else {
this.reassignedHandles = null;
}
return null;
}
case 116: {
return this.map.get(object);
}
}
return super.fw(n, object, object2, object3, object4);
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
protected synchronized void mount(Object object) {
ComponentSlotMap componentSlotMap = (ComponentSlotMap)object;
BComponent bComponent = (BComponent)componentSlotMap.getInstance();
this.nextHandle = BComponentSpace.solveForNextHandle(bComponent, this.nextHandle);
if (componentSlotMap.getSpace() != null) {
throw new IllegalStateException("Component already mounted: " + componentSlotMap.getInstance());
}
Object object2 = componentSlotMap.getHandle();
if (object2 == null || object2.toString().startsWith("copy-")) {
object2 = this.generateHandle();
}
componentSlotMap.setHandle(object2);
BComponent bComponent2 = (BComponent)this.map.get(object2);
if (bComponent2 != null) {
boolean bl;
block15: {
bl = false;
try {
Object object3;
Object object4;
long l;
if (this.dataRecoveryRestorer == null || (l = Long.parseLong((String)object2, 16)) >= this.nextHandleOnCriticalStart && !this.reassignedHandles.contains(object2)) break block15;
boolean bl2 = false;
if (bComponent2.getType().getTypeInfo() == nullProxyExt) {
bl2 = true;
}
if (!(bl = bl2)) {
object4 = bComponent2.getParent();
object3 = bComponent2.getPropertyInParent();
Property property = componentSlotMap.getPropertyInParent();
if (object4 == componentSlotMap.getParent() && object3 != null && property != null && object3.equals(property)) {
bl = true;
} else {
while (object4 != null && object3 != null) {
int n = ((BComplex)object4).getFlags((Slot)object3);
boolean bl3 = false;
if ((n & 2) != 0) {
bl3 = true;
}
if (bl = bl3) break;
object3 = ((BComplex)object4).getPropertyInParent();
object4 = ((BComplex)object4).getParent();
}
}
}
if (!bl) break block15;
object4 = this.generateHandle();
((ComponentSlotMap)bComponent2.fw(1)).setHandle(object4);
this.map.put(object4, bComponent2);
this.reassignedHandles.remove(object2);
this.reassignedHandles.add(object4);
try {
if (BDataRecoveryComponentRecorder.LOG.isTraceOn()) {
object3 = new StringBuffer();
((StringBuffer)object3).append("Reassigned handle for ").append(bComponent2.toPathString());
((StringBuffer)object3).append(", old=").append(object2);
((StringBuffer)object3).append(", new=").append(object4);
((StringBuffer)object3).append(" due to conflict with data recovery restore for component ").append(bComponent.toPathString());
BDataRecoveryComponentRecorder.LOG.trace(((StringBuffer)object3).toString());
}
}
catch (Throwable throwable) {}
}
catch (Throwable throwable) {
throwable.printStackTrace();
throw new IllegalStateException("Duplicate handle: " + object2 + ' ' + bComponent2.toDebugString() + " ; " + bComponent.toDebugString());
}
}
if (!bl) {
throw new IllegalStateException("Duplicate handle: " + object2 + ' ' + bComponent2.toDebugString() + " ; " + bComponent.toDebugString());
}
}
this.map.put(object2, bComponent);
this.updateMixIns(bComponent);
}
protected synchronized void unmount(Object object) {
ComponentSlotMap componentSlotMap = (ComponentSlotMap)object;
if (componentSlotMap.getSpace() != this) {
throw new IllegalStateException("Component not mounted: " + componentSlotMap);
}
this.map.remove(componentSlotMap.getHandle());
}
synchronized Object[] generateHandles(int n) {
Object[] objectArray = new Object[n];
int n2 = 0;
while (n2 < n) {
objectArray[n2] = this.generateHandle();
++n2;
}
return objectArray;
}
synchronized Object generateHandle() {
if (this.isProxyComponentSpace()) {
throw new IllegalStateException("generateHandle in proxy space");
}
return Long.toHexString(this.nextHandle++);
}
String generateUniqueName(String string, ObjectUtil.NameContainer nameContainer) {
return ObjectUtil.generateUniqueSlotName(string, nameContainer);
}
BValue rpc(BComponent bComponent, String string, Object object, Context context) {
int n = string.indexOf(58);
String string2 = string.substring(0, n);
String string3 = string.substring(n + 1);
if (string2.equals("reflect")) {
return this.rpcReflect(bComponent, string3, object, context);
}
if (string2.equals("reflectProperty")) {
return this.rpcReflectProperty(bComponent, string3, object, context);
}
return null;
}
BValue rpcReflect(BComponent bComponent, String string, Object object, Context context) {
return BComponentSpace.wrapRpcResult(BComponentSpace.invokeRpc(bComponent, string, object, context));
}
BValue rpcReflectProperty(BComponent bComponent, String string, Object object, Context context) {
int n = string.indexOf(58);
String string2 = string.substring(0, n);
String string3 = string.substring(n + 1);
BValue bValue = bComponent.get(string2);
return BComponentSpace.wrapRpcResult(BComponentSpace.invokeRpc(bValue, string3, object, context));
}
private static final Object invokeRpc(Object object, String string, Object object2, Context context) {
try {
Class clazz;
Class<?> clazz2 = object.getClass();
Class[] classArray = new Class[2];
Class clazz3 = class$java$lang$Object;
if (clazz3 == null) {
clazz3 = classArray[0] = (class$java$lang$Object = BComponentSpace.class("[Ljava.lang.Object;", false));
}
if ((clazz = class$javax$baja$sys$Context) == null) {
clazz = class$javax$baja$sys$Context = BComponentSpace.class("[Ljavax.baja.sys.Context;", false);
}
classArray[1] = clazz;
Method method = clazz2.getMethod(string, classArray);
return method.invoke(object, object2, context);
}
catch (Exception exception) {
exception.printStackTrace();
return null;
}
}
private static final BValue wrapRpcResult(Object object) {
if (object == null) {
return null;
}
if (object instanceof BValue) {
return (BValue)object;
}
Class<?> clazz = object.getClass();
Class clazz2 = class$java$lang$String;
if (clazz2 == null) {
clazz2 = class$java$lang$String = BComponentSpace.class("[Ljava.lang.String;", false);
}
if (clazz2.isAssignableFrom(clazz)) {
return BString.make((String)object);
}
Class clazz3 = class$java$lang$Integer;
if (clazz3 == null) {
clazz3 = class$java$lang$Integer = BComponentSpace.class("[Ljava.lang.Integer;", false);
}
if (clazz3.isAssignableFrom(clazz)) {
return BInteger.make((Integer)object);
}
Class clazz4 = class$java$lang$Long;
if (clazz4 == null) {
clazz4 = class$java$lang$Long = BComponentSpace.class("[Ljava.lang.Long;", false);
}
if (clazz4.isAssignableFrom(clazz)) {
return BLong.make((Long)object);
}
Class clazz5 = class$java$lang$Float;
if (clazz5 == null) {
clazz5 = class$java$lang$Float = BComponentSpace.class("[Ljava.lang.Float;", false);
}
if (clazz5.isAssignableFrom(clazz)) {
return BFloat.make(((Float)object).floatValue());
}
Class clazz6 = class$java$lang$Double;
if (clazz6 == null) {
clazz6 = class$java$lang$Double = BComponentSpace.class("[Ljava.lang.Double;", false);
}
if (clazz6.isAssignableFrom(clazz)) {
return BDouble.make((Double)object);
}
Class clazz7 = class$java$lang$Boolean;
if (clazz7 == null) {
clazz7 = class$java$lang$Boolean = BComponentSpace.class("[Ljava.lang.Boolean;", false);
}
if (clazz7.isAssignableFrom(clazz)) {
return BBoolean.make((Boolean)object);
}
throw new BajaRuntimeException("Cannot return result of type " + object.getClass());
}
public boolean hasNavChildren() {
boolean bl = false;
if (this.root != null) {
bl = true;
}
return bl;
}
public BINavNode getNavChild(String string) {
if (this.root == null) {
return null;
}
return this.root.getNavChild(string);
}
public BINavNode[] getNavChildren() {
if (this.root == null) {
return new BINavNode[0];
}
return this.root.getNavChildren();
}
public BIcon getNavIcon() {
if (this.root == null) {
return this.getIcon();
}
return this.root.getNavIcon();
}
public BOrd getNavOrd() {
if (this.root == null) {
return super.getNavOrd();
}
return this.root.getNavOrd();
}
private static final long solveForNextHandle(BComponent bComponent, long l) {
Object object = bComponent.getHandle();
if (object != null && !object.toString().startsWith("copy-")) {
try {
long l2 = Long.parseLong(object.toString(), 16);
if (l2 >= l) {
l = l2 + 1L;
}
}
catch (Exception exception) {}
}
SlotCursor slotCursor = bComponent.getProperties();
while (slotCursor.nextComponent()) {
l = Math.max(l, BComponentSpace.solveForNextHandle(slotCursor.get().asComponent(), l));
}
return l;
}
public void spy(SpyWriter spyWriter) throws Exception {
spyWriter.startProps();
spyWriter.trTitle("ComponentSpace", 2);
spyWriter.prop((Object)"map.size", this.map.size());
spyWriter.prop((Object)"nextHandle", Long.toHexString(this.nextHandle));
spyWriter.prop((Object)"categoryMask", this.getCategoryMask());
spyWriter.prop((Object)"defaultLeaseTime", this.getDefaultLeaseTime());
spyWriter.trTitle("Enabled MixIns [" + this.mixIns.length + ']', 2);
spyWriter.w("<tr>").th("MixIn").th("On").w("</tr>\n");
int n = 0;
while (n < this.mixIns.length) {
spyWriter.tr(this.mixIns[n], this.mixInOn(this.mixIns[n]));
++n;
}
spyWriter.endProps();
super.spy(spyWriter);
}
String mixInOn(Type type) {
try {
StringBuffer stringBuffer = new StringBuffer("{");
TypeInfo[] typeInfoArray = type.getTypeInfo().getAgentInfo().getAgentOn();
int n = 0;
while (n < typeInfoArray.length) {
if (n > 0) {
stringBuffer.append(", ");
}
stringBuffer.append(typeInfoArray[n]);
++n;
}
stringBuffer.append("}");
return stringBuffer.toString();
}
catch (Exception exception) {
return exception.toString();
}
}
void dumpMap() {
System.out.println("ComponentSpace.map");
Iterator iterator = this.map.keySet().iterator();
while (iterator.hasNext()) {
Object k = iterator.next();
Object v = this.map.get(k);
System.out.println(" " + k + " = " + v);
}
}
public boolean dataRecoveryRestore(IDataRecoveryRecord iDataRecoveryRecord) throws Exception {
if (this.dataRecoveryRestorer != null) {
return this.dataRecoveryRestorer.restore(this, iDataRecoveryRecord);
}
return false;
}
public void dataRecoveryRestoreComplete() {
}
public void dataRecoverySpy(SpyWriter spyWriter, Iterator iterator) throws Exception {
BDataRecoveryComponentRecorder bDataRecoveryComponentRecorder = Nre.serviceManager.getDataRecoveryComponentRecorder(this);
if (bDataRecoveryComponentRecorder != null) {
bDataRecoveryComponentRecorder.dataRecoverySpy(this, spyWriter, iterator);
}
}
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.map = new HashMap();
this.nextHandle = 1L;
this.loadCallbacks = new LoadCallbacks();
this.trapCallbacks = new TrapCallbacks();
this.subscribeCallbacks = new SubscribeCallbacks();
this.mixIns = new Type[0];
this.dataRecoveryRestorer = null;
this.nextHandleOnCriticalStart = 1L;
this.reassignedHandles = null;
this.typeSubscriptionMap = new HashMap();
}
public BComponentSpace(String string, LexiconText lexiconText, BOrd bOrd) {
super(string, lexiconText);
this.this();
this.ordInSession = bOrd;
}
static {
Class clazz = class$javax$baja$space$BComponentSpace;
if (clazz == null) {
clazz = class$javax$baja$space$BComponentSpace = BComponentSpace.class("[Ljavax.baja.space.BComponentSpace;", false);
}
TYPE = Sys.loadType(clazz);
mixInLog = Log.getLog("sys.mixin");
nullProxyExt = null;
try {
nullProxyExt = Sys.getRegistry().getType("control:NullProxyExt");
}
catch (Exception exception) {}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
static class ContainerCursor
implements Cursor {
Cursor iterator;
String propertyName;
Type propertyType;
BValue propertyValue;
Context cx;
BObject current;
static /* synthetic */ Class class$javax$baja$sys$BComponent;
public Context getContext() {
return this.cx;
}
public boolean next() {
return this.next(null);
}
public boolean nextComponent() {
Class clazz = class$javax$baja$sys$BComponent;
if (clazz == null) {
clazz = class$javax$baja$sys$BComponent = ContainerCursor.class("[Ljavax.baja.sys.BComponent;", false);
}
return this.next(clazz);
}
public boolean next(Class clazz) {
while (this.iterator.next()) {
BValue bValue;
BObject bObject = this.iterator.get();
if (!(bObject instanceof BIPropertyContainer) || clazz != null && !clazz.isInstance(bObject) || (bValue = ((BIPropertyContainer)((Object)bObject)).get(this.propertyName)) == null || this.propertyType != null && !bValue.getType().is(this.propertyType) || this.propertyValue != null && !bValue.equals(this.propertyValue)) continue;
this.current = bObject;
return true;
}
return false;
}
public BObject get() {
return this.current;
}
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.propertyType = null;
this.propertyValue = null;
this.current = null;
}
ContainerCursor(Cursor cursor, String string, Type type, Context context) {
this.this();
this.iterator = cursor;
this.propertyName = string;
this.propertyType = type;
this.cx = context;
}
ContainerCursor(Cursor cursor, String string, BValue bValue, Context context) {
this(cursor, string, bValue.getType(), context);
this.propertyValue = bValue;
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
static class DistinctPropertyCursor
implements Cursor {
Cursor iterator;
String propertyName;
Type propertyType;
Array propertyValues;
Context cx;
BObject current;
static /* synthetic */ Class class$javax$baja$sys$BValue;
static /* synthetic */ Class class$javax$baja$sys$BComponent;
public Context getContext() {
return this.cx;
}
public boolean next() {
return this.next(null);
}
public boolean nextComponent() {
Class clazz = class$javax$baja$sys$BComponent;
if (clazz == null) {
clazz = class$javax$baja$sys$BComponent = DistinctPropertyCursor.class("[Ljavax.baja.sys.BComponent;", false);
}
return this.next(clazz);
}
public boolean next(Class clazz) {
while (this.iterator.next()) {
BValue bValue;
BObject bObject = this.iterator.get();
if (!(bObject instanceof BIPropertyContainer) || (bValue = ((BIPropertyContainer)((Object)bObject)).get(this.propertyName)) == null || clazz != null && !clazz.isInstance(bValue) || this.propertyType != null && !bValue.getType().is(this.propertyType) || this.propertyValues.contains((Object)bValue)) continue;
this.propertyValues.add((Object)bValue);
this.current = bValue;
return true;
}
return false;
}
public BObject get() {
return this.current;
}
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.propertyType = null;
Class clazz = class$javax$baja$sys$BValue;
if (clazz == null) {
clazz = class$javax$baja$sys$BValue = DistinctPropertyCursor.class("[Ljavax.baja.sys.BValue;", false);
}
this.propertyValues = new Array(clazz);
this.current = null;
}
DistinctPropertyCursor(Cursor cursor, String string, Type type, Context context) {
this.this();
this.iterator = cursor;
this.propertyName = string;
this.propertyType = type;
this.cx = context;
}
}
static class ArrayCursor
implements Cursor {
private BObject[] a;
private Context cx;
private int current;
public BObject get() {
return this.a[this.current];
}
public Context getContext() {
return this.cx;
}
public boolean next() {
if (this.current < this.a.length) {
++this.current;
}
boolean bl = false;
if (this.current != this.a.length) {
bl = true;
}
return bl;
}
public boolean next(Class clazz) {
while (this.next()) {
BObject bObject = this.get();
if (!clazz.isInstance(bObject)) continue;
return true;
}
return false;
}
public boolean nextComponent() {
while (this.next()) {
if (!(this.get() instanceof BComponent)) continue;
return true;
}
return false;
}
ArrayCursor(BObject[] bObjectArray, Context context) {
this.a = bObjectArray;
this.cx = context;
this.current = -1;
}
}
}