link start!

This commit is contained in:
cherubin
2026-03-17 13:31:18 -07:00
commit 08abe87cfb
5910 changed files with 386288 additions and 0 deletions
@@ -0,0 +1,35 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.io;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import javax.baja.io.BIEncodable;
import javax.baja.sys.BObject;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIContextEncodable
extends BIEncodable {
public static final Type TYPE;
public void encode(DataOutput var1, Context var2) throws IOException;
public BObject decode(DataInput var1, Context var2) throws IOException;
public String encodeToString(Context var1) throws IOException;
public BObject decodeFromString(String var1, Context var2) throws IOException;
static {
Class clazz = 1.class$javax$baja$io$BIContextEncodable;
if (clazz == null) {
clazz = 1.class$javax$baja$io$BIContextEncodable = 1.class("[Ljavax.baja.io.BIContextEncodable;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,34 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.io;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import javax.baja.sys.BInterface;
import javax.baja.sys.BObject;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIEncodable
extends BInterface {
public static final Type TYPE;
public void encode(DataOutput var1) throws IOException;
public BObject decode(DataInput var1) throws IOException;
public String encodeToString() throws IOException;
public BObject decodeFromString(String var1) throws IOException;
static {
Class clazz = 1.class$javax$baja$io$BIEncodable;
if (clazz == null) {
clazz = 1.class$javax$baja$io$BIEncodable = 1.class("[Ljavax.baja.io.BIEncodable;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,35 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.io;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import javax.baja.io.BIEncodable;
import javax.baja.sys.BObject;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BITypeEncodable
extends BIEncodable {
public static final Type TYPE;
public void encode(DataOutput var1, Context var2) throws IOException;
public BObject decode(DataInput var1, Context var2) throws IOException;
public String encodeToString(Context var1) throws IOException;
public BObject decodeFromString(String var1, Context var2) throws IOException;
static {
Class clazz = 1.class$javax$baja$io$BITypeEncodable;
if (clazz == null) {
clazz = 1.class$javax$baja$io$BITypeEncodable = 1.class("[Ljavax.baja.io.BITypeEncodable;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,32 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.io;
import java.io.IOException;
public class BajaIOException
extends IOException {
private Throwable cause;
public Throwable getCause() {
return this.cause;
}
public BajaIOException(String string, Throwable throwable) {
super(string);
this.cause = throwable;
}
public BajaIOException(Throwable throwable) {
this.cause = throwable;
}
public BajaIOException(String string) {
super(string);
}
public BajaIOException() {
}
}
@@ -0,0 +1,34 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.Base64
*/
package javax.baja.io;
public class Base64 {
private static final char PAD = '=';
public static final int HASHLEN = 16;
public static final int HASHHEXLEN = 32;
public static String encode(String string) {
return javax.baja.nre.util.Base64.encode((String)string);
}
public static String encode(byte[] byArray) {
return javax.baja.nre.util.Base64.encode((byte[])byArray);
}
public static String encode(byte[] byArray, int n) {
return javax.baja.nre.util.Base64.encode((byte[])byArray, (int)n);
}
public static byte[] decode(String string) {
return javax.baja.nre.util.Base64.decode((String)string);
}
public static String decodeToString(String string) {
return javax.baja.nre.util.Base64.decodeToString((String)string);
}
}
@@ -0,0 +1,481 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.xml.XElem
* javax.baja.xml.XException
* javax.baja.xml.XParser
*/
package javax.baja.io;
import com.tridium.sys.Nre;
import com.tridium.sys.module.NModule;
import com.tridium.sys.schema.ComponentSlotMap;
import com.tridium.util.SimpleFactory;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import javax.baja.category.BCategoryMask;
import javax.baja.file.BIFile;
import javax.baja.io.ValueDocDecoder;
import javax.baja.log.Log;
import javax.baja.naming.BOrd;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BDouble;
import javax.baja.sys.BFacets;
import javax.baja.sys.BFloat;
import javax.baja.sys.BInteger;
import javax.baja.sys.BLong;
import javax.baja.sys.BObject;
import javax.baja.sys.BSimple;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.Flags;
import javax.baja.sys.ModuleException;
import javax.baja.sys.ModuleNotFoundException;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.TypeNotFoundException;
import javax.baja.xml.XElem;
import javax.baja.xml.XException;
import javax.baja.xml.XParser;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BogDecoder
extends XParser {
static final Log defaultLog = Log.getLog("sys.xml");
public static final TypeResolver defaultTypeResolver = new TypeResolver();
HashMap modules;
Log log;
int warningCount;
TypeResolver typeResolver;
SimpleFactory simpleFactory;
private Context context;
public static BValue unmarshal(String string) throws Exception {
BogDecoder bogDecoder = new BogDecoder(new ByteArrayInputStream(string.getBytes()));
bogDecoder.next();
return bogDecoder.decode();
}
public static BValue unmarshal(String string, TypeResolver typeResolver) throws Exception {
BogDecoder bogDecoder = new BogDecoder(new ByteArrayInputStream(string.getBytes()));
bogDecoder.setTypeResolver(typeResolver);
bogDecoder.next();
return bogDecoder.decode();
}
public TypeResolver getTypeResolver() {
return this.typeResolver;
}
public void setTypeResolver(TypeResolver typeResolver) {
this.typeResolver = typeResolver == null ? defaultTypeResolver : typeResolver;
}
public BValue decodeDocument() throws Exception {
return this.decodeDocument(true);
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public BValue decodeDocument(boolean bl) throws Exception {
BValue bValue;
block5: {
try {
this.next();
XElem xElem = this.elem();
if (!xElem.name().equals("bajaObjectGraph")) {
throw this.err("Root element must be \"bajaObjectGraph\"");
}
String string = xElem.get("version");
if (!string.equals("1.0")) {
throw this.err("Only version 1.0 is supported");
}
this.next();
BValue bValue2 = this.decode();
this.next();
if (this.type() != 2 || this.elem() != xElem) {
throw this.err("Expected end tag for \"bajaObjectGraph\"");
}
bValue = bValue2;
Object var3_6 = null;
if (!bl) break block5;
}
catch (Throwable throwable) {
block6: {
Object var3_7 = null;
if (!bl) break block6;
this.close();
}
throw throwable;
}
this.close();
}
return bValue;
}
public BValue decode() throws Exception {
BValue bValue = this.parseSlot(null);
if (bValue == null) {
throw this.err("Error parsing value");
}
return bValue;
}
public Log getLog() {
return this.log;
}
public void setLog(Log log) {
if (log == null) {
throw new NullPointerException();
}
this.log = log;
}
public int getWarningCount() {
return this.warningCount;
}
protected void decodingComponent(BComponent bComponent) throws Exception {
this.warning("Unknown element <" + this.elem().name() + "> for decodingComponent");
}
void parseSlots(BObject bObject) throws Exception {
while (true) {
int n;
if ((n = this.next()) == -1) {
throw new EOFException();
}
if (n == 2) {
return;
}
if (n != 1) {
throw this.err("Expected element start");
}
this.parseSlot((BComplex)bObject);
}
}
BValue parseSlot(BComplex bComplex) throws Exception {
Object object;
Object object2;
if (this.type() != 1) {
throw this.err("Expected element start (" + this.type() + ')');
}
XElem xElem = this.elem();
String string = xElem.name().intern();
if (string != "p" && string != "a" && string != "t") {
if (bComplex instanceof BComponent) {
this.decodingComponent((BComponent)bComplex);
} else {
this.warning("Unknown element <" + string + '>');
}
return null;
}
String string2 = null;
String string3 = null;
Object object3 = null;
Object object4 = null;
String string4 = null;
Object object5 = null;
BFacets bFacets = BFacets.NULL;
Object object6 = null;
boolean bl = false;
int n = xElem.attrSize();
int n2 = 0;
while (n2 < n) {
object2 = xElem.attrName(n2);
object = xElem.attrValue(n2);
if (object2 == "n") {
string2 = object;
} else if (object2 == "h") {
string3 = object;
} else if (object2 == "v") {
string4 = object;
} else if (object2 == "t") {
object4 = object;
} else if (object2 == "m") {
object3 = object;
} else if (object2 == "f") {
object5 = object;
} else if (object2 == "x") {
bFacets = this.decodeFacets((String)object);
} else if (object2 == "c") {
object6 = object;
} else if (((String)object2).equals("stub")) {
bl = ((String)object).equals("true");
}
++n2;
}
n2 = this.decodeFlags((String)object5);
if (object3 != null && !this.getTypeResolver().loadModule(this, bComplex, string2, (String)object3, (String)object4)) {
int n3 = this.line();
int n4 = this.column();
try {
this.skip();
}
catch (XException xException) {
this.log.warning("Missing module: " + (String)object3 + " [" + n3 + ':' + n4 + ']');
throw xException;
}
catch (Exception exception) {
this.log.warning("Missing module: " + (String)object3 + " [" + n3 + ':' + n4 + ']');
throw new XException((Throwable)exception);
}
if (this.log.isTraceOn()) {
this.log.trace("Missing module: " + (String)object3 + " [" + n3 + ':' + n4 + ']');
}
return null;
}
object2 = null;
if (bComplex != null) {
if (string2 == null) {
throw this.err("Missing \"n\" name attribute");
}
object2 = bComplex.getSlot(string2);
}
if (object2 != null) {
if (object5 != null) {
bComplex.setFlags((Slot)object2, n2, Context.decoding);
}
if (!object2.isProperty()) {
this.skip();
return null;
}
} else {
if (string == "a") {
this.warning("Missing frozen action: " + string2);
return null;
}
if (string == "t") {
this.warning("Missing frozen topic: " + string2);
return null;
}
}
if (this.decodePrimitive(bComplex, (Property)(object = (Property)object2), string4)) {
return null;
}
BValue bValue = this.getTypeResolver().newInstance(this, bComplex, string2, (Property)object, (String)object4);
if (bValue == null) {
return null;
}
if (bValue.isSimple() && string4 != null) {
bValue = this.decodeSimple(bValue, string4);
}
if (bValue.isComponent()) {
((ComponentSlotMap)bValue.fw(1)).setHandle(string3);
if (!bl) {
((ComponentSlotMap)bValue.fw(1)).setBrokerPropsLoaded(true);
}
if (object6 != null) {
((BComponent)bValue).setCategoryMask(BCategoryMask.make((String)object6), Context.decoding);
}
}
if (bComplex != null) {
if (object != null) {
if (!object.isFrozen()) {
throw this.err("Duplicate slot " + bComplex.getType().getTypeName() + '.' + string2);
}
try {
bComplex.set((Property)object, bValue, Context.decoding);
}
catch (Exception exception) {
this.warning("Cannot set property " + bComplex.getType().getTypeName() + '.' + string2 + ": " + exception);
}
} else if (bComplex.isComponent()) {
bComplex.asComponent().add(string2, bValue, n2, bFacets, Context.decoding);
} else {
this.warning("Missing slot " + bComplex.getType().getTypeName() + '.' + string2);
}
}
this.parseSlots(bValue);
return bValue;
}
boolean decodePrimitive(BComplex bComplex, Property property, String string) throws Exception {
if (property == null || string == null) {
return false;
}
if (property.getTypeAccess() == 7) {
return false;
}
switch (property.getTypeAccess()) {
case 0: {
bComplex.setBoolean(property, BBoolean.decode(string), Context.decoding);
break;
}
case 2: {
bComplex.setInt(property, BInteger.decode(string), Context.decoding);
break;
}
case 3: {
bComplex.setLong(property, BLong.decode(string), Context.decoding);
break;
}
case 4: {
bComplex.setFloat(property, BFloat.decode(string), Context.decoding);
break;
}
case 5: {
bComplex.setDouble(property, BDouble.decode(string), Context.decoding);
break;
}
case 6: {
bComplex.setString(property, string, Context.decoding);
break;
}
default: {
throw new IllegalStateException("" + property.getTypeAccess());
}
}
int n = this.next();
if (n != 2) {
throw this.err("Expecting end of p element for simple property " + property.getName());
}
return true;
}
BSimple decodeSimple(BObject bObject, String string) {
try {
return this.simpleFactory.make(bObject.getType(), string, this.context);
}
catch (Exception exception) {
throw this.err("Invalid " + bObject.getType().getTypeName() + ": '" + string + '\'', exception);
}
}
int decodeFlags(String string) {
if (string == null) {
return 0;
}
return Flags.decodeFromString(string);
}
BFacets decodeFacets(String string) {
try {
if (string == null) {
return BFacets.NULL;
}
return (BFacets)this.simpleFactory.make(BFacets.TYPE, string, this.context);
}
catch (Exception exception) {
throw this.err("Invalid facets " + string, exception);
}
}
XException err(String string, Throwable throwable) {
return new XException(string, (XParser)this, throwable);
}
XException err(String string) {
return new XException(string, (XParser)this);
}
void warning(String string) throws XException {
this.log.warning(string + " [" + this.line() + ':' + this.column() + ']');
++this.warningCount;
try {
this.skip();
}
catch (XException xException) {
throw xException;
}
catch (Exception exception) {
throw new XException((Throwable)exception);
}
}
private final /* synthetic */ void this() {
this.modules = new HashMap();
this.log = defaultLog;
this.typeResolver = defaultTypeResolver;
this.simpleFactory = new SimpleFactory();
this.context = null;
}
public BogDecoder(BOrd bOrd) throws Exception {
this((BIFile)((Object)bOrd.resolve().get()));
}
public BogDecoder(BIFile bIFile) throws Exception {
this(new BufferedInputStream(bIFile.getInputStream()));
}
public BogDecoder(File file) throws Exception {
this(new BufferedInputStream(new FileInputStream(file)));
}
public BogDecoder(InputStream inputStream) throws Exception {
super(inputStream);
this.this();
}
public static class TypeResolver {
public boolean loadModule(BogDecoder bogDecoder, BComplex bComplex, String string, String string2, String string3) {
try {
int n = string2.indexOf(61);
String string4 = string2.substring(0, n).trim();
String string5 = string2.substring(n + 1).trim();
NModule nModule = Nre.moduleManager.loadModule(string5);
this.getModuleMap(bogDecoder).put(string4, nModule);
}
catch (ModuleException moduleException) {
throw bogDecoder.err("Cannot load module '" + string2 + '\'', moduleException);
}
catch (Exception exception) {
throw bogDecoder.err("Invalid module attribute '" + string2 + '\'');
}
return true;
}
public BValue newInstance(BogDecoder bogDecoder, BComplex bComplex, String string, Property property, String string2) {
if (string2 == null) {
if (property != null) {
return property.getDefaultValue();
}
bogDecoder.warning("Missing frozen property: " + string);
return null;
}
try {
int n = string2.indexOf(58);
if (n <= 0) {
throw bogDecoder.err("Invalid typespec '" + string2 + '\'');
}
String string3 = string2.substring(0, n);
String string4 = string2.substring(n + 1);
NModule nModule = (NModule)this.getModuleMap(bogDecoder).get(string3);
if (nModule == null) {
throw bogDecoder.err("Undeclared module symbol: " + string3, new ModuleNotFoundException(string3));
}
return ValueDocDecoder.typeResolverNewInstance(nModule, string4);
}
catch (XException xException) {
throw xException;
}
catch (TypeNotFoundException typeNotFoundException) {
bogDecoder.warning("Type \"" + typeNotFoundException.getMessage() + "\" not found: " + string);
return null;
}
catch (Throwable throwable) {
throw bogDecoder.err("Cannot instantiate type '" + string2 + '\'', throwable);
}
}
protected Map getModuleMap(BogDecoder bogDecoder) {
return bogDecoder.modules;
}
}
}
@@ -0,0 +1,579 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.xml.XWriter
*/
package javax.baja.io;
import com.tridium.sys.schema.ComponentSlotMap;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import javax.baja.category.BCategoryMask;
import javax.baja.io.BIContextEncodable;
import javax.baja.log.Log;
import javax.baja.naming.SlotPath;
import javax.baja.registry.TypeInfo;
import javax.baja.security.BPermissions;
import javax.baja.status.BStatus;
import javax.baja.status.BStatusBoolean;
import javax.baja.status.BStatusEnum;
import javax.baja.status.BStatusNumeric;
import javax.baja.status.BStatusString;
import javax.baja.status.BStatusValue;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BDouble;
import javax.baja.sys.BFacets;
import javax.baja.sys.BFloat;
import javax.baja.sys.BInteger;
import javax.baja.sys.BLink;
import javax.baja.sys.BLong;
import javax.baja.sys.BModule;
import javax.baja.sys.BObject;
import javax.baja.sys.BSimple;
import javax.baja.sys.BString;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.Flags;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.SlotCursor;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.user.BUser;
import javax.baja.virtual.BVirtualComponentSpace;
import javax.baja.xml.XWriter;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BogEncoder
extends XWriter {
static final int SECURITY_INACCESSIBLE = 1;
static final int SECURITY_READONLY = 2;
static final Log log = Log.getLog("sys.xml");
static TypeInfo nullProxyExt = null;
protected int indent;
private boolean encodeTransients;
private boolean encodeComments;
private HashMap modules;
private HashMap keys;
private Context context;
private HashMap permissionsCache;
public static String marshal(BValue bValue) throws IOException {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
BogEncoder bogEncoder = new BogEncoder(byteArrayOutputStream);
bogEncoder.encode(bValue);
bogEncoder.close();
return new String(byteArrayOutputStream.toByteArray());
}
public Context getContext() {
return this.context;
}
public boolean isSyncEncoder() {
return false;
}
public boolean isEncodeTransients() {
return this.encodeTransients;
}
public boolean setEncodeTransients(boolean bl) {
boolean bl2 = this.encodeTransients;
this.encodeTransients = bl;
return bl2;
}
public boolean isEncodeComments() {
return this.encodeComments;
}
public boolean setEncodeComments(boolean bl) {
boolean bl2 = this.encodeComments;
this.encodeComments = bl;
return bl2;
}
public void encodeDocument(BValue bValue) throws IOException {
this.w("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
this.w("<bajaObjectGraph version=\"1.0\">\n");
this.encode(bValue);
this.w("</bajaObjectGraph>\n");
this.flush();
}
public void encode(BValue bValue) throws IOException {
this.encode(null, bValue, Integer.MAX_VALUE);
}
public void encode(String string, BValue bValue, int n) throws IOException {
BPermissions bPermissions = BPermissions.all;
if (this.context != null && this.context != Context.encrypt && bValue.isComponent() && !(bPermissions = this.getPermissionsFor(bValue.asComponent())).hasOperatorRead()) {
throw new SecurityException("Missing op read permission on value");
}
this.w("<p");
if (string != null) {
this.wname(string);
}
if (bValue.isComponent()) {
BCategoryMask bCategoryMask;
BComponent bComponent = (BComponent)bValue;
Object object = bComponent.getHandle();
if (object != null) {
this.whandle(object);
}
if (!(bCategoryMask = bComponent.getCategoryMask()).isNull()) {
this.wcategories(bCategoryMask);
}
if (bComponent.getComponentSpace() instanceof BVirtualComponentSpace && !((ComponentSlotMap)bComponent.fw(1)).isBrokerPropsLoaded()) {
this.w(" stub=\"true\"");
}
}
this.wtype(bValue);
this.encodeValue(bValue, n, bPermissions);
}
protected void encodingComponent(BComponent bComponent) throws IOException {
}
protected void encodingComponentStub(BComponent bComponent) throws IOException {
}
private final void encodeSlot(BComplex bComplex, Slot slot, boolean bl, int n, BPermissions bPermissions) throws IOException {
Object object;
int n2;
if (slot == null) {
return;
}
if (slot.isProperty() && ((Property)slot).getType().isTransient()) {
return;
}
int n3 = bComplex.getFlags(slot);
boolean bl2 = false;
if (!this.encodeTransients && (n3 & 2) != 0) {
if (slot.isProperty() && slot.isFrozen() && n3 != slot.getDefaultFlags()) {
bl2 = true;
} else {
return;
}
}
Property property = null;
BValue bValue = null;
boolean bl3 = false;
if (slot.isProperty() && !bl2) {
property = (Property)slot;
if (this.encodePrimitive(bComplex, property, n3)) {
return;
}
bValue = bComplex.get(property);
if (slot.isFrozen()) {
if (bValue.isComponent()) {
boolean bl4 = false;
if (!this.isSyncEncoder() && bValue.getType().getTypeInfo() == nullProxyExt) {
bl4 = true;
}
bl3 = bl4;
} else {
bl3 = property.isEquivalentToDefaultValue(bValue);
}
} else {
bl3 = false;
}
} else {
bl3 = true;
}
if (this.context != null && this.context != Context.encrypt) {
n2 = this.getSecurityMask(bPermissions, slot, bValue, n3);
if ((n2 & 1) != 0) {
if (slot.isFrozen()) {
n3 |= 4;
} else {
return;
}
}
if ((n2 & 2) != 0) {
n3 |= 1;
}
}
if (n3 == slot.getDefaultFlags() && bl3) {
return;
}
int n4 = 0;
if (slot.isDynamic() && bValue instanceof BComponent) {
n4 = 1;
}
n2 = n4;
this.indent(this.indent);
if (n2 != 0 && this.encodeComments && (object = ((BComponent)bValue).getSlotPath()) != null) {
this.w("<!-- ").w((Object)((SlotPath)object).getBody()).w((Object)" -->\n");
this.indent(this.indent);
}
if (slot.isProperty()) {
this.w("<p");
} else if (slot.isAction()) {
this.w("<a");
} else if (slot.isTopic()) {
this.w("<t");
} else {
throw new IllegalStateException();
}
this.wname(slot.getName());
if ((slot.isDynamic() && n3 != 0 || n3 != slot.getDefaultFlags()) && bComplex.isComponent()) {
this.wflags(n3);
}
object = slot.getFacets();
if (slot.isDynamic() && !((BFacets)object).isNull()) {
this.wfacets((BFacets)object);
}
if (bValue instanceof BComponent) {
BCategoryMask bCategoryMask;
BComponent bComponent = (BComponent)bValue;
Object object2 = bComponent.getHandle();
if (object2 != null) {
this.whandle(object2);
}
if (!(bCategoryMask = bComponent.getCategoryMask()).isNull()) {
this.wcategories(bCategoryMask);
}
if (n == 0 || bComponent.getComponentSpace() instanceof BVirtualComponentSpace && !((ComponentSlotMap)bComponent.fw(1)).isBrokerPropsLoaded()) {
this.w(" stub=\"true\"");
}
}
if (property != null && !bl3) {
if (property.isDynamic() || bl || !property.isTypeFinal()) {
this.wtype(bValue);
}
this.encodeValue(bValue, n - 1, bPermissions);
} else {
this.w("/>\n");
}
}
private final boolean encodePrimitive(BComplex bComplex, Property property, int n) throws IOException {
if (property.isDynamic() || n != property.getDefaultFlags()) {
return false;
}
if (property.getTypeAccess() == 7) {
return false;
}
if (this.isSyncEncoder()) {
return false;
}
String string = null;
boolean bl = false;
switch (property.getTypeAccess()) {
case 0: {
boolean bl2 = bComplex.getBoolean(property);
if (bl2 == ((BBoolean)property.getDefaultValue()).getBoolean()) {
return true;
}
string = BBoolean.encode(bl2);
break;
}
case 2: {
int n2 = bComplex.getInt(property);
if (n2 == ((BInteger)property.getDefaultValue()).getInt()) {
return true;
}
string = BInteger.encode(n2);
break;
}
case 3: {
long l = bComplex.getLong(property);
if (l == ((BLong)property.getDefaultValue()).getLong()) {
return true;
}
string = BLong.encode(l);
break;
}
case 4: {
float f = bComplex.getFloat(property);
if (f == ((BFloat)property.getDefaultValue()).getFloat()) {
return true;
}
string = BFloat.encode(f);
break;
}
case 5: {
double d = bComplex.getDouble(property);
if (d == ((BDouble)property.getDefaultValue()).getDouble()) {
return true;
}
string = BDouble.encode(d);
break;
}
case 6: {
string = bComplex.getString(property);
bl = true;
if (string != ((BString)property.getDefaultValue()).getString()) break;
return true;
}
default: {
throw new IllegalStateException("" + property.getTypeAccess());
}
}
this.indent(this.indent);
this.w("<p");
this.wname(property.getName());
this.w(" v=\"");
if (bl) {
this.safe(string);
} else {
this.w(string);
}
this.w("\"/>\n");
return true;
}
private final void encodeValue(BValue bValue, int n, BPermissions bPermissions) throws IOException {
if (bValue.isSimple()) {
this.wvalue((BSimple)bValue).w("/>\n");
} else if (bValue.isComponent() && n < 0) {
this.w(">");
this.encodingComponentStub((BComponent)bValue);
this.w("</p>\n");
} else {
if (bValue.isComponent()) {
bPermissions = this.getPermissionsFor(bValue.asComponent());
}
if (this.encodeStructValue(bValue)) {
return;
}
this.w(">\n");
++this.indent;
BComplex bComplex = (BComplex)bValue;
SlotCursor slotCursor = bComplex.getSlots();
while (slotCursor.next()) {
this.encodeSlot(bComplex, slotCursor.slot(), false, n, bPermissions);
}
if (bComplex.isComponent()) {
this.encodingComponent(bComplex.asComponent());
}
--this.indent;
this.indent(this.indent);
this.w("</p>\n");
}
}
private final boolean encodeStructValue(BValue bValue) throws IOException {
if (bValue instanceof BStatusValue) {
return this.encodeStatusValue(bValue);
}
if (bValue instanceof BLink) {
return this.encodeLink(bValue);
}
return false;
}
private final boolean encodeLink(BValue bValue) throws IOException {
if (bValue.getType() != BLink.TYPE) {
return false;
}
BLink bLink = (BLink)bValue;
this.w("><p n=\"sourceOrd\" v=\"").safe(bLink.getSourceOrd().encodeToString()).w((Object)"\"/><p n=\"sourceSlotName\" v=\"").safe(bLink.getSourceSlotName()).w((Object)"\"/><p n=\"targetSlotName\" v=\"").safe(bLink.getTargetSlotName()).w((Object)"\"/>");
if (!bLink.getEnabled()) {
this.w("<p n=\"enabled\" v=\"false\"/>");
}
this.w("</p>\n");
return true;
}
private final boolean encodeStatusValue(BValue bValue) throws IOException {
BStatus bStatus = null;
if (bValue.getType() == BStatusNumeric.TYPE) {
BStatusNumeric bStatusNumeric = (BStatusNumeric)bValue;
this.w("><p n=\"value\" v=\"").w((Object)BDouble.encode(bStatusNumeric.getValue())).w((Object)"\"/>");
bStatus = bStatusNumeric.getStatus();
} else if (bValue.getType() == BStatusBoolean.TYPE) {
BStatusBoolean bStatusBoolean = (BStatusBoolean)bValue;
this.w("><p n=\"value\" v=\"").w((Object)BBoolean.encode(bStatusBoolean.getValue())).w((Object)"\"/>");
bStatus = bStatusBoolean.getStatus();
} else if (bValue.getType() == BStatusEnum.TYPE) {
BStatusEnum bStatusEnum = (BStatusEnum)bValue;
this.w("><p n=\"value\" v=\"").w((Object)bStatusEnum.getValue().encodeToString()).w((Object)"\"/>");
bStatus = bStatusEnum.getStatus();
} else if (bValue.getType() == BStatusString.TYPE) {
BStatusString bStatusString = (BStatusString)bValue;
this.w("><p n=\"value\" v=\"").safe(bStatusString.getValue()).w((Object)"\"/>");
bStatus = bStatusString.getStatus();
} else {
return false;
}
if (!bStatus.equals(BStatus.DEFAULT)) {
this.w("<p n=\"status\" v=\"").safe(bStatus.encodeToString()).w((Object)"\"/>");
}
this.w("</p>\n");
return true;
}
public BPermissions getPermissionsFor(BComponent bComponent) {
BPermissions bPermissions;
if (this.context == null) {
return BPermissions.all;
}
BUser bUser = this.context.getUser();
if (bUser == null) {
return BPermissions.all;
}
if (this.permissionsCache == null) {
this.permissionsCache = new HashMap();
}
if ((bPermissions = (BPermissions)this.permissionsCache.get(bComponent)) == null) {
bPermissions = bComponent.getPermissions(this.context);
this.permissionsCache.put(bComponent, bPermissions);
}
return bPermissions;
}
private final int getSecurityMask(BPermissions bPermissions, Slot slot, BValue bValue, int n) {
boolean bl = false;
boolean bl2 = false;
if (slot.isProperty() && bValue.isComponent()) {
if (!this.getPermissionsFor(bValue.asComponent()).has(BPermissions.operatorRead)) {
bl = true;
}
} else if (slot.isAction()) {
if ((n & 0x100) != 0) {
if (!bPermissions.has(BPermissions.operatorInvoke)) {
bl = true;
}
} else if (!bPermissions.has(BPermissions.adminInvoke)) {
bl = true;
}
} else if ((n & 0x100) != 0) {
if (!bPermissions.has(BPermissions.operatorRead)) {
bl = true;
} else if (!bPermissions.has(BPermissions.operatorWrite)) {
bl2 = true;
}
} else if (!bPermissions.has(BPermissions.adminRead)) {
bl = true;
} else if (!bPermissions.has(BPermissions.adminWrite)) {
bl2 = true;
}
int n2 = 0;
if (bl) {
n2 |= 1;
}
if (bl2) {
n2 |= 2;
}
return n2;
}
private final BogEncoder wname(String string) throws IOException {
this.w(" n=\"").w((Object)string).w('\"');
return this;
}
private final BogEncoder wtype(BObject bObject) throws IOException {
Type type = bObject.getType();
BModule bModule = type.getModule();
String string = this.getModuleKey(bModule);
if (string == null) {
string = this.newModuleKey(bModule);
this.w(" m=\"").w((Object)string).w('=').w((Object)bModule.getModuleName()).w('\"');
}
this.w(" t=\"").w((Object)string).w(':').w((Object)type.getTypeName()).w('\"');
return this;
}
private final BogEncoder wflags(int n) throws IOException {
this.w(" f=\"").w((Object)Flags.encodeToString(n)).w('\"');
return this;
}
private final BogEncoder whandle(Object object) throws IOException {
this.w(" h=\"").w(object).w('\"');
return this;
}
private final BogEncoder wcategories(BCategoryMask bCategoryMask) throws IOException {
this.w(" c=\"").w((Object)bCategoryMask.encodeToString()).w('\"');
return this;
}
private final BogEncoder wfacets(BFacets bFacets) throws IOException {
this.w(" x=\"").safe(bFacets.encodeToString()).w('\"');
return this;
}
private final BogEncoder wvalue(BSimple bSimple) throws IOException {
try {
String string = null;
string = bSimple instanceof BIContextEncodable ? ((BIContextEncodable)((Object)bSimple)).encodeToString(this.context) : bSimple.encodeToString();
this.w(" v=\"").safe(string).w('\"');
}
catch (Exception exception) {
String string = "?";
try {
string = bSimple.toString();
}
catch (Exception exception2) {}
log.error("Encoding " + bSimple.getType() + " \"" + string + '\"', exception);
this.w(" err=\"" + bSimple.getType() + ".encodeToString()\"");
}
return this;
}
private final String getModuleKey(BModule bModule) {
return (String)this.modules.get(bModule.getModuleName());
}
private final String newModuleKey(BModule bModule) {
String string = bModule.getPreferredSymbol();
int n = 0;
while (this.keys.get(string) != null) {
string = "" + string.charAt(0) + n;
++n;
}
this.keys.put(string, string);
this.modules.put(bModule.getModuleName(), string);
return string;
}
private final /* synthetic */ void this() {
this.indent = 0;
this.encodeComments = true;
this.modules = new HashMap(33);
this.keys = new HashMap(33);
}
public BogEncoder(File file) throws IOException {
super(file);
this.this();
}
public BogEncoder(OutputStream outputStream) throws IOException {
super(outputStream);
this.this();
}
public BogEncoder(File file, Context context) throws IOException {
super(file);
this.this();
this.context = context;
}
public BogEncoder(OutputStream outputStream, Context context) throws IOException {
super(outputStream);
this.this();
this.context = context;
}
static {
try {
nullProxyExt = Sys.getRegistry().getType("control:NullProxyExt");
}
catch (Exception exception) {}
}
}
@@ -0,0 +1,325 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.ByteBuffer
*/
package javax.baja.io;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UTFDataFormatException;
public class ByteBuffer
implements DataOutput,
DataInput {
private javax.baja.nre.util.ByteBuffer byteBuffer;
public int available() {
return this.byteBuffer.available();
}
public void dump() {
this.byteBuffer.dump();
}
public String dumpToString() {
return this.byteBuffer.dumpToString();
}
public boolean endsWith(byte[] byArray) {
return this.byteBuffer.endsWith(byArray);
}
public boolean endsWith(int n) {
return this.byteBuffer.endsWith(n);
}
public boolean equals(Object object) {
return this.byteBuffer.equals(object);
}
public byte[] getBytes() {
return this.byteBuffer.getBytes();
}
public InputStream getInputStream() {
return this.byteBuffer.getInputStream();
}
public int getLength() {
return this.byteBuffer.getLength();
}
public OutputStream getOutputStream() {
return this.byteBuffer.getOutputStream();
}
public int getPosition() {
return this.byteBuffer.getPosition();
}
public int hashCode() {
return this.byteBuffer.hashCode();
}
public int indexOf(byte[] byArray, int n) {
return this.byteBuffer.indexOf(byArray, n);
}
public int indexOf(byte[] byArray) {
return this.byteBuffer.indexOf(byArray);
}
public int indexOf(int n, int n2) {
return this.byteBuffer.indexOf(n, n2);
}
public int indexOf(int n) {
return this.byteBuffer.indexOf(n);
}
public boolean isBigEndian() {
return this.byteBuffer.isBigEndian();
}
public int lastIndexOf(byte[] byArray, int n) {
return this.byteBuffer.lastIndexOf(byArray, n);
}
public int lastIndexOf(byte[] byArray) {
return this.byteBuffer.lastIndexOf(byArray);
}
public int lastIndexOf(int n, int n2) {
return this.byteBuffer.lastIndexOf(n, n2);
}
public int lastIndexOf(int n) {
return this.byteBuffer.lastIndexOf(n);
}
public int peek() throws IOException {
return this.byteBuffer.peek();
}
public int read() throws IOException {
return this.byteBuffer.read();
}
public int read(byte[] byArray, int n, int n2) throws IOException {
return this.byteBuffer.read(byArray, n, n2);
}
public int read(byte[] byArray) throws IOException {
return this.byteBuffer.read(byArray);
}
public boolean readBoolean() throws IOException {
return this.byteBuffer.readBoolean();
}
public byte readByte() throws IOException {
return this.byteBuffer.readByte();
}
public char readChar() throws IOException {
return this.byteBuffer.readChar();
}
public double readDouble() throws IOException {
return this.byteBuffer.readDouble();
}
public float readFloat() throws IOException {
return this.byteBuffer.readFloat();
}
public int readFrom(InputStream inputStream, int n) throws IOException {
return this.byteBuffer.readFrom(inputStream, n);
}
public void readFully(byte[] byArray, int n, int n2) throws IOException {
this.byteBuffer.readFully(byArray, n, n2);
}
public void readFully(byte[] byArray) throws IOException {
this.byteBuffer.readFully(byArray);
}
public void readFullyFrom(InputStream inputStream, int n) throws IOException {
this.byteBuffer.readFullyFrom(inputStream, n);
}
public int readInt() throws IOException {
return this.byteBuffer.readInt();
}
public String readLine() throws IOException {
return this.byteBuffer.readLine();
}
public long readLong() throws IOException {
return this.byteBuffer.readLong();
}
public short readShort() throws IOException {
return this.byteBuffer.readShort();
}
public void readToEnd(InputStream inputStream) throws IOException {
this.byteBuffer.readToEnd(inputStream);
}
public String readUTF() throws IOException {
return this.byteBuffer.readUTF();
}
public int readUnsignedByte() throws IOException {
return this.byteBuffer.readUnsignedByte();
}
public int readUnsignedShort() throws IOException {
return this.byteBuffer.readUnsignedShort();
}
public void reset() {
this.byteBuffer.reset();
}
public void seek(int n) {
this.byteBuffer.seek(n);
}
public void setBigEndian(boolean bl) {
this.byteBuffer.setBigEndian(bl);
}
public int skipBytes(int n) throws IOException {
return this.byteBuffer.skipBytes(n);
}
public boolean startsWith(byte[] byArray) {
return this.byteBuffer.startsWith(byArray);
}
public boolean startsWith(int n) {
return this.byteBuffer.startsWith(n);
}
public byte[] toByteArray() {
return this.byteBuffer.toByteArray();
}
public String toString() {
return this.byteBuffer.toString();
}
public void write(byte[] byArray, int n, int n2) {
this.byteBuffer.write(byArray, n, n2);
}
public void write(byte[] byArray) {
this.byteBuffer.write(byArray);
}
public void write(int n) {
this.byteBuffer.write(n);
}
public void writeBoolean(boolean bl) {
this.byteBuffer.writeBoolean(bl);
}
public void writeByte(int n) {
this.byteBuffer.writeByte(n);
}
public void writeBytes(String string) {
this.byteBuffer.writeBytes(string);
}
public void writeChar(int n) {
this.byteBuffer.writeChar(n);
}
public void writeChars(String string) {
this.byteBuffer.writeChars(string);
}
public void writeDouble(double d) {
this.byteBuffer.writeDouble(d);
}
public void writeFloat(float f) {
this.byteBuffer.writeFloat(f);
}
public void writeInt(int n) {
this.byteBuffer.writeInt(n);
}
public void writeLong(long l) {
this.byteBuffer.writeLong(l);
}
public void writeShort(int n) {
this.byteBuffer.writeShort(n);
}
public void writeTo(DataOutput dataOutput, int n, int n2) throws IOException {
this.byteBuffer.writeTo(dataOutput, n, n2);
}
public void writeTo(DataOutput dataOutput) throws IOException {
this.byteBuffer.writeTo(dataOutput);
}
public void writeTo(OutputStream outputStream, int n, int n2) throws IOException {
this.byteBuffer.writeTo(outputStream, n, n2);
}
public void writeTo(OutputStream outputStream) throws IOException {
this.byteBuffer.writeTo(outputStream);
}
public void writeUTF(String string) throws UTFDataFormatException {
this.byteBuffer.writeUTF(string);
}
public static int utfEncodedSize(String string) {
return javax.baja.nre.util.ByteBuffer.utfEncodedSize((String)string);
}
public static int utfEncodedSize(char c) {
return javax.baja.nre.util.ByteBuffer.utfEncodedSize((char)c);
}
public void setLength(int n) {
this.byteBuffer.setLength(n);
}
public void setBuffer(byte[] byArray) {
this.byteBuffer.setBuffer(byArray);
}
public ByteBuffer(byte[] byArray, int n) {
this.byteBuffer = new javax.baja.nre.util.ByteBuffer(byArray, n);
}
public ByteBuffer(byte[] byArray) {
this.byteBuffer = new javax.baja.nre.util.ByteBuffer(byArray);
}
public ByteBuffer(int n) {
this.byteBuffer = new javax.baja.nre.util.ByteBuffer(n);
}
public ByteBuffer() {
this.byteBuffer = new javax.baja.nre.util.ByteBuffer();
}
}
@@ -0,0 +1,206 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.TextUtil
* javax.baja.xml.XException
* javax.baja.xml.XWriter
*/
package javax.baja.io;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import javax.baja.nre.util.TextUtil;
import javax.baja.xml.XException;
import javax.baja.xml.XWriter;
public class HtmlWriter
extends PrintWriter {
public void println(String string) {
this.print(string);
this.print('\n');
this.flush();
}
public HtmlWriter w(Object object) {
this.print(object);
return this;
}
public final HtmlWriter w(boolean bl) {
this.print(bl);
return this;
}
public final HtmlWriter w(char c) {
this.print(c);
return this;
}
public final HtmlWriter w(int n) {
this.print(n);
return this;
}
public final HtmlWriter w(long l) {
this.print(l);
return this;
}
public final HtmlWriter w(float f) {
this.print(f);
return this;
}
public final HtmlWriter w(double d) {
this.print(d);
return this;
}
public final HtmlWriter nbsp() {
this.print("&nbsp;");
return this;
}
public final HtmlWriter nl() {
this.print('\n');
return this;
}
public final HtmlWriter indent(int n) {
return this.w(TextUtil.getSpaces((int)n));
}
public final HtmlWriter attr(String string, String string2) {
return this.w(string).w('=').w('\'').safe(string2).w('\'');
}
public final HtmlWriter attr(String string, int n) {
return this.attr(string, Integer.toString(n));
}
public final HtmlWriter attr(String string, float f) {
return this.attr(string, Float.toString(f));
}
public final HtmlWriter attr(String string, double d) {
return this.attr(string, Double.toString(d));
}
public final HtmlWriter attr(String string, Object object) {
return this.attr(string, String.valueOf(object));
}
public final HtmlWriter safe(String string, boolean bl) {
try {
XWriter.safe((Writer)this, (String)string, (boolean)bl);
return this;
}
catch (IOException iOException) {
throw new XException(iOException.toString(), (Throwable)iOException);
}
}
public final HtmlWriter safe(String string) {
try {
XWriter.safe((Writer)this, (String)string, (boolean)true);
return this;
}
catch (IOException iOException) {
throw new XException(iOException.toString(), (Throwable)iOException);
}
}
public final HtmlWriter safe(int n, boolean bl) {
try {
XWriter.safe((Writer)this, (int)n, (boolean)bl);
return this;
}
catch (IOException iOException) {
throw new XException(iOException.toString(), (Throwable)iOException);
}
}
public String href(String string) {
return string;
}
public HtmlWriter a(String string, String string2) {
return this.w("<a href='").w(this.href(string)).w("'>").safe(string2).w("</a>");
}
public HtmlWriter a(String string) {
return this.a(string, string);
}
public HtmlWriter startTable(boolean bl) {
this.w("<table");
if (bl) {
this.w(" border='1' cellspacing='0'");
}
this.w(">\n");
return this;
}
public HtmlWriter trTitle(Object object, int n) {
this.w("<tr><th nowrap='true' colspan='").w(n).w("' bgcolor='#d0d0d0'>").w(object).w("</th></tr>\n");
return this;
}
public HtmlWriter thTitle(Object object) {
this.w("<th align='left' nowrap='true' bgcolor='#d0d0d0'>").w(object).w("</th>\n");
return this;
}
public HtmlWriter endTable() {
this.w("</table>\n");
return this;
}
public HtmlWriter tr(Object object) {
return this.w("<tr>").td(object).w("</tr>\n");
}
public HtmlWriter tr(Object object, Object object2) {
return this.w("<tr>").td(object).td(object2).w("</tr>\n");
}
public HtmlWriter tr(Object object, Object object2, Object object3) {
return this.w("<tr>").td(object).td(object2).td(object3).w("</tr>\n");
}
public HtmlWriter tr(Object object, Object object2, Object object3, Object object4) {
return this.w("<tr>").td(object).td(object2).td(object3).td(object4).w("</tr>\n");
}
public HtmlWriter tr(Object object, Object object2, Object object3, Object object4, Object object5) {
return this.w("<tr>").td(object).td(object2).td(object3).td(object4).td(object5).w("</tr>\n");
}
public HtmlWriter tr(Object object, Object object2, Object object3, Object object4, Object object5, Object object6) {
return this.w("<tr>").td(object).td(object2).td(object3).td(object4).td(object5).td(object6).w("</tr>\n");
}
public HtmlWriter tr(Object object, Object object2, Object object3, Object object4, Object object5, Object object6, Object object7) {
return this.w("<tr>").td(object).td(object2).td(object3).td(object4).td(object5).td(object6).td(object7).w("</tr>\n");
}
public HtmlWriter th(Object object) {
return this.w("<th align='left' nowrap='true'>").w(object).w("</th>");
}
public HtmlWriter td(Object object) {
return this.w("<td align='left' nowrap='true'>").w(object).w("</td>");
}
public HtmlWriter(Writer writer) {
super(writer);
}
public HtmlWriter(OutputStream outputStream) {
super(outputStream);
}
}
@@ -0,0 +1,64 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.io;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
public class RandomAccessFileInputStream
extends InputStream {
private RandomAccessFile in;
private long fp;
public int available() throws IOException {
long l = this.in.length() - this.fp;
if (l > Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
}
return (int)l;
}
public void close() {
}
public boolean markSupported() {
return false;
}
public void seek(long l) {
this.fp = l;
}
public int read() throws IOException {
this.in.seek(this.fp);
int n = this.in.read();
++this.fp;
return n;
}
public int read(byte[] byArray) throws IOException {
this.in.seek(this.fp);
int n = this.in.read(byArray);
this.fp = n != -1 ? (this.fp += (long)n) : this.in.length();
return n;
}
public int read(byte[] byArray, int n, int n2) throws IOException {
this.in.seek(this.fp);
int n3 = this.in.read(byArray, n, n2);
this.fp = n3 != -1 ? (this.fp += (long)n3) : this.in.length();
return n3;
}
public RandomAccessFileInputStream(RandomAccessFile randomAccessFile) {
this(randomAccessFile, 0L);
}
public RandomAccessFileInputStream(RandomAccessFile randomAccessFile, long l) {
this.in = randomAccessFile;
this.fp = l;
}
}
@@ -0,0 +1,53 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.io;
import java.io.IOException;
import java.io.OutputStream;
import java.io.RandomAccessFile;
public class RandomAccessFileOutputStream
extends OutputStream {
private RandomAccessFile out;
private long fp;
public void close() {
}
public void flush() throws IOException {
this.out.getFD().sync();
}
public void seek(long l) {
this.fp = l;
}
public void write(int n) throws IOException {
this.out.seek(this.fp);
this.out.write(n);
++this.fp;
}
public void write(byte[] byArray) throws IOException {
this.out.seek(this.fp);
this.out.write(byArray);
this.fp += (long)byArray.length;
}
public void write(byte[] byArray, int n, int n2) throws IOException {
this.out.seek(this.fp);
this.out.write(byArray, n, n2);
this.fp += (long)n2;
}
public RandomAccessFileOutputStream(RandomAccessFile randomAccessFile) {
this(randomAccessFile, 0L);
}
public RandomAccessFileOutputStream(RandomAccessFile randomAccessFile, long l) {
this.out = randomAccessFile;
this.fp = l;
}
}
@@ -0,0 +1,902 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.xml.XElem
* javax.baja.xml.XException
* javax.baja.xml.XParser
*/
package javax.baja.io;
import com.tridium.sys.Nre;
import com.tridium.sys.module.NModule;
import com.tridium.sys.schema.ComponentSlotMap;
import com.tridium.util.SimpleFactory;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import javax.baja.category.BCategoryMask;
import javax.baja.file.BIFile;
import javax.baja.log.Log;
import javax.baja.naming.BOrd;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BDouble;
import javax.baja.sys.BFacets;
import javax.baja.sys.BFloat;
import javax.baja.sys.BInteger;
import javax.baja.sys.BLong;
import javax.baja.sys.BModule;
import javax.baja.sys.BObject;
import javax.baja.sys.BSimple;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.Flags;
import javax.baja.sys.ModuleException;
import javax.baja.sys.ModuleNotFoundException;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.sys.TypeNotFoundException;
import javax.baja.xml.XElem;
import javax.baja.xml.XException;
import javax.baja.xml.XParser;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class ValueDocDecoder {
private static final Map typeSwapMap = new HashMap();
private static final boolean decodeTypeSwap;
private SimpleFactory simpleFactory;
protected final IDecoderPlugin plugin;
private Context context;
public static final BValue unmarshal(String string) throws Exception {
return BogDecoderPlugin.unmarshal(string);
}
public static final BValue unmarshal(String string, ITypeResolver iTypeResolver) throws Exception {
return BogDecoderPlugin.unmarshal(string, iTypeResolver);
}
public final ITypeResolver getTypeResolver() {
return this.plugin.getTypeResolver();
}
public final void setTypeResolver(ITypeResolver iTypeResolver) {
this.plugin.setTypeResolver(iTypeResolver);
}
public BValue decodeDocument() throws Exception {
return this.decodeDocument(true);
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public BValue decodeDocument(boolean bl) throws Exception {
try {
BValue bValue = this.plugin.decodeDocument(this);
Object var3_3 = null;
if (bl) {
this.plugin.close();
}
return bValue;
}
catch (Throwable throwable) {
block3: {
Object var3_4 = null;
if (!bl) break block3;
this.plugin.close();
}
throw throwable;
}
}
public BValue decode() throws Exception {
return this.parseSlot(null, true);
}
public final IDecoderPlugin getPlugin() {
return this.plugin;
}
public final IElement elem() {
return this.plugin.elem();
}
public final int next() throws Exception {
return this.plugin.next();
}
public final void skip() throws Exception {
this.plugin.skip();
}
public final void skip(int n) throws Exception {
this.plugin.skip(n);
}
public final int type() {
return this.plugin.type();
}
public final int line() {
return this.plugin.line();
}
public final int column() {
return this.plugin.column();
}
public final void close() {
this.plugin.close();
}
public final int depth() {
return this.plugin.depth();
}
public final String getEncoding() throws IOException {
return this.plugin.getEncoding();
}
public final boolean isZipped() throws IOException {
return this.plugin.isZipped();
}
public final IElement parse() throws Exception {
return this.plugin.parse();
}
public IElement parse(boolean bl) throws Exception {
return this.plugin.parse(bl);
}
public final IElement parseCurrent() throws Exception {
return this.plugin.parseCurrent();
}
public final IElement parseCurrent(boolean bl) throws Exception {
return this.plugin.parseCurrent(bl);
}
public final RuntimeException err(String string, Throwable throwable) {
return this.plugin.err(string, throwable);
}
public final RuntimeException err(String string) {
return this.plugin.err(string);
}
public final void warningAndSkip(String string) throws RuntimeException {
this.plugin.warningAndSkip(string);
}
public final void warning(String string) {
this.plugin.warning(string);
}
public final Log getLog() {
return this.plugin.getLog();
}
public final void setLog(Log log) {
this.plugin.setLog(log);
}
public final int getWarningCount() {
return this.plugin.getWarningCount();
}
protected void decodingComponent(BComponent bComponent) throws Exception {
this.plugin.warningAndSkip("Unknown element <" + this.plugin.elem().name() + "> for decodingComponent");
}
private final void parseSlots(BObject bObject) throws Exception {
while (true) {
int n;
if ((n = this.next()) == -1) {
throw new EOFException();
}
if (n == 2) {
return;
}
if (n != 1) {
throw this.err("Expected element start");
}
this.parseSlot((BComplex)bObject, false);
}
}
private final BValue parseSlot(BComplex bComplex, boolean bl) throws Exception {
Object object;
Object object2;
if (this.type() != 1) {
throw this.err("Expected element start (" + this.type() + ')');
}
IElement iElement = this.plugin.elem();
String string = iElement.name().intern();
if (string != "p" && string != "a" && string != "t") {
if (bComplex instanceof BComponent) {
this.decodingComponent((BComponent)bComplex);
} else {
this.plugin.warningAndSkip("Unknown element <" + string + '>');
}
if (bl) {
throw this.err("Unknown element <" + string + '>');
}
return null;
}
String string2 = null;
String string3 = null;
Object object3 = null;
Object object4 = null;
String string4 = null;
Object object5 = null;
BFacets bFacets = BFacets.NULL;
Object object6 = null;
boolean bl2 = false;
int n = iElement.attrSize();
int n2 = 0;
while (n2 < n) {
object2 = iElement.attrName(n2);
object = iElement.attrValue(n2);
if (object2 == "n") {
string2 = object;
} else if (object2 == "h") {
string3 = object;
} else if (object2 == "v") {
string4 = object;
} else if (object2 == "t") {
object4 = object;
} else if (object2 == "m") {
object3 = object;
} else if (object2 == "f") {
object5 = object;
} else if (object2 == "x") {
bFacets = this.decodeFacets((String)object);
} else if (object2 == "c") {
object6 = object;
} else if (((String)object2).equals("stub")) {
bl2 = ((String)object).equals("true");
}
++n2;
}
n2 = this.decodeFlags((String)object5);
if (object3 != null && this.plugin.getTypeResolver().loadModule(this, bComplex, string2, (String)object3, (String)object4) == null) {
try {
this.plugin.skip();
}
catch (RuntimeException runtimeException) {
this.plugin.warning("Missing module " + (String)(((String)object3).indexOf(61) != -1 ? ((String)object3).substring(((String)object3).indexOf(61) + 1) : object3));
throw runtimeException;
}
catch (Exception exception) {
this.plugin.warning("Missing module " + (String)object3);
throw this.plugin.err("Missing module " + (String)(((String)object3).indexOf(61) != -1 ? ((String)object3).substring(((String)object3).indexOf(61) + 1) : object3));
}
if (bl) {
throw this.plugin.err("Missing module " + (String)(((String)object3).indexOf(61) != -1 ? ((String)object3).substring(((String)object3).indexOf(61) + 1) : object3));
}
if (this.plugin.getLog().isTraceOn()) {
this.plugin.getLog().trace("Missing module: " + (String)object3);
}
}
object2 = null;
if (bComplex != null) {
if (string2 == null) {
throw this.plugin.err("Missing \"n\" name attribute");
}
object2 = bComplex.getSlot(string2);
}
if (object2 != null) {
if (object5 != null) {
bComplex.setFlags((Slot)object2, n2, Context.decoding);
}
if (!object2.isProperty()) {
this.plugin.skip();
return null;
}
} else {
if (string == "a") {
this.plugin.warningAndSkip("Missing frozen action: " + string2);
return null;
}
if (string == "t") {
this.plugin.warningAndSkip("Missing frozen topic: " + string2);
return null;
}
}
if (this.decodePrimitive(bComplex, (Property)(object = (Property)object2), string4)) {
if (bl) {
throw this.err("Incountered unexpected primitive");
}
return null;
}
BValue bValue = this.plugin.getTypeResolver().newInstance(this, bComplex, string2, (Property)object, (String)object4);
if (bValue == null) {
if (bl) {
throw this.err("Unable to instantiate " + (String)(((String)object4).indexOf(58) != -1 ? ((String)object4).substring(((String)object4).indexOf(58) + 1) : object4));
}
return null;
}
if (bValue.isSimple() && string4 != null) {
if (this.isTypeBlackListed(bValue.getType())) {
throw this.err("Cannot decode blacklisted Simple Type: " + bValue.getType());
}
bValue = this.decodeSimple(bValue, string4);
}
if (bValue.isComponent()) {
((ComponentSlotMap)bValue.fw(1)).setHandle(string3);
if (!bl2) {
((ComponentSlotMap)bValue.fw(1)).setBrokerPropsLoaded(true);
}
if (object6 != null) {
((BComponent)bValue).setCategoryMask(BCategoryMask.make((String)object6), Context.decoding);
}
}
if (bComplex != null) {
if (object != null) {
if (!object.isFrozen()) {
throw this.plugin.err("Duplicate slot " + bComplex.getType().getTypeName() + '.' + string2);
}
try {
bComplex.set((Property)object, bValue, Context.decoding);
}
catch (Exception exception) {
this.plugin.warningAndSkip("Cannot set property " + bComplex.getType().getTypeName() + '.' + string2 + ": " + exception);
}
} else if (bComplex.isComponent()) {
bComplex.asComponent().add(string2, bValue, n2, bFacets, Context.decoding);
} else {
this.plugin.warningAndSkip("Missing slot " + bComplex.getType().getTypeName() + '.' + string2);
}
}
this.parseSlots(bValue);
return bValue;
}
private final boolean decodePrimitive(BComplex bComplex, Property property, String string) throws Exception {
if (property == null || string == null) {
return false;
}
if (property.getTypeAccess() == 7) {
return false;
}
switch (property.getTypeAccess()) {
case 0: {
bComplex.setBoolean(property, BBoolean.decode(string), Context.decoding);
break;
}
case 2: {
bComplex.setInt(property, BInteger.decode(string), Context.decoding);
break;
}
case 3: {
bComplex.setLong(property, BLong.decode(string), Context.decoding);
break;
}
case 4: {
bComplex.setFloat(property, BFloat.decode(string), Context.decoding);
break;
}
case 5: {
bComplex.setDouble(property, BDouble.decode(string), Context.decoding);
break;
}
case 6: {
bComplex.setString(property, string, Context.decoding);
break;
}
default: {
throw new IllegalStateException("" + property.getTypeAccess());
}
}
int n = this.next();
if (n != 2) {
throw this.err("Expecting end of p element for simple property " + property.getName());
}
return true;
}
protected BSimple decodeSimple(BObject bObject, String string) {
try {
return this.simpleFactory.make(bObject.getType(), string, this.context);
}
catch (Exception exception) {
throw this.plugin.err("Invalid " + bObject.getType().getTypeName() + ": '" + string + '\'', exception);
}
}
private final int decodeFlags(String string) {
if (string == null) {
return 0;
}
return Flags.decodeFromString(string);
}
private final BFacets decodeFacets(String string) {
try {
if (string == null) {
return BFacets.NULL;
}
return (BFacets)this.simpleFactory.make(BFacets.TYPE, string, this.context);
}
catch (Exception exception) {
throw this.plugin.err("Invalid facets " + string, exception);
}
}
public boolean isTypeBlackListed(Type type) {
return false;
}
static final BValue typeResolverNewInstance(NModule nModule, String string) {
Type type;
try {
type = nModule.getType(string);
}
catch (TypeNotFoundException typeNotFoundException) {
if (decodeTypeSwap) {
String string2 = (String)typeSwapMap.get(nModule.getModuleName() + ':' + string);
if (string2 != null) {
type = Sys.getType(string2);
}
throw typeNotFoundException;
}
throw typeNotFoundException;
}
return (BValue)type.getInstance();
}
private final /* synthetic */ void this() {
this.simpleFactory = new SimpleFactory();
this.context = null;
}
public ValueDocDecoder(IDecoderPlugin iDecoderPlugin) throws Exception {
this.this();
this.plugin = iDecoderPlugin;
}
public ValueDocDecoder(BOrd bOrd) throws Exception {
this(new BogDecoderPlugin(bOrd));
}
public ValueDocDecoder(BIFile bIFile) throws Exception {
this(new BogDecoderPlugin(bIFile));
}
public ValueDocDecoder(File file) throws Exception {
this(new BogDecoderPlugin(file));
}
public ValueDocDecoder(InputStream inputStream) throws Exception {
this(new BogDecoderPlugin(inputStream));
}
static {
typeSwapMap.put("niagaraDriver:NiagaraVirtualGateway", "niagaraDriver:NiagaraVirtualDeviceExt");
decodeTypeSwap = System.getProperty("niagara.decodeTypeSwap", "true").equals("true");
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public static final class BogDecoderPlugin
implements IDecoderPlugin {
public static final ITypeResolver defaultTypeResolver = new BogTypeResolver();
private static final Log defaultLog = Log.getLog("sys.xml");
private final XParser parser;
private HashMap modules;
private ITypeResolver typeResolver;
private Log log;
private int warningCount;
public final BValue decodeDocument(ValueDocDecoder valueDocDecoder) throws Exception {
this.next();
IElement iElement = this.elem();
if (!iElement.name().equals("bajaObjectGraph")) {
throw this.err("Root element must be \"bajaObjectGraph\"");
}
String string = iElement.get("version");
if (!string.equals("1.0") && !string.equals("1.1")) {
throw this.err("Only versions 1.0 and 1.1 are supported");
}
this.next();
BValue bValue = valueDocDecoder.decode();
this.next();
if (this.type() != 2 || !this.elem().name().equals("bajaObjectGraph")) {
throw this.err("Expected end tag for \"bajaObjectGraph\"");
}
return bValue;
}
public final int next() throws Exception {
return this.parser.next();
}
public final IElement elem() {
return BogElement.make(this.parser.elem());
}
public final void skip() throws Exception {
this.parser.skip();
}
public final void skip(int n) throws Exception {
this.parser.skip(n);
}
public final int type() {
return this.parser.type();
}
public final int line() {
return this.parser.line();
}
public final int column() {
return this.parser.column();
}
public final void close() {
this.parser.close();
}
public final int depth() {
return this.parser.depth();
}
public final String getEncoding() throws IOException {
return this.parser.getEncoding();
}
public final boolean isZipped() throws IOException {
return this.parser.isZipped();
}
public final IElement parse() throws Exception {
return BogElement.make(this.parser.parse());
}
public final IElement parse(boolean bl) throws Exception {
return BogElement.make(this.parser.parse(bl));
}
public final IElement parseCurrent() throws Exception {
return BogElement.make(this.parser.parseCurrent());
}
public final IElement parseCurrent(boolean bl) throws Exception {
return BogElement.make(this.parser.parseCurrent(bl));
}
public final ITypeResolver getTypeResolver() {
return this.typeResolver;
}
public final void setTypeResolver(ITypeResolver iTypeResolver) {
this.typeResolver = iTypeResolver == null ? defaultTypeResolver : iTypeResolver;
}
public final RuntimeException err(String string, Throwable throwable) {
return new XException(string, this.parser.line(), this.parser.column(), throwable);
}
public final RuntimeException err(String string) {
return new XException(string, this.parser.line(), this.parser.column());
}
public final void warningAndSkip(String string) throws RuntimeException {
this.warning(string);
try {
this.skip();
}
catch (XException xException) {
throw xException;
}
catch (Exception exception) {
throw new XException((Throwable)exception);
}
}
public final void warning(String string) throws RuntimeException {
this.log.warning(string + " [" + this.parser.line() + ':' + this.parser.column() + ']');
++this.warningCount;
}
public final Log getLog() {
return this.log;
}
public final void setLog(Log log) {
this.log = log;
}
public final int getWarningCount() {
return this.warningCount;
}
public final XParser getXmlParser() {
return this.parser;
}
public static final BValue unmarshal(String string) throws Exception {
BogDecoderPlugin bogDecoderPlugin = new BogDecoderPlugin(new ByteArrayInputStream(string.getBytes()));
ValueDocDecoder valueDocDecoder = new ValueDocDecoder(bogDecoderPlugin);
valueDocDecoder.plugin.next();
return valueDocDecoder.decode();
}
public static final BValue unmarshal(String string, ITypeResolver iTypeResolver) throws Exception {
BogDecoderPlugin bogDecoderPlugin = new BogDecoderPlugin(new ByteArrayInputStream(string.getBytes()));
ValueDocDecoder valueDocDecoder = new ValueDocDecoder(bogDecoderPlugin);
valueDocDecoder.plugin.setTypeResolver(iTypeResolver);
valueDocDecoder.plugin.next();
return valueDocDecoder.decode();
}
private final /* synthetic */ void this() {
this.modules = new HashMap();
this.typeResolver = new BogTypeResolver();
this.log = defaultLog;
}
public BogDecoderPlugin(InputStream inputStream) throws Exception {
this.this();
this.parser = XParser.make((InputStream)inputStream);
}
public BogDecoderPlugin(BOrd bOrd) throws Exception {
this((BIFile)((Object)bOrd.resolve().get()));
}
public BogDecoderPlugin(BIFile bIFile) throws Exception {
this(new BufferedInputStream(bIFile.getInputStream()));
}
public BogDecoderPlugin(File file) throws Exception {
this(new BufferedInputStream(new FileInputStream(file)));
}
}
public static interface IDecoderPlugin {
public BValue decodeDocument(ValueDocDecoder var1) throws Exception;
public int next() throws Exception;
public IElement elem();
public void skip() throws Exception;
public void skip(int var1) throws Exception;
public int type();
public int line();
public int column();
public void close();
public int depth();
public String getEncoding() throws IOException;
public boolean isZipped() throws IOException;
public IElement parse() throws Exception;
public IElement parse(boolean var1) throws Exception;
public IElement parseCurrent() throws Exception;
public IElement parseCurrent(boolean var1) throws Exception;
public ITypeResolver getTypeResolver();
public void setTypeResolver(ITypeResolver var1);
public RuntimeException err(String var1, Throwable var2);
public RuntimeException err(String var1);
public void warningAndSkip(String var1) throws RuntimeException;
public void warning(String var1);
public Log getLog();
public void setLog(Log var1);
public int getWarningCount();
}
public static interface IElement {
public String name();
public String get(String var1);
public String get(String var1, String var2);
public int geti(String var1);
public int geti(String var1, int var2);
public double getd(String var1);
public double getd(String var1, double var2);
public float getf(String var1);
public float getf(String var1, float var2);
public long getl(String var1);
public long getl(String var1, long var2);
public int attrSize();
public String attrName(int var1);
public String attrValue(int var1);
public IElement copy();
}
public static interface ITypeResolver {
public BModule loadModule(ValueDocDecoder var1, BComplex var2, String var3, String var4, String var5);
public BValue newInstance(ValueDocDecoder var1, BComplex var2, String var3, Property var4, String var5);
}
public static class BogTypeResolver
implements ITypeResolver {
public BModule loadModule(ValueDocDecoder valueDocDecoder, BComplex bComplex, String string, String string2, String string3) {
try {
int n = string2.indexOf(61);
String string4 = string2.substring(0, n).trim();
String string5 = string2.substring(n + 1).trim();
NModule nModule = Nre.moduleManager.loadModule(string5);
this.getModuleMap(valueDocDecoder).put(string4, nModule);
return nModule.bmodule();
}
catch (ModuleException moduleException) {
throw valueDocDecoder.plugin.err("Cannot load module '" + string2 + '\'', moduleException);
}
catch (Exception exception) {
throw valueDocDecoder.plugin.err("Invalid module attribute '" + string2 + '\'');
}
}
public BValue newInstance(ValueDocDecoder valueDocDecoder, BComplex bComplex, String string, Property property, String string2) {
if (string2 == null) {
if (property != null) {
return property.getDefaultValue();
}
valueDocDecoder.plugin.warningAndSkip("Missing frozen property: " + string);
return null;
}
try {
int n = string2.indexOf(58);
if (n <= 0) {
throw valueDocDecoder.plugin.err("Invalid typespec '" + string2 + '\'');
}
String string3 = string2.substring(0, n);
String string4 = string2.substring(n + 1);
NModule nModule = (NModule)this.getModuleMap(valueDocDecoder).get(string3);
if (nModule == null) {
throw valueDocDecoder.plugin.err("Undeclared module symbol: " + string3, new ModuleNotFoundException(string3));
}
return ValueDocDecoder.typeResolverNewInstance(nModule, string4);
}
catch (XException xException) {
throw xException;
}
catch (TypeNotFoundException typeNotFoundException) {
valueDocDecoder.plugin.warningAndSkip("Type \"" + typeNotFoundException.getMessage() + "\" not found: " + string);
return null;
}
catch (Throwable throwable) {
throw valueDocDecoder.plugin.err("Cannot instantiate type '" + string2 + '\'', throwable);
}
}
public Map getModuleMap(ValueDocDecoder valueDocDecoder) {
return ((BogDecoderPlugin)valueDocDecoder.plugin).modules;
}
}
public static final class BogElement
implements IElement {
private XElem elem;
public static final BogElement make(XElem xElem) {
return xElem == null ? null : new BogElement(xElem);
}
public final String name() {
return this.elem.name();
}
public final String get(String string) {
return this.elem.get(string);
}
public final String get(String string, String string2) {
return this.elem.get(string, string2);
}
public final int geti(String string) {
return this.elem.geti(string);
}
public final int geti(String string, int n) {
return this.elem.geti(string, n);
}
public final double getd(String string) {
return this.elem.getd(string);
}
public final double getd(String string, double d) {
return this.elem.getd(string, d);
}
public final float getf(String string) {
return this.elem.getf(string);
}
public final float getf(String string, float f) {
return this.elem.getf(string, f);
}
public final long getl(String string) {
return this.elem.getl(string);
}
public final long getl(String string, long l) {
return this.elem.getl(string, l);
}
public final int attrSize() {
return this.elem.attrSize();
}
public final String attrName(int n) {
return this.elem.attrName(n);
}
public final String attrValue(int n) {
return this.elem.attrValue(n);
}
public final IElement copy() {
return BogElement.make(this.elem.copy());
}
public final String toString() {
return this.elem.toString();
}
public final XElem getXmlElement() {
return this.elem;
}
private BogElement(XElem xElem) {
this.elem = xElem;
}
}
}
@@ -0,0 +1,947 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.xml.XWriter
*/
package javax.baja.io;
import com.tridium.sys.schema.ComponentSlotMap;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import javax.baja.category.BCategoryMask;
import javax.baja.io.BIContextEncodable;
import javax.baja.log.Log;
import javax.baja.naming.SlotPath;
import javax.baja.registry.TypeInfo;
import javax.baja.security.BPermissions;
import javax.baja.status.BStatus;
import javax.baja.status.BStatusBoolean;
import javax.baja.status.BStatusEnum;
import javax.baja.status.BStatusNumeric;
import javax.baja.status.BStatusString;
import javax.baja.status.BStatusValue;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BDouble;
import javax.baja.sys.BFacets;
import javax.baja.sys.BFloat;
import javax.baja.sys.BInteger;
import javax.baja.sys.BLink;
import javax.baja.sys.BLong;
import javax.baja.sys.BModule;
import javax.baja.sys.BObject;
import javax.baja.sys.BSimple;
import javax.baja.sys.BString;
import javax.baja.sys.BValue;
import javax.baja.sys.BasicContext;
import javax.baja.sys.Context;
import javax.baja.sys.Flags;
import javax.baja.sys.Property;
import javax.baja.sys.Slot;
import javax.baja.sys.SlotCursor;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.user.BUser;
import javax.baja.virtual.BVirtualComponentSpace;
import javax.baja.xml.XWriter;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class ValueDocEncoder {
private static final int SECURITY_INACCESSIBLE = 1;
private static final int SECURITY_READONLY = 2;
private static final Log log = Log.getLog("sys.xml");
private static TypeInfo nullProxyExt = null;
private boolean encodeTransients;
private boolean encodeComments;
private Context context;
private HashMap permissionsCache;
protected final IEncoderPlugin plugin;
public static final String marshal(BValue bValue) throws IOException {
return BogEncoderPlugin.marshal(bValue);
}
public Context getContext() {
return this.context;
}
public static final Context getMergedContext(BComplex bComplex, Slot slot, Context context) {
BFacets bFacets = bComplex.getSlotFacets(slot);
if (context == null) {
context = bFacets;
} else if (bFacets != null && !bFacets.isNull()) {
context = new BasicContext(context, bFacets);
}
if (bComplex.isStruct() && bComplex.getParent() != null) {
return ValueDocEncoder.getMergedContext(bComplex.getParent(), bComplex.getPropertyInParent(), context);
}
return context;
}
public boolean isSyncEncoder() {
return false;
}
public boolean isEncodeTransients() {
return this.encodeTransients;
}
public boolean setEncodeTransients(boolean bl) {
boolean bl2 = this.encodeTransients;
this.encodeTransients = bl;
return bl2;
}
public boolean isEncodeComments() {
return this.encodeComments;
}
public boolean setEncodeComments(boolean bl) {
boolean bl2 = this.encodeComments;
this.encodeComments = bl;
return bl2;
}
public final IEncoderPlugin getPlugin() {
return this.plugin;
}
public void encodeDocument(BValue bValue) throws IOException {
this.plugin.encodeDocument(this, bValue);
this.plugin.flush();
}
public void encode(BValue bValue) throws IOException {
this.encode(null, bValue, Integer.MAX_VALUE);
}
public void encode(String string, BValue bValue, int n) throws IOException {
Object object;
Object object2;
BPermissions bPermissions = BPermissions.all;
if (this.context != null && this.context != Context.encrypt && bValue.isComponent() && !(bPermissions = this.getPermissionsFor(bValue.asComponent())).hasOperatorRead()) {
throw new SecurityException("Missing op read permission on value");
}
this.plugin.start("p");
if (string != null) {
this.wname(string);
}
if (bValue.isComponent()) {
BCategoryMask bCategoryMask;
object2 = (BComponent)bValue;
object = ((BComponent)object2).getHandle();
if (object != null) {
this.whandle(object);
}
if (!(bCategoryMask = ((BComponent)object2).getCategoryMask()).isNull()) {
this.wcategories(bCategoryMask);
}
if (((BComponent)object2).getComponentSpace() instanceof BVirtualComponentSpace && !((ComponentSlotMap)((BObject)object2).fw(1)).isBrokerPropsLoaded()) {
this.plugin.attr("stub", true);
}
}
this.wtype(bValue);
object2 = this.getContext();
if (bValue.isComplex() && bValue.asComplex().getParent() != null) {
object = bValue.asComplex();
object2 = ValueDocEncoder.getMergedContext(((BComplex)object).getParent(), ((BComplex)object).getPropertyInParent(), this.getContext());
}
this.encodeValue(bValue, n, bPermissions, (Context)object2);
}
public final void flush() throws IOException {
this.plugin.flush();
}
public final void close() throws IOException {
this.plugin.close();
}
public final IEncoderPlugin start(String string) throws IOException {
return this.plugin.start(string);
}
public final IEncoderPlugin startArray(String string) throws IOException {
return this.plugin.startArray(string);
}
public final IEncoderPlugin endArray() throws IOException {
return this.plugin.endArray();
}
public final IEncoderPlugin end() throws IOException {
return this.plugin.end();
}
public final IEncoderPlugin end(String string) throws IOException {
return this.plugin.end(string);
}
public final IEncoderPlugin endAttr() throws IOException {
return this.plugin.endAttr();
}
public final IEncoderPlugin key(String string) throws IOException {
return this.plugin.key(string);
}
public final IEncoderPlugin attr(String string, boolean bl) throws IOException {
return this.plugin.attr(string, bl);
}
public final IEncoderPlugin attr(String string, double d) throws IOException {
return this.plugin.attr(string, d);
}
public final IEncoderPlugin attr(String string, String string2) throws IOException {
return this.plugin.attr(string, string2);
}
public final IEncoderPlugin attrSafe(String string, String string2) throws IOException {
return this.plugin.attrSafe(string, string2);
}
public final IEncoderPlugin comment(String string) throws IOException {
return this.plugin.comment(string);
}
public final IEncoderPlugin incrementIndent() throws IOException {
return this.plugin.incrementIndent();
}
public final IEncoderPlugin decrementIndent() throws IOException {
return this.plugin.decrementIndent();
}
public final IEncoderPlugin indent() throws IOException {
return this.plugin.indent();
}
public final int getIndent() {
return this.plugin.getIndent();
}
public final IEncoderPlugin newLine() throws IOException {
return this.plugin.newLine();
}
public boolean isZipped() {
return this.plugin.isZipped();
}
public void setZipped(boolean bl) throws IOException {
this.plugin.setZipped(bl);
}
protected void encodingComponent(BComponent bComponent) throws IOException {
}
protected void encodingComponentStub(BComponent bComponent) throws IOException {
}
protected void encodingValue(BValue bValue, Context context) throws IOException {
}
protected void encodingSlot(BComplex bComplex, Slot slot) throws IOException {
}
protected void encodingFacets(BFacets bFacets) throws IOException {
}
private final void encodeSlot(BComplex bComplex, Slot slot, int n, BPermissions bPermissions) throws IOException {
Object object;
int n2;
if (slot == null) {
return;
}
int n3 = bComplex.getFlags(slot);
boolean bl = false;
if (!this.encodeTransients && (n3 & 2) != 0) {
if (slot.isProperty() && slot.isFrozen() && n3 != slot.getDefaultFlags()) {
bl = true;
} else {
return;
}
}
Property property = null;
BObject bObject = null;
boolean bl2 = false;
if (slot.isProperty() && !bl) {
property = (Property)slot;
if (this.encodePrimitive(bComplex, property, n3)) {
return;
}
bObject = bComplex.get(property);
bl2 = this.canSkipEncodingProperty(bComplex, property, (BValue)bObject, bPermissions);
} else {
bl2 = true;
}
if (this.context != null && this.context != Context.encrypt) {
n2 = this.getSecurityMask(bPermissions, slot, (BValue)bObject, n3);
if ((n2 & 1) != 0) {
if (slot.isFrozen()) {
n3 |= 4;
} else {
return;
}
}
if ((n2 & 2) != 0) {
n3 |= 1;
}
}
if (bObject != null && bObject.isSimple() && this.isTypeBlackListed(((BValue)bObject).getType())) {
if (slot.isFrozen()) {
n3 |= 4;
} else {
return;
}
}
if (n3 == slot.getDefaultFlags() && bl2) {
return;
}
int n4 = 0;
if (slot.isDynamic() && bObject instanceof BComponent) {
n4 = 1;
}
n2 = n4;
this.plugin.indent();
if (n2 != 0 && this.encodeComments && (object = ((BComponent)bObject).getSlotPath()) != null) {
this.plugin.comment(((SlotPath)object).getBody());
this.plugin.indent();
}
if (slot.isProperty()) {
this.plugin.start("p");
} else if (slot.isAction()) {
this.plugin.start("a");
} else if (slot.isTopic()) {
this.plugin.start("t");
} else {
throw new IllegalStateException();
}
this.wname(slot.getName());
this.encodingSlot(bComplex, slot);
if ((slot.isDynamic() && n3 != 0 || n3 != slot.getDefaultFlags()) && bComplex.isComponent()) {
this.wflags(n3);
}
object = slot.getFacets();
if (slot.isDynamic() && !((BFacets)object).isNull()) {
this.wfacets((BFacets)object);
}
if (bObject instanceof BComponent) {
BCategoryMask bCategoryMask;
BComponent bComponent = (BComponent)bObject;
Object object2 = bComponent.getHandle();
if (object2 != null) {
this.whandle(object2);
}
if (!(bCategoryMask = bComponent.getCategoryMask()).isNull()) {
this.wcategories(bCategoryMask);
}
if (n == 0 || bComponent.getComponentSpace() instanceof BVirtualComponentSpace && !((ComponentSlotMap)bComponent.fw(1)).isBrokerPropsLoaded()) {
this.plugin.attr("stub", true);
}
}
if (property != null && !bl2) {
this.wtype(bObject);
this.encodeValue((BValue)bObject, n - 1, bPermissions, ValueDocEncoder.getMergedContext(bComplex, property, this.getContext()));
} else {
this.plugin.end().newLine();
}
}
private final boolean encodePrimitive(BComplex bComplex, Property property, int n) throws IOException {
if (property.isDynamic() || n != property.getDefaultFlags()) {
return false;
}
if (property.getTypeAccess() == 7) {
return false;
}
if (this.isSyncEncoder()) {
return false;
}
String string = null;
boolean bl = false;
switch (property.getTypeAccess()) {
case 0: {
boolean bl2 = bComplex.getBoolean(property);
if (bl2 == ((BBoolean)property.getDefaultValue()).getBoolean()) {
return true;
}
string = BBoolean.encode(bl2);
break;
}
case 2: {
int n2 = bComplex.getInt(property);
if (n2 == ((BInteger)property.getDefaultValue()).getInt()) {
return true;
}
string = BInteger.encode(n2);
break;
}
case 3: {
long l = bComplex.getLong(property);
if (l == ((BLong)property.getDefaultValue()).getLong()) {
return true;
}
string = BLong.encode(l);
break;
}
case 4: {
float f = bComplex.getFloat(property);
if (f == ((BFloat)property.getDefaultValue()).getFloat()) {
return true;
}
string = BFloat.encode(f);
break;
}
case 5: {
double d = bComplex.getDouble(property);
if (d == ((BDouble)property.getDefaultValue()).getDouble()) {
return true;
}
string = BDouble.encode(d);
break;
}
case 6: {
string = bComplex.getString(property);
bl = true;
if (string != ((BString)property.getDefaultValue()).getString()) break;
return true;
}
default: {
throw new IllegalStateException("" + property.getTypeAccess());
}
}
this.plugin.indent().start("p");
this.wname(property.getName());
if (bl) {
this.plugin.attrSafe("v", string);
} else {
this.plugin.attr("v", string);
}
this.encodingValue(bComplex.get(property), ValueDocEncoder.getMergedContext(bComplex, property, this.getContext()));
this.plugin.end().newLine();
return true;
}
private final void encodeValue(BValue bValue, int n, BPermissions bPermissions, Context context) throws IOException {
this.encodingValue(bValue, context);
if (this.isTypeBlackListed(bValue.getType()) && bValue.isSimple()) {
bValue = (BValue)bValue.getType().getInstance();
}
if (bValue.isSimple()) {
this.wvalue((BSimple)bValue);
this.plugin.end().newLine();
} else if (bValue.isComponent() && n < 0) {
this.plugin.endAttr();
this.encodingComponentStub((BComponent)bValue);
this.plugin.end("p").newLine();
} else {
if (bValue.isComponent()) {
bPermissions = this.getPermissionsFor(bValue.asComponent());
}
if (this.encodeStructValue(bValue)) {
return;
}
this.plugin.endAttr().newLine().incrementIndent();
BComplex bComplex = (BComplex)bValue;
SlotCursor slotCursor = bComplex.getSlots();
boolean bl = true;
while (slotCursor.next()) {
if (bl) {
this.plugin.startArray("s");
bl = false;
}
this.encodeSlot(bComplex, slotCursor.slot(), n, bPermissions);
}
if (!bl) {
this.plugin.endArray();
}
if (bComplex.isComponent()) {
this.encodingComponent(bComplex.asComponent());
}
this.plugin.decrementIndent().indent().end("p").newLine();
}
}
protected boolean canSkipEncodingProperty(BComplex bComplex, Property property, BValue bValue, BPermissions bPermissions) {
if (!property.isFrozen()) {
return false;
}
if (bValue.isComponent()) {
boolean bl = false;
if (!this.isSyncEncoder() && bValue.getType().getTypeInfo() == nullProxyExt) {
bl = true;
}
return bl;
}
return property.isEquivalentToDefaultValue(bValue);
}
private final boolean encodeStructValue(BValue bValue) throws IOException {
if (bValue instanceof BStatusValue) {
return this.encodeStatusValue(bValue);
}
if (bValue instanceof BLink) {
return this.encodeLink(bValue);
}
return false;
}
private final boolean encodeLink(BValue bValue) throws IOException {
if (bValue.getType() != BLink.TYPE) {
return false;
}
BLink bLink = (BLink)bValue;
this.plugin.endAttr().startArray("s");
this.plugin.start("p").attr("n", "sourceOrd").attrSafe("v", bLink.getSourceOrd().encodeToString());
this.encodingSlot(bLink, BLink.sourceOrd);
this.encodingValue(bLink.getSourceOrd(), ValueDocEncoder.getMergedContext(bLink, BLink.sourceOrd, this.getContext()));
this.plugin.end();
this.plugin.start("p").attr("n", "sourceSlotName").attrSafe("v", bLink.getSourceSlotName());
this.encodingSlot(bLink, BLink.sourceSlotName);
this.encodingValue(bLink.get(BLink.sourceSlotName), ValueDocEncoder.getMergedContext(bLink, BLink.sourceSlotName, this.getContext()));
this.plugin.end();
this.plugin.start("p").attr("n", "targetSlotName").attrSafe("v", bLink.getTargetSlotName());
this.encodingSlot(bLink, BLink.targetSlotName);
this.encodingValue(bLink.get(BLink.targetSlotName), ValueDocEncoder.getMergedContext(bLink, BLink.targetSlotName, this.getContext()));
this.plugin.end();
if (!bLink.getEnabled()) {
this.plugin.start("p").attr("n", "enabled").attr("v", false);
this.encodingSlot(bLink, BLink.enabled);
this.encodingValue(bLink.get(BLink.enabled), ValueDocEncoder.getMergedContext(bLink, BLink.enabled, this.getContext()));
this.plugin.end();
}
this.plugin.endArray().end("p").newLine();
return true;
}
private final boolean encodeStatusValue(BValue bValue) throws IOException {
BStatus bStatus = null;
if (bValue.getType() == BStatusNumeric.TYPE) {
BStatusNumeric bStatusNumeric = (BStatusNumeric)bValue;
this.plugin.endAttr().startArray("s").start("p").attr("n", "value").attr("v", BDouble.encode(bStatusNumeric.getValue()));
this.encodingSlot(bStatusNumeric, BStatusNumeric.value);
this.encodingValue(bStatusNumeric.get(BStatusNumeric.value), ValueDocEncoder.getMergedContext(bStatusNumeric, BStatusNumeric.value, this.getContext()));
this.plugin.end();
bStatus = bStatusNumeric.getStatus();
} else if (bValue.getType() == BStatusBoolean.TYPE) {
BStatusBoolean bStatusBoolean = (BStatusBoolean)bValue;
this.plugin.endAttr().startArray("s").start("p").attr("n", "value").attr("v", BBoolean.encode(bStatusBoolean.getValue()));
this.encodingSlot(bStatusBoolean, BStatusBoolean.value);
this.encodingValue(bStatusBoolean.get(BStatusBoolean.value), ValueDocEncoder.getMergedContext(bStatusBoolean, BStatusBoolean.value, this.getContext()));
this.plugin.end();
bStatus = bStatusBoolean.getStatus();
} else if (bValue.getType() == BStatusEnum.TYPE) {
BStatusEnum bStatusEnum = (BStatusEnum)bValue;
this.plugin.endAttr().startArray("s").start("p").attr("n", "value").attr("v", bStatusEnum.getValue().encodeToString());
this.encodingSlot(bStatusEnum, BStatusEnum.value);
this.encodingValue(bStatusEnum.get(BStatusEnum.value), ValueDocEncoder.getMergedContext(bStatusEnum, BStatusEnum.value, this.getContext()));
this.plugin.end();
bStatus = bStatusEnum.getStatus();
} else if (bValue.getType() == BStatusString.TYPE) {
BStatusString bStatusString = (BStatusString)bValue;
this.plugin.endAttr().startArray("s").start("p").attr("n", "value").attrSafe("v", bStatusString.getValue());
this.encodingSlot(bStatusString, BStatusString.value);
this.encodingValue(bStatusString.get(BStatusString.value), ValueDocEncoder.getMergedContext(bStatusString, BStatusString.value, this.getContext()));
this.plugin.end();
bStatus = bStatusString.getStatus();
} else {
return false;
}
if (!bStatus.equals(BStatus.DEFAULT)) {
this.plugin.start("p").attr("n", "status").attrSafe("v", bStatus.encodeToString());
this.encodingSlot(bValue.asComplex(), BStatusValue.status);
this.encodingValue(bStatus, ValueDocEncoder.getMergedContext(bValue.asComplex(), BStatusValue.status, this.getContext()));
this.plugin.end();
}
this.plugin.endArray().end("p").newLine();
return true;
}
public BPermissions getPermissionsFor(BComponent bComponent) {
BPermissions bPermissions;
if (this.context == null) {
return BPermissions.all;
}
BUser bUser = this.context.getUser();
if (bUser == null) {
return BPermissions.all;
}
if (this.permissionsCache == null) {
this.permissionsCache = new HashMap();
}
if ((bPermissions = (BPermissions)this.permissionsCache.get(bComponent)) == null) {
bPermissions = bComponent.getPermissions(this.context);
this.permissionsCache.put(bComponent, bPermissions);
}
return bPermissions;
}
private final int getSecurityMask(BPermissions bPermissions, Slot slot, BValue bValue, int n) {
boolean bl = false;
boolean bl2 = false;
if (slot.isProperty() && bValue.isComponent()) {
if (!this.getPermissionsFor(bValue.asComponent()).has(BPermissions.operatorRead)) {
bl = true;
}
} else if (slot.isAction()) {
if ((n & 0x100) != 0) {
if (!bPermissions.has(BPermissions.operatorInvoke)) {
bl = true;
}
} else if (!bPermissions.has(BPermissions.adminInvoke)) {
bl = true;
}
} else if ((n & 0x100) != 0) {
if (!bPermissions.has(BPermissions.operatorRead)) {
bl = true;
} else if (!bPermissions.has(BPermissions.operatorWrite)) {
bl2 = true;
}
} else if (!bPermissions.has(BPermissions.adminRead)) {
bl = true;
} else if (!bPermissions.has(BPermissions.adminWrite)) {
bl2 = true;
}
int n2 = 0;
if (bl) {
n2 |= 1;
}
if (bl2) {
n2 |= 2;
}
return n2;
}
private final ValueDocEncoder wname(String string) throws IOException {
this.plugin.attr("n", string);
return this;
}
private final ValueDocEncoder wtype(BObject bObject) throws IOException {
this.plugin.encodeType(bObject.getType());
return this;
}
private final ValueDocEncoder wtype(Type type) throws IOException {
this.plugin.encodeType(type);
return this;
}
private final ValueDocEncoder wflags(int n) throws IOException {
this.plugin.attr("f", Flags.encodeToString(n));
return this;
}
private final ValueDocEncoder whandle(Object object) throws IOException {
this.plugin.attr("h", object.toString());
return this;
}
private final ValueDocEncoder wcategories(BCategoryMask bCategoryMask) throws IOException {
this.plugin.attr("c", bCategoryMask.encodeToString());
return this;
}
private final ValueDocEncoder wfacets(BFacets bFacets) throws IOException {
this.encodingFacets(bFacets);
this.plugin.attrSafe("x", bFacets.encodeToString());
return this;
}
private final ValueDocEncoder wvalue(BSimple bSimple) throws IOException {
try {
String string = this.encodeSimple(bSimple);
this.plugin.attrSafe("v", string);
}
catch (Exception exception) {
String string = "?";
try {
string = bSimple.toString();
}
catch (Exception exception2) {}
log.error("Encoding " + bSimple.getType() + " \"" + string + '\"', exception);
this.plugin.attr("err", bSimple.getType() + ".encodeToString()");
}
return this;
}
protected String encodeSimple(BSimple bSimple) throws IOException {
if (bSimple instanceof BIContextEncodable) {
return ((BIContextEncodable)((Object)bSimple)).encodeToString(this.context);
}
return bSimple.encodeToString();
}
public boolean isTypeBlackListed(Type type) {
return false;
}
private final /* synthetic */ void this() {
this.encodeComments = true;
}
public ValueDocEncoder(IEncoderPlugin iEncoderPlugin) throws IOException {
this.this();
this.plugin = iEncoderPlugin;
}
public ValueDocEncoder(IEncoderPlugin iEncoderPlugin, Context context) throws IOException {
this.this();
this.plugin = iEncoderPlugin;
this.context = context;
}
public ValueDocEncoder(File file) throws IOException {
this(new BogEncoderPlugin(file));
}
public ValueDocEncoder(OutputStream outputStream) throws IOException {
this(new BogEncoderPlugin(outputStream));
}
public ValueDocEncoder(File file, Context context) throws IOException {
this(new BogEncoderPlugin(file), context);
}
public ValueDocEncoder(OutputStream outputStream, Context context) throws IOException {
this(new BogEncoderPlugin(outputStream), context);
}
static {
try {
nullProxyExt = Sys.getRegistry().getType("control:NullProxyExt");
}
catch (Exception exception) {}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public static final class BogEncoderPlugin
implements IEncoderPlugin {
protected int indent;
private XWriter w;
private HashMap modules;
private HashMap keys;
public final IEncoderPlugin encodeDocument(ValueDocEncoder valueDocEncoder, BValue bValue) throws IOException {
this.w.w((Object)"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
this.w.w((Object)"<bajaObjectGraph version=\"1.0\">\n");
valueDocEncoder.encode(bValue);
this.w.w((Object)"</bajaObjectGraph>\n");
return this;
}
public final IEncoderPlugin start(String string) throws IOException {
this.w.w((Object)"<").w((Object)string);
return this;
}
public final IEncoderPlugin startArray(String string) throws IOException {
return this;
}
public final IEncoderPlugin endArray() throws IOException {
return this;
}
public final IEncoderPlugin end() throws IOException {
this.w.w((Object)"/>");
return this;
}
public final IEncoderPlugin end(String string) throws IOException {
this.w.w((Object)"</").w((Object)string).w((Object)">");
return this;
}
public final IEncoderPlugin endAttr() throws IOException {
this.w.w((Object)">");
return this;
}
public final IEncoderPlugin newLine() throws IOException {
this.w.w((Object)"\n");
return this;
}
public final IEncoderPlugin key(String string) throws IOException {
return this;
}
public final IEncoderPlugin attr(String string, boolean bl) throws IOException {
this.attr(string, String.valueOf(bl));
return this;
}
public final IEncoderPlugin attr(String string, double d) throws IOException {
this.attr(string, String.valueOf(d));
return this;
}
public final IEncoderPlugin attr(String string, String string2) throws IOException {
this.w.w((Object)" ").w((Object)string).w((Object)"=\"").w((Object)string2).w((Object)"\"");
return this;
}
public final IEncoderPlugin attrSafe(String string, String string2) throws IOException {
this.w.w((Object)" ").w((Object)string).w((Object)"=\"").safe(string2).w((Object)"\"");
return this;
}
public final IEncoderPlugin value(String string) throws IOException {
return this;
}
public final IEncoderPlugin comment(String string) throws IOException {
this.w.w((Object)"<!-- ").w((Object)string).w((Object)" -->\n");
return this;
}
public final IEncoderPlugin incrementIndent() throws IOException {
++this.indent;
return this;
}
public final IEncoderPlugin decrementIndent() throws IOException {
--this.indent;
return this;
}
public final IEncoderPlugin indent() throws IOException {
this.w.indent(this.indent);
return this;
}
public final int getIndent() {
return this.indent;
}
public final IEncoderPlugin encodeType(Type type) throws IOException {
BModule bModule = type.getModule();
String string = (String)this.modules.get(bModule.getModuleName());
if (string == null) {
string = this.newModuleKey(bModule);
this.attr("m", string + '=' + bModule.getModuleName());
}
this.attr("t", string + ':' + type.getTypeName());
return this;
}
public final void flush() throws IOException {
this.w.flush();
}
public final void close() throws IOException {
this.w.close();
}
public final boolean isZipped() {
return this.w.isZipped();
}
public final void setZipped(boolean bl) throws IOException {
this.w.setZipped(bl);
}
private final String newModuleKey(BModule bModule) {
String string = bModule.getPreferredSymbol();
int n = 0;
while (this.keys.get(string) != null) {
string = "" + string.charAt(0) + n;
++n;
}
this.keys.put(string, string);
this.modules.put(bModule.getModuleName(), string);
return string;
}
public static final String marshal(BValue bValue) throws IOException {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ValueDocEncoder valueDocEncoder = new ValueDocEncoder(new BogEncoderPlugin(byteArrayOutputStream));
valueDocEncoder.encode(bValue);
valueDocEncoder.close();
return new String(byteArrayOutputStream.toByteArray());
}
public final XWriter getWriter() {
return this.w;
}
private final /* synthetic */ void this() {
this.indent = 0;
this.modules = new HashMap(33);
this.keys = new HashMap(33);
}
public BogEncoderPlugin(File file) throws IOException {
this.this();
this.w = new XWriter(file);
}
public BogEncoderPlugin(OutputStream outputStream) throws IOException {
this.this();
this.w = new XWriter(outputStream);
}
}
public static interface IEncoderPlugin {
public IEncoderPlugin encodeDocument(ValueDocEncoder var1, BValue var2) throws IOException;
public IEncoderPlugin start(String var1) throws IOException;
public IEncoderPlugin startArray(String var1) throws IOException;
public IEncoderPlugin endArray() throws IOException;
public IEncoderPlugin end() throws IOException;
public IEncoderPlugin end(String var1) throws IOException;
public IEncoderPlugin endAttr() throws IOException;
public IEncoderPlugin key(String var1) throws IOException;
public IEncoderPlugin attr(String var1, boolean var2) throws IOException;
public IEncoderPlugin attr(String var1, double var2) throws IOException;
public IEncoderPlugin attr(String var1, String var2) throws IOException;
public IEncoderPlugin attrSafe(String var1, String var2) throws IOException;
public IEncoderPlugin value(String var1) throws IOException;
public IEncoderPlugin comment(String var1) throws IOException;
public IEncoderPlugin incrementIndent() throws IOException;
public IEncoderPlugin decrementIndent() throws IOException;
public IEncoderPlugin indent() throws IOException;
public int getIndent();
public IEncoderPlugin newLine() throws IOException;
public IEncoderPlugin encodeType(Type var1) throws IOException;
public void flush() throws IOException;
public void close() throws IOException;
public boolean isZipped();
public void setZipped(boolean var1) throws IOException;
}
}
@@ -0,0 +1,24 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.io.net;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
public interface IClientSocketFactory {
public Socket createSocket(InetAddress var1, int var2) throws IOException;
public Socket createSocket(InetAddress var1, int var2, int var3) throws IOException;
public Socket createSocket(InetAddress var1, int var2, InetAddress var3, int var4) throws IOException;
public Socket createSocket(String var1, int var2) throws IOException, UnknownHostException;
public Socket createSocket(String var1, int var2, int var3) throws IOException, UnknownHostException;
public Socket createSocket(String var1, int var2, InetAddress var3, int var4) throws IOException, UnknownHostException;
}
@@ -0,0 +1,17 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.io.net;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
public interface IServerSocketFactory {
public ServerSocket createServerSocket(int var1) throws IOException;
public ServerSocket createServerSocket(int var1, int var2) throws IOException;
public ServerSocket createServerSocket(int var1, int var2, InetAddress var3) throws IOException;
}
@@ -0,0 +1,13 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.io.net;
import javax.baja.io.net.IClientSocketFactory;
import javax.baja.io.net.IServerSocketFactory;
public interface ISocketFactory
extends IClientSocketFactory,
IServerSocketFactory {
}