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

2307 lines
88 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.Array
*/
package com.tridium.sys.schema;
import com.tridium.dataRecovery.BDataRecoveryComponentEvent;
import com.tridium.dataRecovery.BDataRecoveryComponentRecorder;
import com.tridium.sys.Nre;
import com.tridium.sys.engine.EngineUtil;
import com.tridium.sys.engine.LocalKnob;
import com.tridium.sys.engine.NKnob;
import com.tridium.sys.engine.SlotKnobs;
import com.tridium.sys.schema.ActionCursor;
import com.tridium.sys.schema.ComplexSlotMap;
import com.tridium.sys.schema.ComplexType;
import com.tridium.sys.schema.DynamicTable;
import com.tridium.sys.schema.NAction;
import com.tridium.sys.schema.NActionProperty;
import com.tridium.sys.schema.NProperty;
import com.tridium.sys.schema.NSlot;
import com.tridium.sys.schema.NTopic;
import com.tridium.sys.schema.NTopicProperty;
import com.tridium.sys.schema.PropertyCursor;
import com.tridium.sys.schema.SlotsCursor;
import com.tridium.sys.schema.TopicCursor;
import com.tridium.sys.schema.UnhandledSlotException;
import com.tridium.sys.transfer.TransferListener;
import com.tridium.sys.transfer.TransferStrategy;
import com.tridium.util.ObjectUtil;
import java.util.ArrayList;
import java.util.List;
import javax.baja.category.BCategoryMask;
import javax.baja.category.BCategoryService;
import javax.baja.naming.BOrd;
import javax.baja.naming.BasicQuery;
import javax.baja.naming.OrdQuery;
import javax.baja.naming.SlotPath;
import javax.baja.nav.BINavNode;
import javax.baja.nav.BNavRoot;
import javax.baja.nav.NavEvent;
import javax.baja.nre.util.Array;
import javax.baja.registry.TypeInfo;
import javax.baja.security.BIProtected;
import javax.baja.security.BPassword;
import javax.baja.security.BPermissions;
import javax.baja.security.BPermissionsMap;
import javax.baja.space.BComponentSpace;
import javax.baja.space.TrapCallbacks;
import javax.baja.sync.Transaction;
import javax.baja.sys.Action;
import javax.baja.sys.ActionInvokeException;
import javax.baja.sys.AlreadyParentedException;
import javax.baja.sys.BAction;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BComponentEvent;
import javax.baja.sys.BFacets;
import javax.baja.sys.BIService;
import javax.baja.sys.BLink;
import javax.baja.sys.BObject;
import javax.baja.sys.BString;
import javax.baja.sys.BTopic;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.CopyHints;
import javax.baja.sys.DuplicateSlotException;
import javax.baja.sys.Flags;
import javax.baja.sys.FrozenSlotException;
import javax.baja.sys.IllegalChildException;
import javax.baja.sys.IllegalParentException;
import javax.baja.sys.Knob;
import javax.baja.sys.NoSuchSlotException;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.SlotCursor;
import javax.baja.sys.Subscriber;
import javax.baja.sys.Topic;
import javax.baja.user.BUser;
import javax.baja.user.BUserService;
import javax.baja.util.BTypeSpec;
import javax.baja.util.BUnrestrictedFolder;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class ComponentSlotMap
extends ComplexSlotMap
implements ObjectUtil.NameContainer {
static final int CHANGED = 0;
static final int ADDED = 1;
static final int REMOVED = 2;
static final int RENAMED = 3;
static final int REORDERED = 4;
static final int PARENTED = 5;
static final int UNPARENTED = 6;
static final int ACTION_INVOKED = 7;
static final int TOPIC_FIRED = 8;
static final int FLAGS_CHANGED = 9;
static final int FACETS_CHANGED = 10;
static final int RECATEGORIZED = 11;
static final int KNOB_ADDED = 12;
static final int KNOB_REMOVED = 13;
static final int STARTED = 14;
static final int STOPPED = 15;
static final int[] COMPONENT_EVENT;
static final int[] COMPONENT_CHILD_EVENT;
static final int INITIALIZED = 1;
static final int MOUNTED = 2;
static final int RUNNING = 4;
static final int BROKER_PROPS_LOADED = 8;
static final int PENDING_MOVE = 16;
static final int PERMANENT_SUBSCRIBE = 32;
static final int IS_WIDGET = 64;
public static final boolean REQUIRE_SUPER_USER_PERMISSION;
static TypeInfo PROG_OBJ_TYPE_INFO;
static TypeInfo PROG_CODE_TYPE_INFO;
public static final String SWIZZLE_PREFIX = "copy-";
private static final Subscriber[] noSubscribers;
private static final NKnob[] noKnobs;
private int[] frozenFlags;
private DynamicTable table;
private SlotKnobs[] frozenKnobs;
private Subscriber[] subscribers;
private int knobCount;
private int mask;
private String handle;
private BComponentSpace space;
private BPermissions cachedPermissions;
private BCategoryMask cat;
private BCategoryMask catDeepOr;
public final void init(ComplexType complexType, BComplex bComplex) {
super.init(complexType, bComplex);
this.setInitialized(true);
int[] nArray = complexType.defaultFlags;
int[] nArray2 = new int[nArray.length];
System.arraycopy(nArray, 0, nArray2, 0, nArray2.length);
this.frozenFlags = nArray2;
if (bComplex.fw(301) != null) {
this.setIsWidget(true);
}
}
public final String getName() {
if (this.propertyInParent != null) {
return this.propertyInParent.getName();
}
return (String)this.instance.fw(24);
}
public final String getDisplayName(Context context) {
if (this.propertyInParent != null) {
return super.getDisplayName(context);
}
if (this.space != null && this.space.getRootComponent() == this.instance) {
return this.space.getNavDisplayName(context);
}
return (String)this.instance.fw(25, context, null, null, null);
}
public final Object getHandle() {
return this.handle;
}
public final void setHandle(Object object) {
this.handle = (String)object;
}
public final SlotPath getSlotPath() {
if (this.space == null) {
return null;
}
ArrayList<String> arrayList = new ArrayList<String>();
BComponent bComponent = this.instance.asComponent();
BComponent bComponent2 = this.space.getRootComponent();
while (bComponent != null && bComponent != bComponent2) {
arrayList.add(bComponent.getName());
bComponent = (BComponent)bComponent.getParent();
}
String[] stringArray = new String[arrayList.size()];
int n = arrayList.size();
int n2 = 0;
while (n2 < n) {
stringArray[n - n2 - 1] = (String)arrayList.get(n2);
++n2;
}
return new SlotPath("slot", stringArray);
}
SlotPath getAuditSlotPath(Context context) {
SlotPath slotPath = this.instance.asComponent().getSlotPath();
if (slotPath == null && context != null) {
slotPath = ComplexSlotMap.getSlotPathFromContext(context);
}
return slotPath;
}
public final boolean equivalent(ComplexSlotMap complexSlotMap) {
if (!super.equivalent(complexSlotMap)) {
return false;
}
ComponentSlotMap componentSlotMap = (ComponentSlotMap)complexSlotMap;
if (this.table == null || this.table.count == 0) {
boolean bl = false;
if (componentSlotMap.table == null || componentSlotMap.table.count == 0) {
bl = true;
}
return bl;
}
return this.table.equivalent(componentSlotMap.table);
}
public final BComplex newCopy(CopyHints copyHints, int n) {
BValue[] bValueArray;
if (copyHints instanceof TransferListener) {
bValueArray = (TransferListener)((Object)copyHints);
bValueArray.updateStatus("Copying \"" + TransferStrategy.toString(this.instance) + "\"...");
}
if (this.space != null) {
bValueArray = new BValue[]{this.instance};
bValueArray = this.space.getLoadCallbacks().newCopy(bValueArray, copyHints);
if (bValueArray != null && bValueArray[0] != null) {
return (BComplex)bValueArray[0];
}
}
bValueArray = (BComponent)super.newCopy(copyHints, n);
Context context = Context.copying;
boolean bl = false;
if (copyHints.cx != null && (copyHints.cx.getUser() != null || copyHints.cx.getFacets() != null && copyHints.cx.getFacets().gets("username", null) != null)) {
bl = true;
}
boolean bl2 = bl;
ComponentSlotMap componentSlotMap = ComponentSlotMap.getComponentSlotMap((BObject)bValueArray);
if (copyHints.swizzleHandles && this.handle != null) {
componentSlotMap.handle = ComponentSlotMap.swizzle(this.handle, n);
}
componentSlotMap.frozenFlags = new int[this.frozenFlags.length];
System.arraycopy(this.frozenFlags, 0, componentSlotMap.frozenFlags, 0, this.frozenFlags.length);
componentSlotMap.cat = this.cat;
if (this.table != null) {
int n2 = 0;
while (n2 < this.table.count) {
NProperty nProperty = this.table.slots[n2];
String string = nProperty.name;
BValue bValue = nProperty.value;
if (!(bValue instanceof BLink && ((BLink)bValue).isDirect() || bValueArray.getSlot(string) != null || copyHints.defaultOnClone && (nProperty.flags & 0x2000) == 8192 || bl2 && nProperty.getType().equals(BPassword.TYPE))) {
if (bValue.isComponent() && copyHints.cx != null) {
if (((BComponent)bValue).getPermissions(copyHints.cx).hasOperatorRead()) {
bValue = ComponentSlotMap.newCopy(bValue, copyHints, n);
bValueArray.add(string, bValue, nProperty.flags, nProperty.facets, context);
}
} else {
bValue = ComponentSlotMap.newCopy(bValue, copyHints, n);
bValueArray.add(string, bValue, nProperty.flags, nProperty.facets, context);
}
}
++n2;
}
}
return bValueArray;
}
BValue getOverride(Property property) {
if (this.isWidget()) {
return (BValue)this.instance.fw(19, property, null, null, null);
}
return null;
}
public final int getSlotCount() {
if (this.table == null) {
return this.getType().slots.length;
}
return this.getType().slots.length + this.table.count;
}
public final Slot getSlot(String string) {
Slot slot = (Slot)this.getType().byName.get(string);
if (slot != null) {
return slot;
}
if (this.table != null) {
return this.table.get(string);
}
return null;
}
public final Slot[] getSlotsArray() {
if (this.table == null) {
return super.getSlotsArray();
}
NSlot[] nSlotArray = this.getType().slots;
Object[] objectArray = new Slot[nSlotArray.length + this.table.count];
System.arraycopy(nSlotArray, 0, objectArray, 0, nSlotArray.length);
this.table.copyInto(objectArray, nSlotArray.length);
return objectArray;
}
public final Property[] getPropertiesArray() {
if (this.table == null) {
return super.getPropertiesArray();
}
NProperty[] nPropertyArray = this.getType().properties;
Object[] objectArray = new Property[nPropertyArray.length + this.table.count];
System.arraycopy(nPropertyArray, 0, objectArray, 0, nPropertyArray.length);
this.table.copyInto(objectArray, nPropertyArray.length);
return objectArray;
}
public Property[] getFrozenPropertiesArray() {
return super.getPropertiesArray();
}
public Property[] getDynamicPropertiesArray() {
if (this.table == null) {
return super.getDynamicPropertiesArray();
}
Object[] objectArray = new Property[this.table.count];
this.table.copyInto(objectArray, 0);
return objectArray;
}
public final Action[] getActionsArray() {
if (this.table == null) {
return super.getActionsArray();
}
NAction[] nActionArray = this.getType().actions;
Action[] actionArray = new Action[nActionArray.length + this.table.count];
int n = nActionArray.length;
System.arraycopy(nActionArray, 0, actionArray, 0, n);
int n2 = 0;
while (n2 < this.table.count) {
if (this.table.slots[n2].isAction()) {
actionArray[n++] = this.table.slots[n2].asAction();
}
++n2;
}
Action[] actionArray2 = new Action[n];
System.arraycopy(actionArray, 0, actionArray2, 0, n);
return actionArray2;
}
public final Topic[] getTopicsArray() {
if (this.table == null) {
return super.getTopicsArray();
}
NTopic[] nTopicArray = this.getType().topics;
Topic[] topicArray = new Topic[nTopicArray.length + this.table.count];
int n = nTopicArray.length;
System.arraycopy(nTopicArray, 0, topicArray, 0, n);
int n2 = 0;
while (n2 < this.table.count) {
if (this.table.slots[n2].isTopic()) {
topicArray[n++] = this.table.slots[n2].asTopic();
}
++n2;
}
Topic[] topicArray2 = new Topic[n];
System.arraycopy(topicArray, 0, topicArray2, 0, n);
return topicArray2;
}
public final SlotCursor getSlots() {
return new SlotsCursor(this.instance, this.getType().slots, this.table);
}
public final SlotCursor getProperties() {
return new PropertyCursor(this.instance, this.getType().properties, this.table);
}
public final SlotCursor getActions() {
return new ActionCursor(this.instance, this.getType().actions, this.table);
}
public final SlotCursor getTopics() {
return new TopicCursor(this.instance, this.getType().topics, this.table);
}
public int getFlags(Slot slot) {
NSlot nSlot = (NSlot)slot;
try {
if (nSlot.isFrozen) {
return this.frozenFlags[nSlot.index];
}
return nSlot.flags;
}
catch (RuntimeException runtimeException) {
System.out.println("ComponentSlotMap.getFlags: " + nSlot);
System.out.println(" instance.type " + this.getType());
System.out.println(" slot.type: " + nSlot.getDeclaringType());
System.out.println(" slot.index: " + nSlot.index);
System.out.println(" slot.isFrozen: " + nSlot.isFrozen);
System.out.println(" type.slots.length: " + this.getType().slots.length);
System.out.println(" type.defaultFlags.length: " + this.getType().defaultFlags.length);
runtimeException.printStackTrace();
throw runtimeException;
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void setFlags(Slot slot, int n, Context context) {
String string;
BUser bUser;
NSlot nSlot;
block13: {
BObject bObject;
nSlot = (NSlot)slot;
if (this.getFlags(nSlot) == n) {
return;
}
BComponent bComponent = (BComponent)this.instance;
bComponent.checkSetFlags(slot, n, context);
if (context instanceof Transaction) {
((Transaction)context).setFlags(bComponent, nSlot, n, null);
return;
}
TrapCallbacks trapCallbacks = this.getSpaceTrap();
if (trapCallbacks != null && trapCallbacks.isTrapEnabled() && context != Context.commit) {
trapCallbacks.setFlags(bComponent, nSlot, n, context);
return;
}
bUser = null;
string = null;
if (context != null && context.getUser() != null) {
bUser = context.getUser();
bUser.check(bComponent, BPermissions.adminWrite);
if (nSlot instanceof NProperty && (bObject = this.get((NProperty)nSlot)) instanceof BIProtected) {
bUser.check((BIProtected)((Object)bObject), BPermissions.adminWrite);
}
string = Flags.encodeToString(this.getFlags(slot));
}
if ((bObject = this.findRecoveryData(6, nSlot, n, context)) != null) {
bObject.record(BDataRecoveryComponentEvent.makeFlagsChangeEvent(bComponent, nSlot.getName(), n), context);
}
BComponent bComponent2 = bComponent;
synchronized (bComponent2) {
block12: {
if (!nSlot.isFrozen) break block12;
if (this.frozenFlags[nSlot.index] == n) {
return;
}
this.frozenFlags[nSlot.index] = n;
break block13;
}
if (nSlot.flags == n) {
return;
}
nSlot.flags = n;
}
}
this.fireComponentEvent(9, nSlot, null, null, context);
if (bUser != null) {
String string2 = Flags.encodeToString(n);
this.audit(this.getAuditSlotPath(context), bUser, "Flags Changed", nSlot.name, string, string2);
}
}
public final BComponentSpace getSpace() {
return this.space;
}
public final TrapCallbacks getSpaceTrap() {
if (this.space == null) {
return null;
}
return this.space.getTrapCallbacks();
}
public void loadSlots() {
if (this.space == null) {
return;
}
if (this.isBrokerPropsLoaded()) {
return;
}
this.space.getLoadCallbacks().loadSlots((BComponent)this.instance);
this.setBrokerPropsLoaded(true);
}
public final boolean isSubscribed() {
if (this.isPermanentlySubscribed() || this.knobCount > 0 && this.isRunning()) {
return true;
}
boolean bl = false;
int n = 0;
while (n < this.subscribers.length) {
Subscriber subscriber = null;
try {
subscriber = this.subscribers[n];
}
catch (Exception exception) {}
if (!(subscriber instanceof PendingSubscriber)) {
bl = true;
break;
}
++n;
}
return bl;
}
public final boolean isPermanentlySubscribed() {
boolean bl = false;
if ((this.mask & 0x20) != 0) {
bl = true;
}
return bl;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public final void setPermanentlySubscribed(boolean bl) {
if (bl == this.isPermanentlySubscribed()) {
return;
}
BComplex bComplex = this.instance;
synchronized (bComplex) {
boolean bl2;
block8: {
block7: {
bl2 = this.isSubscribed();
if (!bl) break block7;
this.mask |= 0x20;
break block8;
}
this.mask &= 0xFFFFFFDF;
}
boolean bl3 = this.isSubscribed();
if (bl2 != bl3) {
if (bl3) {
this.subscribe(true);
} else {
this.unsubscribe(true);
}
}
return;
}
}
public Subscriber[] getSubscribers() {
int n = this.subscribers.length;
Array array = new Array((Object[])new Subscriber[n], 0);
int n2 = 0;
while (n2 < n) {
if (!(this.subscribers[n2] instanceof PendingSubscriber)) {
array.add((Object)this.subscribers[n2]);
}
++n2;
}
return (Subscriber[])array.trim();
}
public boolean isSubscribed(int n) {
if (n == -1) {
return false;
}
int n2 = 0;
while (n2 < this.subscribers.length) {
Subscriber subscriber = this.subscribers[n2];
if (subscriber instanceof PendingSubscriber) {
subscriber = ((PendingSubscriber)subscriber).subscriber;
}
if (subscriber.getMask().includes(n)) {
return true;
}
++n2;
}
return false;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public final void subscribe(Subscriber subscriber) {
BComplex bComplex = this.instance;
synchronized (bComplex) {
boolean bl;
boolean bl2 = this.isSubscribed();
int n = this.subscribers.length;
boolean bl3 = true;
int n2 = 0;
while (n2 < n) {
Subscriber subscriber2 = this.subscribers[n2];
if (subscriber2 instanceof PendingSubscriber && ((PendingSubscriber)subscriber2).subscriber == subscriber) {
this.subscribers[n2] = subscriber;
bl3 = false;
break;
}
++n2;
}
if (bl3) {
Subscriber[] subscriberArray = new Subscriber[this.subscribers.length + 1];
System.arraycopy(this.subscribers, 0, subscriberArray, 0, this.subscribers.length);
subscriberArray[this.subscribers.length] = subscriber;
this.subscribers = subscriberArray;
}
if (bl2 != (bl = this.isSubscribed())) {
this.subscribe(false);
}
return;
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public final void unsubscribe(Subscriber subscriber) {
BComplex bComplex = this.instance;
synchronized (bComplex) {
int n = this.isSubscribed();
int n2 = 0;
while (n2 < this.subscribers.length) {
if (this.subscribers[n2] == subscriber || this.subscribers[n2] instanceof PendingSubscriber && ((PendingSubscriber)this.subscribers[n2]).subscriber == subscriber) {
Subscriber[] subscriberArray = new Subscriber[this.subscribers.length - 1];
System.arraycopy(this.subscribers, 0, subscriberArray, 0, n2);
if (n2 < this.subscribers.length) {
System.arraycopy(this.subscribers, n2 + 1, subscriberArray, n2, this.subscribers.length - n2 - 1);
}
this.subscribers = subscriberArray;
break;
}
++n2;
}
n2 = this.isSubscribed() ? 1 : 0;
if (n != n2) {
this.unsubscribe(false);
}
return;
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public final void unsubscribeAll() {
BComplex bComplex = this.instance;
synchronized (bComplex) {
boolean bl = this.isSubscribed();
this.subscribers = noSubscribers;
boolean bl2 = this.isSubscribed();
if (bl != bl2) {
this.unsubscribe(true);
}
return;
}
}
public final void subscribe(boolean bl) {
try {
if (bl && this.space != null) {
this.space.getSubscribeCallbacks().subscribe(new BComponent[]{(BComponent)this.instance}, 0);
}
}
catch (Throwable throwable) {
throwable.printStackTrace();
}
try {
this.instance.fw(17, null, null, null, null);
if (this.space == null || this.space.fireDirectCallbacks()) {
((BComponent)this.instance).subscribed();
}
}
catch (Throwable throwable) {
throwable.printStackTrace();
}
}
public final void unsubscribe(boolean bl) {
try {
if (bl && this.space != null) {
this.space.getSubscribeCallbacks().unsubscribe(new BComponent[]{(BComponent)this.instance});
}
}
catch (Throwable throwable) {
throwable.printStackTrace();
}
try {
this.instance.fw(18, null, null, null, null);
if (this.space == null || this.space.fireDirectCallbacks()) {
((BComponent)this.instance).unsubscribed();
}
}
catch (Throwable throwable) {
throwable.printStackTrace();
}
}
public final BPermissions getCachedPermissions() {
return this.cachedPermissions;
}
public final void setCachedPermissions(BPermissions bPermissions) {
this.cachedPermissions = bPermissions;
}
final void modified(NProperty nProperty, Context context, BDataRecoveryComponentRecorder bDataRecoveryComponentRecorder) {
SlotKnobs slotKnobs = this.getSlotKnobs(nProperty);
if (slotKnobs != null) {
slotKnobs.propagate(null);
}
this.fireComponentEvent(0, nProperty, null, null, context);
}
protected void fireComponentEvent(int n, Slot slot, Object object, String string, Context context) {
Object object2;
Subscriber[] subscriberArray;
BComponentEvent bComponentEvent;
int n2;
boolean bl;
BComponent bComponent;
block89: {
block88: {
if (!this.isInitialized()) {
return;
}
bComponent = this.instance.asComponent();
try {
switch (n) {
case 0: {
bComponent.fw(2, slot, context, null, null);
break;
}
case 1: {
bComponent.fw(3, slot, context, null, null);
break;
}
case 2: {
bComponent.fw(4, slot, object, context, null);
break;
}
case 3: {
bComponent.fw(5, slot, string, context, null);
break;
}
case 4: {
bComponent.fw(6, context, null, null, null);
break;
}
case 5: {
bComponent.fw(7, slot, object, context, null);
break;
}
case 6: {
bComponent.fw(8, slot, object, context, null);
break;
}
case 7: {
bComponent.fw(9, slot, object, context, null);
break;
}
case 8: {
bComponent.fw(10, slot, object, context, null);
break;
}
}
}
catch (Exception exception) {
exception.printStackTrace();
}
if (this.space == null || this.space.fireDirectCallbacks()) {
try {
switch (n) {
case 0: {
bComponent.changed((Property)slot, context);
break;
}
case 1: {
bComponent.added((Property)slot, context);
break;
}
case 2: {
bComponent.removed((Property)slot, (BValue)object, context);
break;
}
case 3: {
bComponent.renamed((Property)slot, string, context);
break;
}
case 4: {
bComponent.reordered(context);
break;
}
case 5: {
bComponent.childParented((Property)slot, (BValue)object, context);
break;
}
case 6: {
bComponent.childUnparented((Property)slot, (BValue)object, context);
break;
}
case 7: {
break;
}
case 8: {
break;
}
case 9: {
bComponent.flagsChanged(slot, context);
break;
}
case 10: {
bComponent.facetsChanged(slot, context);
break;
}
case 11: {
bComponent.recategorized(context);
break;
}
case 12: {
bComponent.knobAdded((Knob)object, context);
break;
}
case 13: {
bComponent.knobRemoved((Knob)object, context);
break;
}
case 14: {
break;
}
case 15: {
break;
}
default: {
throw new IllegalStateException();
}
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}
if (this.space != null) {
try {
switch (n) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 9:
case 10:
case 11: {
this.space.modified(bComponent, context);
break;
}
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}
BValue bValue = null;
switch (n) {
case 1: {
if (!slot.isProperty()) break;
bValue = this.get((NProperty)slot);
break;
}
case 2: {
bValue = (BValue)object;
break;
}
case 3: {
if (!slot.isProperty()) break;
bValue = this.get((NProperty)slot);
break;
}
case 9: {
if (!slot.isProperty()) break;
bValue = this.get((NProperty)slot);
break;
}
case 10: {
if (!slot.isProperty()) break;
bValue = this.get((NProperty)slot);
break;
}
case 4: {
bValue = null;
break;
}
case 12: {
if (!slot.isProperty()) break;
bValue = this.get((NProperty)slot);
break;
}
case 13: {
if (!slot.isProperty()) break;
bValue = this.get((NProperty)slot);
break;
}
}
if (bValue == null || !bValue.isComponent()) break block88;
bl = ((ComponentSlotMap)bValue.asComponent().fw(1)).isSubscribed(COMPONENT_CHILD_EVENT[n]);
int n3 = 0;
if (this.getSpace() != null && this.getSpace().isSubscribed(bValue.getType(), COMPONENT_CHILD_EVENT[n])) {
n3 = 1;
}
if ((n2 = n3) == 0 && !bl) break block89;
bComponentEvent = null;
switch (n) {
case 1: {
bComponentEvent = new BComponentEvent(11, bValue.asComponent(), null, bComponent);
break;
}
case 2: {
bComponentEvent = new BComponentEvent(12, bValue.asComponent(), null, bComponent);
break;
}
case 3: {
bComponentEvent = new BComponentEvent(13, bValue.asComponent(), null, BString.make(string));
break;
}
case 9: {
bComponentEvent = new BComponentEvent(15, bValue.asComponent(), null, null);
break;
}
case 10: {
bComponentEvent = new BComponentEvent(16, bValue.asComponent(), null, (BFacets)object);
break;
}
}
subscriberArray = ((ComponentSlotMap)bValue.asComponent().fw((int)1)).subscribers;
int n4 = 0;
while (n4 < subscriberArray.length) {
try {
object2 = subscriberArray[n4];
if (object2 instanceof PendingSubscriber) {
object2 = ((PendingSubscriber)object2).subscriber;
}
((Subscriber)object2).event(bComponentEvent);
}
catch (Exception exception) {
exception.printStackTrace();
}
++n4;
}
if (n2 == 0) break block89;
this.getSpace().event(bComponentEvent);
break block89;
}
if (n == 4 && this.getSpace() != null) {
BComponent[] bComponentArray = bComponent.getChildComponents();
n2 = 0;
while (n2 < bComponentArray.length) {
if (this.getSpace().isSubscribed(bComponentArray[n2].getType(), 14)) {
this.getSpace().event(new BComponentEvent(14, bComponentArray[n2], null, bComponent));
}
++n2;
}
}
}
bl = this.isSubscribed(COMPONENT_EVENT[n]);
int n5 = 0;
if (this.getSpace() != null && this.getSpace().isSubscribed(this.getType(), COMPONENT_EVENT[n])) {
n5 = 1;
}
if ((n2 = n5) != 0 || bl) {
bComponentEvent = null;
switch (n) {
case 0: {
subscriberArray = this.get((NProperty)slot);
bComponentEvent = new BComponentEvent(0, bComponent, slot, (BValue)subscriberArray);
break;
}
case 1: {
BValue bValue = this.get((NProperty)slot);
bComponentEvent = new BComponentEvent(1, bComponent, slot, bValue);
break;
}
case 2: {
object2 = (BValue)object;
bComponentEvent = new BComponentEvent(2, bComponent, slot, (BValue)object2);
break;
}
case 3: {
bComponentEvent = new BComponentEvent(3, bComponent, slot, BString.make(string));
break;
}
case 4: {
bComponentEvent = new BComponentEvent(4, bComponent, null, null);
break;
}
case 8: {
bComponentEvent = new BComponentEvent(5, bComponent, slot, (BValue)object);
break;
}
case 9: {
bComponentEvent = new BComponentEvent(6, bComponent, slot, null);
break;
}
case 10: {
bComponentEvent = new BComponentEvent(7, bComponent, slot, (BFacets)object);
break;
}
case 11: {
bComponentEvent = new BComponentEvent(10, bComponent, null, (BCategoryMask)object);
break;
}
case 12: {
bComponentEvent = new BComponentEvent(8, bComponent, (Knob)object);
break;
}
case 13: {
bComponentEvent = new BComponentEvent(9, bComponent, (Knob)object);
break;
}
case 14: {
bComponentEvent = new BComponentEvent(19, bComponent, null, null);
break;
}
case 15: {
bComponentEvent = new BComponentEvent(20, bComponent, null, null);
break;
}
default: {
return;
}
}
int n6 = 0;
while (n6 < this.subscribers.length) {
try {
Subscriber subscriber = this.subscribers[n6];
if (subscriber instanceof PendingSubscriber) {
subscriber = ((PendingSubscriber)subscriber).subscriber;
}
subscriber.event(bComponentEvent);
}
catch (Exception exception) {
exception.printStackTrace();
}
++n6;
}
if (n2 != 0) {
this.getSpace().event(bComponentEvent);
}
}
}
BDataRecoveryComponentRecorder findRecoveryData(int n, Slot slot, Context context) {
boolean bl;
if (!this.isInitialized()) {
return null;
}
BComponent bComponent = this.instance.asComponent();
BDataRecoveryComponentRecorder bDataRecoveryComponentRecorder = Nre.serviceManager.getDataRecoveryComponentRecorder(this.space);
boolean bl2 = false;
if (bDataRecoveryComponentRecorder != null) {
bl2 = true;
}
if (bl = bl2) {
int n2 = slot != null ? this.getFlags(slot) : -1;
bl = bDataRecoveryComponentRecorder.isEventCritical(n, bComponent, slot, n2, context);
}
if (!bl) {
return null;
}
return bDataRecoveryComponentRecorder;
}
BDataRecoveryComponentRecorder findRecoveryData(int n, Slot slot, int n2, Context context) {
boolean bl;
if (!this.isInitialized()) {
return null;
}
BComponent bComponent = this.instance.asComponent();
BDataRecoveryComponentRecorder bDataRecoveryComponentRecorder = Nre.serviceManager.getDataRecoveryComponentRecorder(this.space);
boolean bl2 = false;
if (bDataRecoveryComponentRecorder != null) {
bl2 = true;
}
if (bl = bl2) {
bl = bDataRecoveryComponentRecorder.isEventCritical(n, bComponent, slot, n2, context);
}
if (!bl) {
return null;
}
return bDataRecoveryComponentRecorder;
}
public final SlotKnobs getSlotKnobs(NSlot nSlot) {
if (nSlot.isFrozen) {
if (this.frozenKnobs == null) {
return null;
}
return this.frozenKnobs[nSlot.index];
}
return nSlot.knobs;
}
public final Knob installKnob(BLink bLink) {
return this.installKnob(new LocalKnob(bLink), false);
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public final NKnob installKnob(NKnob nKnob, boolean bl) {
BComplex bComplex = this.instance;
synchronized (bComplex) {
NKnob nKnob2;
NSlot nSlot = (NSlot)nKnob.getSourceSlot();
if (nSlot == null) {
return nKnob;
}
SlotKnobs slotKnobs = this.getSlotKnobs(nSlot);
if (bl && slotKnobs != null && (nKnob2 = slotKnobs.get(nKnob.id)) != null) {
nKnob2.copyFrom(nKnob);
return nKnob2;
}
boolean bl2 = this.isSubscribed();
++this.knobCount;
boolean bl3 = this.isSubscribed();
if (nKnob.isLocal() && bl2 != bl3) {
this.subscribe(true);
}
if (slotKnobs != null) {
slotKnobs.add(nKnob);
} else {
slotKnobs = new SlotKnobs((BComponent)this.instance, nSlot, nKnob);
if (nSlot.isFrozen) {
if (this.frozenKnobs == null) {
this.frozenKnobs = new SlotKnobs[this.getType().slots.length];
}
this.frozenKnobs[nSlot.index] = slotKnobs;
} else {
nSlot.knobs = slotKnobs;
}
}
this.fireComponentEvent(12, nSlot, nKnob, null, null);
return nKnob;
}
}
public final void uninstallKnob(BLink bLink) {
this.uninstallKnob((NKnob)bLink.getKnob());
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public final void uninstallKnob(NKnob nKnob) {
BComplex bComplex = this.instance;
synchronized (bComplex) {
SlotKnobs slotKnobs;
NSlot nSlot;
boolean bl = this.isSubscribed();
--this.knobCount;
boolean bl2 = this.isSubscribed();
if (nKnob.isLocal() && bl != bl2) {
this.unsubscribe(true);
}
if ((nSlot = (NSlot)nKnob.getSourceSlot()) != null && (slotKnobs = this.getSlotKnobs(nSlot)) != null) {
slotKnobs.remove(nKnob);
}
this.fireComponentEvent(13, nSlot, nKnob, null, null);
return;
}
}
/*
* 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 final void mergeKnobs(List var1_1) {
var2_2 = this.instance;
synchronized (var2_2) {
var4_3 = this.getKnobs();
var5_4 = var1_1.toArray(new NKnob[var1_1.size()]);
var6_5 = var4_3.length;
var7_6 = var5_4.length;
var8_7 = 0;
while (true) {
block9: {
if (var8_7 < var6_5) break block9;
var8_7 = 0;
if (true) ** GOTO lbl36
}
var9_8 = false;
var10_9 = 0;
while (var10_9 < var7_6) {
if (var5_4[var10_9] != null && var4_3[var8_7].id == var5_4[var10_9].id) {
var4_3[var8_7].copyFrom(var5_4[var10_9]);
var9_8 = true;
var5_4[var10_9] = null;
break;
}
++var10_9;
}
if (!var9_8) {
this.uninstallKnob(var4_3[var8_7]);
}
++var8_7;
}
do {
if (var5_4[var8_7] != null) {
this.installKnob(var5_4[var8_7], false);
}
++var8_7;
lbl36:
// 2 sources
} while (var8_7 < var7_6);
return;
}
}
public int getKnobCount() {
return this.knobCount;
}
public NKnob[] getKnobs() {
int n;
if (this.knobCount == 0) {
return noKnobs;
}
ArrayList arrayList = new ArrayList();
if (this.frozenKnobs != null) {
n = 0;
while (n < this.frozenKnobs.length) {
if (this.frozenKnobs[n] != null) {
this.frozenKnobs[n].appendTo(arrayList);
}
++n;
}
}
if (this.table != null) {
n = 0;
while (n < this.table.count) {
NProperty nProperty = this.table.slots[n];
if (nProperty.knobs != null) {
nProperty.knobs.appendTo(arrayList);
}
++n;
}
}
return arrayList.toArray(new NKnob[arrayList.size()]);
}
public NKnob[] getKnobs(Slot slot) {
SlotKnobs slotKnobs = this.getSlotKnobs((NSlot)slot);
if (slotKnobs == null) {
return new NKnob[0];
}
return slotKnobs.list();
}
public final BValue invoke(Action action, BValue bValue, Context context) {
return this.invoke(action, bValue, context, false);
}
public final BValue invoke(Action action, BValue bValue, Context context, boolean bl) {
BComponent bComponent = (BComponent)this.instance;
TrapCallbacks trapCallbacks = this.getSpaceTrap();
if (trapCallbacks != null && trapCallbacks.isTrapEnabled() && context != Context.commit) {
return trapCallbacks.invoke(bComponent, action, bValue, context);
}
BUser bUser = null;
if (context != null && context.getUser() != null) {
bUser = context.getUser();
bUser.checkInvoke(bComponent, action);
}
if (!Flags.isAsync(bComponent, action) || bl) {
Object object;
BValue bValue2 = null;
try {
if (action.isFrozen()) {
object = (NAction)action;
bValue2 = this.invoke(((NAction)object).index, bComponent, bValue, context);
} else {
object = (NActionProperty)action;
BAction bAction = (BAction)((NActionProperty)object).value;
bValue2 = bAction.invoke(bComponent, bValue);
}
}
catch (UnhandledSlotException unhandledSlotException) {
unhandledSlotException.printStackTrace();
throw new NoSuchSlotException(this.getType(), action);
}
catch (Throwable throwable) {
throw new ActionInvokeException(throwable);
}
try {
object = this.getSlotKnobs((NSlot)((Object)action));
if (object != null) {
((SlotKnobs)object).propagate(bValue);
}
}
catch (Throwable throwable) {
throwable.printStackTrace();
}
this.fireComponentEvent(7, action, bValue, null, context);
if (bUser != null && !Flags.isNoAudit(bComponent, action)) {
this.audit(this.getAuditSlotPath(context), bUser, "Invoked", action.getName(), null, ComponentSlotMap.toAuditString(bComponent, action, bValue, context));
}
return bValue2;
}
try {
bComponent.post(action, bValue, context);
}
catch (Throwable throwable) {
throwable.printStackTrace();
}
return null;
}
public final void fire(Topic topic, BValue bValue, Context context) {
SlotKnobs slotKnobs = this.getSlotKnobs((NSlot)((Object)topic));
if (slotKnobs != null) {
slotKnobs.propagate(bValue);
}
this.fireComponentEvent(8, topic, bValue, null, context);
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public final void start() {
if (this.propertyInParent != null && Flags.isNoRun(this.parent.instance, this.propertyInParent)) {
return;
}
if (this.isRunning()) return;
BComplex bComplex = this.instance;
synchronized (bComplex) {
boolean bl = this.isSubscribed();
this.setRunning(true);
BComponent bComponent = (BComponent)this.instance;
Nre.engineManager.start(bComponent);
boolean bl2 = this.isSubscribed();
if (bl != bl2) {
this.subscribe(true);
}
this.fireComponentEvent(14, null, null, null, null);
return;
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public final void stop() {
if (!this.isRunning()) return;
BComplex bComplex = this.instance;
synchronized (bComplex) {
boolean bl = this.isSubscribed();
this.setRunning(false);
BComponent bComponent = (BComponent)this.instance;
Nre.engineManager.stop(bComponent);
boolean bl2 = this.isSubscribed();
if (bl != bl2) {
this.unsubscribe(true);
}
this.fireComponentEvent(15, null, null, null, null);
return;
}
}
public final BComplex getParent() {
if (this.parent == null) {
return null;
}
return this.parent.instance;
}
public final Property getPropertyInParent() {
return this.propertyInParent;
}
final void parent(NProperty nProperty, ComplexSlotMap complexSlotMap, Context context, TransferListener transferListener, BDataRecoveryComponentRecorder bDataRecoveryComponentRecorder, BDataRecoveryComponentEvent bDataRecoveryComponentEvent) {
super.parent(nProperty, complexSlotMap, context, transferListener, null, null);
if (this.space != null) {
this.space.childParented((BComponent)this.instance, nProperty, complexSlotMap.instance, context);
}
this.fireComponentEvent(5, nProperty, complexSlotMap.instance, null, context);
if (complexSlotMap.instance.isComponent()) {
ComponentSlotMap componentSlotMap = (ComponentSlotMap)complexSlotMap;
if (complexSlotMap.isRunning()) {
throw new IllegalStateException("Child is running?");
}
try {
if (this.space != null) {
componentSlotMap.mount(this.space, context, transferListener);
}
}
catch (IllegalChildException illegalChildException) {
super.unparent(nProperty, complexSlotMap, context);
if (this.space != null) {
this.space.childUnparented((BComponent)this.instance, nProperty, complexSlotMap.instance, context);
}
this.fireComponentEvent(6, nProperty, complexSlotMap.instance, null, context);
throw illegalChildException;
}
if (bDataRecoveryComponentRecorder != null && bDataRecoveryComponentEvent != null) {
bDataRecoveryComponentRecorder.record(bDataRecoveryComponentEvent, context);
}
if (this.isRunning() && ComponentSlotMap.getContextFacet(context, "niagaraAutoStart", true)) {
complexSlotMap.start();
}
} else if (complexSlotMap.instance instanceof BLink) {
if (bDataRecoveryComponentRecorder != null && bDataRecoveryComponentEvent != null) {
bDataRecoveryComponentRecorder.record(bDataRecoveryComponentEvent, context);
}
if (this.isRunning()) {
BLink bLink = (BLink)complexSlotMap.instance;
EngineUtil.activate(bLink);
}
} else if (bDataRecoveryComponentRecorder != null && bDataRecoveryComponentEvent != null) {
bDataRecoveryComponentRecorder.record(bDataRecoveryComponentEvent, context);
}
}
final void unparent(NProperty nProperty, ComplexSlotMap complexSlotMap, Context context) {
if (complexSlotMap.instance.isComponent()) {
ComponentSlotMap componentSlotMap = (ComponentSlotMap)complexSlotMap;
componentSlotMap.stop();
if (this.space != null) {
componentSlotMap.unmount(context);
}
} else if (complexSlotMap.instance instanceof BLink) {
BLink bLink = (BLink)complexSlotMap.instance;
EngineUtil.deactivate(bLink);
}
super.unparent(nProperty, complexSlotMap, context);
if (this.space != null) {
this.space.childUnparented((BComponent)this.instance, nProperty, complexSlotMap.instance, context);
}
this.fireComponentEvent(6, nProperty, complexSlotMap.instance, null, context);
}
public void deactivating(BLink bLink) {
try {
Slot slot = bLink.getTargetSlot();
if (slot.isProperty() && slot.isFrozen()) {
Property property = slot.asProperty();
BValue bValue = property.getDefaultValue().newCopy();
this.instance.set(property, bValue);
}
}
catch (Throwable throwable) {
throwable.printStackTrace();
}
}
public final void mount(BComponentSpace bComponentSpace, Context context, TransferListener transferListener) {
Object object;
if (context != null && context.getUser() != null) {
if (REQUIRE_SUPER_USER_PERMISSION) {
if (PROG_CODE_TYPE_INFO == null) {
PROG_CODE_TYPE_INFO = BTypeSpec.make("program", "Code").getTypeInfo();
}
if (PROG_OBJ_TYPE_INFO == null) {
PROG_OBJ_TYPE_INFO = BTypeSpec.make("program", "Program").getTypeInfo();
}
if ((this.getType().is(PROG_CODE_TYPE_INFO) || this.getType().is(PROG_OBJ_TYPE_INFO)) && !context.getUser().getPermissions().isSuperUser()) {
throw new IllegalChildException("baja", "RestrictedProgramObjException", null);
}
}
if ((this.getType().is(BUserService.TYPE) || this.getType().is(BCategoryService.TYPE)) && !context.getUser().getPermissions().isSuperUser()) {
throw new IllegalChildException("baja", "RestrictedServiceException", new Object[]{this.getType()});
}
if (this.getType().is(BUser.TYPE)) {
object = context.getUser().getPermissions();
BPermissionsMap bPermissionsMap = ((BUser)this.instance).getPermissions();
if (!bPermissionsMap.equals(((BPermissionsMap)object).and(bPermissionsMap))) {
throw new IllegalChildException("baja", "RestrictedUserAddException", new Object[]{this.getType()});
}
}
}
bComponentSpace.fw(101, this, null, null, null);
this.space = bComponentSpace;
if (this.instance instanceof BIService) {
Nre.serviceManager.register((BComponent)this.instance);
}
if (!bComponentSpace.getLoadCallbacks().isLazyLoad() || this.isBrokerPropsLoaded()) {
object = this.getProperties();
int n = 0;
while (object.nextComponent()) {
try {
ComponentSlotMap.getComponentSlotMap(object.get()).mount(bComponentSpace, context, transferListener);
}
catch (IllegalChildException illegalChildException) {
this.unmount(context);
throw illegalChildException;
}
if (transferListener != null && n % 8 == 0) {
transferListener.updateStatus("Mounting \"" + TransferStrategy.toString(this.instance) + "\"...");
}
++n;
}
}
}
public final void unmount(Context context) {
if (this.instance instanceof BIService) {
Nre.serviceManager.unregister((BComponent)this.instance);
}
NKnob[] nKnobArray = this.getKnobs();
int n = 0;
while (n < nKnobArray.length) {
BLink bLink = nKnobArray[n].getLink();
if (bLink != null && bLink.isIndirect()) {
try {
BComponent bComponent = bLink.getTargetComponent();
if (ComponentSlotMap.getContextFacet(context, "niagaraRemoveLinks", true)) {
bComponent.remove(bLink.getPropertyInParent(), Context.commit);
} else {
ComponentSlotMap componentSlotMap = ComponentSlotMap.getComponentSlotMap(bComponent);
EngineUtil.deactivate(bLink);
}
}
catch (Throwable throwable) {
throwable.printStackTrace();
}
}
++n;
}
this.unsubscribeAll();
if (this.space != null) {
this.space.fw(102, this, null, null, null);
}
this.space = null;
SlotCursor slotCursor = this.getProperties();
while (slotCursor.nextComponent()) {
ComponentSlotMap.getComponentSlotMap(slotCursor.get()).unmount(context);
}
}
public final void checkAdd(String string, int n, BValue bValue, BFacets bFacets, Context context) {
BComponent bComponent = (BComponent)this.instance;
if (bValue == null) {
throw new NullPointerException();
}
if (bValue == bComponent) {
throw new IllegalArgumentException("value == this");
}
bComponent.checkAdd(string, bValue, n, bFacets, context);
if (bValue.isComponent()) {
BComponent bComponent2 = bComponent;
BComponent bComponent3 = bValue.asComponent();
boolean bl = bComponent2 instanceof BUnrestrictedFolder;
if (!bComponent2.isChildLegal(bComponent3)) {
throw new IllegalChildException("baja", "IllegalChildException.parentAndChild", new Object[]{this.getType(), bValue.getType()});
}
if (!bl && !bComponent3.isParentLegal(bComponent2)) {
throw new IllegalParentException("baja", "IllegalParentException.parentAndChild", new Object[]{this.getType(), bValue.getType()});
}
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public final Property add(String string, int n, BValue bValue, ComplexSlotMap complexSlotMap, BFacets bFacets, Context context, TransferListener transferListener) {
NProperty nProperty;
Object object;
BComponent bComponent = (BComponent)this.instance;
if (bFacets == null) {
bFacets = BFacets.NULL;
}
this.checkAdd(string, n, bValue, bFacets, context);
if (context instanceof Transaction) {
((Transaction)context).add(bComponent, string, bValue, n, bFacets, null);
return null;
}
TrapCallbacks trapCallbacks = this.getSpaceTrap();
if (trapCallbacks != null && trapCallbacks.isTrapEnabled() && context != Context.commit) {
return trapCallbacks.add(bComponent, string, bValue, n, bFacets, context);
}
BUser bUser = null;
if (context != null && context.getUser() != null) {
bUser = context.getUser();
bUser.check(bComponent, BPermissions.adminWrite);
}
BComponent bComponent2 = bComponent;
synchronized (bComponent2) {
block20: {
block19: {
if (string != null) break block19;
string = ObjectUtil.generateUniqueSlotName(bValue.getType().getTypeName(), this);
break block20;
}
if (string.endsWith("?")) {
object = string.substring(0, string.length() - 1);
SlotPath.verifyValidName((String)object);
string = ObjectUtil.generateUniqueSlotName((String)object, this);
}
}
object = this.getSlot(string);
if (object != null) {
throw new DuplicateSlotException((Slot)object);
}
SlotPath.verifyValidName(string);
if (!bValue.isSimple() && complexSlotMap.parent != null) {
throw new AlreadyParentedException(string);
}
nProperty = bValue instanceof BAction ? new NActionProperty(string, n, (BAction)bValue, bFacets) : (bValue instanceof BTopic ? new NTopicProperty(string, n, (BTopic)bValue, bFacets) : new NProperty(string, n, bValue, bFacets));
nProperty.declaringType = bComponent.getType();
BDataRecoveryComponentRecorder bDataRecoveryComponentRecorder = this.findRecoveryData(1, nProperty, n, context);
BDataRecoveryComponentEvent bDataRecoveryComponentEvent = null;
if (bDataRecoveryComponentRecorder != null) {
bDataRecoveryComponentEvent = BDataRecoveryComponentEvent.makeAddEvent(bComponent, string, bValue, n, bFacets);
}
if (this.table == null) {
this.table = new DynamicTable(this.getType().slots.length);
}
this.table.put(nProperty);
if (!bValue.isSimple()) {
try {
this.parent(nProperty, complexSlotMap, context, transferListener, bDataRecoveryComponentRecorder, bDataRecoveryComponentEvent);
}
catch (IllegalChildException illegalChildException) {
this.table.remove(nProperty);
throw illegalChildException;
}
} else if (bDataRecoveryComponentRecorder != null && bDataRecoveryComponentEvent != null) {
bDataRecoveryComponentRecorder.record(bDataRecoveryComponentEvent, context);
}
}
this.fireComponentEvent(1, nProperty, null, null, context);
object = this.checkNavEvent(bValue);
if (object != null) {
BNavRoot.INSTANCE.fireNavEvent(NavEvent.makeAdded(bComponent, string, context));
}
if (bUser != null) {
this.audit(this.getAuditSlotPath(context), bUser, "Added", nProperty.name, null, ComponentSlotMap.toAuditString(bComponent, nProperty, bValue, context));
}
return nProperty;
}
public boolean contains(String string) {
this.loadSlots();
boolean bl = false;
if (this.getSlot(string) != null) {
bl = true;
}
return bl;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public final BValue remove(Property property, Context context) {
NKnob[] nKnobArray;
BDataRecoveryComponentRecorder bDataRecoveryComponentRecorder;
if (property.isFrozen()) {
throw new FrozenSlotException(property);
}
if (this.table == null) {
throw new NoSuchSlotException(this.getType(), property);
}
NKnob[] nKnobArray2 = (NKnob[])this.instance;
nKnobArray2.checkRemove(property, context);
NProperty nProperty = (NProperty)property;
BValue bValue = nProperty.value;
if (context instanceof Transaction) {
((Transaction)context).remove((BComponent)nKnobArray2, nProperty, null);
return null;
}
TrapCallbacks trapCallbacks = this.getSpaceTrap();
if (trapCallbacks != null && trapCallbacks.isTrapEnabled() && context != Context.commit) {
trapCallbacks.remove((BComponent)nKnobArray2, nProperty, context);
return null;
}
BUser bUser = null;
if (context != null && context.getUser() != null) {
bUser = context.getUser();
bUser.check((BIProtected)nKnobArray2, BPermissions.adminWrite);
if (bValue instanceof BIProtected) {
bUser.check((BIProtected)((Object)bValue), BPermissions.adminWrite);
}
}
if ((bDataRecoveryComponentRecorder = this.findRecoveryData(2, property, context)) != null) {
bDataRecoveryComponentRecorder.record(BDataRecoveryComponentEvent.makeRemoveEvent((BComponent)nKnobArray2, nProperty.getName()), context);
}
try {
if (!(this.space == null || this.space.isProxyComponentSpace() || bValue instanceof BComponent || bValue instanceof BLink)) {
nKnobArray = this.getKnobs(nProperty);
int n = 0;
while (n < nKnobArray.length) {
this.removeLink(nKnobArray[n]);
++n;
}
BLink[] bLinkArray = nKnobArray2.getLinks(nProperty);
int n2 = 0;
while (n2 < bLinkArray.length) {
this.removeLink(bLinkArray[n2]);
++n2;
}
}
}
catch (Exception exception) {
exception.printStackTrace();
}
nKnobArray = nKnobArray2;
synchronized (nKnobArray2) {
block17: {
if (!bValue.isSimple()) {
this.unparent(nProperty, ComponentSlotMap.getSlotMap(bValue), context);
}
this.table.remove(nProperty);
nProperty.index = -1;
// ** MonitorExit[var9_9] (shouldn't be in output)
this.fireComponentEvent(2, nProperty, bValue, null, context);
BOrd bOrd = this.checkNavEvent(bValue);
if (bOrd != null) {
BNavRoot.INSTANCE.fireNavEvent(NavEvent.makeRemoved((BINavNode)nKnobArray2, nProperty.name, context));
}
if (bUser == null) break block17;
this.audit(this.getAuditSlotPath(context), bUser, "Removed", nProperty.name, ComponentSlotMap.toAuditString((BComponent)nKnobArray2, property, bValue, context), null);
}
return bValue;
}
}
private final void removeLink(Knob knob) {
BComponent bComponent = knob.getTargetComponent();
BLink bLink = knob.getLink();
if (bComponent != null && bLink != null) {
bComponent.remove(bLink);
}
}
private final void removeLink(BLink bLink) {
this.remove(bLink.getPropertyInParent(), null);
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public final void rename(Property property, String string, Context context) {
block13: {
NProperty nProperty = (NProperty)property;
if (string.equals(nProperty.name)) {
return;
}
Slot slot = this.getSlot(string);
SlotPath.verifyValidName(string);
if (property.isFrozen()) {
throw new FrozenSlotException(property);
}
if (slot != null) {
throw new DuplicateSlotException(slot);
}
if (this.table == null) {
throw new NoSuchSlotException(this.getType(), property);
}
BComponent bComponent = (BComponent)this.instance;
bComponent.checkRename(property, string, context);
if (context instanceof Transaction) {
((Transaction)context).rename(bComponent, property, string, null);
return;
}
TrapCallbacks trapCallbacks = this.getSpaceTrap();
if (trapCallbacks != null && trapCallbacks.isTrapEnabled() && context != Context.commit) {
trapCallbacks.rename(bComponent, property, string, context);
return;
}
BUser bUser = null;
if (context != null && context.getUser() != null) {
bUser = context.getUser();
bUser.check(bComponent, BPermissions.adminWrite);
if (nProperty.value instanceof BIProtected) {
bUser.check((BIProtected)((Object)nProperty.value), BPermissions.adminWrite);
}
}
BValue bValue = null;
String string2 = null;
BComponent bComponent2 = bComponent;
synchronized (bComponent2) {
string2 = nProperty.name;
bValue = nProperty.value;
BObject bObject = this.findRecoveryData(3, nProperty, context);
if (bObject != null) {
bObject.record(BDataRecoveryComponentEvent.makeRenameEvent(bComponent, string2, string), context);
}
Property[] propertyArray = (Property[])this.table.slots.clone();
this.table.remove(nProperty);
nProperty.name = string;
nProperty.displayName = null;
this.table.put(nProperty);
this.table.reorder(propertyArray);
// MONITOREXIT @DISABLED, blocks:[0, 1] lbl43 : MonitorExitStatement: MONITOREXIT : var11_11
this.fireComponentEvent(3, nProperty, null, string2, context);
bObject = this.checkNavEvent(bValue);
if (bObject != null) {
BNavRoot.INSTANCE.fireNavEvent(NavEvent.makeRenamed(bComponent, string2, string, context));
}
if (bUser == null) break block13;
}
this.audit(this.getAuditSlotPath(context), bUser, "Renamed", string2, null, string);
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void setFacets(Slot slot, BFacets bFacets, Context context) {
block11: {
BObject bObject;
NSlot nSlot;
if (bFacets == null) {
bFacets = BFacets.NULL;
}
if ((nSlot = (NSlot)slot).isFrozen()) {
throw new FrozenSlotException(slot);
}
if (bFacets.equals(nSlot.facets)) {
return;
}
BComponent bComponent = (BComponent)this.instance;
bComponent.checkSetFacets(slot, bFacets, context);
if (context instanceof Transaction) {
((Transaction)context).setFacets(bComponent, nSlot, bFacets, null);
return;
}
TrapCallbacks trapCallbacks = this.getSpaceTrap();
if (trapCallbacks != null && trapCallbacks.isTrapEnabled() && context != Context.commit) {
trapCallbacks.setFacets(bComponent, nSlot, bFacets, context);
return;
}
BUser bUser = null;
String string = null;
if (context != null && context.getUser() != null) {
bUser = context.getUser();
bUser.check(bComponent, BPermissions.adminWrite);
if (nSlot instanceof NProperty && (bObject = ((NProperty)nSlot).value) instanceof BIProtected) {
bUser.check((BIProtected)((Object)bObject), BPermissions.adminWrite);
}
string = nSlot.facets.toString();
}
if ((bObject = this.findRecoveryData(7, nSlot, context)) != null) {
bObject.record(BDataRecoveryComponentEvent.makeFacetsChangeEvent(bComponent, nSlot.getName(), bFacets), context);
}
BComponent bComponent2 = bComponent;
synchronized (bComponent2) {
nSlot.facets = bFacets;
// MONITOREXIT @DISABLED, blocks:[0, 1] lbl30 : MonitorExitStatement: MONITOREXIT : var10_10
this.fireComponentEvent(10, nSlot, bFacets, null, context);
if (bUser == null) break block11;
}
String string2 = bFacets.toString();
this.audit(this.getAuditSlotPath(context), bUser, "Facets Changed", nSlot.name, string, string2);
}
}
public void reorderToTop(Property property, Context context) {
if (this.table == null || this.table.count == 0) {
throw new IllegalArgumentException("No dynamic properties");
}
if (property.isFrozen()) {
throw new FrozenSlotException(property);
}
Object[] objectArray = new Property[this.table.count];
this.table.copyInto(objectArray, 0);
int n = -1;
int n2 = 0;
while (n2 < objectArray.length) {
if (property == objectArray[n2]) {
n = n2;
break;
}
++n2;
}
if (n == -1) {
throw new IllegalArgumentException("Property not in component");
}
if (n == 0) {
return;
}
System.arraycopy(objectArray, 0, objectArray, 1, n);
objectArray[0] = property;
this.reorderImpl((Property[])objectArray, context);
}
public void reorderToBottom(Property property, Context context) {
if (this.table == null || this.table.count == 0) {
throw new IllegalStateException("No dynamic properties");
}
if (property.isFrozen()) {
throw new FrozenSlotException(property);
}
Object[] objectArray = new Property[this.table.count];
this.table.copyInto(objectArray, 0);
int n = -1;
int n2 = 0;
while (n2 < objectArray.length) {
if (property == objectArray[n2]) {
n = n2;
break;
}
++n2;
}
if (n == -1) {
throw new IllegalArgumentException("Property not in component");
}
if (n == objectArray.length - 1) {
return;
}
System.arraycopy(objectArray, n + 1, objectArray, n, objectArray.length - n - 1);
objectArray[objectArray.length - 1] = property;
this.reorderImpl((Property[])objectArray, context);
}
public void reorder(Property[] propertyArray, Context context) {
if (this.table == null) {
throw new ArrayIndexOutOfBoundsException("no dynamic props");
}
if (this.table.count != propertyArray.length) {
throw new ArrayIndexOutOfBoundsException("actual count " + this.table.count + " != param count " + propertyArray.length);
}
int n = 0;
while (n < propertyArray.length) {
if (propertyArray[n].isFrozen()) {
throw new FrozenSlotException(propertyArray[n]);
}
++n;
}
this.reorderImpl(propertyArray, context);
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
private final void reorderImpl(Property[] propertyArray, Context context) {
BUser bUser;
block9: {
BDataRecoveryComponentRecorder bDataRecoveryComponentRecorder;
BComponent bComponent = (BComponent)this.instance;
bComponent.checkReorder(propertyArray, context);
if (context instanceof Transaction) {
((Transaction)context).reorder(bComponent, propertyArray, null);
return;
}
TrapCallbacks trapCallbacks = this.getSpaceTrap();
if (trapCallbacks != null && trapCallbacks.isTrapEnabled() && context != Context.commit) {
trapCallbacks.reorder(bComponent, propertyArray, context);
return;
}
bUser = null;
if (context != null && context.getUser() != null) {
bUser = context.getUser();
bUser.check(bComponent, BPermissions.adminWrite);
}
if ((bDataRecoveryComponentRecorder = this.findRecoveryData(4, null, -1, context)) != null) {
bDataRecoveryComponentRecorder.record(BDataRecoveryComponentEvent.makeReorderEvent(bComponent, propertyArray), context);
}
BComponent bComponent2 = bComponent;
synchronized (bComponent2) {
this.table.reorder(propertyArray);
// MONITOREXIT @DISABLED, blocks:[0, 1] lbl20 : MonitorExitStatement: MONITOREXIT : var7_7
this.fireComponentEvent(4, null, null, null, context);
BOrd bOrd = bComponent.getNavOrd();
if (bOrd == null) break block9;
}
String[] stringArray = new String[this.table.count];
int n = 0;
while (n < stringArray.length) {
stringArray[n] = this.table.slots[n].name;
++n;
}
BNavRoot.INSTANCE.fireNavEvent(NavEvent.makeReordered(bComponent, stringArray, context));
}
if (bUser != null) {
this.audit(this.getAuditSlotPath(context), bUser, "Reordered", null, null, null);
}
}
public final BCategoryMask getAppliedCategoryMask() {
if (this.cat.isNull() && this.parent != null) {
return this.parent.getAppliedCategoryMask();
}
return this.cat;
}
public final BCategoryMask getCategoryMask() {
return this.cat;
}
public final void setCategoryMask(BCategoryMask bCategoryMask, Context context) {
BComponent bComponent = (BComponent)this.instance;
if (bCategoryMask == null) {
throw new NullPointerException();
}
if (bCategoryMask == this.cat) {
return;
}
if (context instanceof Transaction) {
((Transaction)context).setCategoryMask(bComponent, bCategoryMask, null);
return;
}
TrapCallbacks trapCallbacks = this.getSpaceTrap();
if (trapCallbacks != null && trapCallbacks.isTrapEnabled() && context != Context.commit) {
trapCallbacks.setCategoryMask(bComponent, bCategoryMask, context);
return;
}
BUser bUser = null;
if (context != null && context.getUser() != null) {
bUser = context.getUser();
bUser.check(bComponent, BPermissions.adminWrite);
}
BCategoryMask bCategoryMask2 = this.cat;
BDataRecoveryComponentRecorder bDataRecoveryComponentRecorder = this.findRecoveryData(10, null, -1, context);
if (bDataRecoveryComponentRecorder != null) {
bDataRecoveryComponentRecorder.record(BDataRecoveryComponentEvent.makeRecategorizeEvent(bComponent, bCategoryMask, bCategoryMask2), context);
}
this.cat = bCategoryMask;
this.fireComponentEvent(11, null, bCategoryMask2, null, context);
BOrd bOrd = bComponent.getNavOrd();
if (bOrd != null) {
BNavRoot.INSTANCE.fireNavEvent(NavEvent.makeRecategorized(bComponent, bCategoryMask2, bCategoryMask, context));
}
if (bUser != null) {
this.audit(this.getAuditSlotPath(context), bUser, "Recategorized", null, bCategoryMask2.encodeToString(), bCategoryMask.encodeToString());
}
}
public final BCategoryMask getDeepOrCategoryMask() {
return this.catDeepOr;
}
public void updateDeepOr(BCategoryMask[] bCategoryMaskArray, int n) {
bCategoryMaskArray[n + 1] = BCategoryMask.NULL;
SlotCursor slotCursor = this.getProperties();
while (slotCursor.nextComponent()) {
BComponent bComponent = (BComponent)slotCursor.get();
ComponentSlotMap componentSlotMap = (ComponentSlotMap)bComponent.fw(1, null, null, null, null);
componentSlotMap.updateDeepOr(bCategoryMaskArray, n + 1);
}
this.catDeepOr = bCategoryMaskArray[n + 1];
bCategoryMaskArray[n] = BCategoryMask.or(BCategoryMask.or(bCategoryMaskArray[n], this.cat), this.catDeepOr);
}
public static boolean getContextFacet(Context context, String string, boolean bl) {
if (context == null) {
return bl;
}
BBoolean bBoolean = (BBoolean)context.getFacet(string);
if (bBoolean == null) {
return bl;
}
return bBoolean.getBoolean();
}
final BOrd checkNavEvent(BValue bValue) {
if (bValue instanceof BComponent && ((BComponent)bValue).isNavChild()) {
return ((BComponent)this.instance).getNavOrd();
}
return null;
}
public static BOrd swizzle(BOrd bOrd, int n) {
try {
if (bOrd.toString().startsWith("h:")) {
OrdQuery[] ordQueryArray = bOrd.parse();
ordQueryArray[0] = new BasicQuery("h", ComponentSlotMap.swizzle(ordQueryArray[0].getBody(), n));
return BOrd.make(ordQueryArray);
}
}
catch (Exception exception) {
exception.printStackTrace();
}
return bOrd;
}
public static String swizzle(String string, int n) {
String string2 = Integer.toHexString(n);
return SWIZZLE_PREFIX + string2 + '-' + string;
}
public static String unswizzle(String string) {
if (!string.startsWith(SWIZZLE_PREFIX)) {
return string;
}
int n = string.indexOf(45, SWIZZLE_PREFIX.length() + 1);
if (n < 0) {
return string;
}
return string.substring(n + 1);
}
public String generateUniqueSlotName(String string) {
return ObjectUtil.generateUniqueSlotName(string, this);
}
public final boolean isInitialized() {
boolean bl = false;
if ((this.mask & 1) != 0) {
bl = true;
}
return bl;
}
public final void setInitialized(boolean bl) {
this.mask = bl ? (this.mask |= 1) : (this.mask &= 0xFFFFFFFE);
}
public final boolean isRunning() {
boolean bl = false;
if ((this.mask & 4) != 0) {
bl = true;
}
return bl;
}
public final void setRunning(boolean bl) {
this.mask = bl ? (this.mask |= 4) : (this.mask &= 0xFFFFFFFB);
}
public final boolean isBrokerPropsLoaded() {
boolean bl = false;
if ((this.mask & 8) != 0) {
bl = true;
}
return bl;
}
public final void setBrokerPropsLoaded(boolean bl) {
this.mask = bl ? (this.mask |= 8) : (this.mask &= 0xFFFFFFF7);
}
public final boolean isPendingMove() {
boolean bl = false;
if ((this.mask & 0x10) != 0) {
bl = true;
}
return bl;
}
public final void setPendingMove(boolean bl) {
this.mask = bl ? (this.mask |= 0x10) : (this.mask &= 0xFFFFFFEF);
}
public final boolean isWidget() {
boolean bl = false;
if ((this.mask & 0x40) != 0) {
bl = true;
}
return bl;
}
public final void setIsWidget(boolean bl) {
this.mask = bl ? (this.mask |= 0x40) : (this.mask &= 0xFFFFFFBF);
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public final void setPendingSubscribe(Subscriber subscriber) {
if (this.space == null) return;
if (!this.space.isProxyComponentSpace()) return;
BComplex bComplex = this.instance;
synchronized (bComplex) {
int n = this.subscribers.length;
boolean bl = true;
int n2 = 0;
while (n2 < n) {
Subscriber subscriber2 = this.subscribers[n2];
if (subscriber2 instanceof PendingSubscriber && ((PendingSubscriber)subscriber2).subscriber == subscriber) {
return;
}
++n2;
}
if (!bl) return;
Subscriber[] subscriberArray = new Subscriber[this.subscribers.length + 1];
System.arraycopy(this.subscribers, 0, subscriberArray, 0, this.subscribers.length);
subscriberArray[this.subscribers.length] = new PendingSubscriber(subscriber);
this.subscribers = subscriberArray;
return;
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public final void clearPendingSubscribe(Subscriber subscriber) {
BComplex bComplex = this.instance;
synchronized (bComplex) {
int n = 0;
while (n < this.subscribers.length) {
if (this.subscribers[n] instanceof PendingSubscriber && ((PendingSubscriber)this.subscribers[n]).subscriber == subscriber) {
Subscriber[] subscriberArray = new Subscriber[this.subscribers.length - 1];
System.arraycopy(this.subscribers, 0, subscriberArray, 0, n);
if (n < this.subscribers.length) {
System.arraycopy(this.subscribers, n + 1, subscriberArray, n, this.subscribers.length - n - 1);
}
this.subscribers = subscriberArray;
break;
}
++n;
}
return;
}
}
private final /* synthetic */ void this() {
this.table = null;
this.frozenKnobs = null;
this.subscribers = noSubscribers;
this.mask = 0;
this.cat = BCategoryMask.NULL;
this.catDeepOr = BCategoryMask.NULL;
}
public ComponentSlotMap() {
this.this();
}
static {
int[] nArray = new int[16];
nArray[1] = 1;
nArray[2] = 2;
nArray[3] = 3;
nArray[4] = 4;
nArray[5] = -1;
nArray[6] = -1;
nArray[7] = -1;
nArray[8] = 5;
nArray[9] = 6;
nArray[10] = 7;
nArray[11] = 10;
nArray[12] = 8;
nArray[13] = 9;
nArray[14] = 19;
nArray[15] = 20;
COMPONENT_EVENT = nArray;
COMPONENT_CHILD_EVENT = new int[]{-1, 11, 12, 13, 14, -1, -1, -1, -1, 15, 16, -1, -1, -1, -1, -1};
REQUIRE_SUPER_USER_PERMISSION = Boolean.valueOf(System.getProperty("niagara.program.requireSuperUser", "true"));
PROG_OBJ_TYPE_INFO = null;
PROG_CODE_TYPE_INFO = null;
noSubscribers = new Subscriber[0];
noKnobs = new NKnob[0];
}
static class PendingSubscriber
extends Subscriber {
Subscriber subscriber;
public void event(BComponentEvent bComponentEvent) {
this.subscriber.event(bComponentEvent);
}
public PendingSubscriber(Subscriber subscriber) {
this.subscriber = subscriber;
}
}
}