link start!
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import com.tridium.asm.Assembler;
|
||||
import com.tridium.asm.Code;
|
||||
import com.tridium.asm.ConstantPool;
|
||||
import com.tridium.asm.MethodInfo;
|
||||
import com.tridium.asm.OpCodes;
|
||||
import com.tridium.sys.module.AutoClassLoader;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.HashMap;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class AbstractStubGen
|
||||
implements OpCodes {
|
||||
public static final HashMap cache = new HashMap();
|
||||
Class cls;
|
||||
Assembler asm;
|
||||
ConstantPool cp;
|
||||
int init;
|
||||
static /* synthetic */ Class class$javax$baja$sys$BObject;
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public static Class getConcreteClass(Class clazz) throws Exception {
|
||||
if (!AbstractStubGen.isAbstract(clazz) && !clazz.isInterface()) {
|
||||
return clazz;
|
||||
}
|
||||
HashMap hashMap = cache;
|
||||
synchronized (hashMap) {
|
||||
Class clazz2 = (Class)cache.get(clazz);
|
||||
if (clazz2 == null) {
|
||||
clazz2 = new AbstractStubGen(clazz).generate();
|
||||
cache.put(clazz, clazz2);
|
||||
}
|
||||
return clazz2;
|
||||
}
|
||||
}
|
||||
|
||||
public Class generate() throws Exception {
|
||||
Object object;
|
||||
String string = null;
|
||||
if (!this.cls.isInterface()) {
|
||||
object = this.cls.getName().replace('.', '/');
|
||||
string = "auto/" + (String)object + "Stub";
|
||||
int n = 33;
|
||||
this.asm = new Assembler(string, (String)object, n, null);
|
||||
this.cp = this.asm.cp;
|
||||
} else {
|
||||
Class clazz = class$javax$baja$sys$BObject;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$sys$BObject = AbstractStubGen.class("[Ljavax.baja.sys.BObject;", false);
|
||||
}
|
||||
object = clazz.getName().replace('.', '/');
|
||||
string = "auto/" + this.cls.getName().replace('.', '/') + "BObjectStub";
|
||||
String[] stringArray = new String[]{this.cls.getName().replace('.', '/')};
|
||||
int n = 33;
|
||||
this.asm = new Assembler(string, (String)object, n, stringArray);
|
||||
this.cp = this.asm.cp;
|
||||
}
|
||||
this.genConstants();
|
||||
this.genConstructor();
|
||||
object = AutoClassLoader.load(this.cls, string.replace('/', '.'), this.asm.compile());
|
||||
return object;
|
||||
}
|
||||
|
||||
private final void genConstants() {
|
||||
this.init = this.cp.utf("<init>");
|
||||
}
|
||||
|
||||
private final void genConstructor() {
|
||||
Code code = new Code(this.asm);
|
||||
code.add(42);
|
||||
code.add(183, code.cp.method(this.asm.superClass, this.init, "()V"));
|
||||
code.add(177);
|
||||
this.asm.addMethod(new MethodInfo(this.asm, this.init, "()V", 1, code));
|
||||
}
|
||||
|
||||
public static boolean isAbstract(Class clazz) {
|
||||
return Modifier.isAbstract(clazz.getModifiers());
|
||||
}
|
||||
|
||||
public static boolean isAbstract(Method method) {
|
||||
return Modifier.isAbstract(method.getModifiers());
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public AbstractStubGen(Class clazz) {
|
||||
this.cls = clazz;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import java.util.ListIterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class ArrayIterator
|
||||
implements ListIterator {
|
||||
private Object[] array;
|
||||
private int first;
|
||||
private int size;
|
||||
private int carat;
|
||||
|
||||
public void add(Object object) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
boolean bl = false;
|
||||
if (this.carat < this.first + this.size) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public boolean hasPrevious() {
|
||||
boolean bl = false;
|
||||
if (this.carat > this.first) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public Object next() throws NoSuchElementException {
|
||||
if (!this.hasNext()) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
return this.array[this.carat++];
|
||||
}
|
||||
|
||||
public int nextIndex() {
|
||||
return this.carat - this.first;
|
||||
}
|
||||
|
||||
public Object previous() throws NoSuchElementException {
|
||||
if (!this.hasPrevious()) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
return this.array[--this.carat];
|
||||
}
|
||||
|
||||
public int previousIndex() {
|
||||
if (this.carat == this.first) {
|
||||
return -1;
|
||||
}
|
||||
return Math.min(this.first + this.size - 1, this.carat - this.first - 1);
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void set(Object object) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.first = 0;
|
||||
this.size = 0;
|
||||
this.carat = 0;
|
||||
}
|
||||
|
||||
public ArrayIterator(Object[] objectArray) {
|
||||
this(objectArray, 0, objectArray.length);
|
||||
}
|
||||
|
||||
public ArrayIterator(Object[] objectArray, int n, int n2) {
|
||||
this.this();
|
||||
if (objectArray == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (n < 0 || n2 > objectArray.length) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.array = objectArray;
|
||||
this.first = n;
|
||||
this.size = n2;
|
||||
this.carat = n;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ArrayUtil {
|
||||
public static int indexOf(Object[] objectArray, Object object) {
|
||||
int n = 0;
|
||||
while (n < objectArray.length) {
|
||||
if (objectArray[n] == object) {
|
||||
return n;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static Object[] grow(Object[] objectArray, int n) {
|
||||
if (objectArray.length < n) {
|
||||
Class<?> clazz = objectArray.getClass().getComponentType();
|
||||
int n2 = Math.max(objectArray.length * 2, n);
|
||||
Object[] objectArray2 = (Object[])Array.newInstance(clazz, n2);
|
||||
System.arraycopy(objectArray, 0, objectArray2, 0, objectArray.length);
|
||||
objectArray = objectArray2;
|
||||
}
|
||||
return objectArray;
|
||||
}
|
||||
|
||||
public static Object[] put(Object[] objectArray, int n, Object object) {
|
||||
objectArray = ArrayUtil.grow(objectArray, n + 1);
|
||||
objectArray[n] = object;
|
||||
return objectArray;
|
||||
}
|
||||
|
||||
public static boolean remove(Object[] objectArray, int n, Object object) {
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
if (objectArray[n2] == object) {
|
||||
if (n2 < objectArray.length) {
|
||||
System.arraycopy(objectArray, n2 + 1, objectArray, n2, objectArray.length - n2 - 1);
|
||||
}
|
||||
objectArray[n - 1] = null;
|
||||
return true;
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Object[] addOne(Object[] objectArray, Object object) {
|
||||
Class<?> clazz = objectArray.getClass().getComponentType();
|
||||
Object[] objectArray2 = (Object[])Array.newInstance(clazz, objectArray.length + 1);
|
||||
System.arraycopy(objectArray, 0, objectArray2, 0, objectArray.length);
|
||||
objectArray2[objectArray.length] = object;
|
||||
return objectArray2;
|
||||
}
|
||||
|
||||
public static Object[] removeOne(Object[] objectArray, Object object) {
|
||||
int n = objectArray.length;
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
if (objectArray[n2] == object) {
|
||||
return ArrayUtil.removeOne(objectArray, n2);
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public static Object[] removeOne(Object[] objectArray, int n) {
|
||||
Class<?> clazz = objectArray.getClass().getComponentType();
|
||||
Object[] objectArray2 = (Object[])Array.newInstance(clazz, objectArray.length - 1);
|
||||
System.arraycopy(objectArray, 0, objectArray2, 0, n);
|
||||
System.arraycopy(objectArray, n + 1, objectArray2, n, objectArray.length - n - 1);
|
||||
return objectArray2;
|
||||
}
|
||||
|
||||
public static Object[] toTop(Object[] objectArray, int n) {
|
||||
ArrayList<Object> arrayList = new ArrayList<Object>();
|
||||
int n2 = 0;
|
||||
while (n2 < objectArray.length) {
|
||||
if (n2 != n) {
|
||||
arrayList.add(objectArray[n2]);
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
arrayList.add(0, objectArray[n]);
|
||||
return arrayList.toArray(objectArray);
|
||||
}
|
||||
|
||||
public static Object[] toBottom(Object[] objectArray, int n) {
|
||||
ArrayList<Object> arrayList = new ArrayList<Object>();
|
||||
int n2 = 0;
|
||||
while (n2 < objectArray.length) {
|
||||
if (n2 != n) {
|
||||
arrayList.add(objectArray[n2]);
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
arrayList.add(objectArray[n]);
|
||||
return arrayList.toArray(objectArray);
|
||||
}
|
||||
|
||||
public static int indexOf(int[] nArray, int n) {
|
||||
int n2 = 0;
|
||||
while (n2 < nArray.length) {
|
||||
if (nArray[n2] == n) {
|
||||
return n2;
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int[] grow(int[] nArray, int n) {
|
||||
if (nArray.length < n) {
|
||||
int n2 = Math.max(nArray.length * 2, n);
|
||||
int[] nArray2 = new int[n2];
|
||||
System.arraycopy(nArray, 0, nArray2, 0, nArray.length);
|
||||
nArray = nArray2;
|
||||
}
|
||||
return nArray;
|
||||
}
|
||||
|
||||
public static int[] put(int[] nArray, int n, int n2) {
|
||||
nArray = ArrayUtil.grow(nArray, n + 1);
|
||||
nArray[n] = n2;
|
||||
return nArray;
|
||||
}
|
||||
|
||||
public static boolean remove(int[] nArray, int n, int n2) {
|
||||
int n3 = 0;
|
||||
while (n3 < n) {
|
||||
if (nArray[n3] == n2) {
|
||||
if (n3 < nArray.length) {
|
||||
System.arraycopy(nArray, n3 + 1, nArray, n3, nArray.length - n3 - 1);
|
||||
}
|
||||
nArray[n - 1] = -1;
|
||||
return true;
|
||||
}
|
||||
++n3;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int[] addOne(int[] nArray, int n) {
|
||||
int[] nArray2 = new int[nArray.length + 1];
|
||||
System.arraycopy(nArray, 0, nArray2, 0, nArray.length);
|
||||
nArray2[nArray.length] = n;
|
||||
return nArray2;
|
||||
}
|
||||
|
||||
public static int[] removeOne(int[] nArray, int n) {
|
||||
int[] nArray2 = new int[nArray.length - 1];
|
||||
int n2 = nArray.length;
|
||||
int n3 = 0;
|
||||
while (n3 < n2) {
|
||||
if (nArray[n3] == n) {
|
||||
System.arraycopy(nArray, 0, nArray2, 0, n3);
|
||||
System.arraycopy(nArray, n3 + 1, nArray2, n3, n2 - n3 - 1);
|
||||
return nArray2;
|
||||
}
|
||||
++n3;
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public static int[] removeOneIndex(int[] nArray, int n) {
|
||||
int[] nArray2 = new int[nArray.length - 1];
|
||||
System.arraycopy(nArray, 0, nArray2, 0, n);
|
||||
System.arraycopy(nArray, n + 1, nArray2, n, nArray.length - n - 1);
|
||||
return nArray2;
|
||||
}
|
||||
|
||||
public static void sort(int[] nArray) {
|
||||
int n = nArray.length;
|
||||
int n2 = n / 2;
|
||||
while (n2 >= 1) {
|
||||
int n3 = n2;
|
||||
while (n3 < n) {
|
||||
int n4 = nArray[n3];
|
||||
int n5 = n3;
|
||||
while (n5 >= n2 && n4 < nArray[n5 - n2]) {
|
||||
nArray[n5] = nArray[n5 - n2];
|
||||
n5 -= n2;
|
||||
}
|
||||
nArray[n5] = n4;
|
||||
++n3;
|
||||
}
|
||||
n2 /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
public static int binarySearch(int[] nArray, int n) {
|
||||
int n2 = nArray.length;
|
||||
int n3 = -1;
|
||||
int n4 = n2;
|
||||
while (n4 - n3 > 1) {
|
||||
int n5 = (n4 + n3) / 2;
|
||||
int n6 = nArray[n5];
|
||||
if (n6 > n) {
|
||||
n4 = n5;
|
||||
continue;
|
||||
}
|
||||
if (n6 < n) {
|
||||
n3 = n5;
|
||||
continue;
|
||||
}
|
||||
return n5;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int[] orderCircular(int[] nArray, int n) {
|
||||
int n2 = nArray.length;
|
||||
int[] nArray2 = new int[n2];
|
||||
int n3 = n2 - n;
|
||||
int n4 = n;
|
||||
if (n3 > 0) {
|
||||
System.arraycopy(nArray, n, nArray2, 0, n3);
|
||||
}
|
||||
if (n4 > 0) {
|
||||
System.arraycopy(nArray, 0, nArray2, n3, n4);
|
||||
}
|
||||
return nArray2;
|
||||
}
|
||||
|
||||
public static Object[] add(Object[] objectArray, Object[] objectArray2) {
|
||||
Class<?> clazz = objectArray.getClass().getComponentType();
|
||||
Object[] objectArray3 = (Object[])Array.newInstance(clazz, objectArray.length + objectArray2.length);
|
||||
System.arraycopy(objectArray, 0, objectArray3, 0, objectArray.length);
|
||||
System.arraycopy(objectArray2, 0, objectArray3, objectArray.length, objectArray2.length);
|
||||
return objectArray3;
|
||||
}
|
||||
|
||||
public static String join(Object[] objectArray, String string) {
|
||||
if (objectArray == null || objectArray.length <= 0) {
|
||||
return "";
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
int n = 0;
|
||||
while (n < objectArray.length) {
|
||||
if (n > 0) {
|
||||
stringBuffer.append(string);
|
||||
}
|
||||
stringBuffer.append(objectArray[n].toString());
|
||||
++n;
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,308 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.Array
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.StringTokenizer;
|
||||
import javax.baja.file.BAbstractFile;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BScopedFileSpace;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.naming.UnresolvedException;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.user.BUser;
|
||||
import javax.baja.util.LexiconText;
|
||||
import javax.baja.util.PatternFilter;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BRestrictedFileSpace
|
||||
extends BScopedFileSpace {
|
||||
public static final Type TYPE;
|
||||
public static final BRestrictedFileSpace INSTANCE;
|
||||
private static final FilePath STATION_HOME_SCOPE;
|
||||
private static String SYS_HOME_CANONICAL_PATH;
|
||||
private static String STATION_HOME_CANONICAL_PATH;
|
||||
private static int SYS_HOME_CANONICAL_PATH_LENGTH;
|
||||
private static int STATION_HOME_CANONICAL_PATH_LENGTH;
|
||||
private static PatternFilter[] FILE_NAME_BLACKLIST;
|
||||
private static Array FILE_PATH_BLACKLIST;
|
||||
static /* synthetic */ Class class$com$tridium$util$BRestrictedFileSpace;
|
||||
static /* synthetic */ Class class$java$lang$String;
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public final boolean inScope(FilePath filePath) {
|
||||
return super.inScope(filePath);
|
||||
}
|
||||
|
||||
public final boolean isBlacklisted(BIFile bIFile) {
|
||||
if (bIFile == null) {
|
||||
return false;
|
||||
}
|
||||
return this.isBlacklistedFilePath(bIFile.getFilePath());
|
||||
}
|
||||
|
||||
private final boolean isBlacklistedFilePath(FilePath filePath) {
|
||||
Object object;
|
||||
Object object2;
|
||||
Object object3;
|
||||
String string = null;
|
||||
File file = null;
|
||||
try {
|
||||
file = BFileSystem.INSTANCE.pathToLocalFile(filePath).getCanonicalFile();
|
||||
string = file.getName();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return true;
|
||||
}
|
||||
if (string != null) {
|
||||
object3 = string.toLowerCase();
|
||||
if (((String)object3).startsWith("config") && ((String)object3).endsWith(".bog") || ((String)object3).equals("config.bog.lock") || ((String)object3).equals("config.bog.working")) {
|
||||
return true;
|
||||
}
|
||||
if (((String)object3).endsWith(".properties")) {
|
||||
object2 = BFileSystem.INSTANCE.getStationHome();
|
||||
if (object2 == null) {
|
||||
return true;
|
||||
}
|
||||
object = filePath;
|
||||
boolean bl = false;
|
||||
while (object != null) {
|
||||
BIFile bIFile = null;
|
||||
try {
|
||||
bIFile = BFileSystem.INSTANCE.resolveFile((FilePath)object);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
bIFile = null;
|
||||
}
|
||||
if (bIFile != null) {
|
||||
if (((BAbstractFile)object2).equals(bIFile)) {
|
||||
bl = true;
|
||||
break;
|
||||
}
|
||||
object = bIFile.getFilePath().getParent();
|
||||
continue;
|
||||
}
|
||||
object = ((FilePath)object).getParent();
|
||||
}
|
||||
if (!bl) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (FILE_NAME_BLACKLIST != null) {
|
||||
int n = 0;
|
||||
while (n < FILE_NAME_BLACKLIST.length) {
|
||||
if (FILE_NAME_BLACKLIST[n].accept(string)) {
|
||||
return true;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (FILE_PATH_BLACKLIST != null) {
|
||||
object3 = filePath;
|
||||
try {
|
||||
object2 = file.getCanonicalPath();
|
||||
if (filePath.isStationHomeAbsolute()) {
|
||||
if (STATION_HOME_CANONICAL_PATH_LENGTH == -1) {
|
||||
STATION_HOME_CANONICAL_PATH = Sys.getStationHome().getCanonicalPath();
|
||||
STATION_HOME_CANONICAL_PATH_LENGTH = STATION_HOME_CANONICAL_PATH.length() + 1;
|
||||
}
|
||||
if (!((String)object2).equalsIgnoreCase(STATION_HOME_CANONICAL_PATH)) {
|
||||
object3 = new FilePath(filePath.getScheme(), "^" + ((String)object2).substring(STATION_HOME_CANONICAL_PATH_LENGTH).replace(File.separatorChar, '/'));
|
||||
}
|
||||
} else if (filePath.isSysHomeAbsolute()) {
|
||||
if (SYS_HOME_CANONICAL_PATH_LENGTH == -1) {
|
||||
SYS_HOME_CANONICAL_PATH = Sys.getBajaHome().getCanonicalPath();
|
||||
SYS_HOME_CANONICAL_PATH_LENGTH = SYS_HOME_CANONICAL_PATH.length() + 1;
|
||||
}
|
||||
if (!((String)object2).equalsIgnoreCase(SYS_HOME_CANONICAL_PATH)) {
|
||||
object3 = new FilePath(filePath.getScheme(), "!" + ((String)object2).substring(SYS_HOME_CANONICAL_PATH_LENGTH).replace(File.separatorChar, '/'));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return true;
|
||||
}
|
||||
object2 = null;
|
||||
while (object3 != null) {
|
||||
object = ((FilePath)object3).getBody().toLowerCase();
|
||||
if (FILE_PATH_BLACKLIST.contains(object)) {
|
||||
return true;
|
||||
}
|
||||
if (((String)object).equals("!stations") && object2 != null && !((String)object2).equalsIgnoreCase(Sys.getStation().getStationName())) {
|
||||
return true;
|
||||
}
|
||||
object2 = ((FilePath)object3).getName();
|
||||
object3 = ((FilePath)object3).getParent();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unable to fully structure code
|
||||
*/
|
||||
public final boolean isBlacklistedForUser(BUser var1_1, BIFile var2_2) {
|
||||
var3_3 = var2_2.getFilePath();
|
||||
var4_4 = null;
|
||||
var5_5 = null;
|
||||
try {
|
||||
var5_5 = BFileSystem.INSTANCE.pathToLocalFile(var3_3).getCanonicalFile();
|
||||
var4_4 = var5_5.getName();
|
||||
}
|
||||
catch (Exception var6_6) {
|
||||
return true;
|
||||
}
|
||||
if (var4_4 != null && (var6_7 = var4_4.toLowerCase()).endsWith(".dist") && !(var7_9 = var1_1.getPermissionsFor(var2_2)).hasAdminRead()) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
if (var3_3.isStationHomeAbsolute()) {
|
||||
var6_7 = var5_5.getCanonicalPath();
|
||||
if (BRestrictedFileSpace.STATION_HOME_CANONICAL_PATH_LENGTH < 0) {
|
||||
BRestrictedFileSpace.STATION_HOME_CANONICAL_PATH = Sys.getStationHome().getCanonicalPath();
|
||||
BRestrictedFileSpace.STATION_HOME_CANONICAL_PATH_LENGTH = BRestrictedFileSpace.STATION_HOME_CANONICAL_PATH.length() + 1;
|
||||
}
|
||||
if (!var6_7.equalsIgnoreCase(BRestrictedFileSpace.STATION_HOME_CANONICAL_PATH)) {
|
||||
var3_3 = new FilePath(var3_3.getScheme(), "^" + var6_7.substring(BRestrictedFileSpace.STATION_HOME_CANONICAL_PATH_LENGTH).replace(File.separatorChar, '/'));
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (true) ** GOTO lbl31
|
||||
}
|
||||
catch (Exception var6_8) {
|
||||
return true;
|
||||
}
|
||||
do {
|
||||
if ((var6_7 = var3_3.getBody().toLowerCase()).equals("^provisioningniagara")) {
|
||||
var7_9 = var1_1.getPermissionsFor(var2_2);
|
||||
if (var7_9.hasAdminRead()) break;
|
||||
return true;
|
||||
}
|
||||
var3_3 = var3_3.getParent();
|
||||
lbl31:
|
||||
// 2 sources
|
||||
|
||||
} while (var3_3 != null);
|
||||
return false;
|
||||
}
|
||||
|
||||
public final BPermissions getPermissionsFor(FilePath filePath, Context context) {
|
||||
if (this.inScope(filePath)) {
|
||||
return super.getPermissionsFor(filePath, context);
|
||||
}
|
||||
return BPermissions.none;
|
||||
}
|
||||
|
||||
protected final FilePath scopedPathToAbsPath(FilePath filePath) {
|
||||
switch (filePath.getAbsoluteMode()) {
|
||||
case 0: {
|
||||
return STATION_HOME_SCOPE.merge(filePath);
|
||||
}
|
||||
case 2: {
|
||||
return STATION_HOME_SCOPE.merge(new FilePath(filePath.getScheme(), filePath.getBody().substring(1)));
|
||||
}
|
||||
case 3:
|
||||
case 4: {
|
||||
if (!this.inScope(filePath)) break;
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public final BIFile makeFile(FilePath filePath, Context context) throws IOException {
|
||||
if (this.isBlacklistedFilePath(filePath)) {
|
||||
throw new UnresolvedException("File path is out of scope: " + filePath.getBody());
|
||||
}
|
||||
return super.makeFile(filePath, context);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private BRestrictedFileSpace() {
|
||||
super(new FilePath("!"), "remoteFileSpace", LexiconText.make("baja", "nav.stationHome"));
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$util$BRestrictedFileSpace;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$util$BRestrictedFileSpace = BRestrictedFileSpace.class("[Lcom.tridium.util.BRestrictedFileSpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
INSTANCE = new BRestrictedFileSpace();
|
||||
STATION_HOME_SCOPE = new FilePath("^");
|
||||
SYS_HOME_CANONICAL_PATH = null;
|
||||
STATION_HOME_CANONICAL_PATH = null;
|
||||
SYS_HOME_CANONICAL_PATH_LENGTH = -1;
|
||||
STATION_HOME_CANONICAL_PATH_LENGTH = -1;
|
||||
FILE_NAME_BLACKLIST = null;
|
||||
FILE_PATH_BLACKLIST = null;
|
||||
String string = System.getProperty("niagara.remoteBlacklist.fileNamePatterns", null);
|
||||
if (string != null) {
|
||||
try {
|
||||
FILE_NAME_BLACKLIST = PatternFilter.parseList(string, ";");
|
||||
}
|
||||
catch (Exception exception) {
|
||||
System.out.println("Could not parse file name patterns for remote blacklist.");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
String string2 = System.getProperty("niagara.remoteBlacklist.filePaths", null);
|
||||
Class clazz2 = class$java$lang$String;
|
||||
if (clazz2 == null) {
|
||||
clazz2 = class$java$lang$String = BRestrictedFileSpace.class("[Ljava.lang.String;", false);
|
||||
}
|
||||
FILE_PATH_BLACKLIST = new Array(clazz2);
|
||||
FILE_PATH_BLACKLIST.add((Object)"!backups");
|
||||
FILE_PATH_BLACKLIST.add((Object)"!bin");
|
||||
FILE_PATH_BLACKLIST.add((Object)"!daemon");
|
||||
FILE_PATH_BLACKLIST.add((Object)"!files");
|
||||
FILE_PATH_BLACKLIST.add((Object)"!jre");
|
||||
FILE_PATH_BLACKLIST.add((Object)"!modules");
|
||||
FILE_PATH_BLACKLIST.add((Object)"!registry");
|
||||
FILE_PATH_BLACKLIST.add((Object)"!security");
|
||||
FILE_PATH_BLACKLIST.add((Object)"!users");
|
||||
FILE_PATH_BLACKLIST.add((Object)"!workbench");
|
||||
if (string2 != null) {
|
||||
StringTokenizer stringTokenizer = new StringTokenizer(string2, ";");
|
||||
while (stringTokenizer.hasMoreTokens()) {
|
||||
try {
|
||||
FILE_PATH_BLACKLIST.add((Object)stringTokenizer.nextToken().toLowerCase());
|
||||
}
|
||||
catch (Exception exception) {
|
||||
System.out.println("Could not parse file paths for remote blacklist.");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import javax.baja.status.BStatus;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BRetryableAction
|
||||
extends BComponent {
|
||||
public static final Property status = BRetryableAction.newProperty(3, BStatus.ok, null);
|
||||
public static final Property faultCause = BRetryableAction.newProperty(3, "", BFacets.make("fieldWidth", 55));
|
||||
public static final Property delay = BRetryableAction.newProperty(0, BRelTime.makeSeconds(30), BFacets.make("min", BRelTime.DEFAULT));
|
||||
public static final Property retryInterval = BRetryableAction.newProperty(0, BRelTime.makeMinutes(5), BFacets.make("min", BRelTime.makeSeconds(15)));
|
||||
public static final Property lastSuccess = BRetryableAction.newProperty(1, BAbsTime.NULL, BFacets.make("showSeconds", true));
|
||||
public static final Property lastAttempt = BRetryableAction.newProperty(1, BAbsTime.NULL, BFacets.make("showSeconds", true));
|
||||
public static final Property nextExecuteTime = BRetryableAction.newProperty(1, BAbsTime.NULL, BFacets.make("showSeconds", true));
|
||||
public static final Action schedule = BRetryableAction.newAction(0, null);
|
||||
public static final Action execute = BRetryableAction.newAction(16, null);
|
||||
public static final Action cancel = BRetryableAction.newAction(0, null);
|
||||
public static final Type TYPE;
|
||||
private Clock.Ticket ticket;
|
||||
static /* synthetic */ Class class$com$tridium$util$BRetryableAction;
|
||||
|
||||
public BStatus getStatus() {
|
||||
return (BStatus)this.get(status);
|
||||
}
|
||||
|
||||
public void setStatus(BStatus bStatus) {
|
||||
this.set(status, (BValue)bStatus, null);
|
||||
}
|
||||
|
||||
public String getFaultCause() {
|
||||
return this.getString(faultCause);
|
||||
}
|
||||
|
||||
public void setFaultCause(String string) {
|
||||
this.setString(faultCause, string, null);
|
||||
}
|
||||
|
||||
public BRelTime getDelay() {
|
||||
return (BRelTime)this.get(delay);
|
||||
}
|
||||
|
||||
public void setDelay(BRelTime bRelTime) {
|
||||
this.set(delay, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public BRelTime getRetryInterval() {
|
||||
return (BRelTime)this.get(retryInterval);
|
||||
}
|
||||
|
||||
public void setRetryInterval(BRelTime bRelTime) {
|
||||
this.set(retryInterval, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public BAbsTime getLastSuccess() {
|
||||
return (BAbsTime)this.get(lastSuccess);
|
||||
}
|
||||
|
||||
public void setLastSuccess(BAbsTime bAbsTime) {
|
||||
this.set(lastSuccess, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public BAbsTime getLastAttempt() {
|
||||
return (BAbsTime)this.get(lastAttempt);
|
||||
}
|
||||
|
||||
public void setLastAttempt(BAbsTime bAbsTime) {
|
||||
this.set(lastAttempt, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public BAbsTime getNextExecuteTime() {
|
||||
return (BAbsTime)this.get(nextExecuteTime);
|
||||
}
|
||||
|
||||
public void setNextExecuteTime(BAbsTime bAbsTime) {
|
||||
this.set(nextExecuteTime, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public void schedule() {
|
||||
this.invoke(schedule, null, null);
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
this.invoke(execute, null, null);
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
this.invoke(cancel, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void stationStarted() throws Exception {
|
||||
super.stationStarted();
|
||||
if (this.isRetryCondition()) {
|
||||
this.schedule();
|
||||
}
|
||||
}
|
||||
|
||||
public final void doSchedule() {
|
||||
BAbsTime bAbsTime = Clock.time();
|
||||
BAbsTime bAbsTime2 = this.getNextExecuteTime();
|
||||
if (bAbsTime2.isNull() || this.ticket.isExpired()) {
|
||||
this.cancelTicket();
|
||||
BAbsTime bAbsTime3 = bAbsTime.add(this.getDelay());
|
||||
this.ticket = Clock.schedule((BComponent)this, bAbsTime3, execute, null);
|
||||
this.setNextExecuteTime(bAbsTime3);
|
||||
}
|
||||
}
|
||||
|
||||
public final void doExecute() {
|
||||
try {
|
||||
this.setLastAttempt(Clock.time());
|
||||
this.cancelTicket();
|
||||
this.doExecution();
|
||||
this.configSuccess();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.configFail(exception);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void doExecution() throws Exception;
|
||||
|
||||
public final void doCancel() {
|
||||
this.stopRetrying();
|
||||
this.canceled();
|
||||
}
|
||||
|
||||
protected void canceled() {
|
||||
}
|
||||
|
||||
protected final void configSuccess() {
|
||||
this.setStatus(BStatus.ok);
|
||||
this.setFaultCause("");
|
||||
this.setNextExecuteTime(BAbsTime.NULL);
|
||||
this.setLastSuccess(Clock.time());
|
||||
}
|
||||
|
||||
private final void configFail(Exception exception) {
|
||||
String string = exception.getMessage();
|
||||
if (string == null) {
|
||||
string = "Execution failed.";
|
||||
exception.printStackTrace();
|
||||
}
|
||||
this.setStatus(BStatus.fault);
|
||||
this.setFaultCause(string);
|
||||
this.scheduleRetry();
|
||||
}
|
||||
|
||||
protected void scheduleRetry() {
|
||||
this.cancelTicket();
|
||||
BAbsTime bAbsTime = Clock.time().add(this.getRetryInterval());
|
||||
this.ticket = Clock.schedule((BComponent)this, bAbsTime, execute, null);
|
||||
this.setNextExecuteTime(bAbsTime);
|
||||
}
|
||||
|
||||
protected final void stopRetrying() {
|
||||
this.cancelTicket();
|
||||
this.setStatus(BStatus.ok);
|
||||
this.setFaultCause("");
|
||||
this.setNextExecuteTime(BAbsTime.NULL);
|
||||
}
|
||||
|
||||
protected final void cancelTicket() {
|
||||
this.ticket.cancel();
|
||||
this.ticket = Clock.expiredTicket;
|
||||
}
|
||||
|
||||
public final boolean isRetryCondition() {
|
||||
boolean bl = false;
|
||||
if (!this.getNextExecuteTime().isNull() || this.getLastAttempt().isAfter(this.getLastSuccess())) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.ticket = Clock.expiredTicket;
|
||||
}
|
||||
|
||||
public BRetryableAction() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$util$BRetryableAction;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$util$BRetryableAction = BRetryableAction.class("[Lcom.tridium.util.BRetryableAction;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import java.net.Socket;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BSessionInfo
|
||||
extends BComponent {
|
||||
public static final Type TYPE;
|
||||
private static Lexicon lex;
|
||||
protected BAbsTime connected;
|
||||
protected String hostname;
|
||||
protected String username;
|
||||
static /* synthetic */ Class class$com$tridium$util$BSessionInfo;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static BSessionInfo make(String string, BAbsTime bAbsTime, Socket socket, String string2) {
|
||||
return new BSessionInfo(string, bAbsTime, string2);
|
||||
}
|
||||
|
||||
public String getHostname() {
|
||||
return this.hostname;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return this.username;
|
||||
}
|
||||
|
||||
public String getConnectedAsMessage(String string) {
|
||||
return lex.getText("session.info.connectedAs", new Object[]{string});
|
||||
}
|
||||
|
||||
public BIcon getLastConnectedIcon() {
|
||||
return BIcon.make(lex.getText("session.info.lastConnected.icon"));
|
||||
}
|
||||
|
||||
public String getLastConnectedMessage() {
|
||||
return lex.getText("session.info.lastConnected", new Object[]{this.connected.toString()});
|
||||
}
|
||||
|
||||
public BIcon getIdentityVerifiedIcon() {
|
||||
return BIcon.make(lex.getText("session.info.identityVerified.icon"));
|
||||
}
|
||||
|
||||
public String getIdentityVerifiedMessage() {
|
||||
return lex.getText("session.info.identityVerified");
|
||||
}
|
||||
|
||||
public BIcon getSessionEncryptedIcon() {
|
||||
return BIcon.make(lex.getText("session.info.sessionEncrypted.icon"));
|
||||
}
|
||||
|
||||
public String getSessionEncryptedMessage() {
|
||||
return lex.getText("session.info.sessionEncrypted", new Object[]{this.hostname});
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.connected = BAbsTime.NULL;
|
||||
this.hostname = null;
|
||||
this.username = null;
|
||||
}
|
||||
|
||||
public BSessionInfo() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
public BSessionInfo(String string, BAbsTime bAbsTime, String string2) {
|
||||
this.this();
|
||||
this.hostname = string;
|
||||
this.connected = bAbsTime;
|
||||
this.username = string2;
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$util$BSessionInfo;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$util$BSessionInfo = BSessionInfo.class("[Lcom.tridium.util.BSessionInfo;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
lex = Lexicon.make("baja");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.BUnrestrictedFolder;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BTempUnrestrictedFolder
|
||||
extends BUnrestrictedFolder {
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$com$tridium$util$BTempUnrestrictedFolder;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void removed(Property property, BValue bValue, Context context) {
|
||||
BComplex bComplex;
|
||||
Property property2;
|
||||
Property[] propertyArray = this.getDynamicPropertiesArray();
|
||||
if ((propertyArray == null || propertyArray.length < 1) && (property2 = this.getPropertyInParent()) != null && !property2.isFrozen() && (bComplex = this.getParent()) instanceof BComponent) {
|
||||
((BComponent)bComplex).remove(property2, null);
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$util$BTempUnrestrictedFolder;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$util$BTempUnrestrictedFolder = BTempUnrestrictedFolder.class("[Lcom.tridium.util.BTempUnrestrictedFolder;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.TextUtil
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import com.tridium.util.StringTable;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class CaseInsensitiveStringTable
|
||||
extends StringTable {
|
||||
String[] origKeys;
|
||||
|
||||
public synchronized void init(String[] stringArray, Object[] objectArray) {
|
||||
if (stringArray.length != objectArray.length) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
int n = this.count = stringArray.length;
|
||||
this.keys = new String[n];
|
||||
String[] stringArray2 = this.keys;
|
||||
this.origKeys = new String[n];
|
||||
String[] stringArray3 = this.origKeys;
|
||||
this.values = new Object[n];
|
||||
Object[] objectArray2 = this.values;
|
||||
System.arraycopy(stringArray, 0, this.keys, 0, n);
|
||||
System.arraycopy(stringArray, 0, this.origKeys, 0, n);
|
||||
System.arraycopy(objectArray, 0, this.values, 0, n);
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
stringArray2[n2] = TextUtil.toLowerCase((String)stringArray2[n2]);
|
||||
++n2;
|
||||
}
|
||||
n2 = n / 2;
|
||||
while (n2 >= 1) {
|
||||
int n3 = n2;
|
||||
while (n3 < n) {
|
||||
String string = stringArray2[n3];
|
||||
String string2 = stringArray3[n3];
|
||||
Object object = objectArray2[n3];
|
||||
int n4 = n3;
|
||||
while (n4 >= n2 && string.compareTo(stringArray2[n4 - n2]) < 0) {
|
||||
stringArray2[n4] = stringArray2[n4 - n2];
|
||||
stringArray3[n4] = stringArray3[n4 - n2];
|
||||
objectArray2[n4] = objectArray2[n4 - n2];
|
||||
n4 -= n2;
|
||||
}
|
||||
stringArray2[n4] = string;
|
||||
stringArray3[n4] = string2;
|
||||
objectArray2[n4] = object;
|
||||
++n3;
|
||||
}
|
||||
n2 /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized Object get(String string) {
|
||||
string = TextUtil.toLowerCase((String)string);
|
||||
String[] stringArray = this.keys;
|
||||
int n = -1;
|
||||
int n2 = this.count;
|
||||
while (n2 - n > 1) {
|
||||
int n3 = (n2 + n) / 2;
|
||||
int n4 = string.compareTo(stringArray[n3]);
|
||||
if (n4 < 0) {
|
||||
n2 = n3;
|
||||
continue;
|
||||
}
|
||||
if (n4 > 0) {
|
||||
n = n3;
|
||||
continue;
|
||||
}
|
||||
return this.values[n3];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized Object put(String string, Object object) {
|
||||
String string2 = string;
|
||||
string = TextUtil.toLowerCase((String)string);
|
||||
if (this.keys.length >= this.count) {
|
||||
this.ensureCapacity(Math.max(8, this.count * 2));
|
||||
}
|
||||
String[] stringArray = this.keys;
|
||||
if (this.count == 0) {
|
||||
Object object2 = this.values[0];
|
||||
stringArray[0] = string;
|
||||
this.origKeys[0] = string2;
|
||||
this.values[0] = object;
|
||||
++this.count;
|
||||
return object2;
|
||||
}
|
||||
if (this.count == 1) {
|
||||
int n = string.compareTo(stringArray[0]);
|
||||
if (n == 0) {
|
||||
Object object3 = this.values[0];
|
||||
this.origKeys[0] = string2;
|
||||
this.values[0] = object;
|
||||
return object3;
|
||||
}
|
||||
if (n < 0) {
|
||||
stringArray[1] = stringArray[0];
|
||||
this.origKeys[1] = this.origKeys[0];
|
||||
this.values[1] = this.values[0];
|
||||
stringArray[0] = string;
|
||||
this.origKeys[0] = string2;
|
||||
this.values[0] = object;
|
||||
++this.count;
|
||||
} else {
|
||||
stringArray[1] = string;
|
||||
this.origKeys[1] = string2;
|
||||
this.values[1] = object;
|
||||
++this.count;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
int n = 0;
|
||||
int n2 = this.count - 1;
|
||||
int n3 = (n2 - n) / 2;
|
||||
while (n <= n2) {
|
||||
int n4 = string.compareTo(stringArray[n3]);
|
||||
if (n4 == 0) {
|
||||
Object object4 = this.values[n3];
|
||||
this.origKeys[n3] = string2;
|
||||
this.values[n3] = object;
|
||||
return object4;
|
||||
}
|
||||
if (n4 < 0) {
|
||||
n4 = string.compareTo(stringArray[n]);
|
||||
if (n4 == 0) {
|
||||
Object object5 = this.values[n];
|
||||
this.origKeys[n] = string2;
|
||||
this.values[n] = object;
|
||||
return object5;
|
||||
}
|
||||
if (n4 < 0) {
|
||||
n3 = n;
|
||||
break;
|
||||
}
|
||||
n2 = n3 - 1;
|
||||
} else {
|
||||
n4 = string.compareTo(stringArray[n2]);
|
||||
if (n4 == 0) {
|
||||
Object object6 = this.values[n2];
|
||||
this.origKeys[n2] = string2;
|
||||
this.values[n2] = object;
|
||||
return object6;
|
||||
}
|
||||
if (n4 > 0) {
|
||||
n3 = n2 + 1;
|
||||
break;
|
||||
}
|
||||
n = n3 + 1;
|
||||
}
|
||||
n3 = n + (n2 - n) / 2;
|
||||
}
|
||||
System.arraycopy(stringArray, n3, stringArray, n3 + 1, this.count - n3);
|
||||
stringArray[n3] = string;
|
||||
System.arraycopy(this.origKeys, n3, this.origKeys, n3 + 1, this.count - n3);
|
||||
this.origKeys[n3] = string2;
|
||||
System.arraycopy(this.values, n3, this.values, n3 + 1, this.count - n3);
|
||||
this.values[n3] = object;
|
||||
++this.count;
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized Object remove(String string) {
|
||||
string = TextUtil.toLowerCase((String)string);
|
||||
String[] stringArray = this.keys;
|
||||
int n = -1;
|
||||
int n2 = this.count;
|
||||
while (n2 - n > 1) {
|
||||
int n3 = (n2 + n) / 2;
|
||||
int n4 = string.compareTo(stringArray[n3]);
|
||||
if (n4 < 0) {
|
||||
n2 = n3;
|
||||
continue;
|
||||
}
|
||||
if (n4 > 0) {
|
||||
n = n3;
|
||||
continue;
|
||||
}
|
||||
Object object = this.values[n3];
|
||||
System.arraycopy(this.keys, n3 + 1, this.keys, n3, this.count - n3 - 1);
|
||||
System.arraycopy(this.origKeys, n3 + 1, this.origKeys, n3, this.count - n3 - 1);
|
||||
System.arraycopy(this.values, n3 + 1, this.values, n3, this.count - n3 - 1);
|
||||
this.keys[this.count - 1] = null;
|
||||
this.origKeys[this.count - 1] = null;
|
||||
this.values[this.count - 1] = null;
|
||||
--this.count;
|
||||
return object;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized String[] keyArray() {
|
||||
String[] stringArray = new String[this.count];
|
||||
System.arraycopy(this.origKeys, 0, stringArray, 0, this.count);
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
public synchronized String[] normalizedKeyArray() {
|
||||
String[] stringArray = new String[this.count];
|
||||
System.arraycopy(this.keys, 0, stringArray, 0, this.count);
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
public synchronized void ensureCapacity(int n) {
|
||||
if (this.keys.length < n) {
|
||||
String[] stringArray = new String[n];
|
||||
String[] stringArray2 = new String[n];
|
||||
Object[] objectArray = new Object[n];
|
||||
System.arraycopy(this.keys, 0, stringArray, 0, this.count);
|
||||
System.arraycopy(this.origKeys, 0, stringArray2, 0, this.count);
|
||||
System.arraycopy(this.values, 0, objectArray, 0, this.count);
|
||||
this.keys = stringArray;
|
||||
this.origKeys = stringArray2;
|
||||
this.values = objectArray;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void clear() {
|
||||
this.keys = EMPTY;
|
||||
this.origKeys = EMPTY;
|
||||
this.values = EMPTY;
|
||||
this.count = 0;
|
||||
}
|
||||
|
||||
public synchronized void dump() {
|
||||
int n = 0;
|
||||
while (n < this.count) {
|
||||
System.out.println(" " + this.keys[n] + " (" + this.origKeys[n] + ") = " + this.values[n]);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.origKeys = EMPTY;
|
||||
}
|
||||
|
||||
public CaseInsensitiveStringTable() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
public CaseInsensitiveStringTable(int n) {
|
||||
this.this();
|
||||
this.keys = new String[n];
|
||||
this.origKeys = new String[n];
|
||||
this.values = new Object[n];
|
||||
}
|
||||
|
||||
public CaseInsensitiveStringTable(String[] stringArray, Object[] objectArray) {
|
||||
this.this();
|
||||
this.init(stringArray, objectArray);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public abstract class ClassUtil {
|
||||
public static Class[] classes(Object[] objectArray) {
|
||||
Class[] classArray = new Class[objectArray.length];
|
||||
int n = 0;
|
||||
while (n < objectArray.length) {
|
||||
classArray[n] = objectArray[n].getClass();
|
||||
++n;
|
||||
}
|
||||
return classArray;
|
||||
}
|
||||
|
||||
public static Class baseClass(Class[] classArray) {
|
||||
LinkedList[] linkedListArray = new LinkedList[classArray.length];
|
||||
int n = 0;
|
||||
while (n < classArray.length) {
|
||||
linkedListArray[n] = new LinkedList();
|
||||
Class clazz = classArray[n];
|
||||
while (clazz != null) {
|
||||
linkedListArray[n].addFirst(clazz);
|
||||
clazz = clazz.getSuperclass();
|
||||
}
|
||||
++n;
|
||||
}
|
||||
Class clazz = (Class)linkedListArray[0].get(0);
|
||||
block2: for (int i = 0; i != linkedListArray[0].size(); ++i) {
|
||||
Class clazz2 = (Class)linkedListArray[0].get(i);
|
||||
int n2 = 1;
|
||||
while (n2 < linkedListArray.length) {
|
||||
if (i == linkedListArray[n2].size() || !clazz2.equals((Class)linkedListArray[n2].get(i))) break block2;
|
||||
++n2;
|
||||
}
|
||||
clazz = clazz2;
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
|
||||
public static boolean all(Object[] objectArray, Class clazz) {
|
||||
int n = 0;
|
||||
while (n < objectArray.length) {
|
||||
if (objectArray[n] == null) {
|
||||
return false;
|
||||
}
|
||||
if (!clazz.isAssignableFrom(objectArray[n].getClass())) {
|
||||
return false;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean any(Object[] objectArray, Class clazz) {
|
||||
int n = 0;
|
||||
while (n < objectArray.length) {
|
||||
if (objectArray[n] != null && clazz.isAssignableFrom(objectArray[n].getClass())) {
|
||||
return true;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean allNull(Object[] objectArray) {
|
||||
int n = 0;
|
||||
while (n < objectArray.length) {
|
||||
if (objectArray[n] != null) {
|
||||
return false;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean anyNull(Object[] objectArray) {
|
||||
int n = 0;
|
||||
while (n < objectArray.length) {
|
||||
if (objectArray[n] == null) {
|
||||
return true;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean sameClass(Object[] objectArray) {
|
||||
if (objectArray[0] == null) {
|
||||
return false;
|
||||
}
|
||||
Class<?> clazz = objectArray[0].getClass();
|
||||
int n = 1;
|
||||
while (n < objectArray.length) {
|
||||
if (objectArray[n] == null) {
|
||||
return false;
|
||||
}
|
||||
if (!clazz.equals(objectArray[n].getClass())) {
|
||||
return false;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Type getCommonSuperType(BObject[] bObjectArray) {
|
||||
Type[] typeArray = new Type[bObjectArray.length];
|
||||
int n = 0;
|
||||
while (n < bObjectArray.length) {
|
||||
typeArray[n] = bObjectArray[n].getType();
|
||||
++n;
|
||||
}
|
||||
return ClassUtil.getCommonSuperType(typeArray);
|
||||
}
|
||||
|
||||
public static Type getCommonSuperType(Type[] typeArray) {
|
||||
if (typeArray.length == 1) {
|
||||
return typeArray[0];
|
||||
}
|
||||
int n = 0;
|
||||
while (n < typeArray.length) {
|
||||
if (typeArray[n].isInterface()) {
|
||||
return BObject.TYPE;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
Type type = typeArray[0];
|
||||
while (type != BObject.TYPE) {
|
||||
boolean bl = true;
|
||||
int n2 = 1;
|
||||
while (n2 < typeArray.length) {
|
||||
if (!typeArray[n2].is(type)) {
|
||||
bl = false;
|
||||
break;
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
if (bl) {
|
||||
return type;
|
||||
}
|
||||
if ((type = type.getSuperType()) != null) continue;
|
||||
return BObject.TYPE;
|
||||
}
|
||||
return BObject.TYPE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class CommandLineArguments {
|
||||
public final String[] parameters;
|
||||
public final String[] options;
|
||||
public final String[] optionValues;
|
||||
|
||||
public boolean hasHelpOption() {
|
||||
if (this.hasOption("?")) {
|
||||
return true;
|
||||
}
|
||||
if (this.hasOption("help")) {
|
||||
return true;
|
||||
}
|
||||
return this.hasOption("usage");
|
||||
}
|
||||
|
||||
public boolean hasOption(String string) {
|
||||
int n = 0;
|
||||
while (n < this.options.length) {
|
||||
if (this.options[n].equals(string)) {
|
||||
return true;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getOption(String string) {
|
||||
return this.getOption(string, null);
|
||||
}
|
||||
|
||||
public String getOption(String string, String string2) {
|
||||
int n = 0;
|
||||
while (n < this.options.length) {
|
||||
if (this.options[n].equals(string)) {
|
||||
if (this.optionValues[n] == null) break;
|
||||
return this.optionValues[n];
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return string2;
|
||||
}
|
||||
|
||||
public int getIntOption(String string, int n) {
|
||||
int n2 = 0;
|
||||
while (n2 < this.options.length) {
|
||||
if (this.options[n2].equals(string)) {
|
||||
return Integer.parseInt(this.optionValues[n2]);
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
public void dump() {
|
||||
int n = 0;
|
||||
while (n < this.parameters.length) {
|
||||
System.out.println(this.parameters[n] + " [" + n + ']');
|
||||
++n;
|
||||
}
|
||||
n = 0;
|
||||
while (n < this.options.length) {
|
||||
if (this.optionValues[n] == null) {
|
||||
System.out.println("-" + this.options[n]);
|
||||
} else {
|
||||
System.out.println("-" + this.options[n] + ':' + this.optionValues[n]);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] stringArray) {
|
||||
new CommandLineArguments(stringArray).dump();
|
||||
}
|
||||
|
||||
public CommandLineArguments(String[] stringArray) {
|
||||
Vector<String> vector = new Vector<String>();
|
||||
Vector<String> vector2 = new Vector<String>();
|
||||
Vector<String> vector3 = new Vector<String>();
|
||||
int n = 0;
|
||||
while (n < stringArray.length) {
|
||||
String string = stringArray[n];
|
||||
if (string.length() > 1 && string.charAt(0) == '-') {
|
||||
int n2 = (string = string.substring(1)).indexOf(58);
|
||||
if (n2 > 0) {
|
||||
vector2.addElement(string.substring(0, n2));
|
||||
vector3.addElement(string.substring(n2 + 1));
|
||||
} else {
|
||||
vector2.addElement(string);
|
||||
vector3.addElement(null);
|
||||
}
|
||||
} else {
|
||||
vector.addElement(string);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
this.parameters = new String[vector.size()];
|
||||
vector.copyInto(this.parameters);
|
||||
this.options = new String[vector2.size()];
|
||||
vector2.copyInto(this.options);
|
||||
this.optionValues = new String[vector3.size()];
|
||||
vector3.copyInto(this.optionValues);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import java.util.Stack;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.CursorException;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.SlotCursor;
|
||||
import javax.baja.sys.Topic;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class ComponentTreeCursor
|
||||
implements SlotCursor {
|
||||
public static final int ALL = Integer.MAX_VALUE;
|
||||
private boolean init;
|
||||
private boolean atRoot;
|
||||
private BComponent root;
|
||||
private int depth;
|
||||
private Type[] leafTypes;
|
||||
private SlotCursor current;
|
||||
private int currentDepth;
|
||||
private Stack nodeStack;
|
||||
private Context context;
|
||||
|
||||
public Context getContext() {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
public BComponent root() {
|
||||
return this.root;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.init = true;
|
||||
this.atRoot = false;
|
||||
this.current = null;
|
||||
this.currentDepth = 0;
|
||||
this.nodeStack = null;
|
||||
}
|
||||
|
||||
public BObject target() {
|
||||
return this.current.target();
|
||||
}
|
||||
|
||||
public boolean isLeafType(Type type) {
|
||||
if (this.leafTypes == null) {
|
||||
return false;
|
||||
}
|
||||
int n = 0;
|
||||
while (n < this.leafTypes.length) {
|
||||
if (type.is(this.leafTypes[n])) {
|
||||
return true;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isLeafType(BObject bObject) {
|
||||
if (this.leafTypes == null) {
|
||||
return false;
|
||||
}
|
||||
return this.isLeafType(bObject.getType());
|
||||
}
|
||||
|
||||
/*
|
||||
* Unable to fully structure code
|
||||
*/
|
||||
public boolean next() {
|
||||
if (this.root == null) {
|
||||
return false;
|
||||
}
|
||||
if (this.init) {
|
||||
this.atRoot = true;
|
||||
this.init = false;
|
||||
return true;
|
||||
}
|
||||
if (this.atRoot && this.depth == 0) {
|
||||
return false;
|
||||
}
|
||||
if (this.atRoot) {
|
||||
this.atRoot = false;
|
||||
this.current = this.root.getProperties();
|
||||
return this.current.nextComponent();
|
||||
}
|
||||
var1_1 = null;
|
||||
var2_2 = null;
|
||||
var3_3 = false;
|
||||
v0 = false;
|
||||
if (this.currentDepth + 1 < this.depth && !this.isLeafType(this.current.target())) {
|
||||
v0 = true;
|
||||
}
|
||||
if ((var4_4 = v0) && (var2_2 = (var1_1 = (BComponent)this.current.get()).getProperties()).nextComponent()) {
|
||||
var3_3 = true;
|
||||
}
|
||||
if (!var3_3) ** GOTO lbl33
|
||||
++this.currentDepth;
|
||||
if (this.nodeStack == null) {
|
||||
this.nodeStack = new Stack<E>();
|
||||
}
|
||||
this.nodeStack.push(this.current);
|
||||
this.current = var2_2;
|
||||
return true;
|
||||
lbl-1000:
|
||||
// 1 sources
|
||||
|
||||
{
|
||||
if (this.nodeStack == null || this.nodeStack.empty()) {
|
||||
return false;
|
||||
}
|
||||
this.current = (SlotCursor)this.nodeStack.pop();
|
||||
--this.currentDepth;
|
||||
lbl33:
|
||||
// 2 sources
|
||||
|
||||
** while (!this.current.nextComponent())
|
||||
}
|
||||
lbl34:
|
||||
// 1 sources
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean nextObject() {
|
||||
return this.nextComponent();
|
||||
}
|
||||
|
||||
public boolean nextComponent() {
|
||||
return this.next();
|
||||
}
|
||||
|
||||
public boolean next(Class clazz) {
|
||||
while (this.next()) {
|
||||
BObject bObject = this.get();
|
||||
if (!clazz.isInstance(bObject)) continue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Slot slot() {
|
||||
return this.current.slot();
|
||||
}
|
||||
|
||||
public Property property() {
|
||||
return this.current.property();
|
||||
}
|
||||
|
||||
public int getTypeAccess() {
|
||||
return this.current.getTypeAccess();
|
||||
}
|
||||
|
||||
public BObject get() {
|
||||
if (this.atRoot) {
|
||||
return this.root;
|
||||
}
|
||||
return this.current.get();
|
||||
}
|
||||
|
||||
public boolean getBoolean() {
|
||||
throw new ClassCastException();
|
||||
}
|
||||
|
||||
public int getInt() {
|
||||
throw new ClassCastException();
|
||||
}
|
||||
|
||||
public long getLong() {
|
||||
throw new ClassCastException();
|
||||
}
|
||||
|
||||
public float getFloat() {
|
||||
throw new ClassCastException();
|
||||
}
|
||||
|
||||
public double getDouble() {
|
||||
throw new ClassCastException();
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
throw new ClassCastException();
|
||||
}
|
||||
|
||||
public Action action() {
|
||||
throw new CursorException("not action");
|
||||
}
|
||||
|
||||
public Topic topic() {
|
||||
throw new CursorException("not topic");
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.init = true;
|
||||
this.atRoot = false;
|
||||
this.currentDepth = 0;
|
||||
}
|
||||
|
||||
public ComponentTreeCursor(BComponent bComponent, Context context) {
|
||||
this(bComponent, Integer.MAX_VALUE, context);
|
||||
}
|
||||
|
||||
public ComponentTreeCursor(BComponent bComponent, int n, Context context) {
|
||||
this.this();
|
||||
this.root = bComponent;
|
||||
this.depth = n;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ComponentTreeCursor(BComponent bComponent, Type type, Context context) {
|
||||
this(bComponent, new Type[]{type}, context);
|
||||
}
|
||||
|
||||
public ComponentTreeCursor(BComponent bComponent, Type[] typeArray, Context context) {
|
||||
this.this();
|
||||
this.root = bComponent;
|
||||
this.depth = Integer.MAX_VALUE;
|
||||
this.leafTypes = typeArray;
|
||||
this.context = context;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Cursor;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.SlotCursor;
|
||||
import javax.baja.sys.Topic;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class CompoundCursor
|
||||
implements SlotCursor {
|
||||
private Cursor[] subs;
|
||||
private int index;
|
||||
private Context context;
|
||||
|
||||
public Context getContext() {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
public BObject target() {
|
||||
return ((SlotCursor)this.subs[this.index]).target();
|
||||
}
|
||||
|
||||
/*
|
||||
* Unable to fully structure code
|
||||
*/
|
||||
public boolean next() {
|
||||
if (this.index != this.subs.length) ** GOTO lbl4
|
||||
return false;
|
||||
lbl-1000:
|
||||
// 1 sources
|
||||
|
||||
{
|
||||
++this.index;
|
||||
lbl4:
|
||||
// 2 sources
|
||||
|
||||
** while (this.index != this.subs.length && !this.subs[this.index].next())
|
||||
}
|
||||
lbl5:
|
||||
// 1 sources
|
||||
|
||||
v0 = false;
|
||||
if (this.index != this.subs.length) {
|
||||
v0 = true;
|
||||
}
|
||||
return v0;
|
||||
}
|
||||
|
||||
public boolean nextObject() {
|
||||
return ((SlotCursor)this.subs[this.index]).nextObject();
|
||||
}
|
||||
|
||||
public boolean nextComponent() {
|
||||
return this.subs[this.index].nextComponent();
|
||||
}
|
||||
|
||||
public boolean next(Class clazz) {
|
||||
return this.subs[this.index].next(clazz);
|
||||
}
|
||||
|
||||
public Slot slot() {
|
||||
return ((SlotCursor)this.subs[this.index]).slot();
|
||||
}
|
||||
|
||||
public Property property() {
|
||||
return ((SlotCursor)this.subs[this.index]).property();
|
||||
}
|
||||
|
||||
public int getTypeAccess() {
|
||||
return ((SlotCursor)this.subs[this.index]).getTypeAccess();
|
||||
}
|
||||
|
||||
public Action action() {
|
||||
return ((SlotCursor)this.subs[this.index]).action();
|
||||
}
|
||||
|
||||
public Topic topic() {
|
||||
return ((SlotCursor)this.subs[this.index]).topic();
|
||||
}
|
||||
|
||||
public BObject get() {
|
||||
return this.subs[this.index].get();
|
||||
}
|
||||
|
||||
public boolean getBoolean() {
|
||||
return ((SlotCursor)this.subs[this.index]).getBoolean();
|
||||
}
|
||||
|
||||
public int getInt() {
|
||||
return ((SlotCursor)this.subs[this.index]).getInt();
|
||||
}
|
||||
|
||||
public long getLong() {
|
||||
return ((SlotCursor)this.subs[this.index]).getLong();
|
||||
}
|
||||
|
||||
public float getFloat() {
|
||||
return ((SlotCursor)this.subs[this.index]).getFloat();
|
||||
}
|
||||
|
||||
public double getDouble() {
|
||||
return ((SlotCursor)this.subs[this.index]).getDouble();
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return ((SlotCursor)this.subs[this.index]).getString();
|
||||
}
|
||||
|
||||
public CompoundCursor() {
|
||||
this(new Cursor[0], null, null);
|
||||
}
|
||||
|
||||
public CompoundCursor(Cursor[] cursorArray, Context context) {
|
||||
this(cursorArray, context, null);
|
||||
}
|
||||
|
||||
public CompoundCursor(Cursor[] cursorArray, Context context, Type type) {
|
||||
this.subs = cursorArray;
|
||||
this.context = context;
|
||||
this.index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import javax.baja.sys.Context;
|
||||
|
||||
public interface ContextThread {
|
||||
public Context getContext();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Cursor;
|
||||
|
||||
public class EmptyCursor
|
||||
implements Cursor {
|
||||
private Context context;
|
||||
|
||||
public BObject get() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
public boolean next() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean next(Class clazz) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean nextComponent() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public EmptyCursor(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.CursorException;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.SlotCursor;
|
||||
import javax.baja.sys.Topic;
|
||||
|
||||
public class EmptySlotCursor
|
||||
implements SlotCursor {
|
||||
private BObject target;
|
||||
private Context context;
|
||||
|
||||
public BObject get() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
public boolean next() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean next(Class clazz) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean nextComponent() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public BObject target() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
public boolean nextObject() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Slot slot() {
|
||||
throw new CursorException("Empty Slot Cursor");
|
||||
}
|
||||
|
||||
public Property property() {
|
||||
throw new CursorException("Empty Slot Cursor");
|
||||
}
|
||||
|
||||
public Action action() {
|
||||
throw new CursorException("Empty Slot Cursor");
|
||||
}
|
||||
|
||||
public Topic topic() {
|
||||
throw new CursorException("Empty Slot Cursor");
|
||||
}
|
||||
|
||||
public int getTypeAccess() {
|
||||
throw new CursorException("Empty Slot Cursor");
|
||||
}
|
||||
|
||||
public boolean getBoolean() {
|
||||
throw new CursorException("Empty Slot Cursor");
|
||||
}
|
||||
|
||||
public int getInt() {
|
||||
throw new CursorException("Empty Slot Cursor");
|
||||
}
|
||||
|
||||
public long getLong() {
|
||||
throw new CursorException("Empty Slot Cursor");
|
||||
}
|
||||
|
||||
public float getFloat() {
|
||||
throw new CursorException("Empty Slot Cursor");
|
||||
}
|
||||
|
||||
public double getDouble() {
|
||||
throw new CursorException("Empty Slot Cursor");
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
throw new CursorException("Empty Slot Cursor");
|
||||
}
|
||||
|
||||
public EmptySlotCursor(BObject bObject, Context context) {
|
||||
this.target = bObject;
|
||||
this.context = context;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.TextUtil
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
|
||||
public abstract class EscUtil {
|
||||
public static final EscUtil slot = new SlotEsc();
|
||||
public static final EscUtil ord = new OrdEsc();
|
||||
private static final int CM_LENGTH = 128;
|
||||
private static final int CM_HEX = 1;
|
||||
private static final int CM_START = 2;
|
||||
private static final int CM_PART = 4;
|
||||
private static final int CM_ORD = 8;
|
||||
private static byte[] charMap = new byte[128];
|
||||
|
||||
/*
|
||||
* Unable to fully structure code
|
||||
*/
|
||||
public boolean isValid(String var1_1) {
|
||||
var2_2 = var1_1.length();
|
||||
if (var2_2 == 0) {
|
||||
return false;
|
||||
}
|
||||
var3_4 = 0;
|
||||
while (var3_4 < var2_2) {
|
||||
var4_5 = var1_1.charAt(var3_4);
|
||||
if (var3_4 != 0 ? this.isPart(var4_5) != false : this.isStart(var4_5) != false) ** GOTO lbl18
|
||||
if (var4_5 != '$') {
|
||||
return false;
|
||||
}
|
||||
if ((var5_6 = var1_1.charAt(++var3_4)) == 'u') ** GOTO lbl16
|
||||
if ((EscUtil.charMap[var5_6] & 1) == 0 || (EscUtil.charMap[var1_1.charAt(++var3_4)] & 1) == 0) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
block8: {
|
||||
break block8;
|
||||
lbl16:
|
||||
// 1 sources
|
||||
|
||||
if ((EscUtil.charMap[var1_1.charAt(++var3_4)] & 1) == 0 || (EscUtil.charMap[var1_1.charAt(++var3_4)] & 1) == 0 || (EscUtil.charMap[var1_1.charAt(++var3_4)] & 1) == 0 || (EscUtil.charMap[var1_1.charAt(++var3_4)] & 1) == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
++var3_4;
|
||||
}
|
||||
catch (IndexOutOfBoundsException var2_3) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public String escape(String string) {
|
||||
int n = string.length();
|
||||
if (n == 0) {
|
||||
return string;
|
||||
}
|
||||
char[] cArray = null;
|
||||
int n2 = 0;
|
||||
int n3 = n * 6;
|
||||
char c = string.charAt(0);
|
||||
if (!this.isStart(c)) {
|
||||
cArray = new char[n3];
|
||||
n2 = EscUtil.escape(c, cArray, n2);
|
||||
}
|
||||
int n4 = 1;
|
||||
while (n4 < n) {
|
||||
c = string.charAt(n4);
|
||||
if (this.isPart(c)) {
|
||||
if (cArray != null) {
|
||||
cArray[n2++] = c;
|
||||
}
|
||||
} else {
|
||||
if (cArray == null) {
|
||||
cArray = new char[n * 6];
|
||||
string.getChars(0, n4, cArray, 0);
|
||||
n2 = n4;
|
||||
}
|
||||
n2 = EscUtil.escape(c, cArray, n2);
|
||||
}
|
||||
++n4;
|
||||
}
|
||||
if (cArray == null) {
|
||||
return string;
|
||||
}
|
||||
return new String(cArray, 0, n2);
|
||||
}
|
||||
|
||||
public String unescape(String string) {
|
||||
char[] cArray = null;
|
||||
int n = 0;
|
||||
int n2 = string.length();
|
||||
int n3 = 0;
|
||||
while (n3 < n2) {
|
||||
char c = string.charAt(n3);
|
||||
if (c != '$') {
|
||||
if (cArray != null) {
|
||||
cArray[n++] = c;
|
||||
}
|
||||
} else {
|
||||
char c2;
|
||||
if (cArray == null) {
|
||||
cArray = new char[n2];
|
||||
string.getChars(0, n3, cArray, 0);
|
||||
n = n3;
|
||||
}
|
||||
if ((c2 = string.charAt(++n3)) != 'u') {
|
||||
cArray[n++] = (char)(TextUtil.hexCharToInt((char)c2) << 4 | TextUtil.hexCharToInt((char)string.charAt(++n3)));
|
||||
} else {
|
||||
cArray[n++] = (char)(TextUtil.hexCharToInt((char)string.charAt(++n3)) << 12 | TextUtil.hexCharToInt((char)string.charAt(++n3)) << 8 | TextUtil.hexCharToInt((char)string.charAt(++n3)) << 4 | TextUtil.hexCharToInt((char)string.charAt(++n3)));
|
||||
}
|
||||
}
|
||||
++n3;
|
||||
}
|
||||
if (cArray == null) {
|
||||
return string;
|
||||
}
|
||||
return new String(cArray, 0, n);
|
||||
}
|
||||
|
||||
public abstract boolean isStart(int var1);
|
||||
|
||||
public abstract boolean isPart(int var1);
|
||||
|
||||
public static int escape(char c, char[] cArray, int n) {
|
||||
String string = Integer.toHexString(c);
|
||||
cArray[n++] = 36;
|
||||
if (c < '\u0010') {
|
||||
cArray[n++] = 48;
|
||||
cArray[n++] = string.charAt(0);
|
||||
} else if (c < '\u0100') {
|
||||
cArray[n++] = string.charAt(0);
|
||||
cArray[n++] = string.charAt(1);
|
||||
} else if (c < '\u1000') {
|
||||
cArray[n++] = 117;
|
||||
cArray[n++] = 48;
|
||||
cArray[n++] = string.charAt(0);
|
||||
cArray[n++] = string.charAt(1);
|
||||
cArray[n++] = string.charAt(2);
|
||||
} else {
|
||||
cArray[n++] = 117;
|
||||
cArray[n++] = string.charAt(0);
|
||||
cArray[n++] = string.charAt(1);
|
||||
cArray[n++] = string.charAt(2);
|
||||
cArray[n++] = string.charAt(3);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
public static void main(String[] stringArray) {
|
||||
String string = stringArray[0];
|
||||
System.out.println("raw: " + string);
|
||||
System.out.println("slot: " + slot.escape(string) + " [" + slot.isValid(string) + ']');
|
||||
System.out.println("ord: " + ord.escape(string) + " [" + ord.isValid(string) + ']');
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$0() {
|
||||
return 128;
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$2() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$3() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$4() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
static {
|
||||
int n = 97;
|
||||
while (n <= 122) {
|
||||
EscUtil.charMap[n] = 6;
|
||||
++n;
|
||||
}
|
||||
n = 65;
|
||||
while (n <= 90) {
|
||||
EscUtil.charMap[n] = 6;
|
||||
++n;
|
||||
}
|
||||
n = 48;
|
||||
while (n <= 57) {
|
||||
EscUtil.charMap[n] = 5;
|
||||
++n;
|
||||
}
|
||||
n = 97;
|
||||
while (n <= 102) {
|
||||
int n2 = n++;
|
||||
charMap[n2] = (byte)(charMap[n2] | 1);
|
||||
}
|
||||
n = 65;
|
||||
while (n <= 70) {
|
||||
int n3 = n++;
|
||||
charMap[n3] = (byte)(charMap[n3] | 1);
|
||||
}
|
||||
EscUtil.charMap[95] = 4;
|
||||
n = 32;
|
||||
while (n < 128) {
|
||||
if (n != 36 && n != 124) {
|
||||
int n4 = n;
|
||||
charMap[n4] = (byte)(charMap[n4] | 8);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
static class SlotEsc
|
||||
extends EscUtil {
|
||||
public boolean isStart(int n) {
|
||||
boolean bl = false;
|
||||
if (n < 128 && (charMap[n] & 2) != 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public boolean isPart(int n) {
|
||||
boolean bl = false;
|
||||
if (n < 128 && (charMap[n] & 4) != 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
SlotEsc() {
|
||||
}
|
||||
}
|
||||
|
||||
static class OrdEsc
|
||||
extends EscUtil {
|
||||
public boolean isStart(int n) {
|
||||
boolean bl = false;
|
||||
if (n < 128 && (charMap[n] & 8) != 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public boolean isPart(int n) {
|
||||
boolean bl = false;
|
||||
if (n < 128 && (charMap[n] & 8) != 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
OrdEsc() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.OrdQuery;
|
||||
import javax.baja.sys.Sys;
|
||||
|
||||
public class Href2Ord {
|
||||
BOrd rawBase;
|
||||
BOrd baseOrd;
|
||||
String fileScheme;
|
||||
|
||||
public BOrd hrefToOrd(String string) {
|
||||
if (!this.isAlreadyOrd(string)) {
|
||||
string = new FilePath(this.fileScheme(), string).toString();
|
||||
}
|
||||
return BOrd.make(this.baseOrd(), string).normalize();
|
||||
}
|
||||
|
||||
public boolean isAlreadyOrd(String string) {
|
||||
int n = string.indexOf(58);
|
||||
if (n == -1) {
|
||||
return false;
|
||||
}
|
||||
return Sys.getRegistry().isOrdScheme(string.substring(0, n));
|
||||
}
|
||||
|
||||
public BOrd baseOrd() {
|
||||
if (this.baseOrd == null) {
|
||||
FilePath filePath = this.filePath();
|
||||
if (filePath != null && filePath.depth() > 0) {
|
||||
String string = filePath.nameAt(filePath.depth() - 1);
|
||||
String string2 = "";
|
||||
int n = string.lastIndexOf(46);
|
||||
if (n > 0) {
|
||||
string2 = string.substring(n + 1);
|
||||
}
|
||||
if (string2.equals("html") || string2.equals("css") || string2.equals("bajadoc")) {
|
||||
this.baseOrd = BOrd.make(this.rawBase, filePath.getParent().toString()).normalize();
|
||||
return this.baseOrd;
|
||||
}
|
||||
}
|
||||
if (this.baseOrd == null) {
|
||||
this.baseOrd = this.rawBase;
|
||||
}
|
||||
}
|
||||
return this.baseOrd;
|
||||
}
|
||||
|
||||
public String fileScheme() {
|
||||
if (this.fileScheme == null) {
|
||||
this.fileScheme = "file";
|
||||
FilePath filePath = this.filePath();
|
||||
if (filePath != null) {
|
||||
this.fileScheme = filePath.getScheme();
|
||||
}
|
||||
}
|
||||
return this.fileScheme;
|
||||
}
|
||||
|
||||
public FilePath filePath() {
|
||||
OrdQuery[] ordQueryArray = this.rawBase.parse();
|
||||
int n = ordQueryArray.length - 1;
|
||||
while (n >= 0) {
|
||||
if (ordQueryArray[n] instanceof FilePath) {
|
||||
return (FilePath)ordQueryArray[n];
|
||||
}
|
||||
--n;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Href2Ord(BOrd bOrd) {
|
||||
if (bOrd.toString().endsWith("spy:")) {
|
||||
bOrd = BOrd.make(bOrd.toString() + '/');
|
||||
}
|
||||
this.rawBase = bOrd;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
public interface IFactory {
|
||||
public Object make(Object var1) throws Exception;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
public interface IFoxSession {
|
||||
public String getStationName();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import java.util.Iterator;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BFloat;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Cursor;
|
||||
|
||||
public class IteratorCursor
|
||||
implements Cursor {
|
||||
private BObject target;
|
||||
private Iterator values;
|
||||
private BObject current;
|
||||
private Context context;
|
||||
|
||||
public Context getContext() {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
public BObject target() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
public boolean next() {
|
||||
if (this.values.hasNext()) {
|
||||
this.current = (BObject)this.values.next();
|
||||
return true;
|
||||
}
|
||||
this.current = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean nextObject() {
|
||||
while (this.next()) {
|
||||
if (this.current instanceof BBoolean || this.current instanceof BInteger || this.current instanceof BFloat || this.current instanceof BString) continue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean nextComponent() {
|
||||
while (this.next()) {
|
||||
if (!this.current.isComponent()) continue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean next(Class clazz) {
|
||||
while (this.next()) {
|
||||
if (!clazz.isInstance(this.current)) continue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public final BObject get() {
|
||||
return this.getValue(this.current);
|
||||
}
|
||||
|
||||
protected BObject getValue(BObject bObject) {
|
||||
return bObject;
|
||||
}
|
||||
|
||||
public IteratorCursor(BObject bObject, Iterator iterator) {
|
||||
this(bObject, iterator, null);
|
||||
}
|
||||
|
||||
public IteratorCursor(BObject bObject, Iterator iterator, Context context) {
|
||||
this.target = bObject;
|
||||
this.values = iterator;
|
||||
this.context = context;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.TextUtil
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BLink;
|
||||
import javax.baja.sys.Knob;
|
||||
|
||||
public class LinkUtil {
|
||||
public static String toDisplay(BLink bLink) {
|
||||
try {
|
||||
return LinkUtil.toDisplaySource(bLink) + " -> " + LinkUtil.toDisplayTarget(bLink);
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
runtimeException.printStackTrace();
|
||||
return "err";
|
||||
}
|
||||
}
|
||||
|
||||
public static String toDisplaySource(BLink bLink) {
|
||||
try {
|
||||
BComponentSpace bComponentSpace = LinkUtil.toSpace(bLink);
|
||||
return LinkUtil.toPath(bComponentSpace, bLink.getSourceOrd()) + '.' + LinkUtil.toSlot(bLink.getSourceSlotName());
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
runtimeException.printStackTrace();
|
||||
return "err";
|
||||
}
|
||||
}
|
||||
|
||||
public static String toDisplayTarget(BLink bLink) {
|
||||
try {
|
||||
return LinkUtil.toPath(bLink.getTargetComponent()) + '.' + LinkUtil.toSlot(bLink.getTargetSlotName());
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
runtimeException.printStackTrace();
|
||||
return "err";
|
||||
}
|
||||
}
|
||||
|
||||
public static String toDisplay(Knob knob) {
|
||||
try {
|
||||
return LinkUtil.toDisplaySource(knob) + " -> " + LinkUtil.toDisplayTarget(knob);
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
runtimeException.printStackTrace();
|
||||
return "err";
|
||||
}
|
||||
}
|
||||
|
||||
public static String toDisplaySource(Knob knob) {
|
||||
try {
|
||||
return LinkUtil.toPath(knob.getSourceComponent()) + '.' + LinkUtil.toSlot(knob.getSourceSlotName());
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
runtimeException.printStackTrace();
|
||||
return "err";
|
||||
}
|
||||
}
|
||||
|
||||
public static String toDisplayTarget(Knob knob) {
|
||||
try {
|
||||
BComponentSpace bComponentSpace = LinkUtil.toSpace(knob);
|
||||
return LinkUtil.toPath(bComponentSpace, knob.getTargetOrd()) + '.' + LinkUtil.toSlot(knob.getTargetSlotName());
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
runtimeException.printStackTrace();
|
||||
return "err";
|
||||
}
|
||||
}
|
||||
|
||||
public static BComponentSpace toSpace(BLink bLink) {
|
||||
return bLink.getTargetComponent().getComponentSpace();
|
||||
}
|
||||
|
||||
public static BComponentSpace toSpace(Knob knob) {
|
||||
return knob.getSourceComponent().getComponentSpace();
|
||||
}
|
||||
|
||||
public static String toPath(BComponent bComponent) {
|
||||
return LinkUtil.toPath(bComponent.getSlotPath());
|
||||
}
|
||||
|
||||
public static String toPath(BComponentSpace bComponentSpace, BOrd bOrd) {
|
||||
String string = bOrd.toString();
|
||||
if (!string.startsWith("h:")) {
|
||||
return string;
|
||||
}
|
||||
String string2 = string.substring(2);
|
||||
SlotPath slotPath = bComponentSpace.handleToSlotPath(string2);
|
||||
if (slotPath == null) {
|
||||
return string;
|
||||
}
|
||||
return LinkUtil.toPath(slotPath);
|
||||
}
|
||||
|
||||
public static String toPath(SlotPath slotPath) {
|
||||
return slotPath.toDisplayString();
|
||||
}
|
||||
|
||||
public static String toSlot(String string) {
|
||||
return TextUtil.toFriendly((String)string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import javax.baja.naming.BISession;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.nav.BNavRoot;
|
||||
import javax.baja.registry.TypeInfo;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.space.BISpaceNode;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.SlotCursor;
|
||||
import javax.baja.sys.Sys;
|
||||
|
||||
public class ObjectUtil {
|
||||
public static String generateUniqueName(String string, NameContainer nameContainer) {
|
||||
char c;
|
||||
int n;
|
||||
if (!nameContainer.contains(string)) {
|
||||
return string;
|
||||
}
|
||||
int n2 = -1;
|
||||
int n3 = string.length() - 1;
|
||||
while (n3 >= 0) {
|
||||
if (!Character.isDigit(string.charAt(n3))) break;
|
||||
n2 = n3--;
|
||||
}
|
||||
String string2 = string;
|
||||
int n4 = 1;
|
||||
if (n2 > 0) {
|
||||
string2 = string.substring(0, n2);
|
||||
n4 = Integer.parseInt(string.substring(n2)) + 1;
|
||||
n = n2;
|
||||
while (n < string.length() - 1) {
|
||||
c = string.charAt(n);
|
||||
if (c == '0') {
|
||||
string2 = string2 + '0';
|
||||
++n;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (n2 == 0) {
|
||||
string2 = "";
|
||||
n4 = Integer.parseInt(string) + 1;
|
||||
n = n2;
|
||||
while (n < string.length() - 1) {
|
||||
c = string.charAt(n);
|
||||
if (c == '0') {
|
||||
string2 = string2 + '0';
|
||||
++n;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
n = n4;
|
||||
while (true) {
|
||||
if (n - n4 > 100000) {
|
||||
throw new IllegalStateException("NameContainer not functioning");
|
||||
}
|
||||
String string3 = string2 + n;
|
||||
if (!nameContainer.contains(string3)) {
|
||||
return string3;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public static String generateUniqueSlotName(String string, NameContainer nameContainer) {
|
||||
char c;
|
||||
int n;
|
||||
if (!nameContainer.contains(string)) {
|
||||
return string;
|
||||
}
|
||||
string = SlotPath.unescape(string);
|
||||
int n2 = -1;
|
||||
int n3 = string.length() - 1;
|
||||
while (n3 >= 0) {
|
||||
if (!Character.isDigit(string.charAt(n3))) break;
|
||||
n2 = n3--;
|
||||
}
|
||||
String string2 = string;
|
||||
int n4 = 1;
|
||||
if (n2 > 0) {
|
||||
string2 = string.substring(0, n2);
|
||||
n4 = Integer.parseInt(string.substring(n2)) + 1;
|
||||
n = n2;
|
||||
while (n < string.length() - 1) {
|
||||
c = string.charAt(n);
|
||||
if (c == '0') {
|
||||
string2 = string2 + '0';
|
||||
++n;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (n2 == 0) {
|
||||
string2 = "";
|
||||
n4 = Integer.parseInt(string) + 1;
|
||||
n = n2;
|
||||
while (n < string.length() - 1) {
|
||||
c = string.charAt(n);
|
||||
if (c == '0') {
|
||||
string2 = string2 + '0';
|
||||
++n;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
n = n4;
|
||||
while (true) {
|
||||
if (n - n4 > 100000) {
|
||||
throw new IllegalStateException("NameContainer not functioning");
|
||||
}
|
||||
String string3 = SlotPath.escape(string2 + n);
|
||||
if (!nameContainer.contains(string3)) {
|
||||
return string3;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public static String stripDigitsFromEnd(String string) {
|
||||
int n = string.length() - 1;
|
||||
boolean bl = false;
|
||||
while (Character.isDigit(string.charAt(n)) || string.charAt(n) == '$') {
|
||||
if (n == 0) {
|
||||
return string;
|
||||
}
|
||||
bl = true;
|
||||
--n;
|
||||
}
|
||||
if (!bl) {
|
||||
return string;
|
||||
}
|
||||
return string.substring(0, n + 1);
|
||||
}
|
||||
|
||||
public static BOrd getReferenceHelpOrd(BObject bObject) {
|
||||
String string = bObject.getClass().getName();
|
||||
int n = string.lastIndexOf(46);
|
||||
String string2 = string.substring(0, n).replace('.', '/');
|
||||
String string3 = string.substring(n + 1);
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("local:|module://").append(bObject.getType().getModule().getModuleName()).append("/doc/").append(string2).append('/').append(string3).append(".bajadoc");
|
||||
return BOrd.make(stringBuffer.toString());
|
||||
}
|
||||
|
||||
public static BOrd getGuideHelpOrd(TypeInfo typeInfo) {
|
||||
String string = typeInfo.getModuleName();
|
||||
String string2 = typeInfo.getLexicon(null).get("help.guide.base");
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
if (string2 == null || string2.length() == 0) {
|
||||
stringBuffer.append("local:|module://").append(string).append("/doc/");
|
||||
} else if (string2.startsWith("module:")) {
|
||||
stringBuffer.append("local:|").append(string2);
|
||||
} else {
|
||||
stringBuffer.append(string2);
|
||||
}
|
||||
if (stringBuffer.charAt(stringBuffer.length() - 1) != '/') {
|
||||
stringBuffer.append('/');
|
||||
}
|
||||
stringBuffer.append(string).append('-').append(typeInfo.getTypeName()).append(".html");
|
||||
return BOrd.make(stringBuffer.toString());
|
||||
}
|
||||
|
||||
public static BOrd getGuideHelpOrd(BObject bObject) {
|
||||
return ObjectUtil.getGuideHelpOrd(bObject.getType().getTypeInfo());
|
||||
}
|
||||
|
||||
public static BOrd toSpyRelative(BObject bObject) {
|
||||
BINavNode bINavNode;
|
||||
String string;
|
||||
if (bObject instanceof BINavNode && (string = ObjectUtil.toNavPath(bINavNode = (BINavNode)((Object)bObject), BNavRoot.INSTANCE)) != null) {
|
||||
return BOrd.make("spy:/nav" + string);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static BOrd toSpyLocal(BObject bObject) {
|
||||
BINavNode bINavNode;
|
||||
String string;
|
||||
if (bObject instanceof BINavNode && (string = ObjectUtil.toNavPath(bINavNode = (BINavNode)((Object)bObject), BNavRoot.INSTANCE)) != null) {
|
||||
return BOrd.make("local:|spy:/nav" + string);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static BOrd toSpyRemote(BObject bObject) {
|
||||
String string;
|
||||
BISpaceNode bISpaceNode;
|
||||
BISession bISession;
|
||||
if (bObject instanceof BISpaceNode && (bISession = (bISpaceNode = (BISpaceNode)((Object)bObject)).getSession()) != null && (string = ObjectUtil.toNavPath(bISpaceNode, bISession)) != null) {
|
||||
return BOrd.make(bISession.getNavOrd() + "|spy:/nav/localhost" + string);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static String toNavPath(BINavNode object, Object object2) {
|
||||
Object object3;
|
||||
ArrayList<String> arrayList = new ArrayList<String>();
|
||||
TypeInfo typeInfo = Sys.getRegistry().getType("file:BogFile");
|
||||
TypeInfo typeInfo2 = Sys.getRegistry().getType("baja:VirtualComponentSpace");
|
||||
TypeInfo typeInfo3 = Sys.getRegistry().getType("fox:FoxVirtualSpace");
|
||||
while (object != null && object != object2) {
|
||||
object3 = object.getNavParent();
|
||||
if (object instanceof BComponentSpace || object.getType().is(typeInfo) || object3 != null && (object3.getType().is(typeInfo2) || object3.getType().is(typeInfo3))) {
|
||||
object = object.getNavParent();
|
||||
continue;
|
||||
}
|
||||
String string = object.getNavName();
|
||||
if (string == null) {
|
||||
return null;
|
||||
}
|
||||
arrayList.add(string);
|
||||
object = object3;
|
||||
}
|
||||
object3 = new StringBuffer();
|
||||
int n = arrayList.size() - 1;
|
||||
while (n >= 0) {
|
||||
String string = (String)arrayList.get(n);
|
||||
((StringBuffer)object3).append('/').append(SlotPath.escape(string));
|
||||
--n;
|
||||
}
|
||||
return ((StringBuffer)object3).toString();
|
||||
}
|
||||
|
||||
public static void dump(BComplex bComplex) {
|
||||
PrintWriter printWriter = new PrintWriter(System.out);
|
||||
ObjectUtil.dump(printWriter, bComplex);
|
||||
printWriter.flush();
|
||||
}
|
||||
|
||||
public static void dump(PrintWriter printWriter, BComplex bComplex) {
|
||||
ObjectUtil.dump(null, printWriter, bComplex, false);
|
||||
}
|
||||
|
||||
public static void dumpComponents(BComplex bComplex) {
|
||||
PrintWriter printWriter = new PrintWriter(System.out);
|
||||
ObjectUtil.dumpComponents(printWriter, bComplex);
|
||||
printWriter.flush();
|
||||
}
|
||||
|
||||
public static void dumpComponents(PrintWriter printWriter, BComplex bComplex) {
|
||||
ObjectUtil.dump(null, printWriter, bComplex, true);
|
||||
}
|
||||
|
||||
private static final void dump(String string, PrintWriter printWriter, BComplex bComplex, boolean bl) {
|
||||
if (string == null) {
|
||||
string = "";
|
||||
}
|
||||
printWriter.print(string);
|
||||
printWriter.print(bComplex.getName());
|
||||
printWriter.print(" [" + bComplex.getType() + "] ");
|
||||
if (bComplex.isComponent()) {
|
||||
printWriter.print(" h=" + bComplex.asComponent().getHandle());
|
||||
}
|
||||
printWriter.println();
|
||||
String string2 = string + " ";
|
||||
SlotCursor slotCursor = bComplex.getProperties();
|
||||
while (slotCursor.next()) {
|
||||
BObject bObject = slotCursor.get();
|
||||
if (bl && !(bObject instanceof BComponent)) continue;
|
||||
if (bObject instanceof BComplex) {
|
||||
ObjectUtil.dump(string2, printWriter, (BComplex)bObject, bl);
|
||||
continue;
|
||||
}
|
||||
printWriter.print(string2);
|
||||
printWriter.print(slotCursor.property().getName());
|
||||
printWriter.print(": ");
|
||||
printWriter.println(slotCursor.get());
|
||||
}
|
||||
}
|
||||
|
||||
public static interface NameContainer {
|
||||
public boolean contains(String var1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.TextUtil
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import javax.baja.agent.AgentFilter;
|
||||
import javax.baja.agent.AgentInfo;
|
||||
import javax.baja.agent.AgentList;
|
||||
import javax.baja.agent.BAbstractPxView;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
import javax.baja.registry.TypeInfo;
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public class PxUtil {
|
||||
static final TypeInfo pxEditor = PxUtil.typeInfo("pxEditor:PxEditor");
|
||||
static final TypeInfo hxView = PxUtil.typeInfo("hx:HxView");
|
||||
static final TypeInfo hxPxView = PxUtil.typeInfo("hx:HxPxView");
|
||||
static final TypeInfo pdf = PxUtil.typeInfo("pdf:PxViewToPdf");
|
||||
static TypeInfo[] emptyTypeInfo = new TypeInfo[0];
|
||||
static final BIcon editorBadge = BIcon.std("badges/edit.png");
|
||||
|
||||
public static AgentList explode(AgentList agentList) {
|
||||
AgentInfo[] agentInfoArray = agentList.list();
|
||||
int n = 0;
|
||||
int n2 = 0;
|
||||
while (n2 < agentInfoArray.length) {
|
||||
AgentInfo agentInfo = agentInfoArray[n2];
|
||||
if (agentInfo instanceof BAbstractPxView) {
|
||||
BAbstractPxView bAbstractPxView = (BAbstractPxView)agentInfo;
|
||||
if (pxEditor != null) {
|
||||
agentList.add(agentList.size(), new PxEditor(bAbstractPxView));
|
||||
}
|
||||
if (hxView != null) {
|
||||
AgentList agentList2 = bAbstractPxView.getAgents();
|
||||
agentList2 = agentList2.filter(AgentFilter.is(hxView));
|
||||
TypeInfo typeInfo = agentList2.getDefault().getAgentType();
|
||||
agentList.add(n++, new PxHx(bAbstractPxView, typeInfo));
|
||||
}
|
||||
if (pdf != null) {
|
||||
agentList.add(agentList.size(), new PxPdf(bAbstractPxView));
|
||||
}
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
return agentList;
|
||||
}
|
||||
|
||||
static TypeInfo typeInfo(String string) {
|
||||
try {
|
||||
return Sys.getRegistry().getType(string);
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PxEditor
|
||||
extends PxAgent {
|
||||
public BIcon getIcon(Context context) {
|
||||
return BIcon.make(this.pxView.getIcon(), editorBadge);
|
||||
}
|
||||
|
||||
public BPermissions getRequiredPermissions() {
|
||||
return BPermissions.adminWrite;
|
||||
}
|
||||
|
||||
PxEditor(BAbstractPxView bAbstractPxView) {
|
||||
super(bAbstractPxView, "editor", pxEditor);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PxHx
|
||||
extends PxExporter {
|
||||
public PxHx(BAbstractPxView bAbstractPxView, TypeInfo typeInfo) {
|
||||
super(bAbstractPxView, "hx", typeInfo);
|
||||
}
|
||||
|
||||
public PxHx(BAbstractPxView bAbstractPxView) {
|
||||
super(bAbstractPxView, "hx", hxPxView);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PxPdf
|
||||
extends PxExporter {
|
||||
public PxPdf(BAbstractPxView bAbstractPxView) {
|
||||
super(bAbstractPxView, "pdf", pdf);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PxMobile
|
||||
extends PxExporter {
|
||||
public PxMobile(BAbstractPxView bAbstractPxView, TypeInfo typeInfo) {
|
||||
super(bAbstractPxView, "mobile", typeInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PxExporter
|
||||
extends PxAgent {
|
||||
public BIcon getIcon(Context context) {
|
||||
return BIcon.std("files/" + this.subId + ".png");
|
||||
}
|
||||
|
||||
public BPermissions getRequiredPermissions() {
|
||||
return this.pxView.getRequiredPermissions();
|
||||
}
|
||||
|
||||
PxExporter(BAbstractPxView bAbstractPxView, String string, TypeInfo typeInfo) {
|
||||
super(bAbstractPxView, string, typeInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public static abstract class PxAgent
|
||||
implements AgentInfo {
|
||||
BAbstractPxView pxView;
|
||||
String subId;
|
||||
TypeInfo agentType;
|
||||
static /* synthetic */ Class class$javax$baja$agent$BAbstractPxView;
|
||||
|
||||
public BObject getInstance() {
|
||||
try {
|
||||
Class clazz = this.agentType.getTypeSpec().getResolvedType().getTypeClass();
|
||||
Class[] classArray = new Class[1];
|
||||
Class clazz2 = class$javax$baja$agent$BAbstractPxView;
|
||||
if (clazz2 == null) {
|
||||
clazz2 = class$javax$baja$agent$BAbstractPxView = PxAgent.class("[Ljavax.baja.agent.BAbstractPxView;", false);
|
||||
}
|
||||
classArray[0] = clazz2;
|
||||
Constructor constructor = clazz.getConstructor(classArray);
|
||||
return (BObject)constructor.newInstance(this.pxView);
|
||||
}
|
||||
catch (InvocationTargetException invocationTargetException) {
|
||||
Throwable throwable = invocationTargetException.getTargetException();
|
||||
if (throwable instanceof RuntimeException) {
|
||||
throw (RuntimeException)throwable;
|
||||
}
|
||||
throw new BajaRuntimeException(throwable);
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
throw new BajaRuntimeException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
public final BAbstractPxView getPxView() {
|
||||
return this.pxView;
|
||||
}
|
||||
|
||||
public final String getAgentId() {
|
||||
return this.pxView.getName() + '/' + this.subId;
|
||||
}
|
||||
|
||||
public final TypeInfo getAgentType() {
|
||||
return this.agentType;
|
||||
}
|
||||
|
||||
public final String getAppName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public TypeInfo[] getAgentOn() {
|
||||
return emptyTypeInfo;
|
||||
}
|
||||
|
||||
public String getDisplayName(Context context) {
|
||||
Object[] objectArray = new Object[]{this.pxView.getDisplayName(context)};
|
||||
return Lexicon.make("baja", context).getText("px." + this.subId, objectArray);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.pxView.getName() + " as " + TextUtil.getClassName(this.getClass());
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public PxAgent(BAbstractPxView bAbstractPxView, String string, TypeInfo typeInfo) {
|
||||
this.pxView = bAbstractPxView;
|
||||
this.subId = string;
|
||||
this.agentType = typeInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import com.tridium.sys.schema.SimpleType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.baja.io.BIContextEncodable;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.sys.BSimple;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class SimpleFactory {
|
||||
static Log log = Log.getLog("sys.schema");
|
||||
private Map pool;
|
||||
static /* synthetic */ Class class$javax$baja$sys$BSimple;
|
||||
|
||||
public BSimple make(Type type, String string) throws Exception {
|
||||
return this.make(type, string, null);
|
||||
}
|
||||
|
||||
public BSimple make(Type type, String string, Context context) throws Exception {
|
||||
Class clazz = class$javax$baja$sys$BSimple;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$sys$BSimple = SimpleFactory.class("[Ljavax.baja.sys.BSimple;", false);
|
||||
}
|
||||
if (!clazz.isAssignableFrom(type.getTypeClass())) {
|
||||
throw new IllegalStateException(type.toString() + " is not a BSimple.");
|
||||
}
|
||||
String string2 = type.toString();
|
||||
Entry entry = (Entry)this.pool.get(string2);
|
||||
if (entry == null) {
|
||||
boolean bl;
|
||||
HashMap<String, BSimple> hashMap;
|
||||
BSimple bSimple;
|
||||
BSimple bSimple2;
|
||||
block14: {
|
||||
bSimple2 = type.getInstance().asSimple();
|
||||
bSimple = null;
|
||||
bSimple = bSimple instanceof BIContextEncodable ? (BSimple)((BIContextEncodable)((Object)bSimple2)).decodeFromString(string, context) : (BSimple)bSimple2.decodeFromString(string);
|
||||
hashMap = null;
|
||||
bl = false;
|
||||
try {
|
||||
bl = ((SimpleType)type).interningEnabled();
|
||||
if (bl) {
|
||||
bSimple = bSimple.intern();
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
bl = false;
|
||||
if (!log.isTraceOn()) break block14;
|
||||
log.trace("Could not intern type " + bSimple.getType() + ". Make sure hashCode() method is overridden.");
|
||||
}
|
||||
}
|
||||
if (!bl) {
|
||||
hashMap = new HashMap<String, BSimple>();
|
||||
hashMap.put(string, bSimple);
|
||||
}
|
||||
this.pool.put(string2, new Entry(hashMap, bSimple2, 1));
|
||||
return bSimple;
|
||||
}
|
||||
++entry.requests;
|
||||
BSimple bSimple = null;
|
||||
if (entry.typeMap != null) {
|
||||
bSimple = (BSimple)entry.typeMap.get(string);
|
||||
if (bSimple == null) {
|
||||
bSimple = entry.decoder instanceof BIContextEncodable ? (BSimple)((BIContextEncodable)((Object)entry.decoder)).decodeFromString(string, context) : (BSimple)entry.decoder.decodeFromString(string);
|
||||
entry.typeMap.put(string, bSimple);
|
||||
}
|
||||
} else {
|
||||
bSimple = entry.decoder instanceof BIContextEncodable ? (BSimple)((BIContextEncodable)((Object)entry.decoder)).decodeFromString(string, context) : (BSimple)entry.decoder.decodeFromString(string);
|
||||
try {
|
||||
bSimple = bSimple.intern();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
try {
|
||||
log.warning("Failed to intern type " + bSimple.getType() + " for instance " + bSimple.toString(null), exception);
|
||||
}
|
||||
catch (Exception exception2) {}
|
||||
}
|
||||
}
|
||||
return bSimple;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.pool = new HashMap();
|
||||
}
|
||||
|
||||
public SimpleFactory() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static class Entry {
|
||||
Map typeMap;
|
||||
BSimple decoder;
|
||||
int requests;
|
||||
|
||||
Entry(Map map, BSimple bSimple, int n) {
|
||||
this.typeMap = map;
|
||||
this.decoder = bSimple;
|
||||
this.requests = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
public abstract class StringEscapeUtils {
|
||||
public static String escapeJava(String string) {
|
||||
return StringEscapeUtils.escapeJavaStyleString(string, false);
|
||||
}
|
||||
|
||||
private static final String escapeJavaStyleString(String string, boolean bl) {
|
||||
if (string == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
StringWriter stringWriter = new StringWriter(string.length() * 2);
|
||||
StringEscapeUtils.escapeJavaStyleString(stringWriter, string, bl);
|
||||
return stringWriter.toString();
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
iOException.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static final void escapeJavaStyleString(Writer writer, String string, boolean bl) throws IOException {
|
||||
if (writer == null) {
|
||||
throw new IllegalArgumentException("The Writer must not be null");
|
||||
}
|
||||
if (string == null) {
|
||||
return;
|
||||
}
|
||||
int n = string.length();
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
char c = string.charAt(n2);
|
||||
if (c > '\u0fff') {
|
||||
writer.write("\\u" + StringEscapeUtils.hex(c));
|
||||
} else if (c > '\u00ff') {
|
||||
writer.write("\\u0" + StringEscapeUtils.hex(c));
|
||||
} else if (c > '\u007f') {
|
||||
writer.write("\\u00" + StringEscapeUtils.hex(c));
|
||||
} else if (c < ' ') {
|
||||
switch (c) {
|
||||
case '\b': {
|
||||
writer.write(92);
|
||||
writer.write(98);
|
||||
break;
|
||||
}
|
||||
case '\n': {
|
||||
writer.write(92);
|
||||
writer.write(110);
|
||||
break;
|
||||
}
|
||||
case '\t': {
|
||||
writer.write(92);
|
||||
writer.write(116);
|
||||
break;
|
||||
}
|
||||
case '\f': {
|
||||
writer.write(92);
|
||||
writer.write(102);
|
||||
break;
|
||||
}
|
||||
case '\r': {
|
||||
writer.write(92);
|
||||
writer.write(114);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (c > '\u000f') {
|
||||
writer.write("\\u00" + StringEscapeUtils.hex(c));
|
||||
break;
|
||||
}
|
||||
writer.write("\\u000" + StringEscapeUtils.hex(c));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch (c) {
|
||||
case '\'': {
|
||||
if (bl) {
|
||||
writer.write(92);
|
||||
}
|
||||
writer.write(39);
|
||||
break;
|
||||
}
|
||||
case '\"': {
|
||||
writer.write(92);
|
||||
writer.write(34);
|
||||
break;
|
||||
}
|
||||
case '\\': {
|
||||
writer.write(92);
|
||||
writer.write(92);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
writer.write(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
}
|
||||
|
||||
private static final String hex(char c) {
|
||||
return Integer.toHexString(c).toUpperCase();
|
||||
}
|
||||
|
||||
public static String unescapeJava(String string) {
|
||||
if (string == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
StringWriter stringWriter = new StringWriter(string.length());
|
||||
StringEscapeUtils.unescapeJava(stringWriter, string);
|
||||
return stringWriter.toString();
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
iOException.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static final void unescapeJava(Writer writer, String string) throws IOException {
|
||||
if (writer == null) {
|
||||
throw new IllegalArgumentException("The Writer must not be null");
|
||||
}
|
||||
if (string == null) {
|
||||
return;
|
||||
}
|
||||
int n = string.length();
|
||||
StringBuffer stringBuffer = new StringBuffer(4);
|
||||
boolean bl = false;
|
||||
boolean bl2 = false;
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
char c = string.charAt(n2);
|
||||
if (bl2) {
|
||||
stringBuffer.append(c);
|
||||
if (stringBuffer.length() == 4) {
|
||||
try {
|
||||
int n3 = Integer.parseInt(stringBuffer.toString(), 16);
|
||||
writer.write((char)n3);
|
||||
stringBuffer.setLength(0);
|
||||
bl2 = false;
|
||||
bl = false;
|
||||
}
|
||||
catch (NumberFormatException numberFormatException) {
|
||||
throw new RuntimeException("Unable to parse unicode value: " + stringBuffer, numberFormatException);
|
||||
}
|
||||
}
|
||||
} else if (bl) {
|
||||
bl = false;
|
||||
switch (c) {
|
||||
case '\\': {
|
||||
writer.write(92);
|
||||
break;
|
||||
}
|
||||
case '\'': {
|
||||
writer.write(39);
|
||||
break;
|
||||
}
|
||||
case '\"': {
|
||||
writer.write(34);
|
||||
break;
|
||||
}
|
||||
case 'r': {
|
||||
writer.write(13);
|
||||
break;
|
||||
}
|
||||
case 'f': {
|
||||
writer.write(12);
|
||||
break;
|
||||
}
|
||||
case 't': {
|
||||
writer.write(9);
|
||||
break;
|
||||
}
|
||||
case 'n': {
|
||||
writer.write(10);
|
||||
break;
|
||||
}
|
||||
case 'b': {
|
||||
writer.write(8);
|
||||
break;
|
||||
}
|
||||
case 'u': {
|
||||
bl2 = true;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
writer.write(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (c == '\\') {
|
||||
bl = true;
|
||||
} else {
|
||||
writer.write(c);
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
if (bl) {
|
||||
writer.write(92);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,335 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.nre.util.ArrayIterator
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import com.tridium.nre.util.ArrayIterator;
|
||||
import java.util.Dictionary;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class StringTable
|
||||
extends Dictionary {
|
||||
static final String[] EMPTY = new String[0];
|
||||
String[] keys;
|
||||
Object[] values;
|
||||
int count;
|
||||
|
||||
public synchronized void init(String[] stringArray, Object[] objectArray) {
|
||||
if (stringArray.length != objectArray.length) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
int n = this.count = stringArray.length;
|
||||
this.keys = new String[n];
|
||||
String[] stringArray2 = this.keys;
|
||||
this.values = new Object[n];
|
||||
Object[] objectArray2 = this.values;
|
||||
System.arraycopy(stringArray, 0, this.keys, 0, n);
|
||||
System.arraycopy(objectArray, 0, this.values, 0, n);
|
||||
int n2 = n / 2;
|
||||
while (n2 >= 1) {
|
||||
int n3 = n2;
|
||||
while (n3 < n) {
|
||||
String string = stringArray2[n3];
|
||||
Object object = objectArray2[n3];
|
||||
int n4 = n3;
|
||||
while (n4 >= n2 && string.compareTo(stringArray2[n4 - n2]) < 0) {
|
||||
stringArray2[n4] = stringArray2[n4 - n2];
|
||||
objectArray2[n4] = objectArray2[n4 - n2];
|
||||
n4 -= n2;
|
||||
}
|
||||
stringArray2[n4] = string;
|
||||
objectArray2[n4] = object;
|
||||
++n3;
|
||||
}
|
||||
n2 /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized Object get(String string) {
|
||||
String[] stringArray = this.keys;
|
||||
int n = -1;
|
||||
int n2 = this.count;
|
||||
while (n2 - n > 1) {
|
||||
int n3 = (n2 + n) / 2;
|
||||
int n4 = string.compareTo(stringArray[n3]);
|
||||
if (n4 < 0) {
|
||||
n2 = n3;
|
||||
continue;
|
||||
}
|
||||
if (n4 > 0) {
|
||||
n = n3;
|
||||
continue;
|
||||
}
|
||||
return this.values[n3];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized Object put(String string, Object object) {
|
||||
if (this.keys.length >= this.count) {
|
||||
this.ensureCapacity(Math.max(8, this.count * 2));
|
||||
}
|
||||
String[] stringArray = this.keys;
|
||||
if (this.count == 0) {
|
||||
stringArray[0] = string;
|
||||
this.values[0] = object;
|
||||
++this.count;
|
||||
return null;
|
||||
}
|
||||
if (this.count == 1) {
|
||||
int n = string.compareTo(stringArray[0]);
|
||||
if (n == 0) {
|
||||
Object object2 = this.values[0];
|
||||
this.values[0] = object;
|
||||
return object2;
|
||||
}
|
||||
if (n < 0) {
|
||||
stringArray[1] = stringArray[0];
|
||||
this.values[1] = this.values[0];
|
||||
stringArray[0] = string;
|
||||
this.values[0] = object;
|
||||
++this.count;
|
||||
} else {
|
||||
stringArray[1] = string;
|
||||
this.values[1] = object;
|
||||
++this.count;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
int n = 0;
|
||||
int n2 = this.count - 1;
|
||||
int n3 = (n2 - n) / 2;
|
||||
while (n <= n2) {
|
||||
int n4 = string.compareTo(stringArray[n3]);
|
||||
if (n4 == 0) {
|
||||
Object object3 = this.values[n3];
|
||||
this.values[n3] = object;
|
||||
return object3;
|
||||
}
|
||||
if (n4 < 0) {
|
||||
n4 = string.compareTo(stringArray[n]);
|
||||
if (n4 == 0) {
|
||||
Object object4 = this.values[n];
|
||||
this.values[n] = object;
|
||||
return object4;
|
||||
}
|
||||
if (n4 < 0) {
|
||||
n3 = n;
|
||||
break;
|
||||
}
|
||||
n2 = n3 - 1;
|
||||
} else {
|
||||
n4 = string.compareTo(stringArray[n2]);
|
||||
if (n4 == 0) {
|
||||
Object object5 = this.values[n2];
|
||||
this.values[n2] = object;
|
||||
return object5;
|
||||
}
|
||||
if (n4 > 0) {
|
||||
n3 = n2 + 1;
|
||||
break;
|
||||
}
|
||||
n = n3 + 1;
|
||||
}
|
||||
n3 = n + (n2 - n) / 2;
|
||||
}
|
||||
System.arraycopy(stringArray, n3, stringArray, n3 + 1, this.count - n3);
|
||||
stringArray[n3] = string;
|
||||
System.arraycopy(this.values, n3, this.values, n3 + 1, this.count - n3);
|
||||
this.values[n3] = object;
|
||||
++this.count;
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized Object remove(String string) {
|
||||
String[] stringArray = this.keys;
|
||||
int n = -1;
|
||||
int n2 = this.count;
|
||||
while (n2 - n > 1) {
|
||||
int n3 = (n2 + n) / 2;
|
||||
int n4 = string.compareTo(stringArray[n3]);
|
||||
if (n4 < 0) {
|
||||
n2 = n3;
|
||||
continue;
|
||||
}
|
||||
if (n4 > 0) {
|
||||
n = n3;
|
||||
continue;
|
||||
}
|
||||
Object object = this.values[n3];
|
||||
System.arraycopy(this.keys, n3 + 1, this.keys, n3, this.count - n3 - 1);
|
||||
System.arraycopy(this.values, n3 + 1, this.values, n3, this.count - n3 - 1);
|
||||
this.keys[this.count - 1] = null;
|
||||
this.values[this.count - 1] = null;
|
||||
--this.count;
|
||||
return object;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized String[] keyArray() {
|
||||
String[] stringArray = new String[this.count];
|
||||
System.arraycopy(this.keys, 0, stringArray, 0, this.count);
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
public synchronized Object[] elementArray() {
|
||||
Object[] objectArray = new Object[this.count];
|
||||
System.arraycopy(this.values, 0, objectArray, 0, this.count);
|
||||
return objectArray;
|
||||
}
|
||||
|
||||
public synchronized Object[] elementArray(Object[] objectArray) {
|
||||
System.arraycopy(this.values, 0, objectArray, 0, this.count);
|
||||
return objectArray;
|
||||
}
|
||||
|
||||
public synchronized void copyElementsInto(Object[] objectArray, int n) {
|
||||
System.arraycopy(this.values, 0, objectArray, n, this.count);
|
||||
}
|
||||
|
||||
public synchronized boolean isEmpty() {
|
||||
boolean bl = false;
|
||||
if (this.count == 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public synchronized int size() {
|
||||
return this.count;
|
||||
}
|
||||
|
||||
public synchronized void ensureCapacity(int n) {
|
||||
if (this.keys.length < n) {
|
||||
String[] stringArray = new String[n];
|
||||
Object[] objectArray = new Object[n];
|
||||
System.arraycopy(this.keys, 0, stringArray, 0, this.count);
|
||||
System.arraycopy(this.values, 0, objectArray, 0, this.count);
|
||||
this.keys = stringArray;
|
||||
this.values = objectArray;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void clear() {
|
||||
this.keys = EMPTY;
|
||||
this.values = EMPTY;
|
||||
this.count = 0;
|
||||
}
|
||||
|
||||
public Iterator keyIterator() {
|
||||
return new ArrayIterator((Object[])this.keys, 0, this.size());
|
||||
}
|
||||
|
||||
public Iterator valueIterator() {
|
||||
return new ArrayIterator(this.values, 0, this.size());
|
||||
}
|
||||
|
||||
public Enumeration keys() {
|
||||
return new Enumerator(true);
|
||||
}
|
||||
|
||||
public Enumeration elements() {
|
||||
return new Enumerator(false);
|
||||
}
|
||||
|
||||
public Object get(Object object) {
|
||||
return this.get((String)object);
|
||||
}
|
||||
|
||||
public Object put(Object object, Object object2) {
|
||||
return this.put((String)object, object2);
|
||||
}
|
||||
|
||||
public Object remove(Object object) {
|
||||
return this.remove((String)object);
|
||||
}
|
||||
|
||||
public synchronized void dump() {
|
||||
Enumeration enumeration = this.keys();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
String string = (String)enumeration.nextElement();
|
||||
System.out.println(" " + string + " = " + this.get(string));
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] stringArray) {
|
||||
StringTable stringTable = new StringTable();
|
||||
stringTable.put("value", (Object)"200");
|
||||
stringTable.put("hee", (Object)"2000");
|
||||
ArrayIterator arrayIterator = (ArrayIterator)stringTable.keyIterator();
|
||||
System.out.println("Size --> " + stringTable.size());
|
||||
while (arrayIterator.hasNext()) {
|
||||
System.out.println("\t Next element -> " + arrayIterator.next());
|
||||
}
|
||||
System.out.println("---------");
|
||||
while (arrayIterator.hasPrevious()) {
|
||||
System.out.println("\t Next element -> " + arrayIterator.previous());
|
||||
}
|
||||
while (arrayIterator.hasNext()) {
|
||||
System.out.println("\t Next element -> " + arrayIterator.next());
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.keys = EMPTY;
|
||||
this.values = EMPTY;
|
||||
this.count = 0;
|
||||
}
|
||||
|
||||
public StringTable() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
public StringTable(int n) {
|
||||
this.this();
|
||||
this.keys = new String[n];
|
||||
this.values = new Object[n];
|
||||
}
|
||||
|
||||
public StringTable(String[] stringArray, Object[] objectArray) {
|
||||
this.this();
|
||||
this.init(stringArray, objectArray);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class Enumerator
|
||||
implements Enumeration {
|
||||
private boolean doKeys;
|
||||
private int index;
|
||||
|
||||
public boolean hasMoreElements() {
|
||||
boolean bl = false;
|
||||
if (this.index < StringTable.this.count) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public Object nextElement() {
|
||||
if (this.index >= StringTable.this.count) {
|
||||
throw new NoSuchElementException("StringTable");
|
||||
}
|
||||
if (this.doKeys) {
|
||||
return StringTable.this.keys[this.index++];
|
||||
}
|
||||
return StringTable.this.values[this.index++];
|
||||
}
|
||||
|
||||
public Enumerator(boolean bl) {
|
||||
this.doKeys = bl;
|
||||
this.index = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.TextUtil
|
||||
* javax.baja.xml.XException
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import javax.baja.io.BajaIOException;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
import javax.baja.sys.BajaException;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Localizable;
|
||||
import javax.baja.xml.XException;
|
||||
|
||||
public class ThrowableUtil {
|
||||
static final int DEFAULT_STACK_DEPTH = 20;
|
||||
|
||||
public static RuntimeException toRuntime(Throwable throwable) {
|
||||
if (throwable instanceof RuntimeException) {
|
||||
return (RuntimeException)throwable;
|
||||
}
|
||||
return new BajaRuntimeException(throwable);
|
||||
}
|
||||
|
||||
public static Throwable getCause(Throwable throwable) {
|
||||
if (throwable instanceof BajaException) {
|
||||
return ((BajaException)throwable).getCause();
|
||||
}
|
||||
if (throwable instanceof BajaRuntimeException) {
|
||||
return ((BajaRuntimeException)throwable).getCause();
|
||||
}
|
||||
if (throwable instanceof BajaIOException) {
|
||||
return ((BajaIOException)throwable).getCause();
|
||||
}
|
||||
if (throwable instanceof XException) {
|
||||
return ((XException)throwable).getCause();
|
||||
}
|
||||
if (throwable instanceof InvocationTargetException) {
|
||||
return ((InvocationTargetException)throwable).getTargetException();
|
||||
}
|
||||
if (throwable instanceof ExceptionInInitializerError) {
|
||||
return ((ExceptionInInitializerError)throwable).getException();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getStack() {
|
||||
return ThrowableUtil.dumpToString(new Exception());
|
||||
}
|
||||
|
||||
public static String dumpToString(Throwable throwable) {
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
ThrowableUtil.dump(stringWriter, throwable, 0, 20);
|
||||
return stringWriter.toString();
|
||||
}
|
||||
|
||||
public static String dumpToString(Throwable throwable, int n) {
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
ThrowableUtil.dump(stringWriter, throwable, 0, n);
|
||||
return stringWriter.toString();
|
||||
}
|
||||
|
||||
public static void dump(Writer writer, Throwable throwable) {
|
||||
ThrowableUtil.dump(writer, throwable, 0, 20);
|
||||
}
|
||||
|
||||
public static void dump(Writer writer, Throwable throwable, int n) {
|
||||
ThrowableUtil.dump(writer, throwable, 0, n);
|
||||
}
|
||||
|
||||
public static void dump(Throwable throwable) {
|
||||
ThrowableUtil.dump(System.out, throwable);
|
||||
}
|
||||
|
||||
public static void dump(OutputStream outputStream, Throwable throwable) {
|
||||
try {
|
||||
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
|
||||
ThrowableUtil.dump(outputStreamWriter, throwable, 0, 20);
|
||||
((Writer)outputStreamWriter).flush();
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
iOException.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static final void dump(Writer writer, Throwable throwable, int n, int n2) {
|
||||
try {
|
||||
if (throwable == null) {
|
||||
return;
|
||||
}
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
PrintWriter printWriter = new PrintWriter(stringWriter);
|
||||
throwable.printStackTrace(printWriter);
|
||||
printWriter.flush();
|
||||
BufferedReader bufferedReader = new BufferedReader(new StringReader(stringWriter.toString()));
|
||||
int n3 = 0;
|
||||
while (n3 < n2) {
|
||||
String string = bufferedReader.readLine();
|
||||
if (string == null) break;
|
||||
writer.write(TextUtil.getSpaces((int)(n * 2)));
|
||||
int n4 = string.length();
|
||||
int n5 = 0;
|
||||
while (n5 < n4) {
|
||||
char c = string.charAt(n5);
|
||||
if (c == '\t') {
|
||||
writer.write(" ");
|
||||
} else {
|
||||
writer.write(c);
|
||||
}
|
||||
++n5;
|
||||
}
|
||||
writer.write(10);
|
||||
++n3;
|
||||
}
|
||||
Throwable throwable2 = ThrowableUtil.getCause(throwable);
|
||||
if (throwable2 != null) {
|
||||
ThrowableUtil.dump(writer, throwable2, n + 1, n2);
|
||||
}
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
iOException.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Localizable toLocalizable(Throwable throwable) {
|
||||
if (throwable == null) {
|
||||
return null;
|
||||
}
|
||||
if (throwable instanceof Localizable) {
|
||||
return (Localizable)((Object)throwable);
|
||||
}
|
||||
return ThrowableUtil.toLocalizable(ThrowableUtil.getCause(throwable));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,511 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BMonth;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BTime;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.timezone.BTimeZone;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public class TimeFormat {
|
||||
static final int SHOW_DATE = 1;
|
||||
static final int SHOW_TIME = 2;
|
||||
static final int SHOW_SECONDS = 4;
|
||||
static final int SHOW_MILLIS = 8;
|
||||
static final int SHOW_ZONE = 16;
|
||||
static final int[] SHOW;
|
||||
public static final int YEAR_2 = 1;
|
||||
public static final int YEAR_4 = 2;
|
||||
public static final int MON_1 = 3;
|
||||
public static final int MON_2 = 4;
|
||||
public static final int MON_TAG = 5;
|
||||
public static final int MON = 18;
|
||||
public static final int DAY_1 = 6;
|
||||
public static final int DAY_2 = 7;
|
||||
public static final int HOUR_12_1 = 8;
|
||||
public static final int HOUR_12_2 = 9;
|
||||
public static final int HOUR_24_1 = 10;
|
||||
public static final int HOUR_24_2 = 11;
|
||||
public static final int MIN = 12;
|
||||
public static final int AM_PM = 13;
|
||||
public static final int SEC = 14;
|
||||
public static final int ZONE_TAG = 15;
|
||||
public static final int WEEK_1 = 16;
|
||||
public static final int WEEK_2 = 17;
|
||||
public static final int ZONE_OFFSET = 19;
|
||||
public static final int WEEK_YEAR = 20;
|
||||
private static String[] PATTERNS;
|
||||
static HashMap cache;
|
||||
static String defaultPattern;
|
||||
static final String fallbackPattern = "DD-MMM-YY h:mm:ss a z";
|
||||
public static final String TIME_FORMAT = "timeFormat";
|
||||
int[] pattern;
|
||||
|
||||
public static String format(BAbsTime bAbsTime, String string, Context context) {
|
||||
context = BFacets.make(context.getFacets(), BFacets.make(TIME_FORMAT, BString.make(string)));
|
||||
return TimeFormat.format(bAbsTime, context);
|
||||
}
|
||||
|
||||
public static String format(BAbsTime bAbsTime, String string) {
|
||||
BFacets bFacets = BFacets.make(TIME_FORMAT, BString.make(string));
|
||||
return TimeFormat.format(bAbsTime, (Context)bFacets);
|
||||
}
|
||||
|
||||
public static String format(BAbsTime bAbsTime, Context context) {
|
||||
bAbsTime = TimeFormat.toTimeZone(bAbsTime, context);
|
||||
int n = TimeFormat.toShowMask(19, context);
|
||||
n = TimeFormat.normalizeShowMask(n);
|
||||
return TimeFormat.make(context).format(bAbsTime, n, context);
|
||||
}
|
||||
|
||||
public static String formatTime(BAbsTime bAbsTime, Context context) {
|
||||
bAbsTime = TimeFormat.toTimeZone(bAbsTime, context);
|
||||
int n = TimeFormat.toShowMask(2, context);
|
||||
n |= 2;
|
||||
n &= 0xFFFFFFFE;
|
||||
n = TimeFormat.normalizeShowMask(n);
|
||||
return TimeFormat.make(context).format(bAbsTime, n, context);
|
||||
}
|
||||
|
||||
public static String formatDate(BAbsTime bAbsTime, Context context) {
|
||||
bAbsTime = TimeFormat.toTimeZone(bAbsTime, context);
|
||||
int n = TimeFormat.toShowMask(1, context);
|
||||
n |= 1;
|
||||
n &= 0xFFFFFFFD;
|
||||
n = TimeFormat.normalizeShowMask(n);
|
||||
return TimeFormat.make(context).format(bAbsTime, n, context);
|
||||
}
|
||||
|
||||
public static String format(BTime bTime, Context context) {
|
||||
int n = TimeFormat.toShowMask(2, context);
|
||||
n &= 0xFFFFFFFE;
|
||||
n &= 0xFFFFFFEF;
|
||||
n = TimeFormat.normalizeShowMask(n);
|
||||
return TimeFormat.make(context).format(bTime, n, context);
|
||||
}
|
||||
|
||||
public static int[] pattern(Context context) {
|
||||
int n = TimeFormat.toShowMask(19, context);
|
||||
return TimeFormat.make(context).pattern(n);
|
||||
}
|
||||
|
||||
public static void setDefaultPattern(String string) {
|
||||
if (string != null && (string = string.trim()).length() == 0) {
|
||||
string = null;
|
||||
}
|
||||
defaultPattern = string;
|
||||
}
|
||||
|
||||
private static final BAbsTime toTimeZone(BAbsTime bAbsTime, Context context) {
|
||||
BTimeZone bTimeZone;
|
||||
if (context != null && (bTimeZone = (BTimeZone)context.getFacet("TimeZone")) != null) {
|
||||
return BAbsTime.make(bAbsTime, bTimeZone);
|
||||
}
|
||||
return bAbsTime;
|
||||
}
|
||||
|
||||
static TimeFormat make(Context context) {
|
||||
Object object;
|
||||
String string = null;
|
||||
if (context != null && (object = context.getFacet(TIME_FORMAT)) != null) {
|
||||
string = object.toString();
|
||||
}
|
||||
if (string == null || string.length() == 0) {
|
||||
string = defaultPattern;
|
||||
}
|
||||
if (string == null || string.length() == 0) {
|
||||
string = Lexicon.make(Sys.getBajaModule(), context).get(TIME_FORMAT);
|
||||
}
|
||||
if (string == null || string.length() == 0) {
|
||||
System.out.println("ERROR: Missing baja:timeFormat lexicon entry");
|
||||
string = fallbackPattern;
|
||||
}
|
||||
if ((object = (TimeFormat)cache.get(string)) == null) {
|
||||
object = new TimeFormat(string);
|
||||
cache.put(string, object);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
int toCode(int n, int n2) {
|
||||
switch (n) {
|
||||
case 89: {
|
||||
int n3 = 0;
|
||||
if (n2 <= 2) {
|
||||
n3 = 1;
|
||||
}
|
||||
return 2 - n3;
|
||||
}
|
||||
case 77: {
|
||||
switch (n2) {
|
||||
case 1: {
|
||||
return 3;
|
||||
}
|
||||
case 2: {
|
||||
return 4;
|
||||
}
|
||||
case 3: {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
return 18;
|
||||
}
|
||||
case 68: {
|
||||
int n4 = 0;
|
||||
if (n2 == 1) {
|
||||
n4 = 1;
|
||||
}
|
||||
return 7 - n4;
|
||||
}
|
||||
case 104: {
|
||||
int n5 = 0;
|
||||
if (n2 == 1) {
|
||||
n5 = 1;
|
||||
}
|
||||
return 9 - n5;
|
||||
}
|
||||
case 72: {
|
||||
int n6 = 0;
|
||||
if (n2 == 1) {
|
||||
n6 = 1;
|
||||
}
|
||||
return 11 - n6;
|
||||
}
|
||||
case 109: {
|
||||
return 12;
|
||||
}
|
||||
case 115: {
|
||||
return 14;
|
||||
}
|
||||
case 97: {
|
||||
return 13;
|
||||
}
|
||||
case 122: {
|
||||
return 15;
|
||||
}
|
||||
case 90: {
|
||||
return 19;
|
||||
}
|
||||
case 87: {
|
||||
int n7 = 0;
|
||||
if (n2 == 1) {
|
||||
n7 = 1;
|
||||
}
|
||||
return 17 - n7;
|
||||
}
|
||||
case 119: {
|
||||
return 20;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
int[] pattern(int n) {
|
||||
int[] nArray = new int[this.pattern.length];
|
||||
int n2 = 0;
|
||||
int n3 = -1;
|
||||
int n4 = 0;
|
||||
int n5 = 0;
|
||||
while (n5 < this.pattern.length) {
|
||||
int n6 = this.pattern[n5];
|
||||
if (n6 >= SHOW.length) {
|
||||
n3 = n6;
|
||||
} else if ((SHOW[n6] & n) == 0) {
|
||||
n3 = -1;
|
||||
} else {
|
||||
if (++n4 > 1 && n3 != -1) {
|
||||
nArray[n2++] = n3;
|
||||
n3 = -1;
|
||||
}
|
||||
++n4;
|
||||
nArray[n2++] = n6;
|
||||
}
|
||||
++n5;
|
||||
}
|
||||
int[] nArray2 = new int[n2];
|
||||
System.arraycopy(nArray, 0, nArray2, 0, n2);
|
||||
return nArray2;
|
||||
}
|
||||
|
||||
String format(BTime bTime, int n, Context context) {
|
||||
return this.format(null, 0, BMonth.january, 0, bTime.getHour(), bTime.getMinute(), bTime.getSecond(), bTime.getMillisecond(), BTimeZone.getLocal(), n, context);
|
||||
}
|
||||
|
||||
String format(BAbsTime bAbsTime, int n, Context context) {
|
||||
return this.format(bAbsTime, bAbsTime.getYear(), bAbsTime.getMonth(), bAbsTime.getDay(), bAbsTime.getHour(), bAbsTime.getMinute(), bAbsTime.getSecond(), bAbsTime.getMillisecond(), bAbsTime.getTimeZone(), n, context);
|
||||
}
|
||||
|
||||
String format(BAbsTime bAbsTime, int n, BMonth bMonth, int n2, int n3, int n4, int n5, int n6, BTimeZone bTimeZone, int n7, Context context) {
|
||||
int n8 = bMonth.getOrdinal() + 1;
|
||||
int[] nArray = this.pattern;
|
||||
int n9 = nArray.length;
|
||||
StringBuffer stringBuffer = new StringBuffer(n9 * 4);
|
||||
int n10 = -1;
|
||||
int n11 = -1;
|
||||
int n12 = 0;
|
||||
int n13 = 0;
|
||||
while (n13 < n9) {
|
||||
int n14 = nArray[n13];
|
||||
if (n14 >= SHOW.length) {
|
||||
if (n10 == -1) {
|
||||
n10 = n14;
|
||||
} else if (n11 == -1) {
|
||||
n11 = n14;
|
||||
}
|
||||
} else if ((SHOW[n14] & n7) == 0) {
|
||||
n11 = -1;
|
||||
n10 = -1;
|
||||
} else {
|
||||
if (++n12 > 1 && n10 != -1) {
|
||||
stringBuffer.append((char)n10);
|
||||
if (n11 != -1) {
|
||||
stringBuffer.append((char)n11);
|
||||
}
|
||||
n11 = -1;
|
||||
n10 = -1;
|
||||
}
|
||||
++n12;
|
||||
switch (n14) {
|
||||
case 1: {
|
||||
TimeFormat.pad(stringBuffer, n % 100);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
stringBuffer.append(n);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
stringBuffer.append(n8);
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
TimeFormat.pad(stringBuffer, n8);
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
stringBuffer.append(bMonth.getShortDisplayTag(context));
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
stringBuffer.append(bMonth.toString(context));
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
stringBuffer.append(n2);
|
||||
break;
|
||||
}
|
||||
case 7: {
|
||||
TimeFormat.pad(stringBuffer, n2);
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
if (n3 == 0) {
|
||||
stringBuffer.append("12");
|
||||
break;
|
||||
}
|
||||
stringBuffer.append(n3 > 12 ? n3 - 12 : n3);
|
||||
break;
|
||||
}
|
||||
case 9: {
|
||||
if (n3 == 0) {
|
||||
stringBuffer.append("12");
|
||||
break;
|
||||
}
|
||||
TimeFormat.pad(stringBuffer, n3 > 12 ? n3 - 12 : n3);
|
||||
break;
|
||||
}
|
||||
case 10: {
|
||||
stringBuffer.append(n3);
|
||||
break;
|
||||
}
|
||||
case 11: {
|
||||
TimeFormat.pad(stringBuffer, n3);
|
||||
break;
|
||||
}
|
||||
case 12: {
|
||||
TimeFormat.pad(stringBuffer, n4);
|
||||
break;
|
||||
}
|
||||
case 13: {
|
||||
stringBuffer.append(n3 < 12 ? "AM" : "PM");
|
||||
break;
|
||||
}
|
||||
case 14: {
|
||||
TimeFormat.pad(stringBuffer, n5);
|
||||
if ((n7 & 8) == 0) break;
|
||||
stringBuffer.append('.');
|
||||
if (n6 < 10) {
|
||||
stringBuffer.append('0');
|
||||
}
|
||||
if (n6 < 100) {
|
||||
stringBuffer.append('0');
|
||||
}
|
||||
stringBuffer.append(n6);
|
||||
break;
|
||||
}
|
||||
case 15: {
|
||||
stringBuffer.append(bTimeZone.getShortDisplayName(bAbsTime, context));
|
||||
break;
|
||||
}
|
||||
case 19: {
|
||||
int n15 = bAbsTime != null ? bAbsTime.getTimeZoneOffset() : bTimeZone.getUtcOffset(BAbsTime.now().getMillis());
|
||||
if (n15 == 0) {
|
||||
stringBuffer.append('Z');
|
||||
break;
|
||||
}
|
||||
int n16 = Math.abs(n15 / 3600000);
|
||||
int n17 = Math.abs(n15 % 3600000 / 60000);
|
||||
if (n15 < 0) {
|
||||
stringBuffer.append('-');
|
||||
} else {
|
||||
stringBuffer.append('+');
|
||||
}
|
||||
if (n16 < 10) {
|
||||
stringBuffer.append('0');
|
||||
}
|
||||
stringBuffer.append(n16);
|
||||
stringBuffer.append(":");
|
||||
if (n17 < 10) {
|
||||
stringBuffer.append('0');
|
||||
}
|
||||
stringBuffer.append(n17);
|
||||
break;
|
||||
}
|
||||
case 16: {
|
||||
stringBuffer.append(bAbsTime.getWeekday().getShortDisplayTag(context));
|
||||
break;
|
||||
}
|
||||
case 17: {
|
||||
stringBuffer.append(bAbsTime.getWeekday().getDisplayTag(context));
|
||||
break;
|
||||
}
|
||||
case 20: {
|
||||
Calendar calendar = BAbsTime.makeCalendar(n, bMonth, n2, n3, n4, n5, n6, bTimeZone, context);
|
||||
stringBuffer.append(calendar.get(3));
|
||||
break;
|
||||
}
|
||||
}
|
||||
n11 = -1;
|
||||
n10 = -1;
|
||||
}
|
||||
++n13;
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
static void pad(StringBuffer stringBuffer, int n) {
|
||||
if (n < 10) {
|
||||
stringBuffer.append('0');
|
||||
}
|
||||
stringBuffer.append(n);
|
||||
}
|
||||
|
||||
static int toShowMask(int n, Context context) {
|
||||
if (context != null) {
|
||||
BFacets bFacets = context.getFacets();
|
||||
n = TimeFormat.mask(n, bFacets, "showDate", 1);
|
||||
n = TimeFormat.mask(n, bFacets, "showTime", 2);
|
||||
n = TimeFormat.mask(n, bFacets, "showSeconds", 4);
|
||||
n = TimeFormat.mask(n, bFacets, "showMilliseconds", 8);
|
||||
n = TimeFormat.mask(n, bFacets, "showTimeZone", 16);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
static int mask(int n, BFacets bFacets, String string, int n2) {
|
||||
BObject bObject = bFacets.getFacet(string);
|
||||
if (bObject instanceof BBoolean) {
|
||||
n = ((BBoolean)bObject).getBoolean() ? (n |= n2) : (n &= ~n2);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
static int normalizeShowMask(int n) {
|
||||
if ((n & 2) == 0) {
|
||||
n &= 0xFFFFFFE3;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
public static String patternToString(int n) {
|
||||
if (n < PATTERNS.length) {
|
||||
return PATTERNS[n];
|
||||
}
|
||||
return "" + (char)n;
|
||||
}
|
||||
|
||||
public static String patternToString(int[] nArray) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
int n = 0;
|
||||
while (n < nArray.length) {
|
||||
stringBuffer.append(TimeFormat.patternToString(nArray[n]));
|
||||
++n;
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
TimeFormat(String string) {
|
||||
if (string == null) {
|
||||
string = fallbackPattern;
|
||||
}
|
||||
int n = string.length();
|
||||
int[] nArray = new int[n];
|
||||
int n2 = 0;
|
||||
char c = string.charAt(0);
|
||||
int n3 = 1;
|
||||
int n4 = 1;
|
||||
while (n4 < n) {
|
||||
char c2 = string.charAt(n4);
|
||||
if (c == c2) {
|
||||
++n3;
|
||||
} else {
|
||||
nArray[n2++] = this.toCode(c, n3);
|
||||
c = c2;
|
||||
n3 = 1;
|
||||
}
|
||||
++n4;
|
||||
}
|
||||
nArray[n2++] = this.toCode(c, n3);
|
||||
this.pattern = new int[n2];
|
||||
System.arraycopy(nArray, 0, this.pattern, 0, n2);
|
||||
}
|
||||
|
||||
static {
|
||||
int[] nArray = new int[21];
|
||||
nArray[1] = 1;
|
||||
nArray[2] = 1;
|
||||
nArray[3] = 1;
|
||||
nArray[4] = 1;
|
||||
nArray[5] = 1;
|
||||
nArray[6] = 1;
|
||||
nArray[7] = 1;
|
||||
nArray[8] = 2;
|
||||
nArray[9] = 2;
|
||||
nArray[10] = 2;
|
||||
nArray[11] = 2;
|
||||
nArray[12] = 2;
|
||||
nArray[13] = 2;
|
||||
nArray[14] = 12;
|
||||
nArray[15] = 16;
|
||||
nArray[16] = 1;
|
||||
nArray[17] = 1;
|
||||
nArray[18] = 1;
|
||||
nArray[19] = 16;
|
||||
nArray[20] = 1;
|
||||
SHOW = nArray;
|
||||
PATTERNS = new String[]{"?", "YY", "YYYY", "M", "MM", "MMM", "D", "DD", "h", "hh", "H", "HH", "mm", "a", "ss", "z", "W", "WW", "MMMM", "Z", "w"};
|
||||
cache = new HashMap();
|
||||
defaultPattern = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,580 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util;
|
||||
|
||||
import com.tridium.sys.schema.ComponentSlotMap;
|
||||
import java.io.IOException;
|
||||
import javax.baja.category.BCategoryMask;
|
||||
import javax.baja.io.BIContextEncodable;
|
||||
import javax.baja.io.ByteBuffer;
|
||||
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.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BEnum;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BIPropertyContainer;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BSimple;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.SlotCursor;
|
||||
import javax.baja.sys.TypeNotFoundException;
|
||||
import javax.baja.util.BTypeSpec;
|
||||
import javax.baja.virtual.BVirtualComponentSpace;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class ValueByteBuffer
|
||||
extends ByteBuffer {
|
||||
static final int VERSION = 1;
|
||||
protected static final int PROPERTY_SLOT = 1;
|
||||
protected static final int ACTION_SLOT = 2;
|
||||
protected static final int TOPIC_SLOT = 3;
|
||||
private boolean encodeTransients;
|
||||
private Context encodeContext;
|
||||
|
||||
public static ValueByteBuffer make(byte[] byArray, int n) {
|
||||
return new ValueByteBuffer(byArray, n);
|
||||
}
|
||||
|
||||
public static ValueByteBuffer make(byte[] byArray) {
|
||||
return new ValueByteBuffer(byArray);
|
||||
}
|
||||
|
||||
public static ValueByteBuffer make(int n) {
|
||||
return new ValueByteBuffer(n);
|
||||
}
|
||||
|
||||
public static ValueByteBuffer make() {
|
||||
return new ValueByteBuffer();
|
||||
}
|
||||
|
||||
public static byte[] marshal(BObject bObject) throws IOException {
|
||||
ValueByteBuffer valueByteBuffer = new ValueByteBuffer();
|
||||
valueByteBuffer.encode(bObject);
|
||||
return valueByteBuffer.toByteArray();
|
||||
}
|
||||
|
||||
public static BObject unmarshal(byte[] byArray) throws Exception {
|
||||
ValueByteBuffer valueByteBuffer = new ValueByteBuffer(byArray);
|
||||
return valueByteBuffer.decode();
|
||||
}
|
||||
|
||||
public boolean isEncodeTransients() {
|
||||
return this.encodeTransients;
|
||||
}
|
||||
|
||||
public boolean setEncodeTransients(boolean bl) {
|
||||
boolean bl2 = this.encodeTransients;
|
||||
this.encodeTransients = bl;
|
||||
return bl2;
|
||||
}
|
||||
|
||||
public void setEncodeContext(Context context) {
|
||||
this.encodeContext = context;
|
||||
}
|
||||
|
||||
public void encode(BObject bObject) throws IOException {
|
||||
this.encode(null, bObject, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public void encode(String string, BObject bObject, int n) throws IOException {
|
||||
this.writeByte(1);
|
||||
this.writeBoolean(true);
|
||||
this.writeByte(1);
|
||||
this.wname(string);
|
||||
this.wflags(-1);
|
||||
this.wfacets(null);
|
||||
this.wtype(bObject);
|
||||
if (bObject.isComponent()) {
|
||||
BComponent bComponent = (BComponent)bObject;
|
||||
Object object = bComponent.getHandle();
|
||||
this.whandle(object);
|
||||
BCategoryMask bCategoryMask = bComponent.getCategoryMask();
|
||||
this.wcategories(bCategoryMask);
|
||||
this.writeBoolean(false);
|
||||
}
|
||||
this.encodeValue(bObject, n);
|
||||
}
|
||||
|
||||
public BObject decode() throws Exception {
|
||||
byte by = this.readByte();
|
||||
if (by != 1) {
|
||||
throw new IllegalStateException("Version mismatch " + by + " != 1");
|
||||
}
|
||||
BObject bObject = this.parseSlot(null);
|
||||
if (bObject == null) {
|
||||
throw new IllegalStateException("Error parsing value");
|
||||
}
|
||||
return bObject;
|
||||
}
|
||||
|
||||
protected void encodeValueSpecial(BObject bObject) throws IOException {
|
||||
}
|
||||
|
||||
protected void decodeValueSpecial(BObject bObject) throws Exception {
|
||||
}
|
||||
|
||||
private final void encodeSlot(BObject bObject, Slot slot, boolean bl, int n) throws IOException {
|
||||
if (slot == null) {
|
||||
this.writeBoolean(false);
|
||||
return;
|
||||
}
|
||||
int n2 = this.getSlotFlags(bObject, slot);
|
||||
boolean bl2 = slot.isProperty();
|
||||
Property property = bl2 ? (Property)slot : null;
|
||||
BValue bValue = bl2 ? this.getPropertyValue(bObject, property) : null;
|
||||
boolean bl3 = false;
|
||||
if (!this.encodeTransients && (n2 & 2) != 0) {
|
||||
if (bValue != null && slot.isFrozen() && bValue.isComponent()) {
|
||||
bl3 = false;
|
||||
} else if (bl2 && slot.isFrozen() && n2 != slot.getDefaultFlags()) {
|
||||
bl3 = true;
|
||||
} else {
|
||||
this.writeBoolean(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
boolean bl4 = false;
|
||||
if (bl2 && !bl3) {
|
||||
boolean bl5 = false;
|
||||
if (slot.isFrozen() && !bValue.isComponent() && property.isEquivalentToDefaultValue(bValue)) {
|
||||
bl5 = true;
|
||||
}
|
||||
bl4 = bl5;
|
||||
} else {
|
||||
bl4 = true;
|
||||
}
|
||||
if (n2 == slot.getDefaultFlags() && bl4) {
|
||||
this.writeBoolean(false);
|
||||
return;
|
||||
}
|
||||
this.writeBoolean(true);
|
||||
boolean bl6 = false;
|
||||
if (slot.isProperty()) {
|
||||
this.writeByte(1);
|
||||
} else if (slot.isAction()) {
|
||||
bl6 = true;
|
||||
this.writeByte(2);
|
||||
} else if (slot.isTopic()) {
|
||||
bl6 = true;
|
||||
this.writeByte(3);
|
||||
} else {
|
||||
throw new IllegalStateException("Slot is not a property, action, or topic");
|
||||
}
|
||||
this.wname(slot.getName());
|
||||
this.wflags(n2);
|
||||
if (bl6) {
|
||||
return;
|
||||
}
|
||||
BFacets bFacets = slot.getFacets();
|
||||
this.wfacets(bFacets);
|
||||
this.wtype(bValue);
|
||||
if (bValue instanceof BComponent) {
|
||||
BComponent bComponent = (BComponent)bValue;
|
||||
Object object = bComponent.getHandle();
|
||||
this.whandle(object);
|
||||
BCategoryMask bCategoryMask = bComponent.getCategoryMask();
|
||||
this.wcategories(bCategoryMask);
|
||||
boolean bl7 = false;
|
||||
if (n == 0 || bComponent.getComponentSpace() instanceof BVirtualComponentSpace && !((ComponentSlotMap)bComponent.fw(1)).isBrokerPropsLoaded()) {
|
||||
bl7 = true;
|
||||
}
|
||||
this.writeBoolean(bl7);
|
||||
}
|
||||
if (property != null && !bl4) {
|
||||
this.encodeValue(bValue, n - 1);
|
||||
} else {
|
||||
this.writeBoolean(false);
|
||||
}
|
||||
}
|
||||
|
||||
private final void encodeValue(BObject bObject, int n) throws IOException {
|
||||
this.encodeValueSpecial(bObject);
|
||||
if (bObject.isSimple()) {
|
||||
this.writeBoolean(true);
|
||||
this.wvalue((BSimple)bObject);
|
||||
} else if (!bObject.getType().is(BStatusValue.TYPE) || !this.encodeStatusValue(bObject)) {
|
||||
if (bObject.isComponent() && n >= 0 || (bObject.isComplex() || bObject instanceof BIPropertyContainer) && !bObject.isComponent()) {
|
||||
SlotCursor slotCursor = bObject.isComplex() ? ((BComplex)bObject).getSlots() : ((BIPropertyContainer)((Object)bObject)).getSlots();
|
||||
while (slotCursor.next()) {
|
||||
this.writeBoolean(true);
|
||||
this.encodeSlot(bObject, slotCursor.slot(), false, n);
|
||||
}
|
||||
this.writeBoolean(false);
|
||||
} else {
|
||||
this.writeBoolean(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final int getSlotFlags(BObject bObject, Slot slot) {
|
||||
if (bObject instanceof BIPropertyContainer) {
|
||||
return ((BIPropertyContainer)((Object)bObject)).getFlags(slot);
|
||||
}
|
||||
if (bObject instanceof BComplex) {
|
||||
return ((BComplex)bObject).getFlags(slot);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private final BValue getPropertyValue(BObject bObject, Property property) {
|
||||
if (bObject instanceof BIPropertyContainer) {
|
||||
return ((BIPropertyContainer)((Object)bObject)).get(property);
|
||||
}
|
||||
if (bObject instanceof BComplex) {
|
||||
return ((BComplex)bObject).get(property);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void parseSlots(BObject bObject) throws Exception {
|
||||
while (this.readBoolean()) {
|
||||
this.parseSlot(bObject);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled force condition propagation
|
||||
* Lifted jumps to return sites
|
||||
*/
|
||||
BObject parseSlot(BObject bObject) throws Exception {
|
||||
boolean bl;
|
||||
BObject bObject2;
|
||||
block32: {
|
||||
Property property;
|
||||
if (!this.readBoolean()) {
|
||||
return null;
|
||||
}
|
||||
byte by = this.readByte();
|
||||
if (by != 1 && by != 2 && by != 3) {
|
||||
throw new IllegalStateException("Unknown element <" + by + '>');
|
||||
}
|
||||
String string = this.rname();
|
||||
int n = this.rflags();
|
||||
BFacets bFacets = null;
|
||||
BTypeSpec bTypeSpec = null;
|
||||
Object object = null;
|
||||
BCategoryMask bCategoryMask = null;
|
||||
boolean bl2 = false;
|
||||
if (by == 1) {
|
||||
bFacets = this.rfacets();
|
||||
bTypeSpec = this.rtype();
|
||||
if (bTypeSpec != null && bTypeSpec.getResolvedType().is(BComponent.TYPE)) {
|
||||
object = this.rhandle();
|
||||
bCategoryMask = this.rcategories();
|
||||
bl2 = this.readBoolean();
|
||||
}
|
||||
}
|
||||
Slot slot = null;
|
||||
if (bObject != null) {
|
||||
if (string == null) {
|
||||
throw new IllegalStateException("Missing name attribute");
|
||||
}
|
||||
Slot slot2 = slot = bObject.isComplex() ? ((BComplex)bObject).getSlot(string) : ((BIPropertyContainer)((Object)bObject)).getSlot(string);
|
||||
}
|
||||
if (slot != null) {
|
||||
if (n >= 0) {
|
||||
try {
|
||||
if (bObject.isComplex()) {
|
||||
((BComplex)bObject).setFlags(slot, n, Context.decoding);
|
||||
} else {
|
||||
((BIPropertyContainer)((Object)bObject)).setFlags(slot, n, Context.decoding);
|
||||
}
|
||||
}
|
||||
catch (UnsupportedOperationException unsupportedOperationException) {}
|
||||
}
|
||||
if (!slot.isProperty()) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (by == 2) {
|
||||
System.out.println("Missing frozen action: " + bObject.getType() + ' ' + string);
|
||||
return null;
|
||||
}
|
||||
if (by == 3) {
|
||||
System.out.println("Missing frozen topic: " + string);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if ((bObject2 = this.newInstance(string, property = (Property)slot, bTypeSpec)) == null) {
|
||||
return null;
|
||||
}
|
||||
this.decodeValueSpecial(bObject2);
|
||||
bl = false;
|
||||
if (bObject2.isSimple()) {
|
||||
if (!this.readBoolean()) return null;
|
||||
bObject2 = this.rvalue((BSimple)bObject2);
|
||||
} else if (bObject2.getType() == BStatusNumeric.TYPE || bObject2.getType() == BStatusBoolean.TYPE || bObject2.getType() == BStatusEnum.TYPE || bObject2.getType() == BStatusString.TYPE) {
|
||||
bl = true;
|
||||
if (!this.readBoolean()) return null;
|
||||
bObject2 = this.decodeStatusValue(bObject2);
|
||||
}
|
||||
if (bObject2.isComponent()) {
|
||||
((ComponentSlotMap)bObject2.fw(1)).setHandle(object);
|
||||
if (!bl2) {
|
||||
((ComponentSlotMap)bObject2.fw(1)).setBrokerPropsLoaded(true);
|
||||
}
|
||||
if (bCategoryMask != null) {
|
||||
((BComponent)bObject2).setCategoryMask(bCategoryMask, Context.decoding);
|
||||
}
|
||||
}
|
||||
if (bObject != null) {
|
||||
if (property != null) {
|
||||
if (!property.isFrozen()) {
|
||||
throw new IllegalStateException("Duplicate slot " + bObject.getType().getTypeName() + '.' + string);
|
||||
}
|
||||
try {
|
||||
if (bObject.isComplex()) {
|
||||
((BComplex)bObject).set(property, (BValue)bObject2, Context.decoding);
|
||||
break block32;
|
||||
}
|
||||
((BIPropertyContainer)((Object)bObject)).set(property, (BValue)bObject2, Context.decoding);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
System.out.println("Cannot set property " + bObject.getType().getTypeName() + '.' + string + ": " + exception);
|
||||
}
|
||||
} else if (bObject instanceof BIPropertyContainer) {
|
||||
((BIPropertyContainer)((Object)bObject)).add(string, (BValue)bObject2, n, bFacets, Context.decoding);
|
||||
} else {
|
||||
System.out.println("Missing slot " + bObject.getType().getTypeName() + '.' + string);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!bObject2.isComplex() && !(bObject2 instanceof BIPropertyContainer) || bl) return bObject2;
|
||||
this.parseSlots(bObject2);
|
||||
return bObject2;
|
||||
}
|
||||
|
||||
private final BObject newInstance(String string, Property property, BTypeSpec bTypeSpec) {
|
||||
if (bTypeSpec == null || bTypeSpec.isNull()) {
|
||||
if (property != null) {
|
||||
return property.getDefaultValue();
|
||||
}
|
||||
System.out.println("Missing frozen property: " + string);
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return bTypeSpec.getInstance();
|
||||
}
|
||||
catch (TypeNotFoundException typeNotFoundException) {
|
||||
System.out.println("Type \"" + typeNotFoundException.getMessage() + "\" not found: " + string);
|
||||
return null;
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
throw new IllegalStateException("Cannot instantiate type '" + bTypeSpec + '\'');
|
||||
}
|
||||
}
|
||||
|
||||
private final boolean encodeStatusValue(BObject bObject) throws IOException {
|
||||
BStatusValue bStatusValue;
|
||||
BStatus bStatus = null;
|
||||
if (bObject.getType() == BStatusNumeric.TYPE) {
|
||||
this.writeBoolean(true);
|
||||
bStatusValue = (BStatusNumeric)bObject;
|
||||
this.writeDouble(((BStatusNumeric)bStatusValue).getValue());
|
||||
bStatus = bStatusValue.getStatus();
|
||||
} else if (bObject.getType() == BStatusBoolean.TYPE) {
|
||||
this.writeBoolean(true);
|
||||
bStatusValue = (BStatusBoolean)bObject;
|
||||
this.writeBoolean(((BStatusBoolean)bStatusValue).getValue());
|
||||
bStatus = bStatusValue.getStatus();
|
||||
} else if (bObject.getType() == BStatusEnum.TYPE) {
|
||||
this.writeBoolean(true);
|
||||
bStatusValue = (BStatusEnum)bObject;
|
||||
this.wtype(((BStatusEnum)bStatusValue).getValue());
|
||||
((BStatusEnum)bStatusValue).getValue().encode(this);
|
||||
bStatus = bStatusValue.getStatus();
|
||||
} else if (bObject.getType() == BStatusString.TYPE) {
|
||||
this.writeBoolean(true);
|
||||
bStatusValue = (BStatusString)bObject;
|
||||
this.writeUTF(((BStatusString)bStatusValue).getValue());
|
||||
bStatus = bStatusValue.getStatus();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
boolean bl = bStatus.equals(BStatus.DEFAULT) ^ true;
|
||||
this.writeBoolean(bl);
|
||||
if (bl) {
|
||||
bStatus.encode(this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private final BObject decodeStatusValue(BObject bObject) throws IOException {
|
||||
if (bObject.getType() == BStatusNumeric.TYPE) {
|
||||
((BStatusNumeric)bObject).setValue(this.readDouble());
|
||||
} else if (bObject.getType() == BStatusBoolean.TYPE) {
|
||||
((BStatusBoolean)bObject).setValue(this.readBoolean());
|
||||
} else if (bObject.getType() == BStatusEnum.TYPE) {
|
||||
BTypeSpec bTypeSpec = this.rtype();
|
||||
BSimple bSimple = (BSimple)bTypeSpec.getInstance();
|
||||
((BStatusEnum)bObject).setValue((BEnum)bSimple.decode(this));
|
||||
} else if (bObject.getType() == BStatusString.TYPE) {
|
||||
((BStatusString)bObject).setValue(this.readUTF());
|
||||
} else {
|
||||
return bObject;
|
||||
}
|
||||
if (this.readBoolean()) {
|
||||
((BStatusValue)bObject).setStatus((BStatus)BStatus.DEFAULT.decode(this));
|
||||
}
|
||||
return bObject;
|
||||
}
|
||||
|
||||
private final ValueByteBuffer wname(String string) throws IOException {
|
||||
boolean bl = false;
|
||||
if (string != null) {
|
||||
bl = true;
|
||||
}
|
||||
this.writeBoolean(bl);
|
||||
if (string != null) {
|
||||
this.writeUTF(string);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private final String rname() throws IOException {
|
||||
if (this.readBoolean()) {
|
||||
return this.readUTF();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private final ValueByteBuffer wtype(BObject bObject) throws IOException {
|
||||
boolean bl = false;
|
||||
if (bObject != null) {
|
||||
bl = true;
|
||||
}
|
||||
boolean bl2 = bl;
|
||||
this.writeBoolean(bl2);
|
||||
if (bl2) {
|
||||
bObject.getType().getTypeSpec().encode(this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private final BTypeSpec rtype() throws IOException {
|
||||
if (this.readBoolean()) {
|
||||
return (BTypeSpec)BTypeSpec.DEFAULT.decode(this);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private final ValueByteBuffer wflags(int n) throws IOException {
|
||||
this.writeInt(n);
|
||||
return this;
|
||||
}
|
||||
|
||||
private final int rflags() throws IOException {
|
||||
return this.readInt();
|
||||
}
|
||||
|
||||
private final ValueByteBuffer whandle(Object object) throws IOException {
|
||||
boolean bl = false;
|
||||
if (object != null) {
|
||||
bl = true;
|
||||
}
|
||||
boolean bl2 = bl;
|
||||
this.writeBoolean(bl2);
|
||||
if (bl2) {
|
||||
this.writeUTF(String.valueOf(object));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private final Object rhandle() throws IOException {
|
||||
if (this.readBoolean()) {
|
||||
return this.readUTF();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private final ValueByteBuffer wcategories(BCategoryMask bCategoryMask) throws IOException {
|
||||
boolean bl = false;
|
||||
if (bCategoryMask != null && !bCategoryMask.isNull()) {
|
||||
bl = true;
|
||||
}
|
||||
boolean bl2 = bl;
|
||||
this.writeBoolean(bl2);
|
||||
if (bl2) {
|
||||
bCategoryMask.encode(this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private final BCategoryMask rcategories() throws IOException {
|
||||
if (this.readBoolean()) {
|
||||
return (BCategoryMask)BCategoryMask.DEFAULT.decode(this);
|
||||
}
|
||||
return BCategoryMask.NULL;
|
||||
}
|
||||
|
||||
private final ValueByteBuffer wfacets(BFacets bFacets) throws IOException {
|
||||
boolean bl = false;
|
||||
if (bFacets != null && !bFacets.isNull()) {
|
||||
bl = true;
|
||||
}
|
||||
boolean bl2 = bl;
|
||||
this.writeBoolean(bl2);
|
||||
if (bl2) {
|
||||
bFacets.encode(this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private final BFacets rfacets() throws IOException {
|
||||
if (this.readBoolean()) {
|
||||
return (BFacets)BFacets.DEFAULT.decode(this);
|
||||
}
|
||||
return BFacets.NULL;
|
||||
}
|
||||
|
||||
private final ValueByteBuffer wvalue(BSimple bSimple) throws IOException {
|
||||
if (bSimple instanceof BIContextEncodable) {
|
||||
((BIContextEncodable)((Object)bSimple)).encode(this, this.encodeContext);
|
||||
} else {
|
||||
bSimple.encode(this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private final BSimple rvalue(BSimple bSimple) throws IOException {
|
||||
if (bSimple instanceof BIContextEncodable) {
|
||||
return (BSimple)((BIContextEncodable)((Object)bSimple)).decode(this, this.encodeContext);
|
||||
}
|
||||
return (BSimple)bSimple.decode(this);
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.encodeContext = null;
|
||||
}
|
||||
|
||||
protected ValueByteBuffer(byte[] byArray, int n) {
|
||||
super(byArray, n);
|
||||
this.this();
|
||||
}
|
||||
|
||||
protected ValueByteBuffer(byte[] byArray) {
|
||||
super(byArray);
|
||||
this.this();
|
||||
}
|
||||
|
||||
protected ValueByteBuffer(int n) {
|
||||
super(n);
|
||||
this.this();
|
||||
}
|
||||
|
||||
protected ValueByteBuffer() {
|
||||
this(64);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util.graph;
|
||||
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
|
||||
public class CyclicGraphException
|
||||
extends BajaRuntimeException {
|
||||
private Object parent;
|
||||
private Object child;
|
||||
|
||||
public Object getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public Object getChild() {
|
||||
return this.child;
|
||||
}
|
||||
|
||||
private CyclicGraphException() {
|
||||
}
|
||||
|
||||
CyclicGraphException(String string, Object object, Object object2) {
|
||||
super(string);
|
||||
this.parent = object;
|
||||
this.child = object2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util.graph;
|
||||
|
||||
import com.tridium.util.graph.CyclicGraphException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class Digraph {
|
||||
private static final int WHITE = 0;
|
||||
private static final int GRAY = 1;
|
||||
private static final int BLACK = 2;
|
||||
private Map graph;
|
||||
|
||||
public boolean hasVertex(Object object) {
|
||||
boolean bl = false;
|
||||
if (this.graph.get(object) != null) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public void addVertex(Object object) {
|
||||
try {
|
||||
this.addEdge(object, null);
|
||||
}
|
||||
catch (IllegalArgumentException illegalArgumentException) {
|
||||
throw new IllegalArgumentException("vertex cannot be null.");
|
||||
}
|
||||
}
|
||||
|
||||
public void addEdge(Object object, Object object2) {
|
||||
if (object == null) {
|
||||
throw new IllegalArgumentException("fromVertex cannot be null.");
|
||||
}
|
||||
Vertex vertex = this.getVertex(object);
|
||||
if (object2 != null) {
|
||||
Vertex vertex2 = this.getVertex(object2);
|
||||
vertex.kids.add(vertex2);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeEdge(Object object, Object object2) {
|
||||
if (object == null) {
|
||||
throw new IllegalArgumentException("fromVertex cannot be null.");
|
||||
}
|
||||
Vertex vertex = (Vertex)this.graph.get(object);
|
||||
if (vertex == null) {
|
||||
return;
|
||||
}
|
||||
if (object2 != null) {
|
||||
vertex.kids.remove(object2);
|
||||
} else {
|
||||
vertex.kids.clear();
|
||||
this.graph.remove(object);
|
||||
Iterator iterator = this.graph.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
((Vertex)iterator.next()).kids.remove(vertex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeVertex(Object object) {
|
||||
try {
|
||||
this.removeEdge(object, null);
|
||||
}
|
||||
catch (IllegalArgumentException illegalArgumentException) {
|
||||
throw new IllegalArgumentException("vertex cannot be null.");
|
||||
}
|
||||
}
|
||||
|
||||
public Object[] getNeighbors(Object object) {
|
||||
if (object == null) {
|
||||
throw new IllegalArgumentException("fromVertex cannot be null.");
|
||||
}
|
||||
Vertex vertex = this.getVertex(object);
|
||||
if (vertex == null) {
|
||||
throw new IllegalArgumentException("fromVertex is not in the graph.");
|
||||
}
|
||||
Iterator iterator = vertex.kids.iterator();
|
||||
Object[] objectArray = new Object[vertex.kids.size()];
|
||||
int n = 0;
|
||||
while (iterator.hasNext()) {
|
||||
objectArray[n++] = ((Vertex)iterator.next()).obj;
|
||||
}
|
||||
return objectArray;
|
||||
}
|
||||
|
||||
public Object[] topologicalSort() {
|
||||
final LinkedList linkedList = new LinkedList();
|
||||
DepthFirstSearch depthFirstSearch = new DepthFirstSearch(this){
|
||||
|
||||
protected final void visit(Vertex vertex) {
|
||||
super.visit(vertex);
|
||||
linkedList.addFirst(vertex.obj);
|
||||
}
|
||||
};
|
||||
depthFirstSearch.search();
|
||||
return linkedList.toArray(new Object[linkedList.size()]);
|
||||
}
|
||||
|
||||
public boolean isCyclic() {
|
||||
try {
|
||||
new DepthFirstSearch().search();
|
||||
return false;
|
||||
}
|
||||
catch (CyclicGraphException cyclicGraphException) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private final Vertex getVertex(Object object) {
|
||||
Vertex vertex = (Vertex)this.graph.get(object);
|
||||
if (vertex == null) {
|
||||
vertex = new Vertex(object);
|
||||
this.graph.put(object, vertex);
|
||||
}
|
||||
return vertex;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
Iterator iterator = this.graph.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Vertex vertex = (Vertex)iterator.next();
|
||||
stringBuffer.append(vertex.obj).append(": ").append(vertex.kids).append("\n");
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$0() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$2() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static /* synthetic */ int access$3() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.graph = new HashMap();
|
||||
}
|
||||
|
||||
public Digraph() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private static class Vertex {
|
||||
private Object obj;
|
||||
private int color;
|
||||
private HashSet kids;
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (this == object) {
|
||||
return true;
|
||||
}
|
||||
if (object == null) {
|
||||
return false;
|
||||
}
|
||||
if (this.getClass() != object.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Vertex vertex = (Vertex)object;
|
||||
return !(this.obj == null ? vertex.obj != null : !this.obj.equals(vertex.obj));
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int n = 1;
|
||||
int n2 = 0;
|
||||
if (this.obj != null) {
|
||||
n2 = this.obj.hashCode();
|
||||
}
|
||||
n = 31 * n + n2;
|
||||
return n;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.obj.toString();
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.color = 0;
|
||||
this.kids = new HashSet();
|
||||
}
|
||||
|
||||
public Vertex(Object object) {
|
||||
this.this();
|
||||
this.obj = object;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class DepthFirstSearch {
|
||||
private final void search() {
|
||||
Vertex vertex;
|
||||
Iterator iterator = Digraph.this.graph.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
vertex = (Vertex)iterator.next();
|
||||
vertex.color = 0;
|
||||
}
|
||||
iterator = Digraph.this.graph.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
vertex = (Vertex)iterator.next();
|
||||
switch (vertex.color) {
|
||||
case 1: {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
case 0: {
|
||||
this.visit(vertex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void visit(Vertex vertex) {
|
||||
vertex.color = 1;
|
||||
Iterator iterator = vertex.kids.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Vertex vertex2 = (Vertex)iterator.next();
|
||||
switch (vertex2.color) {
|
||||
case 1: {
|
||||
throw new CyclicGraphException(vertex.toString() + " has cyclic dependency on " + vertex2.toString(), vertex.obj, vertex2.obj);
|
||||
}
|
||||
case 0: {
|
||||
this.visit(vertex2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
vertex.color = 2;
|
||||
}
|
||||
|
||||
private DepthFirstSearch() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util.jar;
|
||||
|
||||
import com.tridium.util.jar.JarFile;
|
||||
import com.tridium.util.jar.JarURLStreamHandler;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
public class JarEntry
|
||||
extends ZipEntry {
|
||||
JarFile jarFile;
|
||||
ZipEntry entry;
|
||||
|
||||
public String getName() {
|
||||
return this.entry.getName();
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return this.entry.getSize();
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return this.entry.getTime();
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return this.jarFile.zip.getInputStream(this.entry);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public byte[] read() throws IOException {
|
||||
int n = (int)this.getSize();
|
||||
byte[] byArray = new byte[n];
|
||||
InputStream inputStream = this.getInputStream();
|
||||
try {
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
int n3 = inputStream.read(byArray, n2, n - n2);
|
||||
if (n3 < 0) {
|
||||
throw new IOException("Unexpected EOF");
|
||||
}
|
||||
n2 += n3;
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var5_7 = null;
|
||||
inputStream.close();
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var5_8 = null;
|
||||
}
|
||||
inputStream.close();
|
||||
return byArray;
|
||||
}
|
||||
|
||||
public URL getURL() {
|
||||
try {
|
||||
String string = this.jarFile.url + "!/" + this.getName();
|
||||
return new URL("jar", "", -1, string, new JarURLStreamHandler(this));
|
||||
}
|
||||
catch (MalformedURLException malformedURLException) {
|
||||
malformedURLException.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public JarEntry(JarFile jarFile, ZipEntry zipEntry) {
|
||||
super(zipEntry.getName());
|
||||
this.jarFile = jarFile;
|
||||
this.entry = zipEntry;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util.jar;
|
||||
|
||||
import com.tridium.util.jar.JarEntry;
|
||||
import com.tridium.util.jar.Manifest;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipException;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
public class JarFile {
|
||||
File file;
|
||||
public ZipFile zip;
|
||||
URL url;
|
||||
long openTime;
|
||||
|
||||
public void check() {
|
||||
if (this.file.lastModified() != this.openTime) {
|
||||
try {
|
||||
System.out.println("WARNING: JarFile.reopen: " + this.file);
|
||||
this.zip.close();
|
||||
this.zip = new ZipFile(this.file);
|
||||
this.openTime = this.file.lastModified();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
System.out.println(" " + exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
this.zip.close();
|
||||
this.zip = null;
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return this.file;
|
||||
}
|
||||
|
||||
public URL getFileURL() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public Enumeration entries() {
|
||||
this.check();
|
||||
return this.zip.entries();
|
||||
}
|
||||
|
||||
public JarEntry getJarEntry(String string) {
|
||||
this.check();
|
||||
ZipEntry zipEntry = this.zip.getEntry(string);
|
||||
if (zipEntry != null) {
|
||||
return new JarEntry(this, zipEntry);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public URL getResource(String string) {
|
||||
JarEntry jarEntry = this.getJarEntry(string);
|
||||
if (jarEntry != null) {
|
||||
return jarEntry.getURL();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Manifest getManifest() throws IOException {
|
||||
JarEntry jarEntry = this.getJarEntry("META-INF/MANIFEST.MF");
|
||||
if (jarEntry == null) {
|
||||
return null;
|
||||
}
|
||||
InputStream inputStream = jarEntry.getInputStream();
|
||||
Manifest manifest = new Manifest(inputStream);
|
||||
inputStream.close();
|
||||
return manifest;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.file.toString();
|
||||
}
|
||||
|
||||
public JarFile(File file) throws ZipException, IOException {
|
||||
if (!file.exists()) {
|
||||
throw new FileNotFoundException("" + file);
|
||||
}
|
||||
this.file = file;
|
||||
this.zip = new ZipFile(file);
|
||||
this.url = file.toURL();
|
||||
this.openTime = file.lastModified();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util.jar;
|
||||
|
||||
import com.tridium.util.jar.JarEntry;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
public class JarURLConnection
|
||||
extends URLConnection {
|
||||
private JarEntry entry;
|
||||
|
||||
public int getContentLength() {
|
||||
return (int)this.entry.getSize();
|
||||
}
|
||||
|
||||
public long getLastModified() {
|
||||
return this.entry.getTime();
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return this.entry.getInputStream();
|
||||
}
|
||||
|
||||
public void connect() {
|
||||
}
|
||||
|
||||
public JarURLConnection(URL uRL, JarEntry jarEntry) {
|
||||
super(uRL);
|
||||
this.entry = jarEntry;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util.jar;
|
||||
|
||||
import com.tridium.util.jar.JarEntry;
|
||||
import com.tridium.util.jar.JarURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLStreamHandler;
|
||||
|
||||
public class JarURLStreamHandler
|
||||
extends URLStreamHandler {
|
||||
private JarEntry entry;
|
||||
|
||||
public URLConnection openConnection(URL uRL) {
|
||||
return new JarURLConnection(uRL, this.entry);
|
||||
}
|
||||
|
||||
public JarURLStreamHandler(JarEntry jarEntry) {
|
||||
this.entry = jarEntry;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.util.jar;
|
||||
|
||||
import com.tridium.util.CaseInsensitiveStringTable;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class Manifest {
|
||||
public static final String NAME = "META-INF/MANIFEST.MF";
|
||||
private static final int LF = 10;
|
||||
private static final int CR = 13;
|
||||
private static final int COLON = 58;
|
||||
private static final int SPACE = 32;
|
||||
private CaseInsensitiveStringTable mainAttributes;
|
||||
private CaseInsensitiveStringTable attributes;
|
||||
|
||||
public CaseInsensitiveStringTable getMainAttributes() {
|
||||
if (this.mainAttributes == null) {
|
||||
this.mainAttributes = new CaseInsensitiveStringTable();
|
||||
}
|
||||
return this.mainAttributes;
|
||||
}
|
||||
|
||||
public CaseInsensitiveStringTable getAttributes(String string) {
|
||||
if (string.charAt(0) == '/') {
|
||||
string = string.substring(1);
|
||||
}
|
||||
return (CaseInsensitiveStringTable)this.attributes.get(string);
|
||||
}
|
||||
|
||||
public void putAttributes(String string, CaseInsensitiveStringTable caseInsensitiveStringTable) {
|
||||
if (string.charAt(0) == '/') {
|
||||
string = string.substring(1);
|
||||
}
|
||||
this.attributes.put(string, (Object)caseInsensitiveStringTable);
|
||||
}
|
||||
|
||||
public void write(OutputStream outputStream) throws IOException {
|
||||
DataOutputStream dataOutputStream = new DataOutputStream(outputStream);
|
||||
this.write(dataOutputStream, this.mainAttributes);
|
||||
String[] stringArray = this.attributes.keyArray();
|
||||
Object[] objectArray = this.attributes.elementArray();
|
||||
int n = 0;
|
||||
while (n < stringArray.length) {
|
||||
String string = stringArray[n];
|
||||
CaseInsensitiveStringTable caseInsensitiveStringTable = (CaseInsensitiveStringTable)objectArray[n];
|
||||
StringBuffer stringBuffer = new StringBuffer(80);
|
||||
stringBuffer.append("Name: ").append(string).append("\r\n");
|
||||
Manifest.checkContinuation(stringBuffer);
|
||||
dataOutputStream.writeBytes(stringBuffer.toString());
|
||||
this.write(dataOutputStream, caseInsensitiveStringTable);
|
||||
++n;
|
||||
}
|
||||
dataOutputStream.flush();
|
||||
}
|
||||
|
||||
void write(DataOutputStream dataOutputStream, CaseInsensitiveStringTable caseInsensitiveStringTable) throws IOException {
|
||||
String[] stringArray = caseInsensitiveStringTable.keyArray();
|
||||
Object[] objectArray = caseInsensitiveStringTable.elementArray();
|
||||
int n = 0;
|
||||
while (n < stringArray.length) {
|
||||
String string = stringArray[n];
|
||||
String string2 = (String)objectArray[n];
|
||||
StringBuffer stringBuffer = new StringBuffer(80);
|
||||
stringBuffer.append(string).append(": ").append(string2).append("\r\n");
|
||||
Manifest.checkContinuation(stringBuffer);
|
||||
dataOutputStream.writeBytes(stringBuffer.toString());
|
||||
++n;
|
||||
}
|
||||
dataOutputStream.writeBytes("\r\n");
|
||||
}
|
||||
|
||||
static void checkContinuation(StringBuffer stringBuffer) {
|
||||
int n = stringBuffer.length();
|
||||
if (n > 72) {
|
||||
int n2;
|
||||
char[] cArray = stringBuffer.toString().toCharArray();
|
||||
if (cArray[(n2 = cArray.length) - 2] == '\r' && cArray[n2 - 1] == '\n') {
|
||||
n2 -= 2;
|
||||
}
|
||||
stringBuffer.setLength(0);
|
||||
int n3 = 0;
|
||||
while (n3 < n2) {
|
||||
stringBuffer.append(cArray[n3]);
|
||||
if (n3 > 0 && n3 % 71 == 0) {
|
||||
stringBuffer.append("\r\n ");
|
||||
}
|
||||
++n3;
|
||||
}
|
||||
if (stringBuffer.charAt(stringBuffer.length() - 3) == '\r' && stringBuffer.charAt(stringBuffer.length() - 2) == '\n' && stringBuffer.charAt(stringBuffer.length() - 1) == ' ') {
|
||||
stringBuffer.setLength(stringBuffer.length() - 1);
|
||||
} else if (cArray.length != n2) {
|
||||
stringBuffer.append("\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void read(InputStream inputStream) throws IOException {
|
||||
int n;
|
||||
this.mainAttributes = null;
|
||||
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
|
||||
LineInfo lineInfo = new LineInfo();
|
||||
String string = null;
|
||||
String string2 = "";
|
||||
CaseInsensitiveStringTable caseInsensitiveStringTable = new CaseInsensitiveStringTable();
|
||||
String string3 = null;
|
||||
int n2 = 0;
|
||||
while ((n = this.readLine(bufferedInputStream, lineInfo)) >= 0) {
|
||||
++n2;
|
||||
if (n > 72) {
|
||||
Manifest.throwException("Line too long", n2);
|
||||
}
|
||||
if (lineInfo.isSectionBreak()) {
|
||||
this.addAttributes(string3, caseInsensitiveStringTable, n2);
|
||||
caseInsensitiveStringTable = new CaseInsensitiveStringTable();
|
||||
string3 = null;
|
||||
continue;
|
||||
}
|
||||
if (string == null) {
|
||||
string = lineInfo.getKey();
|
||||
string2 = lineInfo.getValue();
|
||||
} else {
|
||||
string2 = string2 + lineInfo.getValue();
|
||||
}
|
||||
if (lineInfo.isNextLineContinuation) continue;
|
||||
if (this.isName(string) && string3 == null) {
|
||||
string3 = string2;
|
||||
} else {
|
||||
this.addAttributeEntry(caseInsensitiveStringTable, string, string2, n2);
|
||||
}
|
||||
string = null;
|
||||
}
|
||||
if (string3 != null || this.mainAttributes == null) {
|
||||
this.addAttributes(string3, caseInsensitiveStringTable, n2);
|
||||
}
|
||||
}
|
||||
|
||||
private final void addAttributes(String string, CaseInsensitiveStringTable caseInsensitiveStringTable, int n) throws IOException {
|
||||
if (this.mainAttributes == null) {
|
||||
this.mainAttributes = caseInsensitiveStringTable;
|
||||
} else {
|
||||
if (string == null) {
|
||||
Manifest.throwException("Section missing Name", n);
|
||||
}
|
||||
this.attributes.put(string, (Object)caseInsensitiveStringTable);
|
||||
}
|
||||
}
|
||||
|
||||
private final void addAttributeEntry(CaseInsensitiveStringTable caseInsensitiveStringTable, String string, String string2, int n) {
|
||||
if (string == null) {
|
||||
return;
|
||||
}
|
||||
caseInsensitiveStringTable.put(string, (Object)string2);
|
||||
}
|
||||
|
||||
private final int readLine(BufferedInputStream bufferedInputStream, LineInfo lineInfo) throws IOException {
|
||||
int n;
|
||||
lineInfo.valuePos = -1;
|
||||
lineInfo.count = 0;
|
||||
byte[] byArray = lineInfo.buf;
|
||||
int n2 = 0;
|
||||
boolean bl = false;
|
||||
do {
|
||||
n = bufferedInputStream.read();
|
||||
if (n2 == 0 && n == -1) {
|
||||
n2 = -1;
|
||||
break;
|
||||
}
|
||||
if (n == 13) {
|
||||
bufferedInputStream.mark(1);
|
||||
n = bufferedInputStream.read();
|
||||
if (n != 10) {
|
||||
bufferedInputStream.reset();
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (n == 10) break;
|
||||
if (bl && n == 32 && lineInfo.valuePos == -1) {
|
||||
lineInfo.valuePos = n2;
|
||||
}
|
||||
boolean bl2 = false;
|
||||
if (n == 58) {
|
||||
bl2 = true;
|
||||
}
|
||||
bl = bl2;
|
||||
byArray[n2++] = (byte)n;
|
||||
} while (byArray.length != n2);
|
||||
bufferedInputStream.mark(1);
|
||||
n = bufferedInputStream.read();
|
||||
boolean bl3 = false;
|
||||
if (n == 32) {
|
||||
bl3 = lineInfo.isNextLineContinuation = true;
|
||||
}
|
||||
if (!lineInfo.isNextLineContinuation) {
|
||||
bufferedInputStream.reset();
|
||||
}
|
||||
lineInfo.count = n2;
|
||||
return n2;
|
||||
}
|
||||
|
||||
private final boolean isName(String string) {
|
||||
if (string.length() != 4) {
|
||||
return false;
|
||||
}
|
||||
char c = string.charAt(0);
|
||||
if (c != 'N' && c != 'n') {
|
||||
return false;
|
||||
}
|
||||
c = string.charAt(1);
|
||||
if (c != 'A' && c != 'a') {
|
||||
return false;
|
||||
}
|
||||
c = string.charAt(2);
|
||||
if (c != 'M' && c != 'm') {
|
||||
return false;
|
||||
}
|
||||
c = string.charAt(3);
|
||||
return c == 'E' || c == 'e';
|
||||
}
|
||||
|
||||
static void throwException(String string, int n) throws IOException {
|
||||
if (n != -1) {
|
||||
throw new IOException(string + " [line " + n + ']');
|
||||
}
|
||||
throw new IOException(string);
|
||||
}
|
||||
|
||||
public static void main(String[] stringArray) throws IOException {
|
||||
if (stringArray.length < 1) {
|
||||
System.out.println("usage: Manifest <filename>");
|
||||
return;
|
||||
}
|
||||
System.out.println("--- \"" + stringArray[0] + "\" ---");
|
||||
Manifest manifest = new Manifest(new FileInputStream(stringArray[0]));
|
||||
manifest.write(System.out);
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.attributes = new CaseInsensitiveStringTable();
|
||||
}
|
||||
|
||||
public Manifest() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
public Manifest(InputStream inputStream) throws IOException {
|
||||
this.this();
|
||||
this.read(inputStream);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
static class LineInfo {
|
||||
int valuePos;
|
||||
byte[] buf;
|
||||
int count;
|
||||
boolean isNextLineContinuation;
|
||||
|
||||
String getKey() {
|
||||
if (this.valuePos == -1) {
|
||||
return new String(this.buf, 0, 0, this.count);
|
||||
}
|
||||
return new String(this.buf, 0, 0, this.valuePos - 1);
|
||||
}
|
||||
|
||||
String getValue() {
|
||||
if (this.valuePos == -1) {
|
||||
return new String(this.buf, 0, this.count);
|
||||
}
|
||||
return new String(this.buf, 0, this.valuePos + 1, this.count - this.valuePos - 1);
|
||||
}
|
||||
|
||||
boolean isSectionBreak() {
|
||||
boolean bl = false;
|
||||
if (this.count == 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.valuePos = -1;
|
||||
this.buf = new byte[80];
|
||||
}
|
||||
|
||||
LineInfo() {
|
||||
this.this();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user