link start!
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import com.tridium.sys.engine.NKnob;
|
||||
import com.tridium.sys.schema.ComponentSlotMap;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sync.SyncDecoder;
|
||||
import javax.baja.sync.SyncEncoder;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Knob;
|
||||
|
||||
public class AddKnobOp
|
||||
extends SyncOp {
|
||||
Knob knob;
|
||||
|
||||
public int getId() {
|
||||
return 107;
|
||||
}
|
||||
|
||||
public Knob getKnob() {
|
||||
return this.knob;
|
||||
}
|
||||
|
||||
void commit(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, Context context) throws Exception {
|
||||
if (this.knob != null) {
|
||||
((ComponentSlotMap)this.component.fw(1)).installKnob((NKnob)this.knob, true);
|
||||
}
|
||||
}
|
||||
|
||||
void encode(SyncEncoder syncEncoder) throws Exception {
|
||||
super.encode(syncEncoder);
|
||||
syncEncoder.endAttr().newLine();
|
||||
syncEncoder.key("nk");
|
||||
syncEncoder.encodeKnob((NKnob)this.knob);
|
||||
syncEncoder.end(String.valueOf((char)this.getId())).newLine();
|
||||
}
|
||||
|
||||
void decode(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, SyncDecoder syncDecoder) throws Exception {
|
||||
super.decode(syncBuffer, bComponentSpace, syncDecoder);
|
||||
syncDecoder.next();
|
||||
this.knob = syncDecoder.decodeKnob(this.component);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "AddKnob: " + this.componentToString() + ' ' + this.knob;
|
||||
}
|
||||
|
||||
public AddKnobOp(BComponent bComponent, Knob knob) {
|
||||
super(bComponent);
|
||||
this.knob = knob;
|
||||
}
|
||||
|
||||
public AddKnobOp() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import com.tridium.sys.schema.ComplexSlotMap;
|
||||
import com.tridium.sys.schema.ComponentSlotMap;
|
||||
import javax.baja.io.ValueDocDecoder;
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sync.SyncDecoder;
|
||||
import javax.baja.sync.SyncEncoder;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.DuplicateSlotException;
|
||||
import javax.baja.sys.Flags;
|
||||
import javax.baja.sys.Property;
|
||||
|
||||
public class AddOp
|
||||
extends SyncOp {
|
||||
String name;
|
||||
BValue value;
|
||||
int flags;
|
||||
BFacets facets;
|
||||
String newName;
|
||||
|
||||
public int getId() {
|
||||
return 97;
|
||||
}
|
||||
|
||||
public String getSlotName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public BValue getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public int getFlags() {
|
||||
return this.flags;
|
||||
}
|
||||
|
||||
public BFacets getFacets() {
|
||||
return this.facets;
|
||||
}
|
||||
|
||||
public String getNewSlotName() {
|
||||
return this.newName;
|
||||
}
|
||||
|
||||
void commit(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, Context context) throws Exception {
|
||||
block3: {
|
||||
try {
|
||||
ComponentSlotMap componentSlotMap = (ComponentSlotMap)this.component.fw(1);
|
||||
ComplexSlotMap complexSlotMap = (ComplexSlotMap)this.value.fw(1);
|
||||
Property property = componentSlotMap.add(this.name, this.flags, this.value, complexSlotMap, this.facets, context, syncBuffer.listener);
|
||||
if (property != null) {
|
||||
this.newName = property.getName();
|
||||
}
|
||||
}
|
||||
catch (DuplicateSlotException duplicateSlotException) {
|
||||
if (bComponentSpace.isProxyComponentSpace()) break block3;
|
||||
throw duplicateSlotException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void encode(SyncEncoder syncEncoder) throws Exception {
|
||||
BPermissions bPermissions;
|
||||
if (this.value.isComponent() && !(bPermissions = syncEncoder.getPermissionsFor(this.value.asComponent())).hasOperatorRead()) {
|
||||
throw new SyncOp.SyncOpSecurityException(this, "Missing op read permission on value");
|
||||
}
|
||||
super.encode(syncEncoder);
|
||||
if (this.name != null) {
|
||||
syncEncoder.attr("n", this.name);
|
||||
}
|
||||
if (this.flags != 0) {
|
||||
syncEncoder.attr("f", Flags.encodeToString(this.flags));
|
||||
}
|
||||
if (this.facets != null && !this.facets.isNull()) {
|
||||
syncEncoder.attr("facets", this.facets.encodeToString());
|
||||
}
|
||||
syncEncoder.endAttr().newLine().key("b");
|
||||
syncEncoder.encode(this.value);
|
||||
syncEncoder.end(String.valueOf((char)this.getId())).newLine();
|
||||
}
|
||||
|
||||
void decode(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, SyncDecoder syncDecoder) throws Exception {
|
||||
super.decode(syncBuffer, bComponentSpace, syncDecoder);
|
||||
ValueDocDecoder.IElement iElement = syncDecoder.elem();
|
||||
this.name = iElement.get("n", null);
|
||||
this.flags = Flags.decodeFromString(iElement.get("f", "0"));
|
||||
this.facets = (BFacets)BFacets.DEFAULT.decodeFromString(iElement.get("facets", ""));
|
||||
syncDecoder.next();
|
||||
this.value = syncDecoder.decode();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Add: " + this.componentToString() + " -> " + this.name + " = " + this.value;
|
||||
}
|
||||
|
||||
public AddOp(BComponent bComponent, String string, BValue bValue, int n, BFacets bFacets) {
|
||||
super(bComponent);
|
||||
this.name = string;
|
||||
this.value = bValue;
|
||||
this.flags = n;
|
||||
this.facets = bFacets;
|
||||
}
|
||||
|
||||
public AddOp() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sys.BComponent;
|
||||
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 abstract class BProxyComponentSpace
|
||||
extends BComponentSpace {
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$sync$BProxyComponentSpace;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public final boolean isProxyComponentSpace() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public final BComponent findByHandle(Object object, boolean bl) {
|
||||
BComponent bComponent = super.findByHandle(object, bl);
|
||||
if (bComponent != null) {
|
||||
return bComponent;
|
||||
}
|
||||
if (!bl) {
|
||||
return null;
|
||||
}
|
||||
return this.loadByHandle(object);
|
||||
}
|
||||
|
||||
protected abstract BComponent loadByHandle(Object var1);
|
||||
|
||||
public abstract void sync() throws Exception;
|
||||
|
||||
public boolean fireDirectCallbacks() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void subscribe(Type[] typeArray, TypeSubscriber typeSubscriber) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public BProxyComponentSpace(String string, LexiconText lexiconText, BOrd bOrd) {
|
||||
super(string, lexiconText, bOrd);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$sync$BProxyComponentSpace;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$sync$BProxyComponentSpace = BProxyComponentSpace.class("[Ljavax.baja.sync.BProxyComponentSpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sync.SyncDecoder;
|
||||
import javax.baja.sync.SyncEncoder;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Topic;
|
||||
|
||||
public class FireTopicOp
|
||||
extends SyncOp {
|
||||
String name;
|
||||
BValue event;
|
||||
|
||||
public int getId() {
|
||||
return 116;
|
||||
}
|
||||
|
||||
public String getSlotName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public BValue getEvent() {
|
||||
return this.event;
|
||||
}
|
||||
|
||||
void commit(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, Context context) throws Exception {
|
||||
Topic topic = this.component.getTopic(this.name);
|
||||
if (topic != null) {
|
||||
this.component.fire(topic, this.event, Context.commit);
|
||||
}
|
||||
}
|
||||
|
||||
void encode(SyncEncoder syncEncoder) throws Exception {
|
||||
BPermissions bPermissions;
|
||||
if (this.event != null && this.event.isComponent() && !(bPermissions = syncEncoder.getPermissionsFor(this.event.asComponent())).hasOperatorRead()) {
|
||||
throw new SyncOp.SyncOpSecurityException(this, "Missing op read permission on value");
|
||||
}
|
||||
super.encode(syncEncoder);
|
||||
syncEncoder.attr("n", this.name).endAttr().newLine();
|
||||
if (this.event != null) {
|
||||
syncEncoder.key("b");
|
||||
syncEncoder.encode(this.event);
|
||||
}
|
||||
syncEncoder.end(String.valueOf((char)this.getId())).newLine();
|
||||
}
|
||||
|
||||
void decode(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, SyncDecoder syncDecoder) throws Exception {
|
||||
super.decode(syncBuffer, bComponentSpace, syncDecoder);
|
||||
this.name = syncDecoder.elem().get("n");
|
||||
syncDecoder.next();
|
||||
if (syncDecoder.type() == 1 && syncDecoder.elem().name().equals("p")) {
|
||||
this.event = syncDecoder.decode();
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "FireTopic: " + this.componentToString() + '.' + this.name + " -> " + this.event;
|
||||
}
|
||||
|
||||
public FireTopicOp(BComponent bComponent, String string, BValue bValue) {
|
||||
super(bComponent);
|
||||
this.name = string;
|
||||
this.event = bValue;
|
||||
}
|
||||
|
||||
public FireTopicOp() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import com.tridium.sys.engine.ProxyKnob;
|
||||
import com.tridium.sys.schema.ComponentSlotMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import javax.baja.io.ValueDocDecoder;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sync.SyncDecoder;
|
||||
import javax.baja.sync.SyncEncoder;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BSimple;
|
||||
import javax.baja.sys.BStruct;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.SlotCursor;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class LoadOp
|
||||
extends SyncOp {
|
||||
int depth;
|
||||
BComponent current;
|
||||
HashMap knobs;
|
||||
boolean partialLoad;
|
||||
|
||||
public int getId() {
|
||||
return 108;
|
||||
}
|
||||
|
||||
public int getDepth() {
|
||||
return this.depth;
|
||||
}
|
||||
|
||||
void commit(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, Context context) throws Exception {
|
||||
this.syncComponent(this.current, this.component, this.partialLoad);
|
||||
if (!this.partialLoad) {
|
||||
this.loadKnobs(bComponentSpace);
|
||||
}
|
||||
}
|
||||
|
||||
void syncComponent(BComponent bComponent, BComponent bComponent2, boolean bl) throws Exception {
|
||||
Object object;
|
||||
Object object2;
|
||||
if (bComponent.getType() != bComponent2.getType()) {
|
||||
throw new IllegalStateException(bComponent.getType() + " != " + bComponent2.getType());
|
||||
}
|
||||
if (bComponent2.getHandle() == null || !bComponent2.getHandle().equals(bComponent.getHandle())) {
|
||||
throw new IllegalStateException("from.h != to.h -> " + bComponent.getHandle() + " != " + bComponent2.getHandle());
|
||||
}
|
||||
ComponentSlotMap componentSlotMap = (ComponentSlotMap)bComponent.fw(1);
|
||||
ComponentSlotMap componentSlotMap2 = (ComponentSlotMap)bComponent2.fw(1);
|
||||
componentSlotMap2.setCachedPermissions(componentSlotMap.getCachedPermissions());
|
||||
componentSlotMap2.setCategoryMask(componentSlotMap.getCategoryMask(), Context.commit);
|
||||
boolean bl2 = ((ComponentSlotMap)bComponent.fw(1)).isBrokerPropsLoaded();
|
||||
if (!bl2) {
|
||||
this.syncIcon(bComponent, bComponent2);
|
||||
if (!bl) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!bl) {
|
||||
((ComponentSlotMap)bComponent2.fw(1)).setBrokerPropsLoaded(true);
|
||||
}
|
||||
HashMap<String, Property> hashMap = new HashMap<String, Property>();
|
||||
Property[] propertyArray = bComponent2.getPropertiesArray();
|
||||
int n = 0;
|
||||
while (n < propertyArray.length) {
|
||||
hashMap.put(propertyArray[n].getName(), propertyArray[n]);
|
||||
++n;
|
||||
}
|
||||
SlotCursor slotCursor = bComponent.getSlots();
|
||||
while (slotCursor.next()) {
|
||||
object2 = slotCursor.slot().getName();
|
||||
object = slotCursor.slot();
|
||||
Slot slot = bComponent2.getSlot((String)object2);
|
||||
int n2 = bComponent.getFlags((Slot)object);
|
||||
if (slot == null) {
|
||||
Property property = (Property)object;
|
||||
BValue bValue = bComponent.get(property);
|
||||
BValue bValue2 = this.newCopy(bValue);
|
||||
bComponent2.add((String)object2, bValue2, n2, bComponent.getSlotFacets(property), Context.commit);
|
||||
if (!bValue.isComponent()) continue;
|
||||
this.syncComponent((BComponent)bValue, (BComponent)bValue2, false);
|
||||
continue;
|
||||
}
|
||||
hashMap.remove(object2);
|
||||
bComponent2.setFlags(slot, n2, Context.commit);
|
||||
if (!object.isProperty()) continue;
|
||||
this.syncValue(bComponent, (Property)object, bComponent2, (Property)slot, false);
|
||||
}
|
||||
if (hashMap.size() > 0) {
|
||||
object2 = hashMap.keySet().iterator();
|
||||
while (object2.hasNext()) {
|
||||
object = (String)object2.next();
|
||||
bComponent2.remove((String)object, Context.commit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void syncValue(BComplex bComplex, Property property, BComplex bComplex2, Property property2, boolean bl) throws Exception {
|
||||
BValue bValue = bComplex.get(property);
|
||||
BValue bValue2 = bComplex2.get(property2);
|
||||
if (bValue.getClass() != bValue2.getClass() || bValue.isSimple() || bValue2.isComponent() && (bValue2.asComponent().getHandle() == null || bValue2.asComponent().getComponentSpace() == null)) {
|
||||
if (bValue.isComponent() && bValue.asComponent().getHandle() == null) {
|
||||
if (bValue.asComponent().getPropertyInParent().isDynamic()) {
|
||||
throw new IllegalStateException("LoadOp - dynamic slot with no handle");
|
||||
}
|
||||
System.out.println("WARNING: remote VM does not have frozen slot \"" + bComplex.getType() + '.' + property.getName() + '\"');
|
||||
bComplex2.setFlags(property2, bComplex2.getFlags(property2) | 4, Context.commit);
|
||||
return;
|
||||
}
|
||||
bValue2 = this.newCopy(bValue);
|
||||
bComplex2.set(property2, bValue2, Context.commit);
|
||||
if (bValue.isComponent()) {
|
||||
this.syncComponent((BComponent)bValue, (BComponent)bValue2, bl);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (bValue.isComponent()) {
|
||||
BComponent bComponent = (BComponent)bValue;
|
||||
BComponent bComponent2 = (BComponent)bValue2;
|
||||
if (bComponent2.getHandle() == null) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
this.syncComponent(bComponent, bComponent2, bl);
|
||||
return;
|
||||
}
|
||||
BStruct bStruct = (BStruct)bValue;
|
||||
BStruct bStruct2 = (BStruct)bValue2;
|
||||
SlotCursor slotCursor = bStruct.getProperties();
|
||||
while (slotCursor.next()) {
|
||||
Property property3;
|
||||
Property property4 = slotCursor.property();
|
||||
if (property4 != (property3 = bStruct2.getProperty(property4.getName()))) {
|
||||
throw new IllegalStateException("Structs should have same prop " + property4 + " != " + property3);
|
||||
}
|
||||
this.syncValue(bStruct, property4, bStruct2, property3, bl);
|
||||
}
|
||||
}
|
||||
|
||||
BValue newCopy(BValue bValue) {
|
||||
if (bValue.isComponent()) {
|
||||
BComponent bComponent = (BComponent)bValue;
|
||||
BComponent bComponent2 = (BComponent)bComponent.getType().getInstance();
|
||||
((ComponentSlotMap)bComponent2.fw(1)).setHandle(bComponent.getHandle());
|
||||
return bComponent2;
|
||||
}
|
||||
return bValue.newCopy(true);
|
||||
}
|
||||
|
||||
void loadKnobs(BComponentSpace bComponentSpace) throws Exception {
|
||||
Iterator iterator = this.knobs.keySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BComponent bComponent = (BComponent)iterator.next();
|
||||
if (!((ComponentSlotMap)bComponent.fw(1)).isBrokerPropsLoaded()) continue;
|
||||
BComponent bComponent2 = bComponentSpace.findByHandle(bComponent.getHandle(), false);
|
||||
if (bComponent2 == null) {
|
||||
throw new IllegalStateException("" + bComponent.getHandle());
|
||||
}
|
||||
ArrayList arrayList = (ArrayList)this.knobs.get(bComponent);
|
||||
ArrayList<ProxyKnob> arrayList2 = new ArrayList<ProxyKnob>(arrayList.size());
|
||||
int n = 0;
|
||||
while (n < arrayList.size()) {
|
||||
ValueDocDecoder.IElement iElement = (ValueDocDecoder.IElement)arrayList.get(n);
|
||||
ProxyKnob proxyKnob = SyncDecoder.decodeKnob(bComponent2, iElement);
|
||||
if (proxyKnob != null) {
|
||||
arrayList2.add(proxyKnob);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
((ComponentSlotMap)bComponent2.fw(1)).mergeKnobs(arrayList2);
|
||||
}
|
||||
}
|
||||
|
||||
void syncIcon(BComponent bComponent, BComponent bComponent2) {
|
||||
Property property = bComponent.getProperty("icon");
|
||||
if (property == null) {
|
||||
return;
|
||||
}
|
||||
BValue bValue = bComponent.get(property);
|
||||
if (!(bValue instanceof BSimple)) {
|
||||
return;
|
||||
}
|
||||
Property property2 = bComponent2.getProperty("icon");
|
||||
if (property2 == null) {
|
||||
bComponent2.add("icon", bValue, Context.commit);
|
||||
} else {
|
||||
bComponent2.set(property2, bValue, Context.commit);
|
||||
}
|
||||
}
|
||||
|
||||
void encode(SyncEncoder syncEncoder) throws Exception {
|
||||
super.encode(syncEncoder);
|
||||
if (this.partialLoad) {
|
||||
syncEncoder.attr("partialLoad", true);
|
||||
}
|
||||
syncEncoder.endAttr().newLine().key("b");
|
||||
syncEncoder.encodeForLoad = true;
|
||||
boolean bl = syncEncoder.setEncodeTransients(true);
|
||||
syncEncoder.encode(null, this.component, this.depth);
|
||||
syncEncoder.setEncodeTransients(bl);
|
||||
syncEncoder.encodeForLoad = true;
|
||||
syncEncoder.end(String.valueOf((char)this.getId())).newLine();
|
||||
}
|
||||
|
||||
void decode(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, SyncDecoder syncDecoder) throws Exception {
|
||||
super.decode(syncBuffer, bComponentSpace, syncDecoder);
|
||||
ValueDocDecoder.IElement iElement = syncDecoder.elem();
|
||||
this.partialLoad = iElement.get("partialLoad", "false").equals("true");
|
||||
syncDecoder.knobs = null;
|
||||
syncDecoder.next();
|
||||
this.current = (BComponent)syncDecoder.decode();
|
||||
this.knobs = syncDecoder.knobs;
|
||||
syncDecoder.knobs = null;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("Load: " + this.componentToString());
|
||||
if (this.partialLoad) {
|
||||
stringBuffer.append(", partialLoad enabled");
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.partialLoad = false;
|
||||
}
|
||||
|
||||
public LoadOp(BComponent bComponent, int n) {
|
||||
super(bComponent);
|
||||
this.this();
|
||||
this.depth = n;
|
||||
}
|
||||
|
||||
public LoadOp() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
public LoadOp(BComponent bComponent, int n, boolean bl) {
|
||||
this(bComponent, n);
|
||||
this.partialLoad = bl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import javax.baja.nav.BNavRoot;
|
||||
import javax.baja.nav.NavEvent;
|
||||
import javax.baja.nav.NavListener;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.AddKnobOp;
|
||||
import javax.baja.sync.AddOp;
|
||||
import javax.baja.sync.FireTopicOp;
|
||||
import javax.baja.sync.LoadOp;
|
||||
import javax.baja.sync.RemoveKnobOp;
|
||||
import javax.baja.sync.RemoveOp;
|
||||
import javax.baja.sync.RenameOp;
|
||||
import javax.baja.sync.ReorderOp;
|
||||
import javax.baja.sync.SetCategoryMaskOp;
|
||||
import javax.baja.sync.SetFacetsOp;
|
||||
import javax.baja.sync.SetFlagsOp;
|
||||
import javax.baja.sync.SetOp;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BComponentEvent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Subscriber;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class ProxyBroker
|
||||
extends Subscriber
|
||||
implements NavListener {
|
||||
private BComponentSpace masterSpace;
|
||||
private Object bufferLock;
|
||||
private ProxySyncBuffer buffer;
|
||||
|
||||
public BComponentSpace getMasterSpace() {
|
||||
return this.masterSpace;
|
||||
}
|
||||
|
||||
public void start() {
|
||||
BNavRoot.INSTANCE.addNavListener(this);
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
BNavRoot.INSTANCE.removeNavListener(this);
|
||||
this.unsubscribeAll();
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public SyncBuffer detachBuffer() {
|
||||
Object object = this.bufferLock;
|
||||
synchronized (object) {
|
||||
ProxySyncBuffer proxySyncBuffer = this.buffer;
|
||||
this.buffer = new ProxySyncBuffer(this.masterSpace);
|
||||
return proxySyncBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void loadOp(BComponent bComponent, int n) {
|
||||
Object object = this.bufferLock;
|
||||
synchronized (object) {
|
||||
this.buffer.add(new LoadOp(bComponent, n));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void loadOp(BComponent bComponent, int n, boolean bl) {
|
||||
Object object = this.bufferLock;
|
||||
synchronized (object) {
|
||||
this.buffer.add(new LoadOp(bComponent, n, bl));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void subscribeOp(BComponent bComponent, int n) {
|
||||
this.subscribe(bComponent, n);
|
||||
Object object = this.bufferLock;
|
||||
synchronized (object) {
|
||||
this.buffer.add(new LoadOp(bComponent, n));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void subscribeOp(BComponent bComponent, int n, boolean bl) {
|
||||
this.subscribe(bComponent, n);
|
||||
Object object = this.bufferLock;
|
||||
synchronized (object) {
|
||||
this.buffer.add(new LoadOp(bComponent, n, bl));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void navEvent(NavEvent navEvent) {
|
||||
if (!(navEvent.getParent() instanceof BComponent)) {
|
||||
return;
|
||||
}
|
||||
BComponent bComponent = (BComponent)navEvent.getParent();
|
||||
if (bComponent.getComponentSpace() != this.masterSpace) {
|
||||
return;
|
||||
}
|
||||
Object object = this.bufferLock;
|
||||
synchronized (object) {
|
||||
switch (navEvent.getId()) {
|
||||
case 1: {
|
||||
Property property = bComponent.getProperty(navEvent.getNewChildName());
|
||||
BComponent bComponent2 = (BComponent)bComponent.get(property);
|
||||
this.buffer.add(new AddOp(bComponent, property.getName(), bComponent2, property.getDefaultFlags(), property.getFacets()));
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
this.buffer.add(new RemoveOp(bComponent, navEvent.getOldChildName()));
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
this.buffer.add(new RenameOp(bComponent, navEvent.getOldChildName(), navEvent.getNewChildName()));
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
this.buffer.add(new ReorderOp(bComponent, navEvent.getNewOrder()));
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
String string = navEvent.getOldChildName();
|
||||
this.buffer.add(new SetOp(bComponent, string, null));
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
this.buffer.add(new SetCategoryMaskOp(bComponent, navEvent.getNewChildName()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void event(BComponentEvent bComponentEvent) {
|
||||
BComponent bComponent = bComponentEvent.getSourceComponent();
|
||||
if (bComponent.getComponentSpace() != this.masterSpace) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
Object object = this.bufferLock;
|
||||
synchronized (object) {
|
||||
switch (bComponentEvent.getId()) {
|
||||
case 0: {
|
||||
this.buffer.add(new SetOp(bComponent, bComponentEvent.getSlotName(), null));
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
this.buffer.add(new AddOp(bComponent, bComponentEvent.getSlotName(), bComponentEvent.getValue(), bComponentEvent.getSlotFlags(), bComponentEvent.getSlot().getFacets()));
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
this.buffer.add(new RemoveOp(bComponent, bComponentEvent.getSlotName()));
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
this.buffer.add(new RenameOp(bComponent, bComponentEvent.getValue().toString(), bComponentEvent.getSlotName()));
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
this.buffer.add(new FireTopicOp(bComponent, bComponentEvent.getSlotName(), bComponentEvent.getValue()));
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
this.buffer.add(new SetFlagsOp(bComponent, bComponentEvent.getSlotName(), bComponentEvent.getSlotFlags()));
|
||||
break;
|
||||
}
|
||||
case 7: {
|
||||
this.buffer.add(new SetFacetsOp(bComponent, bComponentEvent.getSlotName(), (BFacets)bComponentEvent.getValue()));
|
||||
break;
|
||||
}
|
||||
case 10: {
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
this.buffer.add(new AddKnobOp(bComponent, bComponentEvent.getKnob()));
|
||||
break;
|
||||
}
|
||||
case 9: {
|
||||
this.buffer.add(new RemoveKnobOp(bComponent, bComponentEvent.getKnob()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.bufferLock = new BufferLock();
|
||||
}
|
||||
|
||||
public ProxyBroker(BComponentSpace bComponentSpace) {
|
||||
this.this();
|
||||
this.masterSpace = bComponentSpace;
|
||||
this.buffer = new ProxySyncBuffer(bComponentSpace);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class ProxySyncBuffer
|
||||
extends SyncBuffer {
|
||||
ProxySyncBuffer(BComponentSpace bComponentSpace) {
|
||||
super(bComponentSpace, true);
|
||||
}
|
||||
}
|
||||
|
||||
static class BufferLock {
|
||||
BufferLock() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import com.tridium.sys.engine.NKnob;
|
||||
import com.tridium.sys.schema.ComponentSlotMap;
|
||||
import javax.baja.io.ValueDocDecoder;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sync.SyncDecoder;
|
||||
import javax.baja.sync.SyncEncoder;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Knob;
|
||||
import javax.baja.sys.Slot;
|
||||
|
||||
public class RemoveKnobOp
|
||||
extends SyncOp {
|
||||
Knob knob;
|
||||
|
||||
public int getId() {
|
||||
return 106;
|
||||
}
|
||||
|
||||
public Knob getKnob() {
|
||||
return this.knob;
|
||||
}
|
||||
|
||||
void commit(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, Context context) throws Exception {
|
||||
if (this.knob != null) {
|
||||
((ComponentSlotMap)this.component.fw(1)).uninstallKnob((NKnob)this.knob);
|
||||
}
|
||||
}
|
||||
|
||||
void encode(SyncEncoder syncEncoder) throws Exception {
|
||||
super.encode(syncEncoder);
|
||||
NKnob nKnob = (NKnob)this.knob;
|
||||
syncEncoder.attr("id", String.valueOf(nKnob.id));
|
||||
syncEncoder.attr("ss", String.valueOf(nKnob.getSourceSlotName())).end().newLine();
|
||||
}
|
||||
|
||||
void decode(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, SyncDecoder syncDecoder) throws Exception {
|
||||
super.decode(syncBuffer, bComponentSpace, syncDecoder);
|
||||
if (this.component == null) {
|
||||
return;
|
||||
}
|
||||
ValueDocDecoder.IElement iElement = syncDecoder.elem();
|
||||
int n = iElement.geti("id");
|
||||
Slot slot = this.component.getSlot(iElement.get("ss"));
|
||||
if (slot != null) {
|
||||
NKnob[] nKnobArray = (NKnob[])this.component.getKnobs(slot);
|
||||
int n2 = 0;
|
||||
while (n2 < nKnobArray.length) {
|
||||
if (nKnobArray[n2].id == n) {
|
||||
this.knob = nKnobArray[n2];
|
||||
break;
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "RemoveKnob: " + this.componentToString() + ' ' + this.knob;
|
||||
}
|
||||
|
||||
public RemoveKnobOp(BComponent bComponent, Knob knob) {
|
||||
super(bComponent);
|
||||
this.knob = knob;
|
||||
}
|
||||
|
||||
public RemoveKnobOp() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sync.SyncDecoder;
|
||||
import javax.baja.sync.SyncEncoder;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
|
||||
public class RemoveOp
|
||||
extends SyncOp {
|
||||
String name;
|
||||
|
||||
public int getId() {
|
||||
return 118;
|
||||
}
|
||||
|
||||
public String getSlotName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
void commit(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, Context context) throws Exception {
|
||||
Property property = this.component.getProperty(this.name);
|
||||
if (property != null) {
|
||||
this.component.remove(property, context);
|
||||
}
|
||||
}
|
||||
|
||||
void encode(SyncEncoder syncEncoder) throws Exception {
|
||||
super.encode(syncEncoder);
|
||||
syncEncoder.attr("n", this.name).end().newLine();
|
||||
}
|
||||
|
||||
void decode(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, SyncDecoder syncDecoder) throws Exception {
|
||||
super.decode(syncBuffer, bComponentSpace, syncDecoder);
|
||||
this.name = syncDecoder.elem().get("n");
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Remove: " + this.componentToString() + '.' + this.name;
|
||||
}
|
||||
|
||||
public RemoveOp(BComponent bComponent, String string) {
|
||||
super(bComponent);
|
||||
this.name = string;
|
||||
}
|
||||
|
||||
public RemoveOp() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import javax.baja.io.ValueDocDecoder;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sync.SyncDecoder;
|
||||
import javax.baja.sync.SyncEncoder;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
|
||||
public class RenameOp
|
||||
extends SyncOp {
|
||||
String oldName;
|
||||
String newName;
|
||||
|
||||
public int getId() {
|
||||
return 114;
|
||||
}
|
||||
|
||||
public String getOldName() {
|
||||
return this.oldName;
|
||||
}
|
||||
|
||||
public String getNewName() {
|
||||
return this.newName;
|
||||
}
|
||||
|
||||
void commit(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, Context context) throws Exception {
|
||||
Property property = this.component.getProperty(this.oldName);
|
||||
if (property != null) {
|
||||
this.component.rename(property, this.newName, context);
|
||||
}
|
||||
}
|
||||
|
||||
void encode(SyncEncoder syncEncoder) throws Exception {
|
||||
super.encode(syncEncoder);
|
||||
syncEncoder.attr("o", this.oldName);
|
||||
syncEncoder.attr("n", this.newName).end().newLine();
|
||||
}
|
||||
|
||||
void decode(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, SyncDecoder syncDecoder) throws Exception {
|
||||
super.decode(syncBuffer, bComponentSpace, syncDecoder);
|
||||
ValueDocDecoder.IElement iElement = syncDecoder.elem();
|
||||
this.oldName = iElement.get("o");
|
||||
this.newName = iElement.get("n");
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Rename: " + this.componentToString() + '.' + this.oldName + " -> " + this.newName;
|
||||
}
|
||||
|
||||
public RenameOp(BComponent bComponent, String string, String string2) {
|
||||
super(bComponent);
|
||||
this.oldName = string;
|
||||
this.newName = string2;
|
||||
}
|
||||
|
||||
public RenameOp() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.StringTokenizer;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sync.SyncDecoder;
|
||||
import javax.baja.sync.SyncEncoder;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
|
||||
public class ReorderOp
|
||||
extends SyncOp {
|
||||
String[] order;
|
||||
|
||||
public int getId() {
|
||||
return 111;
|
||||
}
|
||||
|
||||
public String[] getOrder() {
|
||||
return (String[])this.order.clone();
|
||||
}
|
||||
|
||||
void commit(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, Context context) throws Exception {
|
||||
Property[] propertyArray = new Property[this.order.length];
|
||||
int n = 0;
|
||||
while (n < propertyArray.length) {
|
||||
propertyArray[n] = this.component.getProperty(this.order[n]);
|
||||
++n;
|
||||
}
|
||||
this.component.reorder(propertyArray, context);
|
||||
}
|
||||
|
||||
void encode(SyncEncoder syncEncoder) throws Exception {
|
||||
super.encode(syncEncoder);
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
int n = 0;
|
||||
while (n < this.order.length) {
|
||||
if (n > 0) {
|
||||
stringBuffer.append(';');
|
||||
}
|
||||
stringBuffer.append(this.order[n]);
|
||||
++n;
|
||||
}
|
||||
syncEncoder.attr("o", stringBuffer.toString()).end().newLine();
|
||||
}
|
||||
|
||||
void decode(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, SyncDecoder syncDecoder) throws Exception {
|
||||
super.decode(syncBuffer, bComponentSpace, syncDecoder);
|
||||
String string = syncDecoder.elem().get("o");
|
||||
ArrayList<String> arrayList = new ArrayList<String>();
|
||||
StringTokenizer stringTokenizer = new StringTokenizer(string, ";");
|
||||
while (stringTokenizer.hasMoreTokens()) {
|
||||
arrayList.add(stringTokenizer.nextToken());
|
||||
}
|
||||
this.order = arrayList.toArray(new String[arrayList.size()]);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Reorder: " + this.componentToString();
|
||||
}
|
||||
|
||||
public ReorderOp(BComponent bComponent, String[] stringArray) {
|
||||
super(bComponent);
|
||||
this.order = stringArray;
|
||||
}
|
||||
|
||||
public ReorderOp() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import javax.baja.category.BCategoryMask;
|
||||
import javax.baja.io.ValueDocDecoder;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sync.SyncDecoder;
|
||||
import javax.baja.sync.SyncEncoder;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Context;
|
||||
|
||||
public class SetCategoryMaskOp
|
||||
extends SyncOp {
|
||||
String name;
|
||||
String mask;
|
||||
|
||||
public int getId() {
|
||||
return 99;
|
||||
}
|
||||
|
||||
public BCategoryMask getMask() {
|
||||
return BCategoryMask.make(this.mask);
|
||||
}
|
||||
|
||||
void commit(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, Context context) throws Exception {
|
||||
this.component.setCategoryMask(BCategoryMask.make(this.mask), context);
|
||||
}
|
||||
|
||||
void encode(SyncEncoder syncEncoder) throws Exception {
|
||||
super.encode(syncEncoder);
|
||||
syncEncoder.attr("c", this.mask).end().newLine();
|
||||
}
|
||||
|
||||
void decode(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, SyncDecoder syncDecoder) throws Exception {
|
||||
super.decode(syncBuffer, bComponentSpace, syncDecoder);
|
||||
ValueDocDecoder.IElement iElement = syncDecoder.elem();
|
||||
this.mask = iElement.get("c");
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("SetCatMask: ").append(this.componentToString()).append(" -> ").append(this.mask);
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public SetCategoryMaskOp(BComponent bComponent, BCategoryMask bCategoryMask) {
|
||||
super(bComponent);
|
||||
this.mask = bCategoryMask.encodeToString();
|
||||
}
|
||||
|
||||
public SetCategoryMaskOp(BComponent bComponent, String string) {
|
||||
super(bComponent);
|
||||
this.mask = string;
|
||||
}
|
||||
|
||||
public SetCategoryMaskOp() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import javax.baja.io.ValueDocDecoder;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sync.SyncDecoder;
|
||||
import javax.baja.sync.SyncEncoder;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.Context;
|
||||
|
||||
public class SetFacetsOp
|
||||
extends SyncOp {
|
||||
String name;
|
||||
BFacets facets;
|
||||
|
||||
public int getId() {
|
||||
return 120;
|
||||
}
|
||||
|
||||
public String getSlotName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public BFacets getFacets() {
|
||||
return this.facets;
|
||||
}
|
||||
|
||||
void commit(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, Context context) throws Exception {
|
||||
this.component.setFacets(this.component.getSlot(this.name), this.facets, context);
|
||||
}
|
||||
|
||||
void encode(SyncEncoder syncEncoder) throws Exception {
|
||||
super.encode(syncEncoder);
|
||||
syncEncoder.attr("n", this.name);
|
||||
syncEncoder.attr("x", this.facets.encodeToString()).end().newLine();
|
||||
}
|
||||
|
||||
void decode(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, SyncDecoder syncDecoder) throws Exception {
|
||||
super.decode(syncBuffer, bComponentSpace, syncDecoder);
|
||||
ValueDocDecoder.IElement iElement = syncDecoder.elem();
|
||||
this.name = iElement.get("n");
|
||||
this.facets = BFacets.make(iElement.get("x"));
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("SetFacets: ").append(this.componentToString()).append('.').append(this.name).append(" -> ").append(this.facets);
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public SetFacetsOp(BComponent bComponent, String string, BFacets bFacets) {
|
||||
super(bComponent);
|
||||
this.name = string;
|
||||
this.facets = bFacets;
|
||||
}
|
||||
|
||||
public SetFacetsOp() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import javax.baja.io.ValueDocDecoder;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sync.SyncDecoder;
|
||||
import javax.baja.sync.SyncEncoder;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Flags;
|
||||
|
||||
public class SetFlagsOp
|
||||
extends SyncOp {
|
||||
String name;
|
||||
int flags;
|
||||
|
||||
public int getId() {
|
||||
return 102;
|
||||
}
|
||||
|
||||
public String getSlotName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public int getFlags() {
|
||||
return this.flags;
|
||||
}
|
||||
|
||||
void commit(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, Context context) throws Exception {
|
||||
this.component.setFlags(this.component.getSlot(this.name), this.flags, context);
|
||||
}
|
||||
|
||||
void encode(SyncEncoder syncEncoder) throws Exception {
|
||||
super.encode(syncEncoder);
|
||||
syncEncoder.attr("n", this.name);
|
||||
syncEncoder.attr("f", Flags.encodeToString(this.flags)).end().newLine();
|
||||
}
|
||||
|
||||
void decode(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, SyncDecoder syncDecoder) throws Exception {
|
||||
super.decode(syncBuffer, bComponentSpace, syncDecoder);
|
||||
ValueDocDecoder.IElement iElement = syncDecoder.elem();
|
||||
this.name = iElement.get("n");
|
||||
this.flags = Flags.decodeFromString(iElement.get("f"));
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("SetFlags: ").append(this.componentToString()).append('.').append(this.name).append(" -> ").append(Flags.encodeToString(this.flags));
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public SetFlagsOp(BComponent bComponent, String string, int n) {
|
||||
super(bComponent);
|
||||
this.name = string;
|
||||
this.flags = n;
|
||||
}
|
||||
|
||||
public SetFlagsOp() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sync.SyncDecoder;
|
||||
import javax.baja.sync.SyncEncoder;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
|
||||
public class SetOp
|
||||
extends SyncOp {
|
||||
String name;
|
||||
BValue value;
|
||||
|
||||
public int getId() {
|
||||
return 115;
|
||||
}
|
||||
|
||||
public String getSlotName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public BValue getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
void commit(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, Context context) throws Exception {
|
||||
String string;
|
||||
String string2;
|
||||
BComplex bComplex;
|
||||
Property property;
|
||||
block4: {
|
||||
property = null;
|
||||
bComplex = this.component;
|
||||
string = string2 = this.name;
|
||||
int n = 0;
|
||||
do {
|
||||
int n2;
|
||||
if ((n2 = this.name.indexOf(47, n)) < 0) {
|
||||
if (n > 0) {
|
||||
string = string2.substring(n);
|
||||
}
|
||||
break block4;
|
||||
}
|
||||
string = string2.substring(n, n2);
|
||||
n = n2 + 1;
|
||||
} while ((bComplex = (BComplex)bComplex.get(string)) != null);
|
||||
throw new IllegalStateException("Missing property " + string2);
|
||||
}
|
||||
property = bComplex.getProperty(string);
|
||||
if (property == null) {
|
||||
throw new IllegalStateException("Missing property " + string2);
|
||||
}
|
||||
bComplex.set(property, this.value, context);
|
||||
}
|
||||
|
||||
void encode(SyncEncoder syncEncoder) throws Exception {
|
||||
BPermissions bPermissions;
|
||||
BValue bValue = this.value;
|
||||
if (bValue == null) {
|
||||
bValue = this.component.get(this.name);
|
||||
}
|
||||
if (bValue == null) {
|
||||
System.out.println("WARNING: SetOp null value: " + this.name);
|
||||
bValue = BString.DEFAULT;
|
||||
return;
|
||||
}
|
||||
if (bValue.isComponent() && !(bPermissions = syncEncoder.getPermissionsFor(bValue.asComponent())).hasOperatorRead()) {
|
||||
throw new SyncOp.SyncOpSecurityException(this, "Missing op read permission on value");
|
||||
}
|
||||
super.encode(syncEncoder);
|
||||
syncEncoder.attr("n", this.name).endAttr().newLine().key("b");
|
||||
syncEncoder.encode(bValue);
|
||||
syncEncoder.end(String.valueOf((char)this.getId())).newLine();
|
||||
}
|
||||
|
||||
void decode(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, SyncDecoder syncDecoder) throws Exception {
|
||||
super.decode(syncBuffer, bComponentSpace, syncDecoder);
|
||||
this.name = syncDecoder.elem().get("n");
|
||||
syncDecoder.next();
|
||||
this.value = syncDecoder.decode();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("Set: ").append(this.componentToString()).append('.').append(this.name).append(" -> ").append(this.value);
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public SetOp(BComponent bComponent, String string, BValue bValue) {
|
||||
super(bComponent);
|
||||
this.name = string;
|
||||
this.value = bValue;
|
||||
}
|
||||
|
||||
public SetOp() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,382 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import com.tridium.sys.transfer.TransferListener;
|
||||
import com.tridium.sys.transfer.TransferStrategy;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.category.BCategoryMask;
|
||||
import javax.baja.io.ValueDocDecoder;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.AddOp;
|
||||
import javax.baja.sync.LoadOp;
|
||||
import javax.baja.sync.RemoveOp;
|
||||
import javax.baja.sync.RenameOp;
|
||||
import javax.baja.sync.ReorderOp;
|
||||
import javax.baja.sync.SetCategoryMaskOp;
|
||||
import javax.baja.sync.SetFacetsOp;
|
||||
import javax.baja.sync.SetFlagsOp;
|
||||
import javax.baja.sync.SetOp;
|
||||
import javax.baja.sync.SyncDecoder;
|
||||
import javax.baja.sync.SyncEncoder;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.BasicContext;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class SyncBuffer {
|
||||
static BFacets noAutoStartFacets;
|
||||
BComponentSpace space;
|
||||
OpLinkedList loads;
|
||||
OpLinkedList ops;
|
||||
boolean coalesce;
|
||||
HashMap propChanges;
|
||||
TransferListener listener;
|
||||
boolean checkForAutoStart;
|
||||
|
||||
public BComponentSpace getSpace() {
|
||||
return this.space;
|
||||
}
|
||||
|
||||
public boolean isCoalesced() {
|
||||
return this.coalesce;
|
||||
}
|
||||
|
||||
public void encode(SyncEncoder syncEncoder) throws Exception {
|
||||
syncEncoder.start("sync").attr("ver", "1.0").endAttr().newLine();
|
||||
syncEncoder.startArray("ops");
|
||||
SyncOp[] syncOpArray = this.list();
|
||||
int n = 0;
|
||||
while (n < syncOpArray.length) {
|
||||
try {
|
||||
syncOpArray[n].encode(syncEncoder);
|
||||
}
|
||||
catch (SyncOp.SyncOpSecurityException syncOpSecurityException) {}
|
||||
++n;
|
||||
}
|
||||
syncEncoder.endArray();
|
||||
syncEncoder.end("sync").newLine();
|
||||
}
|
||||
|
||||
public void decode(SyncDecoder syncDecoder) throws Exception {
|
||||
if (this.loads.head != null || this.ops.head != null) {
|
||||
throw new IllegalStateException("Already contains changes");
|
||||
}
|
||||
ValueDocDecoder.IElement iElement = syncDecoder.elem();
|
||||
if (iElement == null) {
|
||||
syncDecoder.next();
|
||||
iElement = syncDecoder.elem();
|
||||
}
|
||||
if (iElement == null) {
|
||||
return;
|
||||
}
|
||||
if (!iElement.name().equals("sync")) {
|
||||
throw syncDecoder.err("Invalid root element " + iElement.name());
|
||||
}
|
||||
while (true) {
|
||||
int n;
|
||||
if ((n = syncDecoder.next()) == 2) {
|
||||
if (syncDecoder.elem().name().equals("sync")) break;
|
||||
throw syncDecoder.err("Expected end sync");
|
||||
}
|
||||
if (n != 1) {
|
||||
throw syncDecoder.err("Expected element start");
|
||||
}
|
||||
int n2 = syncDecoder.depth();
|
||||
ValueDocDecoder.IElement iElement2 = syncDecoder.elem();
|
||||
char c = iElement2.name().charAt(0);
|
||||
SyncOp syncOp = SyncOp.make(c);
|
||||
syncOp.decode(this, this.space, syncDecoder);
|
||||
this.add(syncOp);
|
||||
syncDecoder.skip(n2);
|
||||
}
|
||||
}
|
||||
|
||||
public final void commit() throws Exception {
|
||||
this.commit(null);
|
||||
}
|
||||
|
||||
protected SyncOp[] startCommit(SyncOp[] syncOpArray, Context context) {
|
||||
return syncOpArray;
|
||||
}
|
||||
|
||||
protected void endCommit() throws Exception {
|
||||
}
|
||||
|
||||
protected void abortCommit(Exception exception) {
|
||||
}
|
||||
|
||||
public void commit(Context context) throws Exception {
|
||||
SyncOp[] syncOpArray = this.startCommit(this.list(), context);
|
||||
try {
|
||||
Context context2 = context;
|
||||
if (!this.space.isProxyComponentSpace()) {
|
||||
context2 = new BasicContext(context, noAutoStartFacets);
|
||||
}
|
||||
int n = 0;
|
||||
while (n < syncOpArray.length) {
|
||||
if (!syncOpArray[n].committed) {
|
||||
this.commitOp(syncOpArray[n], context2);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
if (this.checkForAutoStart) {
|
||||
this.checkForAutoStart = false;
|
||||
n = 0;
|
||||
while (n < syncOpArray.length) {
|
||||
try {
|
||||
SyncOp syncOp = syncOpArray[n];
|
||||
if (syncOp instanceof AddOp) {
|
||||
this.checkAutoStart(((AddOp)syncOp).value);
|
||||
}
|
||||
if (syncOp instanceof SetOp) {
|
||||
this.checkAutoStart(((SetOp)syncOp).value);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
this.endCommit();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.abortCommit(exception);
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
|
||||
protected void commitOp(SyncOp syncOp, Context context) throws Exception {
|
||||
block7: {
|
||||
try {
|
||||
if (syncOp.committed) {
|
||||
return;
|
||||
}
|
||||
syncOp.committed = true;
|
||||
if (syncOp.component == null) {
|
||||
try {
|
||||
syncOp.component = this.findByHandle(syncOp.handle, false);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (syncOp.component != null) {
|
||||
syncOp.commit(this, this.space, context);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
System.out.println("ERROR: SyncOp.commit: " + syncOp);
|
||||
exception.printStackTrace();
|
||||
if (this.space.isProxyComponentSpace()) break block7;
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkAutoStart(BValue bValue) {
|
||||
BComponent bComponent;
|
||||
BComponent bComponent2;
|
||||
if (bValue instanceof BComponent && (bComponent2 = (BComponent)(bComponent = (BComponent)bValue).getParent()) != null && bComponent2.isRunning()) {
|
||||
if (this.listener != null) {
|
||||
this.listener.updateStatus("Starting \"" + TransferStrategy.toString(bComponent) + "\"...");
|
||||
}
|
||||
bComponent.start();
|
||||
}
|
||||
}
|
||||
|
||||
protected BComponent findByHandle(Object object, boolean bl) {
|
||||
return this.space.findByHandle(object, bl);
|
||||
}
|
||||
|
||||
public void set(BComponent bComponent, Property[] propertyArray, BValue bValue, Context context) {
|
||||
String string;
|
||||
if (this.coalesce) {
|
||||
this.add(new SetOp(bComponent, propertyArray[0].getName(), null));
|
||||
return;
|
||||
}
|
||||
if (propertyArray.length == 1) {
|
||||
string = propertyArray[0].getName();
|
||||
} else {
|
||||
StringBuffer stringBuffer = new StringBuffer(propertyArray[0].getName());
|
||||
int n = 1;
|
||||
while (n < propertyArray.length) {
|
||||
stringBuffer.append('/').append(propertyArray[n].getName());
|
||||
++n;
|
||||
}
|
||||
string = stringBuffer.toString();
|
||||
}
|
||||
this.add(new SetOp(bComponent, string, bValue));
|
||||
}
|
||||
|
||||
public void add(BComponent bComponent, String string, BValue bValue, int n, BFacets bFacets, Context context) {
|
||||
this.add(new AddOp(bComponent, string, bValue, n, bFacets));
|
||||
}
|
||||
|
||||
public void remove(BComponent bComponent, Property property, Context context) {
|
||||
this.add(new RemoveOp(bComponent, property.getName()));
|
||||
}
|
||||
|
||||
public void rename(BComponent bComponent, Property property, String string, Context context) {
|
||||
this.add(new RenameOp(bComponent, property.getName(), string));
|
||||
}
|
||||
|
||||
public void reorder(BComponent bComponent, Property[] propertyArray, Context context) {
|
||||
String[] stringArray = new String[propertyArray.length];
|
||||
int n = 0;
|
||||
while (n < stringArray.length) {
|
||||
stringArray[n] = propertyArray[n].getName();
|
||||
++n;
|
||||
}
|
||||
this.add(new ReorderOp(bComponent, stringArray));
|
||||
}
|
||||
|
||||
public void setFlags(BComponent bComponent, Slot slot, int n, Context context) {
|
||||
this.add(new SetFlagsOp(bComponent, slot.getName(), n));
|
||||
}
|
||||
|
||||
public void setFacets(BComponent bComponent, Slot slot, BFacets bFacets, Context context) {
|
||||
this.add(new SetFacetsOp(bComponent, slot.getName(), bFacets));
|
||||
}
|
||||
|
||||
public void setCategoryMask(BComponent bComponent, BCategoryMask bCategoryMask, Context context) {
|
||||
this.add(new SetCategoryMaskOp(bComponent, bCategoryMask));
|
||||
}
|
||||
|
||||
public synchronized SyncOp[] list() {
|
||||
SyncOp[] syncOpArray = new SyncOp[this.loads.size + this.ops.size];
|
||||
int n = 0;
|
||||
SyncOp syncOp = this.loads.head;
|
||||
while (syncOp != null) {
|
||||
syncOpArray[n] = syncOp;
|
||||
syncOp = syncOp.next;
|
||||
++n;
|
||||
}
|
||||
syncOp = this.ops.head;
|
||||
while (syncOp != null) {
|
||||
syncOpArray[n] = syncOp;
|
||||
syncOp = syncOp.next;
|
||||
++n;
|
||||
}
|
||||
return syncOpArray;
|
||||
}
|
||||
|
||||
public synchronized void add(SyncOp syncOp) {
|
||||
if (syncOp.prev != null || syncOp.next != null) {
|
||||
throw new IllegalStateException("Already in linked list " + syncOp);
|
||||
}
|
||||
if (this.coalesce && syncOp instanceof SetOp) {
|
||||
this.addSet((SetOp)syncOp);
|
||||
} else if (syncOp instanceof LoadOp) {
|
||||
this.loads.append(syncOp);
|
||||
} else {
|
||||
this.ops.append(syncOp);
|
||||
}
|
||||
}
|
||||
|
||||
private final void addSet(SetOp setOp) {
|
||||
BComponent bComponent = setOp.component;
|
||||
String string = setOp.name;
|
||||
HashMap<String, SetOp> hashMap = (HashMap<String, SetOp>)this.propChanges.get(bComponent);
|
||||
if (hashMap != null) {
|
||||
SetOp setOp2 = (SetOp)hashMap.get(string);
|
||||
if (setOp2 != null) {
|
||||
this.ops.remove(setOp2);
|
||||
}
|
||||
} else {
|
||||
hashMap = new HashMap<String, SetOp>(13);
|
||||
this.propChanges.put(bComponent, hashMap);
|
||||
}
|
||||
hashMap.put(string, setOp);
|
||||
this.ops.append(setOp);
|
||||
}
|
||||
|
||||
public void fw(Object object) {
|
||||
if (object instanceof TransferListener) {
|
||||
this.listener = (TransferListener)object;
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.checkForAutoStart = true;
|
||||
}
|
||||
|
||||
public SyncBuffer(BComponentSpace bComponentSpace, boolean bl) {
|
||||
this.this();
|
||||
this.space = bComponentSpace;
|
||||
this.loads = new OpLinkedList();
|
||||
this.ops = new OpLinkedList();
|
||||
this.coalesce = bl;
|
||||
if (bl) {
|
||||
this.propChanges = new HashMap();
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
HashMap<String, BBoolean> hashMap = new HashMap<String, BBoolean>();
|
||||
hashMap.put("niagaraAutoStart", BBoolean.FALSE);
|
||||
noAutoStartFacets = BFacets.make(hashMap);
|
||||
}
|
||||
|
||||
static class OpLinkedList {
|
||||
SyncOp head;
|
||||
SyncOp tail;
|
||||
int size;
|
||||
|
||||
void append(SyncOp syncOp) {
|
||||
if (this.tail == null) {
|
||||
this.head = this.tail = syncOp;
|
||||
} else {
|
||||
this.tail.next = syncOp;
|
||||
syncOp.prev = this.tail;
|
||||
this.tail = syncOp;
|
||||
}
|
||||
++this.size;
|
||||
}
|
||||
|
||||
void remove(SyncOp syncOp) {
|
||||
SyncOp syncOp2 = syncOp.prev;
|
||||
SyncOp syncOp3 = syncOp.next;
|
||||
if (syncOp2 != null) {
|
||||
syncOp2.next = syncOp3;
|
||||
} else {
|
||||
this.head = syncOp3;
|
||||
}
|
||||
if (syncOp3 != null) {
|
||||
syncOp3.prev = syncOp2;
|
||||
} else {
|
||||
this.tail = syncOp2;
|
||||
}
|
||||
--this.size;
|
||||
}
|
||||
|
||||
void replace(SyncOp syncOp, SyncOp syncOp2) {
|
||||
syncOp2.prev = syncOp.prev;
|
||||
syncOp2.next = syncOp.next;
|
||||
if (syncOp.prev != null) {
|
||||
syncOp.prev.next = syncOp2;
|
||||
} else {
|
||||
this.head = syncOp2;
|
||||
}
|
||||
if (syncOp.next != null) {
|
||||
syncOp.next.prev = syncOp2;
|
||||
} else {
|
||||
this.tail = syncOp2;
|
||||
}
|
||||
}
|
||||
|
||||
OpLinkedList() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import com.tridium.sys.engine.ProxyKnob;
|
||||
import com.tridium.sys.schema.ComponentSlotMap;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.io.ValueDocDecoder;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Slot;
|
||||
|
||||
public class SyncDecoder
|
||||
extends ValueDocDecoder {
|
||||
HashMap knobs;
|
||||
|
||||
protected void decodingComponent(BComponent bComponent) throws Exception {
|
||||
ValueDocDecoder.IElement iElement = this.elem();
|
||||
String string = iElement.name();
|
||||
if (string.equals("load")) {
|
||||
this.decodingLoadInfo(bComponent, iElement);
|
||||
}
|
||||
if (string.equals("nknob")) {
|
||||
this.decodingKnob(bComponent, iElement);
|
||||
}
|
||||
this.skip();
|
||||
}
|
||||
|
||||
private final void decodingLoadInfo(BComponent bComponent, ValueDocDecoder.IElement iElement) {
|
||||
if (this.knobs == null) {
|
||||
this.knobs = new HashMap();
|
||||
}
|
||||
this.knobs.put(bComponent, new ArrayList(4));
|
||||
String string = iElement.get("p", null);
|
||||
if (string != null) {
|
||||
try {
|
||||
BPermissions bPermissions = BPermissions.make(string);
|
||||
((ComponentSlotMap)bComponent.fw(1)).setCachedPermissions(bPermissions);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final void decodingKnob(BComponent bComponent, ValueDocDecoder.IElement iElement) {
|
||||
if (this.knobs == null) {
|
||||
throw new IllegalStateException("unexpected <nknob> without <load>");
|
||||
}
|
||||
ArrayList arrayList = (ArrayList)this.knobs.get(bComponent);
|
||||
arrayList.add(this.elem().copy());
|
||||
}
|
||||
|
||||
ProxyKnob decodeKnob(BComponent bComponent) throws Exception {
|
||||
return SyncDecoder.decodeKnob(bComponent, this.elem());
|
||||
}
|
||||
|
||||
static ProxyKnob decodeKnob(BComponent bComponent, ValueDocDecoder.IElement iElement) throws Exception {
|
||||
Slot slot = bComponent.getSlot(iElement.get("ss"));
|
||||
if (slot == null) {
|
||||
return null;
|
||||
}
|
||||
int n = iElement.geti("id");
|
||||
BOrd bOrd = BOrd.make(iElement.get("to"));
|
||||
String string = iElement.get("ts");
|
||||
return new ProxyKnob(n, bComponent, slot, bOrd, string);
|
||||
}
|
||||
|
||||
public SyncDecoder(ValueDocDecoder.IDecoderPlugin iDecoderPlugin) throws Exception {
|
||||
super(iDecoderPlugin);
|
||||
}
|
||||
|
||||
public SyncDecoder(InputStream inputStream) throws Exception {
|
||||
super(inputStream);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import com.tridium.sys.engine.NKnob;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.io.ValueDocEncoder;
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.sync.SyncOp;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
|
||||
public class SyncEncoder
|
||||
extends ValueDocEncoder {
|
||||
boolean encodeForLoad;
|
||||
|
||||
public boolean isSyncEncoder() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void encodingComponent(BComponent bComponent) throws IOException {
|
||||
if (this.encodeForLoad) {
|
||||
this.encodeLoadInfo(bComponent);
|
||||
NKnob[] nKnobArray = (NKnob[])bComponent.getKnobs();
|
||||
if (nKnobArray.length > 0) {
|
||||
this.startArray("nk");
|
||||
int n = 0;
|
||||
while (n < nKnobArray.length) {
|
||||
this.encodeKnob(nKnobArray[n]);
|
||||
++n;
|
||||
}
|
||||
this.endArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void encodingComponentStub(BComponent bComponent) throws IOException {
|
||||
this.encodeLoadInfo(bComponent);
|
||||
BValue bValue = bComponent.get("icon");
|
||||
if (bValue instanceof BIcon) {
|
||||
this.newLine().incrementIndent().indent();
|
||||
this.key("icon");
|
||||
this.encode("icon", bValue, 0);
|
||||
this.decrementIndent().indent();
|
||||
}
|
||||
}
|
||||
|
||||
private final void encodeLoadInfo(BComponent bComponent) throws IOException {
|
||||
BPermissions bPermissions = this.getPermissionsFor(bComponent);
|
||||
this.key("l").start("load").attr("p", bPermissions.encodeToString()).end();
|
||||
}
|
||||
|
||||
protected void encodingSyncOp(SyncOp syncOp) throws IOException {
|
||||
}
|
||||
|
||||
void encodeKnob(NKnob nKnob) throws IOException {
|
||||
this.indent();
|
||||
this.start("nknob");
|
||||
this.attr("id", String.valueOf(nKnob.id));
|
||||
this.attr("ss", nKnob.getSourceSlotName());
|
||||
this.attr("to", nKnob.getTargetOrd().toString());
|
||||
this.attr("ts", nKnob.getTargetSlotName()).end().newLine();
|
||||
}
|
||||
|
||||
public SyncEncoder(ValueDocEncoder.IEncoderPlugin iEncoderPlugin, Context context) throws Exception {
|
||||
super(iEncoderPlugin, context);
|
||||
this.setEncodeComments(false);
|
||||
this.setEncodeTransients(true);
|
||||
}
|
||||
|
||||
public SyncEncoder(OutputStream outputStream, Context context) throws Exception {
|
||||
super(outputStream, context);
|
||||
this.setEncodeComments(false);
|
||||
this.setEncodeTransients(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.AddKnobOp;
|
||||
import javax.baja.sync.AddOp;
|
||||
import javax.baja.sync.FireTopicOp;
|
||||
import javax.baja.sync.LoadOp;
|
||||
import javax.baja.sync.RemoveKnobOp;
|
||||
import javax.baja.sync.RemoveOp;
|
||||
import javax.baja.sync.RenameOp;
|
||||
import javax.baja.sync.ReorderOp;
|
||||
import javax.baja.sync.SetCategoryMaskOp;
|
||||
import javax.baja.sync.SetFacetsOp;
|
||||
import javax.baja.sync.SetFlagsOp;
|
||||
import javax.baja.sync.SetOp;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sync.SyncDecoder;
|
||||
import javax.baja.sync.SyncEncoder;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Context;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class SyncOp {
|
||||
public static final int LOAD = 108;
|
||||
public static final int SET = 115;
|
||||
public static final int ADD = 97;
|
||||
public static final int REMOVE = 118;
|
||||
public static final int RENAME = 114;
|
||||
public static final int REORDER = 111;
|
||||
public static final int SET_FLAGS = 102;
|
||||
public static final int SET_FACETS = 120;
|
||||
public static final int ADD_KNOB = 107;
|
||||
public static final int REMOVE_KNOB = 106;
|
||||
public static final int FIRE_TOPIC = 116;
|
||||
public static final int SET_CATEGORY_MASK = 99;
|
||||
SyncBuffer buffer;
|
||||
BComponent component;
|
||||
SyncOp prev;
|
||||
SyncOp next;
|
||||
String handle;
|
||||
boolean committed;
|
||||
|
||||
public static SyncOp make(int n) {
|
||||
switch (n) {
|
||||
case 108: {
|
||||
return new LoadOp();
|
||||
}
|
||||
case 115: {
|
||||
return new SetOp();
|
||||
}
|
||||
case 97: {
|
||||
return new AddOp();
|
||||
}
|
||||
case 118: {
|
||||
return new RemoveOp();
|
||||
}
|
||||
case 114: {
|
||||
return new RenameOp();
|
||||
}
|
||||
case 111: {
|
||||
return new ReorderOp();
|
||||
}
|
||||
case 102: {
|
||||
return new SetFlagsOp();
|
||||
}
|
||||
case 120: {
|
||||
return new SetFacetsOp();
|
||||
}
|
||||
case 107: {
|
||||
return new AddKnobOp();
|
||||
}
|
||||
case 106: {
|
||||
return new RemoveKnobOp();
|
||||
}
|
||||
case 116: {
|
||||
return new FireTopicOp();
|
||||
}
|
||||
case 99: {
|
||||
return new SetCategoryMaskOp();
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("" + n);
|
||||
}
|
||||
|
||||
public abstract int getId();
|
||||
|
||||
public BComponent getComponent() {
|
||||
return this.component;
|
||||
}
|
||||
|
||||
abstract void commit(SyncBuffer var1, BComponentSpace var2, Context var3) throws Exception;
|
||||
|
||||
void encode(SyncEncoder syncEncoder) throws Exception {
|
||||
this.handle = "?";
|
||||
if (this.component != null) {
|
||||
this.handle = String.valueOf(this.component.getHandle());
|
||||
}
|
||||
syncEncoder.start(String.valueOf((char)this.getId())).attr("h", this.handle);
|
||||
syncEncoder.encodingSyncOp(this);
|
||||
}
|
||||
|
||||
void decode(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, SyncDecoder syncDecoder) throws Exception {
|
||||
this.handle = syncDecoder.elem().get("h");
|
||||
this.component = syncBuffer != null ? syncBuffer.findByHandle(this.handle, false) : bComponentSpace.findByHandle(this.handle, false);
|
||||
}
|
||||
|
||||
public abstract String toString();
|
||||
|
||||
String componentToString() {
|
||||
return this.component != null ? this.component.toPathString() : "null";
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.committed = false;
|
||||
}
|
||||
|
||||
protected SyncOp(BComponent bComponent) {
|
||||
this.this();
|
||||
this.component = bComponent;
|
||||
if (this.component != null) {
|
||||
this.handle = String.valueOf(this.component.getHandle());
|
||||
}
|
||||
}
|
||||
|
||||
protected SyncOp() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class SyncOpSecurityException
|
||||
extends SecurityException {
|
||||
SyncOpSecurityException() {
|
||||
}
|
||||
|
||||
SyncOpSecurityException(String string) {
|
||||
super(string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BasicContext;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.user.BUser;
|
||||
|
||||
public abstract class Transaction
|
||||
extends SyncBuffer
|
||||
implements Context {
|
||||
private Context baseContext;
|
||||
|
||||
public static Context start(BComponent bComponent, Context context) {
|
||||
BComponentSpace bComponentSpace = bComponent.getComponentSpace();
|
||||
if (bComponentSpace != null) {
|
||||
return bComponentSpace.newTransaction(context);
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
public static void end(BComponent bComponent, Context context) throws Exception {
|
||||
if (context instanceof Transaction) {
|
||||
Transaction transaction = (Transaction)context;
|
||||
transaction.commit(transaction.baseContext);
|
||||
}
|
||||
}
|
||||
|
||||
public Context getBase() {
|
||||
return this.baseContext;
|
||||
}
|
||||
|
||||
public BUser getUser() {
|
||||
return this.baseContext.getUser();
|
||||
}
|
||||
|
||||
public BFacets getFacets() {
|
||||
return this.baseContext.getFacets();
|
||||
}
|
||||
|
||||
public BObject getFacet(String string) {
|
||||
return this.baseContext.getFacet(string);
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return this.baseContext.getLanguage();
|
||||
}
|
||||
|
||||
protected Transaction(BComponentSpace bComponentSpace, Context context) {
|
||||
super(bComponentSpace, false);
|
||||
if (context instanceof Transaction) {
|
||||
throw new IllegalStateException("Nested transactions not supported");
|
||||
}
|
||||
this.baseContext = context == null ? new BasicContext() : context;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.sync;
|
||||
|
||||
import javax.baja.category.BCategoryMask;
|
||||
import javax.baja.space.TrapCallbacks;
|
||||
import javax.baja.sync.SyncBuffer;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
|
||||
public abstract class TrapToSyncBuffer
|
||||
extends TrapCallbacks {
|
||||
public abstract SyncBuffer getBuffer();
|
||||
|
||||
public boolean isTrapEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean trapSets() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean set(BComponent bComponent, Property[] propertyArray, BValue bValue, Context context) {
|
||||
this.getBuffer().set(bComponent, propertyArray, bValue, context);
|
||||
return false;
|
||||
}
|
||||
|
||||
public Property add(BComponent bComponent, String string, BValue bValue, int n, BFacets bFacets, Context context) {
|
||||
this.getBuffer().add(bComponent, string, bValue, n, bFacets, context);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void remove(BComponent bComponent, Property property, Context context) {
|
||||
this.getBuffer().remove(bComponent, property, context);
|
||||
}
|
||||
|
||||
public void rename(BComponent bComponent, Property property, String string, Context context) {
|
||||
this.getBuffer().rename(bComponent, property, string, context);
|
||||
}
|
||||
|
||||
public void reorder(BComponent bComponent, Property[] propertyArray, Context context) {
|
||||
this.getBuffer().reorder(bComponent, propertyArray, context);
|
||||
}
|
||||
|
||||
public void setFlags(BComponent bComponent, Slot slot, int n, Context context) {
|
||||
this.getBuffer().setFlags(bComponent, slot, n, context);
|
||||
}
|
||||
|
||||
public void setFacets(BComponent bComponent, Slot slot, BFacets bFacets, Context context) {
|
||||
this.getBuffer().setFacets(bComponent, slot, bFacets, context);
|
||||
}
|
||||
|
||||
public void setCategoryMask(BComponent bComponent, BCategoryMask bCategoryMask, Context context) {
|
||||
this.getBuffer().setCategoryMask(bComponent, bCategoryMask, context);
|
||||
}
|
||||
|
||||
public BValue invoke(BComponent bComponent, Action action, BValue bValue, Context context) {
|
||||
return bComponent.invoke(action, bValue, Context.commit);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user