136 lines
4.1 KiB
Java
136 lines
4.1 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package javax.baja.job;
|
|
|
|
import com.tridium.sys.service.ServiceManager;
|
|
import com.tridium.sys.station.BStationSaveJob;
|
|
import javax.baja.job.BIJobService;
|
|
import javax.baja.job.BJob;
|
|
import javax.baja.naming.BOrd;
|
|
import javax.baja.spy.SpyWriter;
|
|
import javax.baja.sys.Action;
|
|
import javax.baja.sys.BComponent;
|
|
import javax.baja.sys.BIService;
|
|
import javax.baja.sys.BIcon;
|
|
import javax.baja.sys.BValue;
|
|
import javax.baja.sys.Context;
|
|
import javax.baja.sys.ServiceNotFoundException;
|
|
import javax.baja.sys.Sys;
|
|
import javax.baja.sys.Topic;
|
|
import javax.baja.sys.Type;
|
|
import javax.baja.util.BNotification;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public class BJobService
|
|
extends BComponent
|
|
implements BIService,
|
|
BIJobService {
|
|
public static final Action submitAction = BJobService.newAction(4, new BStationSaveJob(), null);
|
|
public static final Topic notification = BJobService.newTopic(4, null);
|
|
public static final Type TYPE;
|
|
private static final BIcon icon;
|
|
static /* synthetic */ Class class$javax$baja$job$BJobService;
|
|
static /* synthetic */ Class class$javax$baja$job$BJob;
|
|
|
|
public BOrd submitAction(BJob bJob) {
|
|
return (BOrd)this.invoke(submitAction, bJob, null);
|
|
}
|
|
|
|
public void fireNotification(BNotification bNotification) {
|
|
this.fire(notification, bNotification, null);
|
|
}
|
|
|
|
public Type getType() {
|
|
return TYPE;
|
|
}
|
|
|
|
public static BIJobService getService() {
|
|
try {
|
|
return (BIJobService)((Object)Sys.getService(TYPE));
|
|
}
|
|
catch (ServiceNotFoundException serviceNotFoundException) {
|
|
try {
|
|
BOrd bOrd = BOrd.make("tool:workbench:WbJobService|slot:/");
|
|
return (BIJobService)((Object)bOrd.resolve().get());
|
|
}
|
|
catch (Exception exception) {
|
|
throw new ServiceNotFoundException("IJobService", exception);
|
|
}
|
|
}
|
|
}
|
|
|
|
public final BJob[] getJobs() {
|
|
Class clazz = class$javax$baja$job$BJob;
|
|
if (clazz == null) {
|
|
clazz = class$javax$baja$job$BJob = BJobService.class("[Ljavax.baja.job.BJob;", false);
|
|
}
|
|
return (BJob[])this.getChildren(clazz);
|
|
}
|
|
|
|
public BOrd submit(BJob bJob, Context context) {
|
|
return (BOrd)this.invoke(submitAction, bJob, context);
|
|
}
|
|
|
|
public BOrd doSubmitAction(BJob bJob, Context context) {
|
|
this.add(bJob.getType().getTypeName() + '?', (BValue)bJob, 2);
|
|
bJob.doSubmit(context);
|
|
ServiceManager.houseKeeping(this);
|
|
return bJob.getSlotPathOrd();
|
|
}
|
|
|
|
public Type[] getServiceTypes() {
|
|
return new Type[]{TYPE};
|
|
}
|
|
|
|
public void serviceStarted() {
|
|
}
|
|
|
|
public void serviceStopped() {
|
|
}
|
|
|
|
public BIcon getIcon() {
|
|
return icon;
|
|
}
|
|
|
|
public void spy(SpyWriter spyWriter) throws Exception {
|
|
BJob[] bJobArray = this.getJobs();
|
|
spyWriter.startTable(true);
|
|
spyWriter.trTitle("Jobs", 6);
|
|
spyWriter.w("<tr>").th("Name").th("State").th("Progress").th("Start").th("Heartbeat").th("End").w("</tr>").nl();
|
|
int n = 0;
|
|
while (n < bJobArray.length) {
|
|
BJob bJob = bJobArray[n];
|
|
spyWriter.tr(bJob.getName(), bJob.getJobState(), "" + bJob.getProgress(), bJob.getStartTime(), bJob.getHeartbeatTime(), bJob.getEndTime());
|
|
++n;
|
|
}
|
|
spyWriter.endTable();
|
|
super.spy(spyWriter);
|
|
}
|
|
|
|
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$javax$baja$job$BJobService;
|
|
if (clazz == null) {
|
|
clazz = class$javax$baja$job$BJobService = BJobService.class("[Ljavax.baja.job.BJobService;", false);
|
|
}
|
|
TYPE = Sys.loadType(clazz);
|
|
icon = BIcon.std("build.png");
|
|
}
|
|
}
|
|
|