link start!
This commit is contained in:
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.fox.message.FoxMessage
|
||||
* com.tridium.fox.message.FoxTuple
|
||||
* com.tridium.fox.session.FoxCircuit
|
||||
* com.tridium.fox.session.FoxRequest
|
||||
* com.tridium.fox.session.FoxResponse
|
||||
* com.tridium.fox.session.InvalidCommandException
|
||||
* com.tridium.fox.sys.BFoxChannel
|
||||
* com.tridium.fox.sys.file.BFileChannel
|
||||
* com.tridium.fox.sys.file.BFoxFileSpace
|
||||
* com.tridium.fox.sys.file.BFoxFileStore
|
||||
* javax.baja.file.BFileSystem
|
||||
* javax.baja.file.BIDirectory
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.file.BIFileStore
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.file.FileUtil
|
||||
* javax.baja.security.BPermissions
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.platform.fox;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.message.FoxTuple;
|
||||
import com.tridium.fox.session.FoxCircuit;
|
||||
import com.tridium.fox.session.FoxRequest;
|
||||
import com.tridium.fox.session.FoxResponse;
|
||||
import com.tridium.fox.session.InvalidCommandException;
|
||||
import com.tridium.fox.sys.BFoxChannel;
|
||||
import com.tridium.fox.sys.file.BFileChannel;
|
||||
import com.tridium.fox.sys.file.BFoxFileSpace;
|
||||
import com.tridium.fox.sys.file.BFoxFileStore;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.BIDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.BIFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.file.FileUtil;
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BLicenseChannel
|
||||
extends BFoxChannel {
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$com$tridium$platform$fox$BLicenseChannel;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public FoxResponse process(FoxRequest foxRequest) throws Exception {
|
||||
String string = foxRequest.command;
|
||||
if (string == "listcertificates") {
|
||||
return this.listcertificates(foxRequest);
|
||||
}
|
||||
if (string == "listlicenses") {
|
||||
return this.listlicenses(foxRequest);
|
||||
}
|
||||
throw new InvalidCommandException(string);
|
||||
}
|
||||
|
||||
public void circuitOpened(FoxCircuit foxCircuit) throws Exception {
|
||||
String string = foxCircuit.command;
|
||||
if (string == "read") {
|
||||
this.read(foxCircuit);
|
||||
return;
|
||||
}
|
||||
throw new InvalidCommandException(string);
|
||||
}
|
||||
|
||||
public BIFile[] listcertificates(BFoxFileSpace bFoxFileSpace) throws Exception {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:listcertificates");
|
||||
}
|
||||
FoxRequest foxRequest = this.makeRequest("listcertificates");
|
||||
FoxResponse foxResponse = this.sendSync(foxRequest);
|
||||
FoxTuple[] foxTupleArray = foxResponse.list("file");
|
||||
BFoxFileStore[] bFoxFileStoreArray = new BFoxFileStore[foxTupleArray.length];
|
||||
int n = 0;
|
||||
while (n < bFoxFileStoreArray.length) {
|
||||
FoxMessage foxMessage = (FoxMessage)foxTupleArray[n];
|
||||
String string = foxMessage.getString("name");
|
||||
bFoxFileStoreArray[n] = BFileChannel.msgToStore((BFoxFileSpace)bFoxFileSpace, (FilePath)new FilePath("!certificates").merge(string), (FoxMessage)foxMessage);
|
||||
++n;
|
||||
}
|
||||
BIFile[] bIFileArray = new BIFile[bFoxFileStoreArray.length];
|
||||
int n2 = 0;
|
||||
while (n2 < bIFileArray.length) {
|
||||
bIFileArray[n2] = bFoxFileSpace.makeFile((BIFileStore)bFoxFileStoreArray[n2]);
|
||||
++n2;
|
||||
}
|
||||
return bIFileArray;
|
||||
}
|
||||
|
||||
public FoxResponse listcertificates(FoxRequest foxRequest) throws Exception {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:listcertificates");
|
||||
}
|
||||
FoxResponse foxResponse = new FoxResponse(foxRequest);
|
||||
FilePath filePath = new FilePath("!certificates");
|
||||
BIFile bIFile = BFileSystem.INSTANCE.resolveFile(filePath);
|
||||
if (bIFile instanceof BIDirectory) {
|
||||
BIDirectory bIDirectory = (BIDirectory)bIFile;
|
||||
BIFile[] bIFileArray = bIDirectory.listFiles();
|
||||
int n = 0;
|
||||
while (n < bIFileArray.length) {
|
||||
BPermissions bPermissions = this.getPermissionsFor(bIFileArray[n]);
|
||||
FoxMessage foxMessage = new FoxMessage("file");
|
||||
BFileChannel.storeToMsg((BIFileStore)bIFileArray[n].getStore(), (BPermissions)bPermissions, (FoxMessage)foxMessage);
|
||||
foxResponse.add((FoxTuple)foxMessage);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
return foxResponse;
|
||||
}
|
||||
|
||||
public BIFile[] listlicenses(BFoxFileSpace bFoxFileSpace) throws Exception {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:listlicenses");
|
||||
}
|
||||
FoxRequest foxRequest = this.makeRequest("listlicenses");
|
||||
FoxResponse foxResponse = this.sendSync(foxRequest);
|
||||
FoxTuple[] foxTupleArray = foxResponse.list("file");
|
||||
BFoxFileStore[] bFoxFileStoreArray = new BFoxFileStore[foxTupleArray.length];
|
||||
int n = 0;
|
||||
while (n < bFoxFileStoreArray.length) {
|
||||
FoxMessage foxMessage = (FoxMessage)foxTupleArray[n];
|
||||
String string = foxMessage.getString("name");
|
||||
bFoxFileStoreArray[n] = BFileChannel.msgToStore((BFoxFileSpace)bFoxFileSpace, (FilePath)new FilePath("!licenses").merge(string), (FoxMessage)foxMessage);
|
||||
++n;
|
||||
}
|
||||
BIFile[] bIFileArray = new BIFile[bFoxFileStoreArray.length];
|
||||
int n2 = 0;
|
||||
while (n2 < bIFileArray.length) {
|
||||
bIFileArray[n2] = bFoxFileSpace.makeFile((BIFileStore)bFoxFileStoreArray[n2]);
|
||||
++n2;
|
||||
}
|
||||
return bIFileArray;
|
||||
}
|
||||
|
||||
public FoxResponse listlicenses(FoxRequest foxRequest) throws Exception {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:listlicenses");
|
||||
}
|
||||
FoxResponse foxResponse = new FoxResponse(foxRequest);
|
||||
FilePath filePath = new FilePath("!licenses");
|
||||
BIFile bIFile = BFileSystem.INSTANCE.resolveFile(filePath);
|
||||
if (bIFile instanceof BIDirectory) {
|
||||
BIDirectory bIDirectory = (BIDirectory)bIFile;
|
||||
BIFile[] bIFileArray = bIDirectory.listFiles();
|
||||
int n = 0;
|
||||
while (n < bIFileArray.length) {
|
||||
BPermissions bPermissions = this.getPermissionsFor(bIFileArray[n]);
|
||||
FoxMessage foxMessage = new FoxMessage("file");
|
||||
BFileChannel.storeToMsg((BIFileStore)bIFileArray[n].getStore(), (BPermissions)bPermissions, (FoxMessage)foxMessage);
|
||||
foxResponse.add((FoxTuple)foxMessage);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
return foxResponse;
|
||||
}
|
||||
|
||||
public InputStream read(BFoxFileStore bFoxFileStore) throws Exception {
|
||||
FilePath filePath = bFoxFileStore.getFilePath();
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:read \"" + filePath.getBody() + '\"');
|
||||
}
|
||||
if (!filePath.getBody().startsWith("!certificates") && !filePath.getBody().startsWith("!licenses")) {
|
||||
return null;
|
||||
}
|
||||
FoxCircuit foxCircuit = this.openCircuit("read");
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("path", bFoxFileStore.getFilePath().getBody());
|
||||
foxCircuit.writeMessage(foxMessage);
|
||||
foxCircuit.flush();
|
||||
return foxCircuit.getInputStream();
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 void read(FoxCircuit foxCircuit) throws Exception {
|
||||
FoxMessage foxMessage = foxCircuit.readMessage();
|
||||
FilePath filePath = new FilePath(foxMessage.getString("path"));
|
||||
if (!filePath.getBody().startsWith("!certificates") && !filePath.getBody().startsWith("!licenses")) {
|
||||
return;
|
||||
}
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:read \"" + filePath.getBody() + '\"');
|
||||
}
|
||||
BIFile bIFile = BFileSystem.INSTANCE.resolveFile(filePath);
|
||||
long l = bIFile.getSize();
|
||||
InputStream inputStream = bIFile.getInputStream();
|
||||
OutputStream outputStream = foxCircuit.getOutputStream();
|
||||
try {
|
||||
FileUtil.pipe((InputStream)inputStream, (long)l, (OutputStream)outputStream);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var10_9 = null;
|
||||
inputStream.close();
|
||||
foxCircuit.close();
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var10_10 = null;
|
||||
}
|
||||
inputStream.close();
|
||||
foxCircuit.close();
|
||||
}
|
||||
|
||||
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 BLicenseChannel() {
|
||||
super("license");
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$fox$BLicenseChannel;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$fox$BLicenseChannel = BLicenseChannel.class("[Lcom.tridium.platform.fox.BLicenseChannel;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.fox.session.FoxCircuit
|
||||
* com.tridium.fox.session.FoxRequest
|
||||
* com.tridium.fox.session.FoxResponse
|
||||
* com.tridium.fox.session.InvalidCommandException
|
||||
* com.tridium.fox.sys.BFoxChannel
|
||||
* javax.baja.file.BFileSystem
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.file.FileUtil
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.platform.fox;
|
||||
|
||||
import com.tridium.fox.session.FoxCircuit;
|
||||
import com.tridium.fox.session.FoxRequest;
|
||||
import com.tridium.fox.session.FoxResponse;
|
||||
import com.tridium.fox.session.InvalidCommandException;
|
||||
import com.tridium.fox.sys.BFoxChannel;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.file.FileUtil;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BTimeChannel
|
||||
extends BFoxChannel {
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$com$tridium$platform$fox$BTimeChannel;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public FoxResponse process(FoxRequest foxRequest) throws Exception {
|
||||
String string = foxRequest.command;
|
||||
throw new InvalidCommandException(string);
|
||||
}
|
||||
|
||||
public void circuitOpened(FoxCircuit foxCircuit) throws Exception {
|
||||
String string = foxCircuit.command;
|
||||
if (string == "gettimezones") {
|
||||
this.gettimezones(foxCircuit);
|
||||
return;
|
||||
}
|
||||
throw new InvalidCommandException(string);
|
||||
}
|
||||
|
||||
public InputStream gettimezones() throws Exception {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("c:gettimezones");
|
||||
}
|
||||
FoxCircuit foxCircuit = this.openCircuit("gettimezones");
|
||||
return foxCircuit.getInputStream();
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 void gettimezones(FoxCircuit foxCircuit) throws Exception {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("s:gettimezones");
|
||||
}
|
||||
FilePath filePath = new FilePath("!lib/timezones.jar");
|
||||
BIFile bIFile = BFileSystem.INSTANCE.resolveFile(filePath);
|
||||
long l = bIFile.getSize();
|
||||
InputStream inputStream = bIFile.getInputStream();
|
||||
OutputStream outputStream = foxCircuit.getOutputStream();
|
||||
try {
|
||||
FileUtil.pipe((InputStream)inputStream, (long)l, (OutputStream)outputStream);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var9_8 = null;
|
||||
inputStream.close();
|
||||
foxCircuit.close();
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var9_9 = null;
|
||||
}
|
||||
inputStream.close();
|
||||
foxCircuit.close();
|
||||
}
|
||||
|
||||
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 BTimeChannel() {
|
||||
super("time");
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$com$tridium$platform$fox$BTimeChannel;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$fox$BTimeChannel = BTimeChannel.class("[Lcom.tridium.platform.fox.BTimeChannel;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.fox.message.FoxMessage
|
||||
* com.tridium.fox.session.FoxCircuit
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
*/
|
||||
package com.tridium.platform.fox;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.session.FoxCircuit;
|
||||
import com.tridium.platform.fox.MessageClient;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class ChunkedInputStream
|
||||
extends InputStream {
|
||||
private FoxCircuit circuit;
|
||||
private byte[] chunk;
|
||||
private int nextRead;
|
||||
private MessageClient[] messageClients;
|
||||
|
||||
public int read() throws IOException {
|
||||
int n = this.available();
|
||||
if (n <= 0) {
|
||||
return -1;
|
||||
}
|
||||
byte by = this.chunk[this.nextRead];
|
||||
++this.nextRead;
|
||||
return by;
|
||||
}
|
||||
|
||||
public int read(byte[] byArray) throws IOException {
|
||||
return this.read(byArray, 0, byArray.length);
|
||||
}
|
||||
|
||||
public int read(byte[] byArray, int n, int n2) throws IOException {
|
||||
int n3 = this.available();
|
||||
if (n3 <= 0) {
|
||||
return -1;
|
||||
}
|
||||
int n4 = n2 > n3 ? n3 : n2;
|
||||
System.arraycopy(this.chunk, this.nextRead, byArray, n, n4);
|
||||
this.nextRead += n4;
|
||||
return n4;
|
||||
}
|
||||
|
||||
public int available() throws IOException {
|
||||
try {
|
||||
if (this.chunk == null || this.nextRead >= this.chunk.length) {
|
||||
boolean bl = true;
|
||||
FoxMessage foxMessage = null;
|
||||
block4: while (bl) {
|
||||
bl = false;
|
||||
foxMessage = this.circuit.readMessage();
|
||||
int n = 0;
|
||||
while (n < this.messageClients.length) {
|
||||
if (this.messageClients[n].handleMessage(foxMessage)) {
|
||||
bl = true;
|
||||
continue block4;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
this.chunk = foxMessage.getBlob("chunk");
|
||||
this.nextRead = 0;
|
||||
}
|
||||
return this.chunk.length - this.nextRead;
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw iOException;
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
try {
|
||||
this.circuit.writeMessage(new FoxMessage());
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw iOException;
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.chunk = null;
|
||||
this.nextRead = -1;
|
||||
}
|
||||
|
||||
public ChunkedInputStream(FoxCircuit foxCircuit) {
|
||||
this(foxCircuit, new MessageClient[0]);
|
||||
}
|
||||
|
||||
public ChunkedInputStream(FoxCircuit foxCircuit, MessageClient[] messageClientArray) {
|
||||
this.this();
|
||||
this.circuit = foxCircuit;
|
||||
this.messageClients = messageClientArray;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.fox.message.FoxMessage
|
||||
* com.tridium.fox.session.Fox
|
||||
* com.tridium.fox.session.FoxCircuit
|
||||
*/
|
||||
package com.tridium.platform.fox;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.session.Fox;
|
||||
import com.tridium.fox.session.FoxCircuit;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class ChunkedOutputStream
|
||||
extends OutputStream {
|
||||
private FoxCircuit circuit;
|
||||
private byte[] buf;
|
||||
private int n;
|
||||
|
||||
public void write(int n) throws IOException {
|
||||
this.buf[this.n++] = (byte)(0xFF & n);
|
||||
if (this.n >= this.buf.length) {
|
||||
this.flush();
|
||||
}
|
||||
}
|
||||
|
||||
public void flush() throws IOException {
|
||||
if (this.n > 0) {
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("type", "chunk");
|
||||
foxMessage.add("chunk", this.buf, this.n);
|
||||
this.writeMessage(foxMessage);
|
||||
this.n = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
this.flush();
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("type", "chunk");
|
||||
foxMessage.add("chunk", this.buf, 0);
|
||||
this.writeMessage(foxMessage);
|
||||
FoxMessage foxMessage2 = this.readMessage();
|
||||
this.circuit.close();
|
||||
String string = foxMessage2.getString("error", null);
|
||||
if (string != null) {
|
||||
throw new IOException(string);
|
||||
}
|
||||
}
|
||||
|
||||
private final FoxMessage readMessage() throws IOException {
|
||||
try {
|
||||
return this.circuit.readMessage();
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw iOException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new IOException(exception.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private final void writeMessage(FoxMessage foxMessage) throws IOException {
|
||||
try {
|
||||
this.circuit.writeMessage(foxMessage);
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw iOException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new IOException(exception.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.buf = new byte[Fox.circuitChunkSize - 256];
|
||||
}
|
||||
|
||||
public ChunkedOutputStream(FoxCircuit foxCircuit) {
|
||||
this.this();
|
||||
this.circuit = foxCircuit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.fox.message.FoxMessage
|
||||
*/
|
||||
package com.tridium.platform.fox;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
|
||||
public interface MessageClient {
|
||||
public boolean handleMessage(FoxMessage var1) throws Exception;
|
||||
|
||||
public void close();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.fox.message.FoxMessage
|
||||
* com.tridium.fox.session.FoxCircuit
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
*/
|
||||
package com.tridium.platform.fox;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.session.FoxCircuit;
|
||||
import com.tridium.platform.daemon.task.DaemonSessionTask;
|
||||
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class TaskDispatcher
|
||||
implements DaemonSessionTaskListener {
|
||||
private Array tasks;
|
||||
private FoxCircuit circuit;
|
||||
static /* synthetic */ Class class$com$tridium$platform$daemon$task$DaemonSessionTask;
|
||||
|
||||
public synchronized void taskStarted(DaemonSessionTask daemonSessionTask) {
|
||||
try {
|
||||
this.tasks.add((Object)daemonSessionTask);
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("type", "taskStatus");
|
||||
foxMessage.add("id", "started");
|
||||
foxMessage.add("title", daemonSessionTask.getTitle());
|
||||
foxMessage.add("message", daemonSessionTask.getMessage());
|
||||
foxMessage.add("total", daemonSessionTask.getTotal());
|
||||
foxMessage.add("immediate", daemonSessionTask.isImmediate());
|
||||
foxMessage.add("taskindex", this.tasks.size() - 1);
|
||||
this.circuit.writeMessage(foxMessage);
|
||||
this.circuit.flush();
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void taskUpdated(DaemonSessionTask daemonSessionTask) {
|
||||
try {
|
||||
int n = this.tasks.indexOf((Object)daemonSessionTask);
|
||||
if (n < 0) {
|
||||
this.taskStarted(daemonSessionTask);
|
||||
}
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("type", "taskStatus");
|
||||
foxMessage.add("id", "updated");
|
||||
foxMessage.add("immediate", daemonSessionTask.isImmediate());
|
||||
foxMessage.add("progress", daemonSessionTask.getProgress());
|
||||
foxMessage.add("message", daemonSessionTask.getMessage());
|
||||
foxMessage.add("taskindex", n);
|
||||
this.circuit.writeMessage(foxMessage);
|
||||
this.circuit.flush();
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void taskFinished(DaemonSessionTask daemonSessionTask) {
|
||||
try {
|
||||
int n = this.tasks.indexOf((Object)daemonSessionTask);
|
||||
if (n < 0) {
|
||||
return;
|
||||
}
|
||||
FoxMessage foxMessage = new FoxMessage();
|
||||
foxMessage.add("type", "taskStatus");
|
||||
foxMessage.add("id", "finished");
|
||||
foxMessage.add("immediate", daemonSessionTask.isImmediate());
|
||||
foxMessage.add("progress", daemonSessionTask.getProgress());
|
||||
foxMessage.add("message", daemonSessionTask.getMessage());
|
||||
foxMessage.add("taskindex", n);
|
||||
this.circuit.writeMessage(foxMessage);
|
||||
this.circuit.flush();
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new BajaRuntimeException((Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCancelEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
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() {
|
||||
Class clazz = class$com$tridium$platform$daemon$task$DaemonSessionTask;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$daemon$task$DaemonSessionTask = TaskDispatcher.class("[Lcom.tridium.platform.daemon.task.DaemonSessionTask;", false);
|
||||
}
|
||||
this.tasks = new Array(clazz);
|
||||
}
|
||||
|
||||
public TaskDispatcher(FoxCircuit foxCircuit) {
|
||||
this.this();
|
||||
this.circuit = foxCircuit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.fox.message.FoxMessage
|
||||
* javax.baja.nre.util.IntHashMap
|
||||
* javax.baja.nre.util.IntHashMap$Iterator
|
||||
*/
|
||||
package com.tridium.platform.fox;
|
||||
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.platform.daemon.task.DaemonSessionTask;
|
||||
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
|
||||
import com.tridium.platform.fox.MessageClient;
|
||||
import javax.baja.nre.util.IntHashMap;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class TaskListenerClient
|
||||
implements MessageClient {
|
||||
public IntHashMap tasks;
|
||||
public DaemonSessionTaskListener listener;
|
||||
|
||||
public boolean handleMessage(FoxMessage foxMessage) throws Exception {
|
||||
String string = foxMessage.getString("type");
|
||||
if (string.equals("taskStatus")) {
|
||||
DaemonSessionTask daemonSessionTask;
|
||||
String string2 = foxMessage.getString("id");
|
||||
if (string2.equals("started")) {
|
||||
DaemonSessionTask daemonSessionTask2 = new DaemonSessionTask(foxMessage.getString("title"), foxMessage.getString("message"), foxMessage.getInt("total"));
|
||||
daemonSessionTask2.setImmediate(foxMessage.getBoolean("immediate"));
|
||||
this.tasks.put(foxMessage.getInt("taskindex"), (Object)daemonSessionTask2);
|
||||
this.listener.taskStarted(daemonSessionTask2);
|
||||
} else if (string2.equals("updated")) {
|
||||
DaemonSessionTask daemonSessionTask3 = (DaemonSessionTask)this.tasks.get(foxMessage.getInt("taskindex"));
|
||||
if (daemonSessionTask3 != null) {
|
||||
daemonSessionTask3.setImmediate(foxMessage.getBoolean("immediate"));
|
||||
daemonSessionTask3.setProgress(foxMessage.getInt("progress"));
|
||||
daemonSessionTask3.setMessage(foxMessage.getString("message"));
|
||||
this.listener.taskUpdated(daemonSessionTask3);
|
||||
}
|
||||
} else if (string2.equals("finished") && (daemonSessionTask = (DaemonSessionTask)this.tasks.get(foxMessage.getInt("taskindex"))) != null) {
|
||||
this.listener.taskFinished(daemonSessionTask);
|
||||
this.tasks.remove(foxMessage.getInt("taskindex"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
IntHashMap.Iterator iterator = this.tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
this.listener.taskFinished((DaemonSessionTask)iterator.next());
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.tasks = new IntHashMap();
|
||||
}
|
||||
|
||||
public TaskListenerClient(DaemonSessionTaskListener daemonSessionTaskListener) {
|
||||
this.this();
|
||||
this.listener = daemonSessionTaskListener == null ? DaemonSessionTaskListener.NULL_TASK_LISTENER : daemonSessionTaskListener;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user