129 lines
4.6 KiB
Java
129 lines
4.6 KiB
Java
/*
|
|
* 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;
|
|
}
|
|
}
|
|
|