2026-03-17 13:31:18 -07:00

262 lines
7.7 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.agent.AgentList
* javax.baja.file.FileUtil
* javax.baja.io.ValueDocEncoder
* javax.baja.sys.Action
* javax.baja.sys.BComponent
* javax.baja.sys.BIService
* javax.baja.sys.BRelTime
* javax.baja.sys.BStation
* javax.baja.sys.BValue
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Clock
* javax.baja.sys.Clock$Ticket
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform;
import com.tridium.platform.BPlatformServiceContainer;
import java.io.File;
import javax.baja.agent.AgentList;
import javax.baja.file.FileUtil;
import javax.baja.io.ValueDocEncoder;
import javax.baja.sys.Action;
import javax.baja.sys.BComponent;
import javax.baja.sys.BIService;
import javax.baja.sys.BRelTime;
import javax.baja.sys.BStation;
import javax.baja.sys.BValue;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Clock;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BPlatformService
extends BComponent
implements BIService {
public static final Property platformServiceDescription = BPlatformService.newProperty((int)1, (String)"unknown", null);
public static final Action poll = BPlatformService.newAction((int)2048, null);
public static final Action checkPropertiesLoaded = BPlatformService.newAction((int)4, null);
public static final Action savePlatformServiceProperties = BPlatformService.newAction((int)4, null);
public static final Type TYPE;
protected boolean platformServicePropertiesLoaded;
protected boolean isProxy;
protected boolean isServiceStarted;
protected Clock.Ticket pollTicket;
static /* synthetic */ Class class$com$tridium$platform$BPlatformService;
public String getPlatformServiceDescription() {
return this.getString(platformServiceDescription);
}
public void setPlatformServiceDescription(String string) {
this.setString(platformServiceDescription, string, null);
}
public void poll() {
this.invoke(poll, null, null);
}
public void checkPropertiesLoaded() {
this.invoke(checkPropertiesLoaded, null, null);
}
public void savePlatformServiceProperties() {
this.invoke(savePlatformServiceProperties, null, null);
}
public Type getType() {
return TYPE;
}
public boolean isProxy() {
return this.isProxy;
}
public boolean isValidPlatform() {
return false;
}
public String getLicenseFeature() {
return null;
}
public String getLicenseVendor() {
return "Tridium";
}
public int getSlotFlags() {
return 4;
}
public void loadPlatformServiceProperties() {
}
public void doStationStarted(BStation bStation) {
}
protected boolean startPollTimerOnSubscribe() {
return false;
}
public BRelTime getPollFrequency() {
return BRelTime.DEFAULT;
}
public AgentList getAgents(Context context) {
try {
AgentList agentList = super.getAgents(context);
agentList.remove("workbench:PropertySheet");
return agentList;
}
catch (Exception exception) {
exception.printStackTrace();
if (exception instanceof RuntimeException) {
throw (RuntimeException)exception;
}
throw new BajaRuntimeException((Throwable)exception);
}
}
public void doPoll(Context context) {
if (!this.isRunning()) {
return;
}
this.checkPropertiesLoaded();
}
public final synchronized void doCheckPropertiesLoaded() {
if (!this.platformServicePropertiesLoaded) {
this.loadPlatformServiceProperties();
this.platformServicePropertiesLoaded = true;
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void doSavePlatformServiceProperties() throws Exception {
if (!this.isRunning()) {
return;
}
BPlatformServiceContainer bPlatformServiceContainer = (BPlatformServiceContainer)Sys.getService((Type)BPlatformServiceContainer.TYPE);
BPlatformServiceContainer bPlatformServiceContainer2 = bPlatformServiceContainer;
synchronized (bPlatformServiceContainer2) {
File file = new File(Sys.getBajaHome(), "lib" + File.separator + "platform.bog.working");
File file2 = new File(Sys.getBajaHome(), "lib" + File.separator + "platform.bog");
ValueDocEncoder valueDocEncoder = new ValueDocEncoder(file);
valueDocEncoder.encodeDocument((BValue)bPlatformServiceContainer);
valueDocEncoder.close();
FileUtil.renameToBackup((File)file2, (int)1);
if (!file.renameTo(file2)) {
throw new BajaRuntimeException("platform.bog rename failed");
}
return;
}
}
public void serviceStarted() throws Exception {
this.isProxy = false;
this.isServiceStarted = true;
}
public void serviceStopped() throws Exception {
this.isServiceStarted = false;
}
public boolean isServiceStarted() {
return this.isServiceStarted;
}
public boolean isParentLegal(BComponent bComponent) {
return bComponent instanceof BPlatformServiceContainer;
}
public void subscribed() {
if (this.startPollTimerOnSubscribe()) {
this.startPollTimer();
} else {
this.poll();
}
super.subscribed();
}
public void unsubscribed() {
if (this.startPollTimerOnSubscribe()) {
this.stopPollTimer();
}
}
protected void startPollTimer() {
this.poll();
if (this.pollTicket == null && this.getPollFrequency().getMillis() > 0L && this.isRunning()) {
this.pollTicket = Clock.schedulePeriodically((BComponent)this, (BRelTime)this.getPollFrequency(), (Action)poll, null);
}
}
protected void stopPollTimer() {
if (this.pollTicket != null) {
this.pollTicket.cancel();
this.pollTicket = null;
}
}
public final String getNavDescription(Context context) {
if (this.getPlatformServiceDescription().equals("unknown")) {
return super.getNavDescription(context);
}
return this.getPlatformServiceDescription();
}
public boolean hasNavChildren() {
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() {
this.platformServicePropertiesLoaded = false;
this.isProxy = true;
this.isServiceStarted = false;
this.pollTicket = null;
}
public BPlatformService() {
this.this();
}
static {
Class clazz = class$com$tridium$platform$BPlatformService;
if (clazz == null) {
clazz = class$com$tridium$platform$BPlatformService = BPlatformService.class("[Lcom.tridium.platform.BPlatformService;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}