link start!
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
|
||||
public class AlarmException
|
||||
extends BajaRuntimeException {
|
||||
public AlarmException(String string, Throwable throwable) {
|
||||
super(string, throwable);
|
||||
}
|
||||
|
||||
public AlarmException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
public AlarmException(String string) {
|
||||
super(string);
|
||||
}
|
||||
|
||||
public AlarmException() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,414 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.collection.BICollection
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.BOrdList
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Cursor
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import javax.baja.alarm.BAckState;
|
||||
import javax.baja.alarm.BAlarmClass;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.alarm.BAlarmSourceInfo;
|
||||
import javax.baja.alarm.BIAlarmSource;
|
||||
import javax.baja.alarm.BSourceState;
|
||||
import javax.baja.alarm.ext.BAlarmSourceExt;
|
||||
import javax.baja.collection.BICollection;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.BOrdList;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Cursor;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class AlarmSupport {
|
||||
private static final Log logger = Log.getLog((String)"alarm");
|
||||
public static final String USER_OVERRIDE_FACET = "fw_BAlarmRecord_user";
|
||||
BComponent comp;
|
||||
String alarmClassName;
|
||||
BAlarmClass alarmClass;
|
||||
BAlarmSourceInfo info;
|
||||
BSourceState lastTransition;
|
||||
BAlarmRecord lastOffnormal;
|
||||
BAlarmRecord lastFault;
|
||||
BAlarmRecord lastAlert;
|
||||
int alarmCount;
|
||||
boolean firstNormal;
|
||||
BAlarmService as;
|
||||
|
||||
public void setAlarmClass(String string) {
|
||||
this.alarmClassName = string;
|
||||
if (this.getAlarmService() != null) {
|
||||
this.alarmClass = this.getAlarmService().lookupAlarmClass(string);
|
||||
}
|
||||
}
|
||||
|
||||
public BOrdList getSourceOrd() {
|
||||
return BOrdList.make((BOrd)this.comp.getNavOrd());
|
||||
}
|
||||
|
||||
public String getAlarmClassName() {
|
||||
if (this.info != null) {
|
||||
return this.info.getAlarmClass();
|
||||
}
|
||||
return this.alarmClassName;
|
||||
}
|
||||
|
||||
public boolean isAckRequired(BSourceState bSourceState) {
|
||||
this.getAlarmService();
|
||||
if (this.alarmClass != null) {
|
||||
return this.alarmClass.getAckRequired().includes(bSourceState);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public BAlarmRecord newAlert() throws Exception {
|
||||
return this.newAlert(BFacets.DEFAULT);
|
||||
}
|
||||
|
||||
public BAlarmRecord newAlert(BFacets bFacets) throws Exception {
|
||||
return this.newAlarm(BSourceState.alert, bFacets);
|
||||
}
|
||||
|
||||
public BAlarmRecord newOffnormalAlarm() throws Exception {
|
||||
return this.newOffnormalAlarm(BFacets.DEFAULT);
|
||||
}
|
||||
|
||||
public BAlarmRecord newOffnormalAlarm(BFacets bFacets) throws Exception {
|
||||
return this.newAlarm(BSourceState.offnormal, bFacets);
|
||||
}
|
||||
|
||||
public BAlarmRecord newFaultAlarm() throws Exception {
|
||||
return this.newFaultAlarm(BFacets.DEFAULT);
|
||||
}
|
||||
|
||||
public BAlarmRecord newFaultAlarm(BFacets bFacets) throws Exception {
|
||||
return this.newAlarm(BSourceState.fault, bFacets);
|
||||
}
|
||||
|
||||
protected BAlarmRecord newAlarm(BSourceState bSourceState, BFacets bFacets) {
|
||||
this.lastTransition = bSourceState;
|
||||
boolean bl = this.isAckRequired(bSourceState);
|
||||
BAlarmRecord bAlarmRecord = new BAlarmRecord();
|
||||
String string = bFacets.gets(USER_OVERRIDE_FACET, null);
|
||||
if (string != null) {
|
||||
bAlarmRecord.setUser(string);
|
||||
bFacets = BFacets.makeRemove((BFacets)bFacets, (String)USER_OVERRIDE_FACET);
|
||||
}
|
||||
if (this.info != null) {
|
||||
bFacets = BFacets.make((BFacets)this.info.makeAlarmData(bSourceState), (BFacets)bFacets);
|
||||
}
|
||||
bAlarmRecord.setSource(this.getSourceOrd());
|
||||
bAlarmRecord.setAlarmClass(this.getAlarmClassName());
|
||||
bAlarmRecord.setAlarmTransition(bSourceState);
|
||||
bAlarmRecord.setSourceState(bSourceState);
|
||||
bAlarmRecord.setAckRequired(bl);
|
||||
bAlarmRecord.setAlarmData(bFacets);
|
||||
if (bSourceState.equals((Object)BSourceState.offnormal)) {
|
||||
this.lastOffnormal = bAlarmRecord;
|
||||
} else if (bSourceState.equals((Object)BSourceState.fault)) {
|
||||
this.lastFault = bAlarmRecord;
|
||||
} else if (bSourceState.equals((Object)BSourceState.alert)) {
|
||||
this.lastAlert = bAlarmRecord;
|
||||
}
|
||||
++this.alarmCount;
|
||||
if (this.getAlarmService() != null) {
|
||||
this.getAlarmService().routeAlarm(bAlarmRecord);
|
||||
return bAlarmRecord;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized BAlarmRecord toNormal() throws Exception {
|
||||
return this.toNormal(BFacets.DEFAULT);
|
||||
}
|
||||
|
||||
public synchronized BAlarmRecord toNormal(BFacets bFacets) throws Exception {
|
||||
this.lastTransition = BSourceState.normal;
|
||||
BAlarmRecord bAlarmRecord = new BAlarmRecord();
|
||||
if (this.info != null) {
|
||||
bFacets = BFacets.make((BFacets)bFacets, (BFacets)this.info.makeAlarmData(BSourceState.normal));
|
||||
}
|
||||
if (this.getAlarmService() == null) {
|
||||
return new BAlarmRecord();
|
||||
}
|
||||
boolean bl = this.alarmClass.getAckRequired().isToNormal();
|
||||
if (this.alarmCount > 1 || this.firstNormal) {
|
||||
StringBuffer stringBuffer = new StringBuffer("alarm:|bql:select * where ");
|
||||
stringBuffer.append("source = OrdList '" + SlotPath.escape((String)this.getSourceOrd().encodeToString()) + "' and sourceState != alarm:SourceState.normal");
|
||||
BOrd bOrd = BOrd.make((String)stringBuffer.toString());
|
||||
Cursor cursor = ((BICollection)bOrd.resolve((BObject)this.as).get()).cursor();
|
||||
boolean bl2 = false;
|
||||
while (cursor.next()) {
|
||||
bl2 = true;
|
||||
BAlarmRecord bAlarmRecord2 = (BAlarmRecord)((BValue)cursor.get()).newCopy(true);
|
||||
if (bAlarmRecord2.getSourceState() == BSourceState.alert) continue;
|
||||
bAlarmRecord2.setSource(this.getSourceOrd());
|
||||
bAlarmRecord2.setAlarmClass(this.getAlarmClassName());
|
||||
bAlarmRecord2.setNormalTime(Clock.time());
|
||||
bAlarmRecord2.setSourceState(BSourceState.normal);
|
||||
boolean bl3 = false;
|
||||
if (bAlarmRecord2.getAckRequired() || bl) {
|
||||
bl3 = true;
|
||||
}
|
||||
bAlarmRecord2.setAckRequired(bl3);
|
||||
bAlarmRecord2.setAlarmData(BFacets.make((BFacets)bAlarmRecord2.getAlarmData(), (BFacets)bFacets));
|
||||
if (bl) {
|
||||
bAlarmRecord2.setAckState(BAckState.unacked);
|
||||
}
|
||||
if (this.getAlarmService() != null) {
|
||||
this.getAlarmService().routeAlarm(bAlarmRecord2);
|
||||
}
|
||||
bAlarmRecord = bAlarmRecord2;
|
||||
}
|
||||
if (!bl2) {
|
||||
if (bl) {
|
||||
bAlarmRecord.setAckState(BAckState.unacked);
|
||||
}
|
||||
bAlarmRecord.setSource(this.getSourceOrd());
|
||||
bAlarmRecord.setAlarmClass(this.getAlarmClassName());
|
||||
bAlarmRecord.setNormalTime(Clock.time());
|
||||
bAlarmRecord.setSourceState(BSourceState.normal);
|
||||
bAlarmRecord.setAckRequired(bl);
|
||||
bAlarmRecord.setAlarmData(bFacets);
|
||||
if (this.getAlarmService() != null) {
|
||||
this.getAlarmService().routeAlarm(bAlarmRecord);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
BAlarmRecord bAlarmRecord3 = null;
|
||||
if (this.lastAlert != null && !this.lastAlert.isNormal()) {
|
||||
this.lastAlert.setSourceState(BSourceState.normal);
|
||||
bAlarmRecord3 = this.getAlarmService().getAlarmDb().getRecord(this.lastAlert.getUuid());
|
||||
if (bAlarmRecord3 == null) {
|
||||
bAlarmRecord3 = new BAlarmRecord();
|
||||
bAlarmRecord3.setUuid(this.lastAlert.getUuid());
|
||||
}
|
||||
} else if (this.lastFault != null && !this.lastFault.isNormal()) {
|
||||
this.lastFault.setSourceState(BSourceState.normal);
|
||||
bAlarmRecord3 = this.getAlarmService().getAlarmDb().getRecord(this.lastFault.getUuid());
|
||||
if (bAlarmRecord3 == null) {
|
||||
bAlarmRecord3 = new BAlarmRecord();
|
||||
bAlarmRecord3.setUuid(this.lastFault.getUuid());
|
||||
}
|
||||
} else if (this.lastOffnormal != null && !this.lastOffnormal.isNormal()) {
|
||||
this.lastOffnormal.setSourceState(BSourceState.normal);
|
||||
bAlarmRecord3 = this.getAlarmService().getAlarmDb().getRecord(this.lastOffnormal.getUuid());
|
||||
if (bAlarmRecord3 == null) {
|
||||
bAlarmRecord3 = new BAlarmRecord();
|
||||
bAlarmRecord3.setUuid(this.lastOffnormal.getUuid());
|
||||
}
|
||||
} else {
|
||||
bAlarmRecord3 = new BAlarmRecord();
|
||||
}
|
||||
bAlarmRecord3.setSource(this.getSourceOrd());
|
||||
bAlarmRecord3.setAlarmClass(this.getAlarmClassName());
|
||||
bAlarmRecord3.setNormalTime(Clock.time());
|
||||
bAlarmRecord3.setSourceState(BSourceState.normal);
|
||||
boolean bl4 = false;
|
||||
if (bAlarmRecord3.getAckRequired() || bl) {
|
||||
bl4 = true;
|
||||
}
|
||||
bAlarmRecord3.setAckRequired(bl4);
|
||||
bAlarmRecord3.setAlarmData(BFacets.make((BFacets)bAlarmRecord3.getAlarmData(), (BFacets)bFacets));
|
||||
if (bl) {
|
||||
bAlarmRecord3.setAckState(BAckState.unacked);
|
||||
}
|
||||
if (this.getAlarmService() != null) {
|
||||
this.getAlarmService().routeAlarm(bAlarmRecord3);
|
||||
}
|
||||
bAlarmRecord = bAlarmRecord3;
|
||||
}
|
||||
this.firstNormal = false;
|
||||
this.alarmCount = 0;
|
||||
return bAlarmRecord;
|
||||
}
|
||||
|
||||
public synchronized void toNormal(Context context) throws Exception {
|
||||
this.toNormal(BFacets.DEFAULT, context);
|
||||
}
|
||||
|
||||
public synchronized void toNormal(BFacets bFacets, Context context) throws Exception {
|
||||
this.lastTransition = BSourceState.normal;
|
||||
if (this.info != null) {
|
||||
bFacets = BFacets.make((BFacets)bFacets, (BFacets)this.info.makeAlarmData(BSourceState.normal));
|
||||
}
|
||||
if (this.getAlarmService() == null) {
|
||||
return;
|
||||
}
|
||||
boolean bl = this.alarmClass.getAckRequired().isToNormal();
|
||||
if (this.alarmCount > 1 || this.firstNormal) {
|
||||
BAlarmRecord bAlarmRecord = new BAlarmRecord();
|
||||
if (bl) {
|
||||
bAlarmRecord.setAckState(BAckState.unacked);
|
||||
}
|
||||
bAlarmRecord.setSource(this.getSourceOrd());
|
||||
bAlarmRecord.setAlarmClass(this.getAlarmClassName());
|
||||
bAlarmRecord.setNormalTime(Clock.time());
|
||||
bAlarmRecord.setSourceState(BSourceState.normal);
|
||||
bAlarmRecord.setAckRequired(bl);
|
||||
bAlarmRecord.setAlarmData(bFacets);
|
||||
this.getAlarmService().getAlarmDb().toNormal(bAlarmRecord);
|
||||
} else {
|
||||
BAlarmRecord bAlarmRecord = null;
|
||||
if (this.lastAlert != null && !this.lastAlert.isNormal()) {
|
||||
this.lastAlert.setSourceState(BSourceState.normal);
|
||||
bAlarmRecord = this.getAlarmService().getAlarmDb().getRecord(this.lastAlert.getUuid());
|
||||
if (bAlarmRecord == null) {
|
||||
bAlarmRecord = new BAlarmRecord();
|
||||
bAlarmRecord.setUuid(this.lastAlert.getUuid());
|
||||
}
|
||||
} else if (this.lastFault != null && !this.lastFault.isNormal()) {
|
||||
this.lastFault.setSourceState(BSourceState.normal);
|
||||
bAlarmRecord = this.getAlarmService().getAlarmDb().getRecord(this.lastFault.getUuid());
|
||||
if (bAlarmRecord == null) {
|
||||
bAlarmRecord = new BAlarmRecord();
|
||||
bAlarmRecord.setUuid(this.lastFault.getUuid());
|
||||
}
|
||||
} else if (this.lastOffnormal != null && !this.lastOffnormal.isNormal()) {
|
||||
this.lastOffnormal.setSourceState(BSourceState.normal);
|
||||
bAlarmRecord = this.getAlarmService().getAlarmDb().getRecord(this.lastOffnormal.getUuid());
|
||||
if (bAlarmRecord == null) {
|
||||
bAlarmRecord = new BAlarmRecord();
|
||||
bAlarmRecord.setUuid(this.lastOffnormal.getUuid());
|
||||
}
|
||||
} else {
|
||||
bAlarmRecord = new BAlarmRecord();
|
||||
}
|
||||
bAlarmRecord.setSource(this.getSourceOrd());
|
||||
bAlarmRecord.setAlarmClass(this.getAlarmClassName());
|
||||
bAlarmRecord.setNormalTime(Clock.time());
|
||||
bAlarmRecord.setSourceState(BSourceState.normal);
|
||||
boolean bl2 = false;
|
||||
if (bAlarmRecord.getAckRequired() || bl) {
|
||||
bl2 = true;
|
||||
}
|
||||
bAlarmRecord.setAckRequired(bl2);
|
||||
bAlarmRecord.setAlarmData(BFacets.make((BFacets)bAlarmRecord.getAlarmData(), (BFacets)bFacets));
|
||||
if (bl) {
|
||||
bAlarmRecord.setAckState(BAckState.unacked);
|
||||
}
|
||||
this.getAlarmService().routeAlarm(bAlarmRecord);
|
||||
BOrdList bOrdList = this.getSourceOrd();
|
||||
BObject bObject = bOrdList.get(0).resolve().get();
|
||||
if (bObject instanceof BAlarmSourceExt) {
|
||||
BAlarmSourceExt bAlarmSourceExt = (BAlarmSourceExt)bObject;
|
||||
bAlarmSourceExt.fireToNormal(bAlarmRecord);
|
||||
}
|
||||
}
|
||||
this.firstNormal = false;
|
||||
this.alarmCount = 0;
|
||||
}
|
||||
|
||||
public boolean ackAlarm(BAlarmRecord bAlarmRecord) throws Exception {
|
||||
bAlarmRecord.setAckTime(Clock.time());
|
||||
boolean bl = false;
|
||||
bAlarmRecord.setAckState(BAckState.acked);
|
||||
bAlarmRecord.setAckRequired(false);
|
||||
bAlarmRecord.setAlarmClass(this.getAlarmClassName());
|
||||
if (this.lastTransition == BSourceState.normal && bAlarmRecord.getSourceState() != BSourceState.normal) {
|
||||
bAlarmRecord.setSourceState(BSourceState.normal);
|
||||
}
|
||||
if (bAlarmRecord.getAlarmTransition() == BSourceState.offnormal) {
|
||||
boolean bl2 = true;
|
||||
if (this.lastOffnormal != null) {
|
||||
bl2 = bAlarmRecord.getUuid().equals((Object)this.lastOffnormal.getUuid());
|
||||
}
|
||||
bl = bl2;
|
||||
} else if (bAlarmRecord.getAlarmTransition() == BSourceState.fault) {
|
||||
boolean bl3 = true;
|
||||
if (this.lastFault != null) {
|
||||
bl3 = bAlarmRecord.getUuid().equals((Object)this.lastFault.getUuid());
|
||||
}
|
||||
bl = bl3;
|
||||
} else if (bAlarmRecord.getAlarmTransition() == BSourceState.alert) {
|
||||
boolean bl4 = true;
|
||||
if (this.lastAlert != null) {
|
||||
bl4 = bAlarmRecord.getUuid().equals((Object)this.lastAlert.getUuid());
|
||||
}
|
||||
bl = bl4;
|
||||
}
|
||||
try {
|
||||
this.getAlarmService().routeAlarm(bAlarmRecord);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public BAlarmRecord getLastOffnormal() {
|
||||
return this.lastOffnormal;
|
||||
}
|
||||
|
||||
public BAlarmRecord getLastFault() {
|
||||
return this.lastFault;
|
||||
}
|
||||
|
||||
public BAlarmRecord getLastAlert() {
|
||||
return this.lastAlert;
|
||||
}
|
||||
|
||||
private final BAlarmService getAlarmService() {
|
||||
if (this.as == null) {
|
||||
try {
|
||||
this.as = (BAlarmService)Sys.getService((Type)BAlarmService.TYPE);
|
||||
this.alarmClass = this.as.lookupAlarmClass(this.getAlarmClassName());
|
||||
}
|
||||
catch (Exception exception) {
|
||||
System.out.println("Could Not Get AlarmService");
|
||||
exception.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return this.as;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.info = null;
|
||||
this.lastOffnormal = null;
|
||||
this.lastFault = null;
|
||||
this.lastAlert = null;
|
||||
this.alarmCount = 0;
|
||||
this.firstNormal = true;
|
||||
this.as = null;
|
||||
}
|
||||
|
||||
public AlarmSupport(BIAlarmSource bIAlarmSource, String string) {
|
||||
this.this();
|
||||
this.comp = (BComponent)bIAlarmSource;
|
||||
this.alarmClassName = string;
|
||||
}
|
||||
|
||||
public AlarmSupport(BIAlarmSource bIAlarmSource, BAlarmSourceInfo bAlarmSourceInfo) {
|
||||
this.this();
|
||||
this.comp = (BComponent)bIAlarmSource;
|
||||
this.alarmClassName = bAlarmSourceInfo.getAlarmClass();
|
||||
this.info = bAlarmSourceInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BFrozenEnum
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import javax.baja.sys.BFrozenEnum;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BAckState
|
||||
extends BFrozenEnum {
|
||||
public static final int ACKED = 0;
|
||||
public static final int UNACKED = 1;
|
||||
public static final int ACK_PENDING = 2;
|
||||
public static final BAckState acked = new BAckState(0);
|
||||
public static final BAckState unacked = new BAckState(1);
|
||||
public static final BAckState ackPending = new BAckState(2);
|
||||
public static final Type TYPE;
|
||||
public static final BAckState DEFAULT;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAckState;
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static final BAckState make(int n) {
|
||||
return (BAckState)acked.getRange().get(n, false);
|
||||
}
|
||||
|
||||
public static final BAckState make(String string) {
|
||||
return (BAckState)acked.getRange().get(string);
|
||||
}
|
||||
|
||||
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 BAckState(int n) {
|
||||
super(n);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$BAckState;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAckState = BAckState.class("[Ljavax.baja.alarm.BAckState;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
DEFAULT = acked;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,392 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.ServiceNotFoundException
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Topic
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.timezone.BTimeZone
|
||||
* javax.baja.util.IFuture
|
||||
* javax.baja.util.Queue
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import com.tridium.alarm.AlarmClassRouteAlarmInvocation;
|
||||
import java.io.IOException;
|
||||
import javax.baja.alarm.AlarmException;
|
||||
import javax.baja.alarm.BAckState;
|
||||
import javax.baja.alarm.BAlarmDatabase;
|
||||
import javax.baja.alarm.BAlarmPriorities;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.alarm.BAlarmTransitionBits;
|
||||
import javax.baja.alarm.BIAlarmClassFolder;
|
||||
import javax.baja.alarm.BSourceState;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.ServiceNotFoundException;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Topic;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.timezone.BTimeZone;
|
||||
import javax.baja.util.IFuture;
|
||||
import javax.baja.util.Queue;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BAlarmClass
|
||||
extends BComponent {
|
||||
public static final Property ackRequired = BAlarmClass.newProperty((int)0, (BValue)BAlarmTransitionBits.make(7), null);
|
||||
public static final Property priority = BAlarmClass.newProperty((int)0, (BValue)BAlarmPriorities.DEFAULT, null);
|
||||
public static final Property totalAlarmCount = BAlarmClass.newProperty((int)67, (int)0, null);
|
||||
public static final Property openAlarmCount = BAlarmClass.newProperty((int)67, (int)0, null);
|
||||
public static final Property inAlarmCount = BAlarmClass.newProperty((int)67, (int)0, null);
|
||||
public static final Property unackedAlarmCount = BAlarmClass.newProperty((int)67, (int)0, null);
|
||||
public static final Property timeOfLastAlarm = BAlarmClass.newProperty((int)65, (BValue)BAbsTime.DEFAULT, null);
|
||||
public static final Property escalationLevel1Enabled = BAlarmClass.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property escalationLevel1Delay = BAlarmClass.newProperty((int)0, (BValue)BRelTime.make((long)300000L), (BFacets)BFacets.make((String)"showSeconds", (BIDataValue)BBoolean.FALSE, (String)"min", (BIDataValue)BRelTime.make((long)60000L)));
|
||||
public static final Property escalationLevel2Enabled = BAlarmClass.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property escalationLevel2Delay = BAlarmClass.newProperty((int)0, (BValue)BRelTime.make((long)900000L), (BFacets)BFacets.make((String)"showSeconds", (BIDataValue)BBoolean.FALSE, (String)"min", (BIDataValue)BRelTime.make((long)120000L)));
|
||||
public static final Property escalationLevel3Enabled = BAlarmClass.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property escalationLevel3Delay = BAlarmClass.newProperty((int)0, (BValue)BRelTime.make((long)1800000L), (BFacets)BFacets.make((String)"showSeconds", (BIDataValue)BBoolean.FALSE, (String)"min", (BIDataValue)BRelTime.make((long)180000L)));
|
||||
public static final Action routeAlarm = BAlarmClass.newAction((int)20, (BValue)new BAlarmRecord(), null);
|
||||
public static final Topic alarm = BAlarmClass.newTopic((int)8, null);
|
||||
public static final Topic escalatedAlarm1 = BAlarmClass.newTopic((int)0, null);
|
||||
public static final Topic escalatedAlarm2 = BAlarmClass.newTopic((int)0, null);
|
||||
public static final Topic escalatedAlarm3 = BAlarmClass.newTopic((int)0, null);
|
||||
public static final Type TYPE;
|
||||
public static final Log log;
|
||||
private static final BIcon icon;
|
||||
public static String ESCALATED;
|
||||
public static String LEVEL_1;
|
||||
public static String LEVEL_2;
|
||||
public static String LEVEL_3;
|
||||
BAlarmService alarmService;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmClass;
|
||||
|
||||
public BAlarmTransitionBits getAckRequired() {
|
||||
return (BAlarmTransitionBits)this.get(ackRequired);
|
||||
}
|
||||
|
||||
public void setAckRequired(BAlarmTransitionBits bAlarmTransitionBits) {
|
||||
this.set(ackRequired, (BValue)bAlarmTransitionBits, null);
|
||||
}
|
||||
|
||||
public BAlarmPriorities getPriority() {
|
||||
return (BAlarmPriorities)this.get(priority);
|
||||
}
|
||||
|
||||
public void setPriority(BAlarmPriorities bAlarmPriorities) {
|
||||
this.set(priority, (BValue)bAlarmPriorities, null);
|
||||
}
|
||||
|
||||
public int getTotalAlarmCount() {
|
||||
return this.getInt(totalAlarmCount);
|
||||
}
|
||||
|
||||
public void setTotalAlarmCount(int n) {
|
||||
this.setInt(totalAlarmCount, n, null);
|
||||
}
|
||||
|
||||
public int getOpenAlarmCount() {
|
||||
return this.getInt(openAlarmCount);
|
||||
}
|
||||
|
||||
public void setOpenAlarmCount(int n) {
|
||||
this.setInt(openAlarmCount, n, null);
|
||||
}
|
||||
|
||||
public int getInAlarmCount() {
|
||||
return this.getInt(inAlarmCount);
|
||||
}
|
||||
|
||||
public void setInAlarmCount(int n) {
|
||||
this.setInt(inAlarmCount, n, null);
|
||||
}
|
||||
|
||||
public int getUnackedAlarmCount() {
|
||||
return this.getInt(unackedAlarmCount);
|
||||
}
|
||||
|
||||
public void setUnackedAlarmCount(int n) {
|
||||
this.setInt(unackedAlarmCount, n, null);
|
||||
}
|
||||
|
||||
public BAbsTime getTimeOfLastAlarm() {
|
||||
return (BAbsTime)this.get(timeOfLastAlarm);
|
||||
}
|
||||
|
||||
public void setTimeOfLastAlarm(BAbsTime bAbsTime) {
|
||||
this.set(timeOfLastAlarm, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public boolean getEscalationLevel1Enabled() {
|
||||
return this.getBoolean(escalationLevel1Enabled);
|
||||
}
|
||||
|
||||
public void setEscalationLevel1Enabled(boolean bl) {
|
||||
this.setBoolean(escalationLevel1Enabled, bl, null);
|
||||
}
|
||||
|
||||
public BRelTime getEscalationLevel1Delay() {
|
||||
return (BRelTime)this.get(escalationLevel1Delay);
|
||||
}
|
||||
|
||||
public void setEscalationLevel1Delay(BRelTime bRelTime) {
|
||||
this.set(escalationLevel1Delay, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public boolean getEscalationLevel2Enabled() {
|
||||
return this.getBoolean(escalationLevel2Enabled);
|
||||
}
|
||||
|
||||
public void setEscalationLevel2Enabled(boolean bl) {
|
||||
this.setBoolean(escalationLevel2Enabled, bl, null);
|
||||
}
|
||||
|
||||
public BRelTime getEscalationLevel2Delay() {
|
||||
return (BRelTime)this.get(escalationLevel2Delay);
|
||||
}
|
||||
|
||||
public void setEscalationLevel2Delay(BRelTime bRelTime) {
|
||||
this.set(escalationLevel2Delay, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public boolean getEscalationLevel3Enabled() {
|
||||
return this.getBoolean(escalationLevel3Enabled);
|
||||
}
|
||||
|
||||
public void setEscalationLevel3Enabled(boolean bl) {
|
||||
this.setBoolean(escalationLevel3Enabled, bl, null);
|
||||
}
|
||||
|
||||
public BRelTime getEscalationLevel3Delay() {
|
||||
return (BRelTime)this.get(escalationLevel3Delay);
|
||||
}
|
||||
|
||||
public void setEscalationLevel3Delay(BRelTime bRelTime) {
|
||||
this.set(escalationLevel3Delay, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public void routeAlarm(BAlarmRecord bAlarmRecord) {
|
||||
this.invoke(routeAlarm, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public void fireAlarm(BAlarmRecord bAlarmRecord) {
|
||||
this.fire(alarm, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public void fireEscalatedAlarm1(BAlarmRecord bAlarmRecord) {
|
||||
this.fire(escalatedAlarm1, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public void fireEscalatedAlarm2(BAlarmRecord bAlarmRecord) {
|
||||
this.fire(escalatedAlarm2, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public void fireEscalatedAlarm3(BAlarmRecord bAlarmRecord) {
|
||||
this.fire(escalatedAlarm3, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (property == totalAlarmCount || property == openAlarmCount || property == unackedAlarmCount || property == inAlarmCount) {
|
||||
if (this.getInt(property) < 0) {
|
||||
this.setInt(property, 0, null);
|
||||
}
|
||||
} else if (property == escalationLevel1Enabled) {
|
||||
if (this.getEscalationLevel1Enabled()) {
|
||||
int n = this.getFlags((Slot)escalatedAlarm1);
|
||||
this.setFlags((Slot)escalatedAlarm1, n |= 8);
|
||||
} else {
|
||||
int n = this.getFlags((Slot)escalatedAlarm1);
|
||||
this.setFlags((Slot)escalatedAlarm1, n &= 0xFFFFFFF7);
|
||||
}
|
||||
} else if (property == escalationLevel2Enabled) {
|
||||
if (this.getEscalationLevel2Enabled()) {
|
||||
int n = this.getFlags((Slot)escalatedAlarm1);
|
||||
this.setFlags((Slot)escalatedAlarm2, n |= 8);
|
||||
} else {
|
||||
int n = this.getFlags((Slot)escalatedAlarm2);
|
||||
this.setFlags((Slot)escalatedAlarm2, n &= 0xFFFFFFF7);
|
||||
}
|
||||
} else if (property == escalationLevel3Enabled) {
|
||||
if (this.getEscalationLevel3Enabled()) {
|
||||
int n = this.getFlags((Slot)escalatedAlarm3);
|
||||
this.setFlags((Slot)escalatedAlarm3, n |= 8);
|
||||
} else {
|
||||
int n = this.getFlags((Slot)escalatedAlarm3);
|
||||
this.setFlags((Slot)escalatedAlarm3, n &= 0xFFFFFFF7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void started() {
|
||||
}
|
||||
|
||||
public IFuture post(Action action, BValue bValue, Context context) {
|
||||
if (action == routeAlarm) {
|
||||
Queue queue = (Queue)((BAlarmService)Sys.getService((Type)BAlarmService.TYPE)).fw(601);
|
||||
AlarmClassRouteAlarmInvocation alarmClassRouteAlarmInvocation = AlarmClassRouteAlarmInvocation.make(this, action, (BAlarmRecord)bValue, context);
|
||||
queue.enqueue((Object)alarmClassRouteAlarmInvocation);
|
||||
if (action == routeAlarm) {
|
||||
return alarmClassRouteAlarmInvocation;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return super.post(action, bValue, context);
|
||||
}
|
||||
|
||||
public boolean isParentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BIAlarmClassFolder;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unable to fully structure code
|
||||
*/
|
||||
public void doRouteAlarm(BAlarmRecord var1_1) {
|
||||
block18: {
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
var2_2 = this.getAlarmService();
|
||||
if (this.isModifiedOrNew(var2_2.getAlarmDb(), var1_1)) break block18;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
** GOTO lbl14
|
||||
}
|
||||
catch (IOException var3_4) {
|
||||
try {
|
||||
var3_4.printStackTrace();
|
||||
lbl14:
|
||||
// 2 sources
|
||||
|
||||
var3_5 = var1_1.getSourceState();
|
||||
var1_1.setPriority(this.getPriority().getPriority(var3_5));
|
||||
var1_1.setAlarmClass(this.getName());
|
||||
var1_1.setAlarmData(BFacets.make((BFacets)var1_1.getAlarmData(), (String)"TimeZone", (BIDataValue)BTimeZone.getLocal()));
|
||||
var4_6 = this.getAckRequired().includes(var3_5);
|
||||
if (var1_1.getSourceState() == BSourceState.alert && var1_1.getAckState() == BAckState.acked) {
|
||||
var1_1.setSourceState(BSourceState.normal);
|
||||
var1_1.setAlarmTransition(BSourceState.alert);
|
||||
}
|
||||
if (var1_1.getAlarmData().get(BAlarmClass.ESCALATED) == null) {
|
||||
var1_1.addAlarmFacet(BAlarmClass.ESCALATED, (BIDataValue)BString.make((String)""));
|
||||
}
|
||||
var1_1.setLastUpdate(BAbsTime.now());
|
||||
try {
|
||||
if (var2_2.getAlarmDb().getRecord(var1_1.getUuid()) == null) {
|
||||
var2_2.getAlarmDb().append(var1_1);
|
||||
} else {
|
||||
var2_2.getAlarmDb().update(var1_1);
|
||||
}
|
||||
}
|
||||
catch (Exception var5_7) {
|
||||
BAlarmClass.log.error("Cannot write alarm.", (Throwable)var5_7);
|
||||
throw new AlarmException("Cannot write alarm", var5_7);
|
||||
}
|
||||
BAlarmClass.log.trace("BAlarmClass: " + this.getName() + " stored alarm.timestamp: " + var1_1.getTimestamp());
|
||||
if (var1_1.isAlarm()) {
|
||||
this.setTimeOfLastAlarm(var1_1.getTimestamp());
|
||||
}
|
||||
this.fireAlarm(var1_1);
|
||||
var5_8 = (BString)var1_1.getAlarmData().get(BAlarmClass.ESCALATED);
|
||||
if (var5_8 != null) {
|
||||
if (this.getEscalationLevel1Enabled() && (var5_8.equals((Object)BString.make((String)BAlarmClass.LEVEL_1)) || var5_8.equals((Object)BString.make((String)BAlarmClass.LEVEL_2)) || var5_8.equals((Object)BString.make((String)BAlarmClass.LEVEL_3)))) {
|
||||
this.fireEscalatedAlarm1(var1_1);
|
||||
}
|
||||
if (this.getEscalationLevel2Enabled() && (var5_8.equals((Object)BString.make((String)BAlarmClass.LEVEL_2)) || var5_8.equals((Object)BString.make((String)BAlarmClass.LEVEL_3)))) {
|
||||
this.fireEscalatedAlarm2(var1_1);
|
||||
}
|
||||
if (this.getEscalationLevel3Enabled() && var5_8.equals((Object)BString.make((String)BAlarmClass.LEVEL_3))) {
|
||||
this.fireEscalatedAlarm3(var1_1);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ServiceNotFoundException var2_3) {
|
||||
BAlarmClass.log.error("Alarm service not found", (Throwable)var2_3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final boolean isModifiedOrNew(BAlarmDatabase bAlarmDatabase, BAlarmRecord bAlarmRecord) throws IOException {
|
||||
BAlarmRecord bAlarmRecord2 = bAlarmDatabase.getRecord(bAlarmRecord.getUuid());
|
||||
return bAlarmRecord2 == null || !bAlarmRecord2.getTimestamp().equals((Object)bAlarmRecord.getTimestamp()) || !bAlarmRecord2.getSourceState().equivalent((Object)bAlarmRecord.getSourceState()) || !bAlarmRecord2.getAckState().equivalent((Object)bAlarmRecord.getAckState()) || bAlarmRecord2.getAckRequired() != bAlarmRecord.getAckRequired() || !bAlarmRecord2.getSource().equivalent((Object)bAlarmRecord.getSource()) || !bAlarmRecord2.getAlarmClass().equals(bAlarmRecord.getAlarmClass()) || bAlarmRecord2.getPriority() != bAlarmRecord.getPriority() || !bAlarmRecord2.getNormalTime().equivalent((Object)bAlarmRecord.getNormalTime()) || !bAlarmRecord2.getAckTime().equivalent((Object)bAlarmRecord.getAckTime()) || !bAlarmRecord2.getUser().equals(bAlarmRecord.getUser()) || !bAlarmRecord2.getAlarmData().equivalent((Object)bAlarmRecord.getAlarmData());
|
||||
}
|
||||
|
||||
public String toString(Context context) {
|
||||
return this.getDisplayName(context);
|
||||
}
|
||||
|
||||
protected BAlarmService getAlarmService() {
|
||||
if (this.alarmService == null) {
|
||||
this.alarmService = (BAlarmService)Sys.getService((Type)BAlarmService.TYPE);
|
||||
}
|
||||
return this.alarmService;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
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$alarm$BAlarmClass;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAlarmClass = BAlarmClass.class("[Ljavax.baja.alarm.BAlarmClass;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
log = Log.getLog((String)"alarm");
|
||||
icon = BIcon.make((BIcon)BIcon.std((String)"shapes/squareBlue.png"), (BIcon)BIcon.std((String)"badges/alarm.png"));
|
||||
ESCALATED = new String("escalated");
|
||||
LEVEL_1 = new String("level1");
|
||||
LEVEL_2 = new String("level2");
|
||||
LEVEL_3 = new String("level3");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.IllegalNameException
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.BFolder
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import javax.baja.alarm.BAlarmClass;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.alarm.BIAlarmClassFolder;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.IllegalNameException;
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.BFolder;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BAlarmClassFolder
|
||||
extends BFolder
|
||||
implements BIAlarmClassFolder {
|
||||
public static final Type TYPE;
|
||||
private static final BIcon icon;
|
||||
private BAlarmService alarmService;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmClassFolder;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void checkAdd(String string, BValue bValue, int n, BFacets bFacets, Context context) {
|
||||
if (this.isRunning() && bValue.getType().is(BAlarmClass.TYPE) && string != null) {
|
||||
BAlarmService bAlarmService = (BAlarmService)BOrd.make((String)"service:alarm:AlarmService").get((BObject)this);
|
||||
BAlarmClass bAlarmClass = bAlarmService.lookupAlarmClass(string);
|
||||
if (string.equals("defaultAlarmClass") || !bAlarmClass.getName().equals("defaultAlarmClass")) {
|
||||
throw new LocalizableRuntimeException("alarm", "DuplicateAlarmClass", (Object[])new String[]{string});
|
||||
}
|
||||
}
|
||||
super.checkAdd(string, bValue, n, bFacets, context);
|
||||
}
|
||||
|
||||
public void checkRename(Property property, String string, Context context) {
|
||||
if (property.getType().is(BAlarmClass.TYPE)) {
|
||||
BAlarmService bAlarmService = (BAlarmService)BOrd.make((String)"service:alarm:AlarmService").get((BObject)this);
|
||||
BAlarmClass bAlarmClass = bAlarmService.lookupAlarmClass(string);
|
||||
if (string.equals("defaultAlarmClass") || !bAlarmClass.getName().equals("defaultAlarmClass")) {
|
||||
throw new IllegalNameException("alarm", "DuplicateAlarmClass", (Object[])new String[]{string});
|
||||
}
|
||||
bAlarmService.alarmClassDisplayNames.clear();
|
||||
}
|
||||
super.checkRename(property, string, context);
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
if (property.getName().equals("displayNames")) {
|
||||
this.alarmService.alarmClassDisplayNames.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void added(Property property, Context context) {
|
||||
if (property.getName().equals("displayNames")) {
|
||||
this.alarmService.alarmClassDisplayNames.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void removed(Property property, BValue bValue, Context context) {
|
||||
if (property.getName().equals("displayNames")) {
|
||||
this.alarmService.alarmClassDisplayNames.clear();
|
||||
}
|
||||
}
|
||||
|
||||
protected BAlarmService getAlarmService() {
|
||||
if (this.alarmService == null) {
|
||||
this.alarmService = (BAlarmService)Sys.getService((Type)BAlarmService.TYPE);
|
||||
}
|
||||
return this.alarmService;
|
||||
}
|
||||
|
||||
public boolean isParentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BAlarmService || bComponent instanceof BAlarmClassFolder;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
BValue bValue = this.get("icon");
|
||||
if (bValue instanceof BIcon) {
|
||||
return (BIcon)bValue;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
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$alarm$BAlarmClassFolder;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAlarmClassFolder = BAlarmClassFolder.class("[Ljavax.baja.alarm.BAlarmClassFolder;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
icon = BIcon.make((BIcon)BIcon.std((String)"folder.png"), (BIcon)BIcon.std((String)"badges/alarm.png"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,402 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.bql.BBqlExtent
|
||||
* com.tridium.bql.Range
|
||||
* com.tridium.bql.RangeSet
|
||||
* com.tridium.bql.SelectQuery
|
||||
* com.tridium.util.EmptyCursor
|
||||
* javax.baja.bql.BIRelational
|
||||
* javax.baja.bql.BqlQuery
|
||||
* javax.baja.bql.Queryable
|
||||
* javax.baja.collection.BICollection
|
||||
* javax.baja.collection.BIList
|
||||
* javax.baja.collection.BITable
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.BOrdList
|
||||
* javax.baja.naming.OrdTarget
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Cursor
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.BUuid
|
||||
* javax.baja.util.IFilter
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import com.tridium.alarm.AlarmsToSourcesCursor;
|
||||
import com.tridium.alarm.db.BAckPendingAlarmTable;
|
||||
import com.tridium.alarm.db.BAlarmDbQueryResult;
|
||||
import com.tridium.alarm.db.BOpenAlarmTable;
|
||||
import com.tridium.bql.BBqlExtent;
|
||||
import com.tridium.bql.Range;
|
||||
import com.tridium.bql.RangeSet;
|
||||
import com.tridium.bql.SelectQuery;
|
||||
import com.tridium.util.EmptyCursor;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import javax.baja.alarm.AlarmException;
|
||||
import javax.baja.alarm.BAckState;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.alarm.BSourceState;
|
||||
import javax.baja.alarm.ext.BAlarmSourceExt;
|
||||
import javax.baja.bql.BIRelational;
|
||||
import javax.baja.bql.BqlQuery;
|
||||
import javax.baja.bql.Queryable;
|
||||
import javax.baja.collection.BICollection;
|
||||
import javax.baja.collection.BIList;
|
||||
import javax.baja.collection.BITable;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.BOrdList;
|
||||
import javax.baja.naming.OrdTarget;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Cursor;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.BUuid;
|
||||
import javax.baja.util.IFilter;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BAlarmDatabase
|
||||
extends BObject
|
||||
implements Queryable,
|
||||
BIRelational {
|
||||
public static final Type TYPE;
|
||||
public static final Log log;
|
||||
private boolean open;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmDatabase;
|
||||
|
||||
public final synchronized void open() throws IOException {
|
||||
this.doOpen();
|
||||
this.open = true;
|
||||
}
|
||||
|
||||
protected void doOpen() throws IOException {
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
return this.open;
|
||||
}
|
||||
|
||||
public final synchronized void save() throws IOException {
|
||||
if (!this.isOpen()) {
|
||||
return;
|
||||
}
|
||||
this.flush();
|
||||
this.doSave();
|
||||
}
|
||||
|
||||
protected void doSave() throws IOException {
|
||||
}
|
||||
|
||||
public final synchronized void flush() throws IOException {
|
||||
if (!this.isOpen()) {
|
||||
return;
|
||||
}
|
||||
this.doFlush();
|
||||
}
|
||||
|
||||
protected void doFlush() throws IOException {
|
||||
}
|
||||
|
||||
protected synchronized void assertOpen() {
|
||||
if (!this.isOpen()) {
|
||||
throw new AlarmException("Operation not allowed while database is closed.");
|
||||
}
|
||||
}
|
||||
|
||||
public final synchronized void close() {
|
||||
if (!this.isOpen()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.doClose();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("Cannot close alarm database.", (Throwable)exception);
|
||||
}
|
||||
this.open = false;
|
||||
}
|
||||
|
||||
protected void doClose() {
|
||||
}
|
||||
|
||||
public abstract void append(BAlarmRecord var1) throws IOException, AlarmException;
|
||||
|
||||
public abstract void update(BAlarmRecord var1) throws IOException, AlarmException;
|
||||
|
||||
public abstract int getRecordCount();
|
||||
|
||||
public abstract BAlarmRecord getRecord(BUuid var1) throws IOException;
|
||||
|
||||
public Cursor getOpenAlarmSources() throws IOException {
|
||||
Cursor cursor = this.getOpenAlarms();
|
||||
return new AlarmsToSourcesCursor(cursor);
|
||||
}
|
||||
|
||||
public abstract Cursor getOpenAlarms() throws IOException;
|
||||
|
||||
public abstract Cursor getAckPendingAlarms() throws IOException;
|
||||
|
||||
public abstract Cursor getAlarmsForSource(BOrdList var1) throws IOException;
|
||||
|
||||
public abstract Cursor scan() throws IOException, AlarmException;
|
||||
|
||||
public abstract Cursor timeQuery(BAbsTime var1, BAbsTime var2) throws IOException, AlarmException;
|
||||
|
||||
public synchronized Cursor doBqlQuery(BqlQuery bqlQuery) throws IOException, AlarmException {
|
||||
SelectQuery selectQuery = (SelectQuery)bqlQuery;
|
||||
RangeSet rangeSet = null;
|
||||
if (((BBqlExtent)selectQuery.getSelect().getExtent()).getUnparsed().equals("openAlarms")) {
|
||||
return this.getOpenAlarms();
|
||||
}
|
||||
if (((BBqlExtent)selectQuery.getSelect().getExtent()).getUnparsed().equals("ackPendingAlarms")) {
|
||||
return this.getAckPendingAlarms();
|
||||
}
|
||||
if (!selectQuery.hasPredicate()) {
|
||||
return this.scan();
|
||||
}
|
||||
try {
|
||||
rangeSet = selectQuery.getRange("uuid", BUuid.TYPE, true);
|
||||
if (!rangeSet.isAll()) {
|
||||
ArrayList<BValue> arrayList = new ArrayList<BValue>(1);
|
||||
int n = rangeSet.getCount();
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
Range range = rangeSet.getRange(n2);
|
||||
BAlarmRecord bAlarmRecord = this.getRecord((BUuid)range.getSingleton());
|
||||
if (bAlarmRecord != null) {
|
||||
arrayList.add(bAlarmRecord.newCopy(true));
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
BAlarmRecord[] bAlarmRecordArray = arrayList.toArray(new BAlarmRecord[arrayList.size()]);
|
||||
return new ArrayCursor(bAlarmRecordArray);
|
||||
}
|
||||
rangeSet = selectQuery.getRange("source", BOrdList.TYPE, true);
|
||||
if (!rangeSet.isAll() && rangeSet.getCount() == 1) {
|
||||
return this.getAlarmsForSource((BOrdList)rangeSet.getRange(0).getSingleton());
|
||||
}
|
||||
rangeSet = selectQuery.getRange("timestamp", BAbsTime.TYPE, false);
|
||||
if (rangeSet.isAll()) {
|
||||
return this.scan();
|
||||
}
|
||||
rangeSet.sort();
|
||||
Range range = rangeSet.getRange(0);
|
||||
Range range2 = rangeSet.getRange(rangeSet.getCount() - 1);
|
||||
return this.timeQuery((BAbsTime)range.min, (BAbsTime)range2.max);
|
||||
}
|
||||
catch (IllegalStateException illegalStateException) {
|
||||
illegalStateException.printStackTrace();
|
||||
return this.scan();
|
||||
}
|
||||
}
|
||||
|
||||
public void toNormal(BAlarmRecord bAlarmRecord) {
|
||||
BObject bObject;
|
||||
Object object;
|
||||
BAlarmService bAlarmService = (BAlarmService)Sys.getService((Type)BAlarmService.TYPE);
|
||||
Object object2 = null;
|
||||
StringBuffer stringBuffer = new StringBuffer("alarm:|bql:select * where ");
|
||||
stringBuffer.append("source = OrdList '");
|
||||
stringBuffer.append(SlotPath.escape((String)bAlarmRecord.getSource().encodeToString()));
|
||||
stringBuffer.append("' and sourceState != alarm:SourceState.normal and sourceState != alarm:SourceState.alert");
|
||||
BOrd bOrd = BOrd.make((String)stringBuffer.toString());
|
||||
Cursor cursor = ((BICollection)bOrd.resolve((BObject)bAlarmService).get()).cursor();
|
||||
if (cursor.next()) {
|
||||
do {
|
||||
if (((BAlarmRecord)((Object)(object = (BAlarmRecord)((BValue)cursor.get()).newCopy(true)))).getSourceState() == BSourceState.alert) continue;
|
||||
((BAlarmRecord)((Object)object)).setSource(bAlarmRecord.getSource());
|
||||
((BAlarmRecord)((Object)object)).setAlarmClass(bAlarmRecord.getAlarmClass());
|
||||
((BAlarmRecord)((Object)object)).setNormalTime(Clock.time());
|
||||
((BAlarmRecord)((Object)object)).setSourceState(BSourceState.normal);
|
||||
boolean bl = false;
|
||||
if (((BAlarmRecord)((Object)object)).getAckRequired() || bAlarmRecord.getAckRequired()) {
|
||||
bl = true;
|
||||
}
|
||||
((BAlarmRecord)((Object)object)).setAckRequired(bl);
|
||||
((BAlarmRecord)((Object)object)).setAlarmData(BFacets.make((BFacets)((BAlarmRecord)((Object)object)).getAlarmData(), (BFacets)bAlarmRecord.getAlarmData()));
|
||||
if (bAlarmRecord.getAckRequired()) {
|
||||
((BAlarmRecord)((Object)object)).setAckState(BAckState.unacked);
|
||||
}
|
||||
bAlarmService.routeAlarm((BAlarmRecord)((Object)object));
|
||||
object2 = object;
|
||||
} while (cursor.next());
|
||||
}
|
||||
if (object2 == null) {
|
||||
object = new BAlarmRecord();
|
||||
if (bAlarmRecord.getAckRequired()) {
|
||||
((BAlarmRecord)((Object)object)).setAckState(BAckState.unacked);
|
||||
}
|
||||
((BAlarmRecord)((Object)object)).setSource(bAlarmRecord.getSource());
|
||||
((BAlarmRecord)((Object)object)).setAlarmClass(bAlarmRecord.getAlarmClass());
|
||||
((BAlarmRecord)((Object)object)).setNormalTime(Clock.time());
|
||||
((BAlarmRecord)((Object)object)).setSourceState(BSourceState.normal);
|
||||
((BAlarmRecord)((Object)object)).setAckRequired(bAlarmRecord.getAckRequired());
|
||||
((BAlarmRecord)((Object)object)).setAlarmData(bAlarmRecord.getAlarmData());
|
||||
bAlarmService.routeAlarm((BAlarmRecord)((Object)object));
|
||||
object2 = object;
|
||||
}
|
||||
if ((bObject = (object = bAlarmRecord.getSource()).get(0).resolve().get()) instanceof BAlarmSourceExt) {
|
||||
BAlarmSourceExt bAlarmSourceExt = (BAlarmSourceExt)bObject;
|
||||
bAlarmSourceExt.fireToNormal((BAlarmRecord)((Object)object2));
|
||||
}
|
||||
}
|
||||
|
||||
public BObject bqlQuery(OrdTarget ordTarget, BqlQuery bqlQuery) {
|
||||
return new BAlarmDbQueryResult(this, bqlQuery);
|
||||
}
|
||||
|
||||
public BITable getRelation(String string) {
|
||||
if (string.equals("openAlarms")) {
|
||||
return new BOpenAlarmTable(this);
|
||||
}
|
||||
if (string.equals("ackPendingAlarms")) {
|
||||
return new BAckPendingAlarmTable(this);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Cursor cursor() {
|
||||
return new EmptyCursor(null);
|
||||
}
|
||||
|
||||
public BIList toList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public BITable toTable() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public BICollection filter(IFilter iFilter) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract void clearAllRecords(Context var1) throws IOException;
|
||||
|
||||
public abstract void clearOldRecords(BAbsTime var1, Context var2) throws IOException;
|
||||
|
||||
public abstract void clearRecord(BUuid var1, Context var2) throws IOException;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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.open = false;
|
||||
}
|
||||
|
||||
public BAlarmDatabase() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$BAlarmDatabase;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAlarmDatabase = BAlarmDatabase.class("[Ljavax.baja.alarm.BAlarmDatabase;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
log = Log.getLog((String)"alarm.database");
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private static class ArrayCursor
|
||||
implements Cursor {
|
||||
BAlarmRecord[] recs;
|
||||
int index;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmRecord;
|
||||
|
||||
public Context getContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public BObject get() {
|
||||
if (this.index == -1) {
|
||||
throw new IllegalStateException("get() before next()");
|
||||
}
|
||||
return this.recs[this.index];
|
||||
}
|
||||
|
||||
public boolean next() {
|
||||
if (this.index == this.recs.length) {
|
||||
return false;
|
||||
}
|
||||
++this.index;
|
||||
boolean bl = false;
|
||||
if (this.index != this.recs.length) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public boolean next(Class clazz) {
|
||||
Class clazz2 = class$javax$baja$alarm$BAlarmRecord;
|
||||
if (clazz2 == null) {
|
||||
clazz2 = class$javax$baja$alarm$BAlarmRecord = ArrayCursor.class("[Ljavax.baja.alarm.BAlarmRecord;", false);
|
||||
}
|
||||
if (clazz2.isAssignableFrom(clazz)) {
|
||||
return this.next();
|
||||
}
|
||||
this.index = this.recs.length;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean nextComponent() {
|
||||
this.index = this.recs.length;
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayCursor(BAlarmRecord[] bAlarmRecordArray) {
|
||||
this.recs = bAlarmRecordArray;
|
||||
this.index = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BSimple
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.BFormat
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.StringTokenizer;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BSimple;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.BFormat;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BAlarmInstructions
|
||||
extends BSimple {
|
||||
public static final BAlarmInstructions NULL;
|
||||
public static final BAlarmInstructions DEFAULT;
|
||||
public static final Type TYPE;
|
||||
private int hashCode;
|
||||
private BFormat[] instructions;
|
||||
private String string;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmInstructions;
|
||||
|
||||
public static final BAlarmInstructions make(BFormat bFormat) throws IOException {
|
||||
return new BAlarmInstructions(new BFormat[]{bFormat}, bFormat.encodeToString());
|
||||
}
|
||||
|
||||
public static final BAlarmInstructions make(BFormat[] bFormatArray) {
|
||||
if (bFormatArray.length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
return new BAlarmInstructions((BFormat[])bFormatArray.clone(), null);
|
||||
}
|
||||
|
||||
public static final BAlarmInstructions add(BAlarmInstructions bAlarmInstructions, BFormat bFormat) {
|
||||
BFormat[] bFormatArray = new BFormat[bAlarmInstructions.instructions.length + 1];
|
||||
System.arraycopy(bAlarmInstructions.instructions, 0, bFormatArray, 0, bAlarmInstructions.instructions.length);
|
||||
bFormatArray[bFormatArray.length - 1] = bFormat;
|
||||
return new BAlarmInstructions(bFormatArray, null);
|
||||
}
|
||||
|
||||
public static final BAlarmInstructions remove(BAlarmInstructions bAlarmInstructions, int n) {
|
||||
BFormat[] bFormatArray = new BFormat[bAlarmInstructions.instructions.length - 1];
|
||||
System.arraycopy(bAlarmInstructions.instructions, 0, bFormatArray, 0, n);
|
||||
if (n < bAlarmInstructions.instructions.length) {
|
||||
System.arraycopy(bAlarmInstructions.instructions, n + 1, bFormatArray, n, bAlarmInstructions.instructions.length - n - 1);
|
||||
}
|
||||
return new BAlarmInstructions(bFormatArray, null);
|
||||
}
|
||||
|
||||
public static final BAlarmInstructions make(String string) {
|
||||
return (BAlarmInstructions)DEFAULT.decodeFromString(string);
|
||||
}
|
||||
|
||||
public final BFormat get(int n) {
|
||||
return this.instructions[n];
|
||||
}
|
||||
|
||||
public final int size() {
|
||||
return this.instructions.length;
|
||||
}
|
||||
|
||||
public final boolean isNull() {
|
||||
boolean bl = false;
|
||||
if (this.instructions.length == 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final BFormat[] toArray() {
|
||||
return (BFormat[])this.instructions.clone();
|
||||
}
|
||||
|
||||
public final int hashCode() {
|
||||
if (this.hashCode == -1) {
|
||||
int n = 11;
|
||||
int n2 = 0;
|
||||
while (n2 < this.instructions.length) {
|
||||
n ^= this.instructions[n2].hashCode();
|
||||
++n2;
|
||||
}
|
||||
this.hashCode = n;
|
||||
}
|
||||
return this.hashCode;
|
||||
}
|
||||
|
||||
public final boolean equals(Object object) {
|
||||
if (object instanceof BAlarmInstructions) {
|
||||
BFormat[] bFormatArray = this.instructions;
|
||||
BFormat[] bFormatArray2 = ((BAlarmInstructions)((Object)object)).instructions;
|
||||
if (bFormatArray.length != bFormatArray2.length) {
|
||||
return false;
|
||||
}
|
||||
int n = 0;
|
||||
while (n < bFormatArray.length) {
|
||||
if (!bFormatArray[n].equals((Object)bFormatArray2[n])) {
|
||||
return false;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public final void encode(DataOutput dataOutput) throws IOException {
|
||||
dataOutput.writeUTF(this.encodeToString());
|
||||
}
|
||||
|
||||
public final BObject decode(DataInput dataInput) throws IOException {
|
||||
return this.decodeFromString(dataInput.readUTF());
|
||||
}
|
||||
|
||||
public final String encodeToString() throws IOException {
|
||||
if (this.string == null) {
|
||||
if (this.instructions.length == 1) {
|
||||
this.string = this.instructions[0].encodeToString();
|
||||
} else {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
int n = 0;
|
||||
while (n < this.instructions.length) {
|
||||
if (n > 0) {
|
||||
stringBuffer.append('\n');
|
||||
}
|
||||
stringBuffer.append(this.instructions[n].encodeToString());
|
||||
++n;
|
||||
}
|
||||
this.string = stringBuffer.toString();
|
||||
}
|
||||
}
|
||||
return this.string;
|
||||
}
|
||||
|
||||
public final BObject decodeFromString(String string) {
|
||||
if (string.length() == 0) {
|
||||
return DEFAULT;
|
||||
}
|
||||
int n = string.indexOf(10);
|
||||
if (n < 0) {
|
||||
return new BAlarmInstructions(new BFormat[]{BFormat.make((String)string)}, string);
|
||||
}
|
||||
ArrayList<BFormat> arrayList = new ArrayList<BFormat>();
|
||||
StringTokenizer stringTokenizer = new StringTokenizer(string, "\n");
|
||||
while (stringTokenizer.hasMoreTokens()) {
|
||||
arrayList.add(BFormat.make((String)stringTokenizer.nextToken()));
|
||||
}
|
||||
BFormat[] bFormatArray = arrayList.toArray(new BFormat[arrayList.size()]);
|
||||
return new BAlarmInstructions(bFormatArray, string);
|
||||
}
|
||||
|
||||
public final String toString(Context context) {
|
||||
if (this.instructions.length == 1) {
|
||||
return this.instructions[0].toString(context);
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
int n = 0;
|
||||
while (n < this.instructions.length) {
|
||||
if (n > 0) {
|
||||
stringBuffer.append("; ");
|
||||
}
|
||||
stringBuffer.append(this.instructions[n].toString(context));
|
||||
++n;
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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.hashCode = -1;
|
||||
}
|
||||
|
||||
private BAlarmInstructions(BFormat[] bFormatArray, String string) {
|
||||
this.this();
|
||||
this.instructions = bFormatArray;
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
static {
|
||||
DEFAULT = NULL = new BAlarmInstructions(new BFormat[0], "");
|
||||
Class clazz = class$javax$baja$alarm$BAlarmInstructions;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAlarmInstructions = BAlarmInstructions.class("[Ljavax.baja.alarm.BAlarmInstructions;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BSimple
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.util.StringTokenizer;
|
||||
import javax.baja.alarm.BSourceState;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BSimple;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BAlarmPriorities
|
||||
extends BSimple {
|
||||
public static final BAlarmPriorities DEFAULT = new BAlarmPriorities();
|
||||
public static final int MAX_PRIORITY = 255;
|
||||
public static final int MIN_PRIORITY = 0;
|
||||
public static final Type TYPE;
|
||||
private int toNormal;
|
||||
private int toOffnormal;
|
||||
private int toFault;
|
||||
private int toAlert;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmPriorities;
|
||||
|
||||
public static final BAlarmPriorities make(int n, int n2, int n3) {
|
||||
return new BAlarmPriorities(n, n2, n3, 255);
|
||||
}
|
||||
|
||||
public static final BAlarmPriorities make(int n, int n2, int n3, int n4) {
|
||||
return new BAlarmPriorities(n, n2, n3, n4);
|
||||
}
|
||||
|
||||
public final int getPriority(BSourceState bSourceState) {
|
||||
if (bSourceState == BSourceState.offnormal) {
|
||||
return this.toOffnormal;
|
||||
}
|
||||
if (bSourceState == BSourceState.fault) {
|
||||
return this.toFault;
|
||||
}
|
||||
if (bSourceState == BSourceState.normal) {
|
||||
return this.toNormal;
|
||||
}
|
||||
if (bSourceState == BSourceState.alert) {
|
||||
return this.toAlert;
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public final int getToOffnormal() {
|
||||
return this.toOffnormal;
|
||||
}
|
||||
|
||||
public final int getToNormal() {
|
||||
return this.toNormal;
|
||||
}
|
||||
|
||||
public final int getToFault() {
|
||||
return this.toFault;
|
||||
}
|
||||
|
||||
public final int getToAlert() {
|
||||
return this.toAlert;
|
||||
}
|
||||
|
||||
private final int checkPriority(int n) {
|
||||
if (n < 0 || n > 255) {
|
||||
throw new IllegalStateException(n + ": not in range 0-255");
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
public final int hashCode() {
|
||||
int n = 23 + this.toOffnormal;
|
||||
n = n * 37 + this.toNormal;
|
||||
n = n * 37 + this.toFault;
|
||||
return n * 37 + this.toAlert;
|
||||
}
|
||||
|
||||
public final boolean equals(Object object) {
|
||||
if (!(object instanceof BAlarmPriorities)) {
|
||||
return false;
|
||||
}
|
||||
BAlarmPriorities bAlarmPriorities = (BAlarmPriorities)((Object)object);
|
||||
boolean bl = false;
|
||||
if (this.toOffnormal == bAlarmPriorities.getToOffnormal() && this.toNormal == bAlarmPriorities.getToNormal() && this.toFault == bAlarmPriorities.getToFault() && this.toAlert == bAlarmPriorities.getToAlert()) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final void encode(DataOutput dataOutput) throws IOException {
|
||||
dataOutput.writeInt(this.toOffnormal);
|
||||
dataOutput.writeInt(this.toFault);
|
||||
dataOutput.writeInt(this.toNormal);
|
||||
dataOutput.writeInt(this.toAlert);
|
||||
}
|
||||
|
||||
public final BObject decode(DataInput dataInput) throws IOException {
|
||||
int n = dataInput.readInt();
|
||||
int n2 = dataInput.readInt();
|
||||
int n3 = dataInput.readInt();
|
||||
int n4 = dataInput.readInt();
|
||||
return BAlarmPriorities.make(n, n2, n3, n4);
|
||||
}
|
||||
|
||||
public final String encodeToString() throws IOException {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("toOffnormal=");
|
||||
stringBuffer.append(this.toOffnormal).append(';');
|
||||
stringBuffer.append("toFault=");
|
||||
stringBuffer.append(this.toFault).append(';');
|
||||
stringBuffer.append("toNormal=");
|
||||
stringBuffer.append(this.toNormal).append(';');
|
||||
stringBuffer.append("toAlert=");
|
||||
stringBuffer.append(this.toAlert).append(';');
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public final BObject decodeFromString(String string) throws IOException {
|
||||
BAlarmPriorities bAlarmPriorities = DEFAULT;
|
||||
StringTokenizer stringTokenizer = new StringTokenizer(string, ";");
|
||||
int n = 0;
|
||||
int n2 = 0;
|
||||
int n3 = 0;
|
||||
int n4 = 0;
|
||||
while (stringTokenizer.hasMoreTokens()) {
|
||||
String string2 = stringTokenizer.nextToken();
|
||||
int n5 = string2.indexOf("=");
|
||||
String string3 = string2.substring(0, n5);
|
||||
String string4 = string2.substring(n5 + 1);
|
||||
if (string3.equals("toOffnormal")) {
|
||||
n = Integer.parseInt(string4);
|
||||
continue;
|
||||
}
|
||||
if (string3.equals("toNormal")) {
|
||||
n3 = Integer.parseInt(string4);
|
||||
continue;
|
||||
}
|
||||
if (string3.equals("toFault")) {
|
||||
n2 = Integer.parseInt(string4);
|
||||
continue;
|
||||
}
|
||||
if (!string3.equals("toAlert")) continue;
|
||||
n4 = Integer.parseInt(string4);
|
||||
}
|
||||
return BAlarmPriorities.make(n, n2, n3, n4);
|
||||
}
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BAlarmPriorities(int n, int n2, int n3, int n4) {
|
||||
this.toOffnormal = this.checkPriority(n);
|
||||
this.toFault = this.checkPriority(n2);
|
||||
this.toNormal = this.checkPriority(n3);
|
||||
this.toAlert = this.checkPriority(n4);
|
||||
}
|
||||
|
||||
private BAlarmPriorities() {
|
||||
this(255, 255, 255, 255);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$BAlarmPriorities;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAlarmPriorities = BAlarmPriorities.class("[Ljavax.baja.alarm.BAlarmPriorities;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,251 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BLink
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.ServiceNotFoundException
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Topic
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.BCompositeTopic
|
||||
* javax.baja.util.BDaysOfWeekBits
|
||||
* javax.baja.util.BTimeRange
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import javax.baja.alarm.BAlarmClass;
|
||||
import javax.baja.alarm.BAlarmClassFolder;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.alarm.BAlarmTransitionBits;
|
||||
import javax.baja.alarm.BIAlarmClassFolder;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BLink;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.ServiceNotFoundException;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Topic;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.BCompositeTopic;
|
||||
import javax.baja.util.BDaysOfWeekBits;
|
||||
import javax.baja.util.BTimeRange;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BAlarmRecipient
|
||||
extends BComponent {
|
||||
public static final Property timeRange = BAlarmRecipient.newProperty((int)0, (BValue)new BTimeRange(), null);
|
||||
public static final Property daysOfWeek = BAlarmRecipient.newProperty((int)0, (BValue)BDaysOfWeekBits.DEFAULT, null);
|
||||
public static final Property transitions = BAlarmRecipient.newProperty((int)0, (BValue)BAlarmTransitionBits.ALL, null);
|
||||
public static final Property routeAcks = BAlarmRecipient.newProperty((int)0, (boolean)true, null);
|
||||
public static final Action routeAlarmAck = BAlarmRecipient.newAction((int)4, (BValue)new BAlarmRecord(), null);
|
||||
public static final Action routeAlarm = BAlarmRecipient.newAction((int)8, (BValue)new BAlarmRecord(), null);
|
||||
public static final Topic newUnackedAlarm = BAlarmRecipient.newTopic((int)4, null);
|
||||
public static final Type TYPE;
|
||||
private static final Log logger;
|
||||
private static final BIcon icon;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmRecipient;
|
||||
static /* synthetic */ Class class$javax$baja$sys$BLink;
|
||||
|
||||
public BTimeRange getTimeRange() {
|
||||
return (BTimeRange)this.get(timeRange);
|
||||
}
|
||||
|
||||
public void setTimeRange(BTimeRange bTimeRange) {
|
||||
this.set(timeRange, (BValue)bTimeRange, null);
|
||||
}
|
||||
|
||||
public BDaysOfWeekBits getDaysOfWeek() {
|
||||
return (BDaysOfWeekBits)this.get(daysOfWeek);
|
||||
}
|
||||
|
||||
public void setDaysOfWeek(BDaysOfWeekBits bDaysOfWeekBits) {
|
||||
this.set(daysOfWeek, (BValue)bDaysOfWeekBits, null);
|
||||
}
|
||||
|
||||
public BAlarmTransitionBits getTransitions() {
|
||||
return (BAlarmTransitionBits)this.get(transitions);
|
||||
}
|
||||
|
||||
public void setTransitions(BAlarmTransitionBits bAlarmTransitionBits) {
|
||||
this.set(transitions, (BValue)bAlarmTransitionBits, null);
|
||||
}
|
||||
|
||||
public boolean getRouteAcks() {
|
||||
return this.getBoolean(routeAcks);
|
||||
}
|
||||
|
||||
public void setRouteAcks(boolean bl) {
|
||||
this.setBoolean(routeAcks, bl, null);
|
||||
}
|
||||
|
||||
public void routeAlarmAck(BAlarmRecord bAlarmRecord) {
|
||||
this.invoke(routeAlarmAck, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public void routeAlarm(BAlarmRecord bAlarmRecord) {
|
||||
this.invoke(routeAlarm, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public void fireNewUnackedAlarm(BAlarmRecord bAlarmRecord) {
|
||||
this.fire(newUnackedAlarm, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public final void doRouteAlarm(BAlarmRecord bAlarmRecord) {
|
||||
if (this.accept(bAlarmRecord)) {
|
||||
this.handleAlarm(bAlarmRecord);
|
||||
}
|
||||
}
|
||||
|
||||
public void doRouteAlarmAck(BAlarmRecord bAlarmRecord) {
|
||||
try {
|
||||
((BAlarmService)Sys.getService((Type)BAlarmService.TYPE)).doAckAlarm(bAlarmRecord);
|
||||
}
|
||||
catch (ServiceNotFoundException serviceNotFoundException) {
|
||||
logger.warning("BAlarmRecipient: cannot find AlarmService");
|
||||
serviceNotFoundException.printStackTrace();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
logger.warning("BAlarmRecipient: cannot resolve alarm source for: " + (Object)((Object)bAlarmRecord));
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void handleAlarm(BAlarmRecord var1);
|
||||
|
||||
public String[] getSubscribedAlarmClasses() {
|
||||
return this.getSubscribedAlarmClasses("alarm");
|
||||
}
|
||||
|
||||
public String[] getSubscribedEscalatedAlarmClasses(int n) {
|
||||
if (n < 1 || n > 3) {
|
||||
return new String[0];
|
||||
}
|
||||
return this.getSubscribedAlarmClasses("escalatedAlarm" + n);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unable to fully structure code
|
||||
*/
|
||||
private final String[] getSubscribedAlarmClasses(String var1_1) {
|
||||
var2_2 = new ArrayList<String>();
|
||||
var3_3 = this.getProperties();
|
||||
if (true) ** GOTO lbl25
|
||||
do {
|
||||
block5: {
|
||||
try {
|
||||
var4_4 = (BLink)var3_3.get();
|
||||
if (!var4_4.isActive()) {
|
||||
var4_4.activate();
|
||||
}
|
||||
if (!((var5_6 = var4_4.getSourceComponent()) instanceof BAlarmClass) || !var4_4.getSourceSlotName().equals(var1_1)) ** GOTO lbl21
|
||||
var2_2.add(var5_6.getName());
|
||||
break block5;
|
||||
lbl-1000:
|
||||
// 1 sources
|
||||
|
||||
{
|
||||
var6_7 = (BAlarmClassFolder)var5_6;
|
||||
var7_8 = var4_4.getSourceSlotName();
|
||||
var4_4 = ((BCompositeTopic)var6_7.get((String)var7_8)).getMirror().link;
|
||||
var5_6 = var4_4.getSourceComponent();
|
||||
if (!(var5_6 instanceof BAlarmClass) || !var4_4.getSourceSlotName().equals(var1_1)) continue;
|
||||
var2_2.add(var5_6.getName());
|
||||
break block5;
|
||||
lbl21:
|
||||
// 2 sources
|
||||
|
||||
** while (var5_6 instanceof BIAlarmClassFolder)
|
||||
}
|
||||
lbl22:
|
||||
// 1 sources
|
||||
|
||||
}
|
||||
catch (Exception var4_5) {
|
||||
BAlarmRecipient.logger.error("alarm:BAlarmRecipient:getSubscribedAlarmClasses " + var4_5.getMessage(), (Throwable)var4_5);
|
||||
}
|
||||
}
|
||||
if ((v0 = BAlarmRecipient.class$javax$baja$sys$BLink) != null) continue;
|
||||
v0 = BAlarmRecipient.class("[Ljavax.baja.sys.BLink;", false);
|
||||
} while (var3_3.next(v0));
|
||||
var4_4 = new String[var2_2.size()];
|
||||
return (String[])var2_2.toArray((T[])var4_4);
|
||||
}
|
||||
|
||||
public boolean accept(BAlarmRecord bAlarmRecord) {
|
||||
BAbsTime bAbsTime = bAlarmRecord.getTimestamp();
|
||||
if (!this.getDaysOfWeek().includes(bAbsTime.getWeekday())) {
|
||||
return false;
|
||||
}
|
||||
if (!this.getTimeRange().includes(bAbsTime)) {
|
||||
return false;
|
||||
}
|
||||
if (!this.getTransitions().includes(bAlarmRecord.getSourceState())) {
|
||||
return false;
|
||||
}
|
||||
if (!this.getRouteAcks() && bAlarmRecord.isAcknowledged()) {
|
||||
if (bAlarmRecord.getNormalTime().isNull()) {
|
||||
return false;
|
||||
}
|
||||
if (bAlarmRecord.getNormalTime().isBefore(bAlarmRecord.getAckTime())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public String toString(Context context) {
|
||||
if (this.isMounted()) {
|
||||
return this.getName();
|
||||
}
|
||||
return TYPE.getTypeName();
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
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$alarm$BAlarmRecipient;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAlarmRecipient = BAlarmRecipient.class("[Ljavax.baja.alarm.BAlarmRecipient;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
logger = Log.getLog((String)"alarm");
|
||||
icon = BIcon.make((String)"module://icons/x16/alarm/alarmRecipient.png");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,421 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.BOrdList
|
||||
* javax.baja.naming.OrdQuery
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BInteger
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BStruct
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.BUuid
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import javax.baja.alarm.BAckState;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.alarm.BSourceState;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.BOrdList;
|
||||
import javax.baja.naming.OrdQuery;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BStruct;
|
||||
import javax.baja.sys.BValue;
|
||||
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;
|
||||
import javax.baja.util.BUuid;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BAlarmRecord
|
||||
extends BStruct {
|
||||
public static final Property timestamp = BAlarmRecord.newProperty((int)8, (BValue)BAbsTime.NULL, (BFacets)BFacets.make((String)"showSeconds", (BIDataValue)BBoolean.TRUE));
|
||||
public static final Property uuid = BAlarmRecord.newProperty((int)0, (BValue)BUuid.make(), null);
|
||||
public static final Property sourceState = BAlarmRecord.newProperty((int)0, (BValue)BSourceState.offnormal, null);
|
||||
public static final Property ackState = BAlarmRecord.newProperty((int)0, (BValue)BAckState.unacked, null);
|
||||
public static final Property ackRequired = BAlarmRecord.newProperty((int)0, (boolean)true, null);
|
||||
public static final Property source = BAlarmRecord.newProperty((int)8, (BValue)BOrdList.DEFAULT, (BFacets)BFacets.make((String)"width", (BIDataValue)BInteger.make((int)512)));
|
||||
public static final Property alarmClass = BAlarmRecord.newProperty((int)8, (String)"defaultAlarmClass", (BFacets)BFacets.make((String)"width", (BIDataValue)BInteger.make((int)256)));
|
||||
public static final Property priority = BAlarmRecord.newProperty((int)8, (int)0, null);
|
||||
public static final Property normalTime = BAlarmRecord.newProperty((int)0, (BValue)BAbsTime.NULL, null);
|
||||
public static final Property ackTime = BAlarmRecord.newProperty((int)0, (BValue)BAbsTime.NULL, null);
|
||||
public static final Property user = BAlarmRecord.newProperty((int)0, (String)"Unknown User", null);
|
||||
public static final Property alarmData = BAlarmRecord.newProperty((int)0, (BValue)BFacets.DEFAULT, (BFacets)BFacets.make((String)"width", (BIDataValue)BInteger.make((int)1024)));
|
||||
public static final Property alarmTransition = BAlarmRecord.newProperty((int)0, (BValue)BSourceState.offnormal, null);
|
||||
public static final Property lastUpdate = BAlarmRecord.newProperty((int)0, (BValue)BAbsTime.NULL, null);
|
||||
public static final Type TYPE;
|
||||
private static final int SERIAL_VERSION_ID = 0;
|
||||
public static final BFacets TIMESTAMP_FACETS;
|
||||
public static final String MSG_TEXT = "msgText";
|
||||
public static final String FROM_STATE = "fromState";
|
||||
public static final String TO_STATE = "toState";
|
||||
public static final String NOTIFY_TYPE = "notifyType";
|
||||
public static final String STATUS = "status";
|
||||
public static final String NEW_VALUE = "newValue";
|
||||
public static final String SETPT_VALUE = "setptValue";
|
||||
public static final String ERROR_LIMIT = "errorLimit";
|
||||
public static final String DEADBAND = "deadband";
|
||||
public static final String COUNT = "Count";
|
||||
public static final String HIGH_LIMIT = "highLimit";
|
||||
public static final String LOW_LIMIT = "lowLimit";
|
||||
public static final String ALARM_VALUE = "alarmValue";
|
||||
public static final String OFFNORMAL_VALUE = "offnormalValue";
|
||||
public static final String FAULT_VALUE = "faultValue";
|
||||
public static final String PRESENT_VALUE = "presentValue";
|
||||
public static final String NUMERIC_VALUE = "numericValue";
|
||||
public static final String FEEDBACK_VALUE = "feedbackValue";
|
||||
public static final String FEEDBACK_NUMERIC = "feedbackNumeric";
|
||||
public static final String CONTROLLED_VALUE = "controlledValue";
|
||||
public static final String HYPERLINK_ORD = "hyperlinkOrd";
|
||||
public static final String SOUND_FILE = "soundFile";
|
||||
public static final String ICON = "icon";
|
||||
public static final String SOURCE_NAME = "sourceName";
|
||||
public static final String NOTES = "notes";
|
||||
public static final String INSTRUCTIONS = "instructions";
|
||||
public static final String TIME_ZONE = "TimeZone";
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmRecord;
|
||||
|
||||
public final BAbsTime getTimestamp() {
|
||||
return (BAbsTime)this.get(timestamp);
|
||||
}
|
||||
|
||||
public final void setTimestamp(BAbsTime bAbsTime) {
|
||||
this.set(timestamp, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public final BUuid getUuid() {
|
||||
return (BUuid)this.get(uuid);
|
||||
}
|
||||
|
||||
public final void setUuid(BUuid bUuid) {
|
||||
this.set(uuid, (BValue)bUuid, null);
|
||||
}
|
||||
|
||||
public final BSourceState getSourceState() {
|
||||
return (BSourceState)this.get(sourceState);
|
||||
}
|
||||
|
||||
public final void setSourceState(BSourceState bSourceState) {
|
||||
this.set(sourceState, (BValue)bSourceState, null);
|
||||
}
|
||||
|
||||
public final BAckState getAckState() {
|
||||
return (BAckState)this.get(ackState);
|
||||
}
|
||||
|
||||
public final void setAckState(BAckState bAckState) {
|
||||
this.set(ackState, (BValue)bAckState, null);
|
||||
}
|
||||
|
||||
public final boolean getAckRequired() {
|
||||
return this.getBoolean(ackRequired);
|
||||
}
|
||||
|
||||
public final void setAckRequired(boolean bl) {
|
||||
this.setBoolean(ackRequired, bl, null);
|
||||
}
|
||||
|
||||
public final BOrdList getSource() {
|
||||
return (BOrdList)this.get(source);
|
||||
}
|
||||
|
||||
public final void setSource(BOrdList bOrdList) {
|
||||
this.set(source, (BValue)bOrdList, null);
|
||||
}
|
||||
|
||||
public final String getAlarmClass() {
|
||||
return this.getString(alarmClass);
|
||||
}
|
||||
|
||||
public final void setAlarmClass(String string) {
|
||||
this.setString(alarmClass, string, null);
|
||||
}
|
||||
|
||||
public final int getPriority() {
|
||||
return this.getInt(priority);
|
||||
}
|
||||
|
||||
public final void setPriority(int n) {
|
||||
this.setInt(priority, n, null);
|
||||
}
|
||||
|
||||
public final BAbsTime getNormalTime() {
|
||||
return (BAbsTime)this.get(normalTime);
|
||||
}
|
||||
|
||||
public final void setNormalTime(BAbsTime bAbsTime) {
|
||||
this.set(normalTime, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public final BAbsTime getAckTime() {
|
||||
return (BAbsTime)this.get(ackTime);
|
||||
}
|
||||
|
||||
public final void setAckTime(BAbsTime bAbsTime) {
|
||||
this.set(ackTime, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public final String getUser() {
|
||||
return this.getString(user);
|
||||
}
|
||||
|
||||
public final void setUser(String string) {
|
||||
this.setString(user, string, null);
|
||||
}
|
||||
|
||||
public final BFacets getAlarmData() {
|
||||
return (BFacets)this.get(alarmData);
|
||||
}
|
||||
|
||||
public final void setAlarmData(BFacets bFacets) {
|
||||
this.set(alarmData, (BValue)bFacets, null);
|
||||
}
|
||||
|
||||
public final BSourceState getAlarmTransition() {
|
||||
return (BSourceState)this.get(alarmTransition);
|
||||
}
|
||||
|
||||
public final void setAlarmTransition(BSourceState bSourceState) {
|
||||
this.set(alarmTransition, (BValue)bSourceState, null);
|
||||
}
|
||||
|
||||
public final BAbsTime getLastUpdate() {
|
||||
return (BAbsTime)this.get(lastUpdate);
|
||||
}
|
||||
|
||||
public final void setLastUpdate(BAbsTime bAbsTime) {
|
||||
this.set(lastUpdate, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public final boolean isFixedSize() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public final void ackAlarm() {
|
||||
this.ackAlarm(this.getUser());
|
||||
}
|
||||
|
||||
public final void ackAlarm(String string) {
|
||||
BAbsTime bAbsTime = Clock.time();
|
||||
if (this.getAckRequired()) {
|
||||
this.setAckState(BAckState.ackPending);
|
||||
} else {
|
||||
this.setAckState(BAckState.acked);
|
||||
}
|
||||
this.setUser(string);
|
||||
this.setAckTime(bAbsTime);
|
||||
this.setLastUpdate(bAbsTime);
|
||||
}
|
||||
|
||||
public final boolean isAlarm() {
|
||||
boolean bl = false;
|
||||
if (this.getSourceState() != BSourceState.normal && this.getAckState() != BAckState.acked) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final boolean isAcknowledged() {
|
||||
boolean bl = false;
|
||||
if (this.getAckState() == BAckState.acked) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final boolean isAckPending() {
|
||||
boolean bl = false;
|
||||
if (this.getAckState() == BAckState.ackPending) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final boolean isNormal() {
|
||||
boolean bl = false;
|
||||
if (this.getSourceState() == BSourceState.normal) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final boolean isOpen() {
|
||||
if (this.getSourceState() == BSourceState.alert && this.getAckState() != BAckState.acked) {
|
||||
return true;
|
||||
}
|
||||
boolean bl = false;
|
||||
if (this.getAckState() != BAckState.acked && this.getAckRequired() || this.getSourceState() != BSourceState.normal && this.getSourceState() != BSourceState.alert) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final void addAlarmFacet(String string, BIDataValue bIDataValue) {
|
||||
this.setAlarmData(BFacets.make((BFacets)this.getAlarmData(), (String)string, (BIDataValue)bIDataValue));
|
||||
}
|
||||
|
||||
public final BObject getAlarmFacet(String string) {
|
||||
return this.getAlarmData().get(string);
|
||||
}
|
||||
|
||||
public final BObject getAlarmValue() {
|
||||
BObject bObject = this.getAlarmFacet(ALARM_VALUE);
|
||||
if (bObject != null) {
|
||||
return bObject;
|
||||
}
|
||||
bObject = this.getAlarmFacet(OFFNORMAL_VALUE);
|
||||
if (bObject != null) {
|
||||
return bObject;
|
||||
}
|
||||
return this.getAlarmFacet(FAULT_VALUE);
|
||||
}
|
||||
|
||||
public final void removeAlarmFacet(String string) {
|
||||
this.setAlarmData(BFacets.makeRemove((BFacets)this.getAlarmData(), (String)string));
|
||||
}
|
||||
|
||||
public final String toString(Context context) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("timestamp = ");
|
||||
stringBuffer.append(this.getTimestamp()).append(", ");
|
||||
stringBuffer.append("sourceState = ");
|
||||
stringBuffer.append((Object)this.getSourceState()).append(", ");
|
||||
stringBuffer.append("ackState = ");
|
||||
stringBuffer.append((Object)this.getAckState()).append(", ");
|
||||
stringBuffer.append("ackRequired = ");
|
||||
stringBuffer.append(this.getAckRequired()).append(", ");
|
||||
stringBuffer.append("source = ");
|
||||
stringBuffer.append(this.getSource()).append(", ");
|
||||
stringBuffer.append("priority = ");
|
||||
stringBuffer.append(this.getPriority()).append(", ");
|
||||
stringBuffer.append("alarmClass = ");
|
||||
stringBuffer.append(this.getAlarmClass()).append(", ");
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public final String getAlarmClassDisplayName(Context context) {
|
||||
if (Sys.getStation() == null) {
|
||||
return this.getAlarmClass();
|
||||
}
|
||||
BAlarmService bAlarmService = (BAlarmService)Sys.getService((Type)BAlarmService.TYPE);
|
||||
return bAlarmService.getAlarmClassDisplayName(BString.make((String)this.getAlarmClass()), context).toString();
|
||||
}
|
||||
|
||||
public final int getSerialVersionId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public final void write(DataOutput dataOutput) throws IOException {
|
||||
this.getTimestamp().encode(dataOutput);
|
||||
this.getUuid().encode(dataOutput);
|
||||
this.getSourceState().encode(dataOutput);
|
||||
this.getAckState().encode(dataOutput);
|
||||
dataOutput.writeBoolean(this.getAckRequired());
|
||||
this.getSource().encode(dataOutput);
|
||||
dataOutput.writeUTF(this.getAlarmClass());
|
||||
dataOutput.writeInt(this.getPriority());
|
||||
this.getNormalTime().encode(dataOutput);
|
||||
this.getAckTime().encode(dataOutput);
|
||||
dataOutput.writeUTF(this.getUser());
|
||||
this.getAlarmData().encode(dataOutput);
|
||||
this.getAlarmTransition().encode(dataOutput);
|
||||
this.getLastUpdate().encode(dataOutput);
|
||||
}
|
||||
|
||||
public final void read(DataInput dataInput) throws IOException {
|
||||
this.setTimestamp((BAbsTime)BAbsTime.DEFAULT.decode(dataInput));
|
||||
this.setUuid((BUuid)BUuid.DEFAULT.decode(dataInput));
|
||||
this.setSourceState((BSourceState)BSourceState.normal.decode(dataInput));
|
||||
this.setAckState((BAckState)BAckState.acked.decode(dataInput));
|
||||
this.setAckRequired(dataInput.readBoolean());
|
||||
this.setSource((BOrdList)BOrdList.DEFAULT.decode(dataInput));
|
||||
this.setAlarmClass(dataInput.readUTF());
|
||||
this.setPriority(dataInput.readInt());
|
||||
this.setNormalTime((BAbsTime)BAbsTime.NULL.decode(dataInput));
|
||||
this.setAckTime((BAbsTime)BAbsTime.NULL.decode(dataInput));
|
||||
this.setUser(dataInput.readUTF());
|
||||
this.setAlarmData((BFacets)BFacets.DEFAULT.decode(dataInput));
|
||||
this.setAlarmTransition((BSourceState)BSourceState.normal.decode(dataInput));
|
||||
this.setLastUpdate((BAbsTime)BAbsTime.NULL.decode(dataInput));
|
||||
}
|
||||
|
||||
public final String toSummaryString() {
|
||||
StringBuffer stringBuffer = new StringBuffer(128);
|
||||
stringBuffer.append(this.getTimestamp().toString((Context)TIMESTAMP_FACETS));
|
||||
stringBuffer.append(": ");
|
||||
stringBuffer.append('(').append((Object)this.getAckState()).append(':').append((Object)this.getSourceState()).append(") ");
|
||||
stringBuffer.append(this.getUuid());
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
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 BAlarmRecord() {
|
||||
this(BOrd.make((String)""), "defaultAlarmClass", BFacets.DEFAULT);
|
||||
}
|
||||
|
||||
public BAlarmRecord(BComponent bComponent, String string, BFacets bFacets) {
|
||||
this(BOrd.make((OrdQuery)bComponent.getSlotPath()), string, bFacets);
|
||||
}
|
||||
|
||||
public BAlarmRecord(BOrd bOrd, String string, BFacets bFacets) {
|
||||
this.setSource(BOrdList.make((BOrd)bOrd));
|
||||
this.setAlarmClass(string);
|
||||
this.setAlarmData(bFacets);
|
||||
BAbsTime bAbsTime = Clock.time();
|
||||
this.setUuid(BUuid.make());
|
||||
this.setTimestamp(bAbsTime);
|
||||
this.setLastUpdate(bAbsTime);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$BAlarmRecord;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAlarmRecord = BAlarmRecord.class("[Ljavax.baja.alarm.BAlarmRecord;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
TIMESTAMP_FACETS = BFacets.make((String)"showSeconds", (BIDataValue)BBoolean.TRUE, (String)"showMilliseconds", (BIDataValue)BBoolean.TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.agent.AgentFilter
|
||||
* javax.baja.agent.AgentList
|
||||
* javax.baja.naming.BISession
|
||||
* javax.baja.naming.BLocalHost
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.BOrdScheme
|
||||
* javax.baja.naming.InvalidOrdBaseException
|
||||
* javax.baja.naming.OrdQuery
|
||||
* javax.baja.naming.OrdTarget
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import com.tridium.alarm.db.AlarmQuery;
|
||||
import com.tridium.alarm.db.BIAlarmResolver;
|
||||
import com.tridium.alarm.db.BLocalAlarmResolver;
|
||||
import javax.baja.agent.AgentFilter;
|
||||
import javax.baja.agent.AgentList;
|
||||
import javax.baja.naming.BISession;
|
||||
import javax.baja.naming.BLocalHost;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.BOrdScheme;
|
||||
import javax.baja.naming.InvalidOrdBaseException;
|
||||
import javax.baja.naming.OrdQuery;
|
||||
import javax.baja.naming.OrdTarget;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BAlarmScheme
|
||||
extends BOrdScheme {
|
||||
public static final BAlarmScheme INSTANCE = new BAlarmScheme();
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmScheme;
|
||||
|
||||
public OrdQuery parse(String string) {
|
||||
return new AlarmQuery(string);
|
||||
}
|
||||
|
||||
public OrdTarget resolve(OrdTarget ordTarget, OrdQuery ordQuery) {
|
||||
BISession bISession = this.toSession(ordTarget);
|
||||
BIAlarmResolver bIAlarmResolver = this.getResolver(bISession);
|
||||
if (bIAlarmResolver == null) {
|
||||
throw new InvalidOrdBaseException("" + ordTarget.get());
|
||||
}
|
||||
return bIAlarmResolver.resolve(bISession, ordTarget, (AlarmQuery)ordQuery);
|
||||
}
|
||||
|
||||
private final BISession toSession(OrdTarget ordTarget) {
|
||||
if (ordTarget == null) {
|
||||
throw new InvalidOrdBaseException("null");
|
||||
}
|
||||
OrdTarget ordTarget2 = ordTarget;
|
||||
BISession bISession = null;
|
||||
while (ordTarget2 != null && (bISession = BOrd.toSession((BObject)ordTarget2.get())) == null) {
|
||||
ordTarget2 = ordTarget2.getBaseOrdTarget();
|
||||
}
|
||||
if (bISession != null) {
|
||||
return bISession;
|
||||
}
|
||||
throw new InvalidOrdBaseException("" + ordTarget.get());
|
||||
}
|
||||
|
||||
private final BIAlarmResolver getResolver(BISession bISession) {
|
||||
if (bISession == null || bISession instanceof BLocalHost) {
|
||||
return BLocalAlarmResolver.INSTANCE;
|
||||
}
|
||||
AgentList agentList = Sys.getRegistry().getAgents(bISession.getType().getTypeInfo());
|
||||
if ((agentList = agentList.filter(AgentFilter.is((Type)BIAlarmResolver.TYPE))).size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return (BIAlarmResolver)agentList.getDefault().getInstance();
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BAlarmScheme() {
|
||||
super("alarm");
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$BAlarmScheme;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAlarmScheme = BAlarmScheme.class("[Ljavax.baja.alarm.BAlarmScheme;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,928 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.fox.sys.BFoxChannelRegistry
|
||||
* com.tridium.fox.sys.BFoxSession
|
||||
* com.tridium.platform.BPlatformService
|
||||
* com.tridium.platform.BPlatformServiceContainer
|
||||
* com.tridium.platform.alarm.BIAlarmablePlatformService
|
||||
* com.tridium.platform.alarm.BPlatformServiceAlarmRecord
|
||||
* com.tridium.platform.alarm.BPlatformServiceSourceState
|
||||
* com.tridium.platform.alarm.PlatformServiceAlarmListener
|
||||
* com.tridium.sys.station.Station
|
||||
* com.tridium.sys.station.Station$SaveListener
|
||||
* javax.baja.agent.AgentList
|
||||
* javax.baja.collection.BITable
|
||||
* javax.baja.control.trigger.BIntervalTriggerMode
|
||||
* javax.baja.control.trigger.BTimeTrigger
|
||||
* javax.baja.control.trigger.BTriggerMode
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.dataRecovery.BIDataRecoveryService
|
||||
* javax.baja.dataRecovery.BIDataRecoverySourceService
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.BOrdList
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.naming.UnresolvedException
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.security.AuditEvent
|
||||
* javax.baja.security.Auditor
|
||||
* javax.baja.spy.SpyWriter
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BIService
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BLink
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.BVector
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Cursor
|
||||
* javax.baja.sys.IllegalNameException
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Topic
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.units.BDimension
|
||||
* javax.baja.units.BUnit
|
||||
* javax.baja.user.BUser
|
||||
* javax.baja.util.BUuid
|
||||
* javax.baja.util.CoalesceQueue
|
||||
* javax.baja.util.IFuture
|
||||
* javax.baja.util.Invocation
|
||||
* javax.baja.util.Queue
|
||||
* javax.baja.util.Version
|
||||
* javax.baja.util.Worker
|
||||
* javax.baja.util.Worker$ITodo
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import com.tridium.alarm.BAlarmExtStatusJob;
|
||||
import com.tridium.alarm.BIUpdatableAlarmSource;
|
||||
import com.tridium.alarm.db.file.BFileAlarmDatabase;
|
||||
import com.tridium.alarm.fox.BAlarmDbChannel;
|
||||
import com.tridium.fox.sys.BFoxChannelRegistry;
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.platform.BPlatformService;
|
||||
import com.tridium.platform.BPlatformServiceContainer;
|
||||
import com.tridium.platform.alarm.BIAlarmablePlatformService;
|
||||
import com.tridium.platform.alarm.BPlatformServiceAlarmRecord;
|
||||
import com.tridium.platform.alarm.BPlatformServiceSourceState;
|
||||
import com.tridium.platform.alarm.PlatformServiceAlarmListener;
|
||||
import com.tridium.sys.station.Station;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import javax.baja.agent.AgentList;
|
||||
import javax.baja.alarm.AlarmException;
|
||||
import javax.baja.alarm.BAckState;
|
||||
import javax.baja.alarm.BAlarmClass;
|
||||
import javax.baja.alarm.BAlarmClassFolder;
|
||||
import javax.baja.alarm.BAlarmDatabase;
|
||||
import javax.baja.alarm.BAlarmInstructions;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.alarm.BAlarmTransitionBits;
|
||||
import javax.baja.alarm.BIAlarmClassFolder;
|
||||
import javax.baja.alarm.BIAlarmSource;
|
||||
import javax.baja.alarm.BIRemoteAlarmSource;
|
||||
import javax.baja.alarm.BSourceState;
|
||||
import javax.baja.collection.BITable;
|
||||
import javax.baja.control.trigger.BIntervalTriggerMode;
|
||||
import javax.baja.control.trigger.BTimeTrigger;
|
||||
import javax.baja.control.trigger.BTriggerMode;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.dataRecovery.BIDataRecoveryService;
|
||||
import javax.baja.dataRecovery.BIDataRecoverySourceService;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.BOrdList;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.naming.UnresolvedException;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.security.AuditEvent;
|
||||
import javax.baja.security.Auditor;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BIService;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BLink;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.BVector;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Cursor;
|
||||
import javax.baja.sys.IllegalNameException;
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Topic;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.units.BDimension;
|
||||
import javax.baja.units.BUnit;
|
||||
import javax.baja.user.BUser;
|
||||
import javax.baja.util.BUuid;
|
||||
import javax.baja.util.CoalesceQueue;
|
||||
import javax.baja.util.IFuture;
|
||||
import javax.baja.util.Invocation;
|
||||
import javax.baja.util.Queue;
|
||||
import javax.baja.util.Version;
|
||||
import javax.baja.util.Worker;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BAlarmService
|
||||
extends BComponent
|
||||
implements BIService,
|
||||
BIAlarmClassFolder,
|
||||
BIDataRecoverySourceService {
|
||||
public static final Property capacity = BAlarmService.newProperty((int)0, (int)500, (BFacets)BFacets.makeInt((BUnit)BUnit.make((String)"records", (BDimension)BDimension.DEFAULT), (int)1, (int)250000));
|
||||
public static final Property defaultAlarmClass = BAlarmService.newProperty((int)0, (BValue)new BAlarmClass(), null);
|
||||
public static final Property masterAlarmInstructions = BAlarmService.newProperty((int)0, (BValue)BAlarmInstructions.make(""), null);
|
||||
public static final Property escalationTimeTrigger = BAlarmService.newProperty((int)4, (BValue)new BTimeTrigger((BTriggerMode)BIntervalTriggerMode.make((BRelTime)BRelTime.makeMinutes((int)1))), null);
|
||||
public static final Property coalesceAlarms = BAlarmService.newProperty((int)0, (boolean)BBoolean.TRUE.getBoolean(), null);
|
||||
public static final Action routeAlarm = BAlarmService.newAction((int)4, (BValue)new BAlarmRecord(), null);
|
||||
public static final Action ackAlarm = BAlarmService.newAction((int)4, (BValue)new BAlarmRecord(), null);
|
||||
public static final Action enableToOffnormal = BAlarmService.newAction((int)4, (BValue)new BVector(), null);
|
||||
public static final Action disableToOffnormal = BAlarmService.newAction((int)4, (BValue)new BVector(), null);
|
||||
public static final Action enableToFault = BAlarmService.newAction((int)4, (BValue)new BVector(), null);
|
||||
public static final Action disableToFault = BAlarmService.newAction((int)4, (BValue)new BVector(), null);
|
||||
public static final Action auditForceClear = BAlarmService.newAction((int)2052, (BValue)new BAlarmRecord(), null);
|
||||
public static final Action escalateAlarms = BAlarmService.newAction((int)2068, null);
|
||||
public static final Topic alarm = BAlarmService.newTopic((int)8, null);
|
||||
public static final Type TYPE;
|
||||
private static Type[] serviceTypes;
|
||||
private static final BIcon icon;
|
||||
public static final Log logger;
|
||||
HashMap alarmClassDisplayNames;
|
||||
private Version remoteVersion;
|
||||
private PlatformServiceListener listener;
|
||||
private BAlarmDatabase alarmDb;
|
||||
private Queue alarmQueue;
|
||||
private Worker alarmWorker;
|
||||
private Station.SaveListener saveListener;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmService;
|
||||
static /* synthetic */ Class class$com$tridium$platform$BPlatformService;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmClass;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmClassFolder;
|
||||
|
||||
public int getCapacity() {
|
||||
return this.getInt(capacity);
|
||||
}
|
||||
|
||||
public void setCapacity(int n) {
|
||||
this.setInt(capacity, n, null);
|
||||
}
|
||||
|
||||
public BAlarmClass getDefaultAlarmClass() {
|
||||
return (BAlarmClass)this.get(defaultAlarmClass);
|
||||
}
|
||||
|
||||
public void setDefaultAlarmClass(BAlarmClass bAlarmClass) {
|
||||
this.set(defaultAlarmClass, (BValue)bAlarmClass, null);
|
||||
}
|
||||
|
||||
public BAlarmInstructions getMasterAlarmInstructions() {
|
||||
return (BAlarmInstructions)this.get(masterAlarmInstructions);
|
||||
}
|
||||
|
||||
public void setMasterAlarmInstructions(BAlarmInstructions bAlarmInstructions) {
|
||||
this.set(masterAlarmInstructions, (BValue)bAlarmInstructions, null);
|
||||
}
|
||||
|
||||
public BTimeTrigger getEscalationTimeTrigger() {
|
||||
return (BTimeTrigger)this.get(escalationTimeTrigger);
|
||||
}
|
||||
|
||||
public void setEscalationTimeTrigger(BTimeTrigger bTimeTrigger) {
|
||||
this.set(escalationTimeTrigger, (BValue)bTimeTrigger, null);
|
||||
}
|
||||
|
||||
public boolean getCoalesceAlarms() {
|
||||
return this.getBoolean(coalesceAlarms);
|
||||
}
|
||||
|
||||
public void setCoalesceAlarms(boolean bl) {
|
||||
this.setBoolean(coalesceAlarms, bl, null);
|
||||
}
|
||||
|
||||
public void routeAlarm(BAlarmRecord bAlarmRecord) {
|
||||
this.invoke(routeAlarm, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public void ackAlarm(BAlarmRecord bAlarmRecord) {
|
||||
this.invoke(ackAlarm, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public BOrd enableToOffnormal(BVector bVector) {
|
||||
return (BOrd)this.invoke(enableToOffnormal, (BValue)bVector, null);
|
||||
}
|
||||
|
||||
public BOrd disableToOffnormal(BVector bVector) {
|
||||
return (BOrd)this.invoke(disableToOffnormal, (BValue)bVector, null);
|
||||
}
|
||||
|
||||
public BOrd enableToFault(BVector bVector) {
|
||||
return (BOrd)this.invoke(enableToFault, (BValue)bVector, null);
|
||||
}
|
||||
|
||||
public BOrd disableToFault(BVector bVector) {
|
||||
return (BOrd)this.invoke(disableToFault, (BValue)bVector, null);
|
||||
}
|
||||
|
||||
public void auditForceClear(BAlarmRecord bAlarmRecord) {
|
||||
this.invoke(auditForceClear, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public void escalateAlarms() {
|
||||
this.invoke(escalateAlarms, null, null);
|
||||
}
|
||||
|
||||
public void fireAlarm(BAlarmRecord bAlarmRecord) {
|
||||
this.fire(alarm, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public Type[] getServiceTypes() {
|
||||
return serviceTypes;
|
||||
}
|
||||
|
||||
public void serviceStarted() throws Exception {
|
||||
BPlatformServiceContainer bPlatformServiceContainer;
|
||||
try {
|
||||
bPlatformServiceContainer = (BPlatformServiceContainer)Sys.getService((Type)BPlatformServiceContainer.TYPE);
|
||||
Class clazz = class$com$tridium$platform$BPlatformService;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$BPlatformService = BAlarmService.class("[Lcom.tridium.platform.BPlatformService;", false);
|
||||
}
|
||||
BPlatformService[] bPlatformServiceArray = (BPlatformService[])bPlatformServiceContainer.getChildren(clazz);
|
||||
int n = 0;
|
||||
while (n < bPlatformServiceArray.length) {
|
||||
if (bPlatformServiceArray[n] instanceof BIAlarmablePlatformService) {
|
||||
((BIAlarmablePlatformService)bPlatformServiceArray[n]).addPlatformServiceAlarmListener((PlatformServiceAlarmListener)this.listener);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
logger.error("Cannot setup alarming for platform service\n " + exception);
|
||||
}
|
||||
if (this.alarmWorker == null) {
|
||||
this.alarmWorker = new Worker((Worker.ITodo)this.alarmQueue);
|
||||
this.alarmWorker.start("Alarm:ServiceWorker");
|
||||
}
|
||||
this.initAlarmDb();
|
||||
bPlatformServiceContainer = BFoxChannelRegistry.getPrototype();
|
||||
if (bPlatformServiceContainer.get("alarmdb") == null) {
|
||||
bPlatformServiceContainer.add("alarmdb", (BValue)new BAlarmDbChannel());
|
||||
}
|
||||
Station.addSaveListener((Station.SaveListener)this.saveListener);
|
||||
}
|
||||
|
||||
public void atSteadyState() {
|
||||
}
|
||||
|
||||
public void serviceStopped() throws Exception {
|
||||
Station.removeSaveListener((Station.SaveListener)this.saveListener);
|
||||
this.alarmWorker.stop();
|
||||
BFoxChannelRegistry bFoxChannelRegistry = BFoxChannelRegistry.getPrototype();
|
||||
if (bFoxChannelRegistry.get("alarmdb") != null) {
|
||||
bFoxChannelRegistry.remove("alarmdb");
|
||||
}
|
||||
this.alarmDb.close();
|
||||
this.alarmDb = null;
|
||||
BPlatformServiceContainer bPlatformServiceContainer = (BPlatformServiceContainer)Sys.getService((Type)BPlatformServiceContainer.TYPE);
|
||||
Class clazz = class$com$tridium$platform$BPlatformService;
|
||||
if (clazz == null) {
|
||||
clazz = class$com$tridium$platform$BPlatformService = BAlarmService.class("[Lcom.tridium.platform.BPlatformService;", false);
|
||||
}
|
||||
BPlatformService[] bPlatformServiceArray = (BPlatformService[])bPlatformServiceContainer.getChildren(clazz);
|
||||
int n = 0;
|
||||
while (n < bPlatformServiceArray.length) {
|
||||
if (bPlatformServiceArray[n] instanceof BIAlarmablePlatformService) {
|
||||
((BIAlarmablePlatformService)bPlatformServiceArray[n]).removePlatformServiceAlarmListener((PlatformServiceAlarmListener)this.listener);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
public void initDataRecoverySource(BIDataRecoveryService bIDataRecoveryService) {
|
||||
if (this.alarmWorker == null) {
|
||||
this.alarmWorker = new Worker((Worker.ITodo)this.alarmQueue);
|
||||
this.alarmWorker.start("Alarm:ServiceWorker");
|
||||
}
|
||||
this.initAlarmDb();
|
||||
}
|
||||
|
||||
private final void initAlarmDb() {
|
||||
if (this.alarmDb == null) {
|
||||
this.alarmDb = this.createAlarmDb();
|
||||
try {
|
||||
this.updateDbCapacity(this.alarmDb);
|
||||
this.alarmDb.open();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
logger.error("Cannot open alarm database.", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final BAlarmDatabase getAlarmDb() {
|
||||
if (this.alarmDb == null) {
|
||||
throw new AlarmException("Alarm database is not open.");
|
||||
}
|
||||
return this.alarmDb;
|
||||
}
|
||||
|
||||
protected BAlarmDatabase createAlarmDb() {
|
||||
return new BFileAlarmDatabase();
|
||||
}
|
||||
|
||||
private final void updateDbCapacity(BAlarmDatabase bAlarmDatabase) throws Exception {
|
||||
try {
|
||||
Method method = ((Object)((Object)bAlarmDatabase)).getClass().getMethod("setCapacity", Integer.TYPE);
|
||||
method.invoke((Object)bAlarmDatabase, new Integer(this.getCapacity()));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
logger.trace("Alarm database capacity could not be updated.");
|
||||
}
|
||||
}
|
||||
|
||||
public IFuture post(Action action, BValue bValue, Context context) {
|
||||
if (action.equals((Object)escalateAlarms)) {
|
||||
this.alarmQueue.enqueue((Object)new Invocation((BComponent)this, action, null, context));
|
||||
return null;
|
||||
}
|
||||
return super.post(action, bValue, context);
|
||||
}
|
||||
|
||||
public void doEscalateAlarms() {
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Object object;
|
||||
Object object2;
|
||||
BAlarmClass.log.trace("Escalating");
|
||||
BAlarmClass[] bAlarmClassArray = this.getAlarmClasses();
|
||||
BAlarmDatabase bAlarmDatabase = this.getAlarmDb();
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("alarm:|bql:select from openAlarms ");
|
||||
int n = 0;
|
||||
boolean bl = false;
|
||||
int n2 = 0;
|
||||
while (n2 < bAlarmClassArray.length) {
|
||||
if (bAlarmClassArray[n2].getEscalationLevel1Enabled() || bAlarmClassArray[n2].getEscalationLevel2Enabled() || bAlarmClassArray[n2].getEscalationLevel3Enabled()) {
|
||||
bl = true;
|
||||
if (n++ != 0) {
|
||||
stringBuffer.append("or ");
|
||||
} else {
|
||||
stringBuffer.append("where (");
|
||||
}
|
||||
stringBuffer.append("alarmClass='");
|
||||
stringBuffer.append(SlotPath.escape((String)bAlarmClassArray[n2].getName()));
|
||||
stringBuffer.append("' ");
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
if (n > 0) {
|
||||
stringBuffer.append(")");
|
||||
}
|
||||
if (!bl) {
|
||||
return;
|
||||
}
|
||||
BITable bITable = (BITable)BOrd.make((String)stringBuffer.toString()).get((BObject)this);
|
||||
Cursor cursor = bITable.cursor();
|
||||
Hashtable<BUuid, BValue> hashtable = new Hashtable<BUuid, BValue>();
|
||||
while (cursor.next()) {
|
||||
object2 = (BAlarmRecord)cursor.get();
|
||||
if (((BAlarmRecord)((Object)object2)).getAckState() != BAckState.unacked) continue;
|
||||
object = this.lookupAlarmClass(((BAlarmRecord)((Object)object2)).getAlarmClass());
|
||||
if (((BAlarmClass)((Object)object)).getEscalationLevel1Enabled() && ((BAlarmRecord)((Object)object2)).getAlarmData().get(BAlarmClass.ESCALATED).equals((Object)BString.make((String)""))) {
|
||||
if (!((BAlarmRecord)((Object)object2)).getTimestamp().add(((BAlarmClass)((Object)object)).getEscalationLevel1Delay()).isBefore(BAbsTime.now())) continue;
|
||||
((BAlarmRecord)((Object)object2)).addAlarmFacet(BAlarmClass.ESCALATED, (BIDataValue)BString.make((String)BAlarmClass.LEVEL_1));
|
||||
hashtable.put(((BAlarmRecord)((Object)object2)).getUuid(), object2.newCopy());
|
||||
continue;
|
||||
}
|
||||
if (((BAlarmClass)((Object)object)).getEscalationLevel2Enabled() && (((BAlarmRecord)((Object)object2)).getAlarmData().get(BAlarmClass.ESCALATED).equals((Object)BString.make((String)BAlarmClass.LEVEL_1)) || ((BAlarmRecord)((Object)object2)).getAlarmData().get(BAlarmClass.ESCALATED).equals((Object)BString.make((String)"")))) {
|
||||
if (!((BAlarmRecord)((Object)object2)).getTimestamp().add(((BAlarmClass)((Object)object)).getEscalationLevel2Delay()).isBefore(BAbsTime.now())) continue;
|
||||
((BAlarmRecord)((Object)object2)).addAlarmFacet(BAlarmClass.ESCALATED, (BIDataValue)BString.make((String)BAlarmClass.LEVEL_2));
|
||||
hashtable.put(((BAlarmRecord)((Object)object2)).getUuid(), object2.newCopy());
|
||||
BAlarmClass.log.trace("Escalating " + ((BAlarmRecord)((Object)object2)).getUuid() + " to level 2");
|
||||
continue;
|
||||
}
|
||||
if (!((BAlarmClass)((Object)object)).getEscalationLevel3Enabled() || !((BAlarmRecord)((Object)object2)).getAlarmData().get(BAlarmClass.ESCALATED).equals((Object)BString.make((String)BAlarmClass.LEVEL_2)) && !((BAlarmRecord)((Object)object2)).getAlarmData().get(BAlarmClass.ESCALATED).equals((Object)BString.make((String)BAlarmClass.LEVEL_1)) && !((BAlarmRecord)((Object)object2)).getAlarmData().get(BAlarmClass.ESCALATED).equals((Object)BString.make((String)"")) || !((BAlarmRecord)((Object)object2)).getTimestamp().add(((BAlarmClass)((Object)object)).getEscalationLevel3Delay()).isBefore(BAbsTime.now())) continue;
|
||||
((BAlarmRecord)((Object)object2)).addAlarmFacet(BAlarmClass.ESCALATED, (BIDataValue)BString.make((String)BAlarmClass.LEVEL_3));
|
||||
hashtable.put(((BAlarmRecord)((Object)object2)).getUuid(), object2.newCopy());
|
||||
BAlarmClass.log.trace("Escalating " + ((BAlarmRecord)((Object)object2)).getUuid() + " to level 3");
|
||||
}
|
||||
object2 = hashtable.elements();
|
||||
while (object2.hasMoreElements()) {
|
||||
object = (BAlarmRecord)((Object)object2.nextElement());
|
||||
bAlarmDatabase.update((BAlarmRecord)((Object)object));
|
||||
BAlarmClass bAlarmClass = this.lookupAlarmClass(object.getAlarmClass());
|
||||
if (object.getAlarmData().get(BAlarmClass.ESCALATED).equals((Object)BString.make((String)BAlarmClass.LEVEL_1))) {
|
||||
bAlarmClass.fireAlarm((BAlarmRecord)((Object)object));
|
||||
bAlarmClass.fireEscalatedAlarm1((BAlarmRecord)((Object)object));
|
||||
continue;
|
||||
}
|
||||
if (object.getAlarmData().get(BAlarmClass.ESCALATED).equals((Object)BString.make((String)BAlarmClass.LEVEL_2))) {
|
||||
bAlarmClass.fireAlarm((BAlarmRecord)((Object)object));
|
||||
bAlarmClass.fireEscalatedAlarm1((BAlarmRecord)((Object)object));
|
||||
bAlarmClass.fireEscalatedAlarm2((BAlarmRecord)((Object)object));
|
||||
continue;
|
||||
}
|
||||
if (!object.getAlarmData().get(BAlarmClass.ESCALATED).equals((Object)BString.make((String)BAlarmClass.LEVEL_3))) continue;
|
||||
bAlarmClass.fireAlarm((BAlarmRecord)((Object)object));
|
||||
bAlarmClass.fireEscalatedAlarm1((BAlarmRecord)((Object)object));
|
||||
bAlarmClass.fireEscalatedAlarm2((BAlarmRecord)((Object)object));
|
||||
bAlarmClass.fireEscalatedAlarm3((BAlarmRecord)((Object)object));
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void doAckAlarm(BAlarmRecord bAlarmRecord) throws Exception {
|
||||
BObject bObject = null;
|
||||
try {
|
||||
bObject = this.resolveAlarmSource(bAlarmRecord);
|
||||
}
|
||||
catch (UnresolvedException unresolvedException) {}
|
||||
if (bObject != null && bObject instanceof BIRemoteAlarmSource) {
|
||||
this.doRouteToSource(bAlarmRecord, bObject);
|
||||
} else if (bAlarmRecord.getAckRequired()) {
|
||||
this.doRouteToSource(bAlarmRecord, bObject);
|
||||
} else {
|
||||
bAlarmRecord.setAckState(BAckState.acked);
|
||||
this.doRouteToRecipient(bAlarmRecord);
|
||||
}
|
||||
}
|
||||
|
||||
public void doRouteAlarm(BAlarmRecord bAlarmRecord) throws Exception {
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
logger.trace("BAlarmService.doRouteAlarm: " + (Object)((Object)bAlarmRecord.getSourceState()) + ' ' + (Object)((Object)bAlarmRecord.getAckState()) + ' ' + bAlarmRecord.getTimestamp() + ' ' + bAlarmRecord.getAlarmClass());
|
||||
this.doRouteToRecipient(bAlarmRecord);
|
||||
}
|
||||
|
||||
public void doRouteToRecipient(BAlarmRecord bAlarmRecord) {
|
||||
BAlarmClass bAlarmClass = this.lookupAlarmClass(bAlarmRecord.getAlarmClass());
|
||||
bAlarmClass.routeAlarm(bAlarmRecord);
|
||||
this.fireAlarm(bAlarmRecord);
|
||||
}
|
||||
|
||||
public void doRouteToSource(BAlarmRecord bAlarmRecord) throws Exception {
|
||||
BObject bObject = null;
|
||||
try {
|
||||
bObject = this.resolveAlarmSource(bAlarmRecord);
|
||||
}
|
||||
catch (UnresolvedException unresolvedException) {}
|
||||
this.doRouteToSource(bAlarmRecord, bObject);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unable to fully structure code
|
||||
*/
|
||||
public void doRouteToSource(BAlarmRecord var1_1, BObject var2_2) throws Exception {
|
||||
block18: {
|
||||
block19: {
|
||||
var3_3 = true;
|
||||
var4_4 = false;
|
||||
var5_5 = false;
|
||||
if (var1_1.getAckState() == BAckState.ackPending || var1_1.getAckState() == BAckState.acked && var1_1.getAckRequired()) {
|
||||
var5_5 = true;
|
||||
}
|
||||
if (var2_2 == null) {
|
||||
BAlarmService.logger.error("BAlarmService.doRouteToSource cannot resolve alarm source " + var1_1.getSource());
|
||||
if (var5_5) {
|
||||
var1_1.setAckState(BAckState.acked);
|
||||
var1_1.setAckTime(BAbsTime.now());
|
||||
var1_1.setAckRequired(false);
|
||||
var1_1.addAlarmFacet("autoAcked", (BIDataValue)BString.make((String)("Cannot resolve: " + var1_1.getSource())));
|
||||
this.doRouteToRecipient(var1_1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (var2_2 == null || !var3_3) break block18;
|
||||
BAlarmService.logger.trace("BAlarmService.doRouteToSource: " + var2_2);
|
||||
if (!(var2_2 instanceof BIAlarmSource)) break block19;
|
||||
if (!var5_5) ** GOTO lbl26
|
||||
if (((BIAlarmSource)var2_2).ackAlarm(var1_1).getBoolean()) {
|
||||
var4_4 = true;
|
||||
}
|
||||
if (var2_2 instanceof BIRemoteAlarmSource) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
break block18;
|
||||
lbl26:
|
||||
// 1 sources
|
||||
|
||||
if (var2_2 instanceof BIUpdatableAlarmSource) {
|
||||
var6_6 = (BIUpdatableAlarmSource)var2_2;
|
||||
var6_6.updateAlarm(var1_1);
|
||||
}
|
||||
break block18;
|
||||
}
|
||||
catch (Exception var6_7) {
|
||||
if (var6_7 instanceof BajaRuntimeException) {
|
||||
throw (Exception)((BajaRuntimeException)var6_7).getCause();
|
||||
}
|
||||
throw var6_7;
|
||||
}
|
||||
}
|
||||
if (var5_5 && var2_2 instanceof BIAlarmablePlatformService) {
|
||||
var7_9 = var1_1.getAlarmTransition();
|
||||
if (var7_9 == BSourceState.offnormal) {
|
||||
var6_8 = BPlatformServiceSourceState.offnormal;
|
||||
} else if (var7_9 == BSourceState.fault) {
|
||||
var6_8 = BPlatformServiceSourceState.fault;
|
||||
} else if (var7_9 == BSourceState.alert) {
|
||||
var6_8 = BPlatformServiceSourceState.alert;
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
var8_10 = var1_1.getSource();
|
||||
var9_11 = var8_10.get(var8_10.size() - 1);
|
||||
var10_12 = new BPlatformServiceAlarmRecord(var9_11, var1_1.getAlarmClass(), var6_8, var1_1.getAlarmData());
|
||||
var10_12.setTimestamp(var1_1.getTimestamp());
|
||||
if (((BIAlarmablePlatformService)var2_2).ackAlarm(var10_12).getBoolean()) {
|
||||
var4_4 = true;
|
||||
}
|
||||
var1_1.setAckState(BAckState.acked);
|
||||
var1_1.setAckTime(BAbsTime.now());
|
||||
var1_1.setAckRequired(false);
|
||||
var1_1.setAlarmClass(var10_12.getAlarmClass());
|
||||
this.doRouteToRecipient(var1_1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BOrd doEnableToOffnormal(BVector bVector, Context context) {
|
||||
return new BAlarmExtStatusJob(this, bVector, BAlarmTransitionBits.toOffnormal, true).submit(context);
|
||||
}
|
||||
|
||||
public BOrd doDisableToOffnormal(BVector bVector, Context context) {
|
||||
return new BAlarmExtStatusJob(this, bVector, BAlarmTransitionBits.toOffnormal, false).submit(context);
|
||||
}
|
||||
|
||||
public BOrd doEnableToFault(BVector bVector, Context context) {
|
||||
return new BAlarmExtStatusJob(this, bVector, BAlarmTransitionBits.toFault, true).submit(context);
|
||||
}
|
||||
|
||||
public BOrd doDisableToFault(BVector bVector, Context context) {
|
||||
return new BAlarmExtStatusJob(this, bVector, BAlarmTransitionBits.toFault, false).submit(context);
|
||||
}
|
||||
|
||||
public void doAuditForceClear(BAlarmRecord bAlarmRecord, Context context) {
|
||||
Auditor auditor = Sys.getAuditor();
|
||||
if (auditor != null) {
|
||||
BUser bUser = context.getUser();
|
||||
String string = "";
|
||||
if (bUser != null) {
|
||||
string = bUser.getUsername();
|
||||
}
|
||||
bUser.getUsername();
|
||||
auditor.audit(new AuditEvent("Force Clear Alarm", bAlarmRecord.getSource().toString(), bAlarmRecord.getUuid().toString(), "", "", string));
|
||||
}
|
||||
}
|
||||
|
||||
public BAlarmClass[] getAlarmClasses() {
|
||||
return this.loadFromFolder(this);
|
||||
}
|
||||
|
||||
private final BAlarmClass[] loadFromFolder(BComponent bComponent) {
|
||||
Class clazz = class$javax$baja$alarm$BAlarmClass;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAlarmClass = BAlarmService.class("[Ljavax.baja.alarm.BAlarmClass;", false);
|
||||
}
|
||||
Array array = new Array(clazz);
|
||||
bComponent.lease();
|
||||
Class clazz2 = class$javax$baja$alarm$BAlarmClass;
|
||||
if (clazz2 == null) {
|
||||
clazz2 = class$javax$baja$alarm$BAlarmClass = BAlarmService.class("[Ljavax.baja.alarm.BAlarmClass;", false);
|
||||
}
|
||||
BComponent[] bComponentArray = (BComponent[])bComponent.getChildren(clazz2);
|
||||
int n = 0;
|
||||
while (n < bComponentArray.length) {
|
||||
array.add((Object)bComponentArray[n]);
|
||||
++n;
|
||||
}
|
||||
Class clazz3 = class$javax$baja$alarm$BAlarmClassFolder;
|
||||
if (clazz3 == null) {
|
||||
clazz3 = class$javax$baja$alarm$BAlarmClassFolder = BAlarmService.class("[Ljavax.baja.alarm.BAlarmClassFolder;", false);
|
||||
}
|
||||
BAlarmClassFolder[] bAlarmClassFolderArray = (BAlarmClassFolder[])bComponent.getChildren(clazz3);
|
||||
int n2 = 0;
|
||||
while (n2 < bAlarmClassFolderArray.length) {
|
||||
this.loadFromFolder((BComponent)bAlarmClassFolderArray[n2]);
|
||||
BAlarmClass[] bAlarmClassArray = this.loadFromFolder((BComponent)bAlarmClassFolderArray[n2]);
|
||||
int n3 = 0;
|
||||
while (n3 < bAlarmClassArray.length) {
|
||||
array.add((Object)bAlarmClassArray[n3]);
|
||||
++n3;
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
return (BAlarmClass[])array.trim();
|
||||
}
|
||||
|
||||
public BAlarmClass lookupAlarmClass(String string) {
|
||||
BAlarmClass bAlarmClass = this.lookupAlarmClass(this, string);
|
||||
if (bAlarmClass == null) {
|
||||
bAlarmClass = this.getDefaultAlarmClass();
|
||||
logger.trace("BAlarmService.lookupAlarmClass can't find alarm class <" + string + "> using default <" + bAlarmClass.getName() + '>');
|
||||
} else {
|
||||
logger.trace("BAlarmService.lookupAlarmClass: will route alarm with " + (Object)((Object)bAlarmClass));
|
||||
}
|
||||
return bAlarmClass;
|
||||
}
|
||||
|
||||
protected BAlarmClass lookupAlarmClass(BComponent bComponent, String string) {
|
||||
bComponent.lease();
|
||||
Property property = bComponent.getProperty(string);
|
||||
if (property == null || !bComponent.get(property).getType().is(BAlarmClass.TYPE)) {
|
||||
Class clazz = class$javax$baja$alarm$BAlarmClassFolder;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAlarmClassFolder = BAlarmService.class("[Ljavax.baja.alarm.BAlarmClassFolder;", false);
|
||||
}
|
||||
BAlarmClassFolder[] bAlarmClassFolderArray = (BAlarmClassFolder[])bComponent.getChildren(clazz);
|
||||
int n = 0;
|
||||
while (n < bAlarmClassFolderArray.length) {
|
||||
BAlarmClass bAlarmClass = this.lookupAlarmClass((BComponent)bAlarmClassFolderArray[n], string);
|
||||
if (bAlarmClass != null) {
|
||||
return bAlarmClass;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
} else {
|
||||
return (BAlarmClass)bComponent.get(property);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BString getAlarmClassDisplayName(Object object, Context context) {
|
||||
if (Sys.getStation() == null) {
|
||||
if (this.remoteVersion == null) {
|
||||
try {
|
||||
this.remoteVersion = (Version)((BFoxSession)this.getSession()).fw(404, (Object)"alarm", null, null, null);
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
}
|
||||
if (this.remoteVersion != null && !this.remoteVersion.isNull() && this.remoteVersion.compareTo((Object)new Version("3.7.35")) >= 0) {
|
||||
try {
|
||||
BString bString = (BString)this.getComponentSpace().fw(109, (Object)this, (Object)"reflect:getAlarmClassDisplayName", (Object)BString.make((String)object.toString()), null);
|
||||
if (bString != null) {
|
||||
return bString;
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
}
|
||||
return BString.make((String)object.toString());
|
||||
}
|
||||
String string = (String)this.alarmClassDisplayNames.get(object.toString());
|
||||
if (string == null) {
|
||||
string = this.lookupAlarmClass(object.toString()).getDisplayName(context);
|
||||
this.alarmClassDisplayNames.put(object, string);
|
||||
}
|
||||
return BString.make((String)string);
|
||||
}
|
||||
|
||||
private final BObject resolveAlarmSource(BAlarmRecord bAlarmRecord) throws Exception {
|
||||
BObject bObject = null;
|
||||
BOrdList bOrdList = bAlarmRecord.getSource();
|
||||
BOrd bOrd = bOrdList.get(bOrdList.size() - 1);
|
||||
logger.trace("BAlarmService::resolveAlarmSource = " + bOrd);
|
||||
bObject = bOrd.get((BObject)this);
|
||||
logger.trace(" BAlarmService::resolveAlarmSource resolved = " + bObject);
|
||||
return bObject;
|
||||
}
|
||||
|
||||
public void checkAdd(String string, BValue bValue, int n, BFacets bFacets, Context context) {
|
||||
if (this.isRunning() && bValue.getType().is(BAlarmClass.TYPE)) {
|
||||
BAlarmClass bAlarmClass = this.lookupAlarmClass(string);
|
||||
if (string.equals("defaultAlarmClass") || !bAlarmClass.getName().equals("defaultAlarmClass")) {
|
||||
throw new LocalizableRuntimeException("alarm", "DuplicateAlarmClass", (Object[])new String[]{string});
|
||||
}
|
||||
}
|
||||
super.checkAdd(string, bValue, n, bFacets, context);
|
||||
}
|
||||
|
||||
public void checkRename(Property property, String string, Context context) {
|
||||
if (property.getType().is(BAlarmClass.TYPE)) {
|
||||
BAlarmClass bAlarmClass = this.lookupAlarmClass(string);
|
||||
if (string.equals("defaultAlarmClass") || !bAlarmClass.getName().equals("defaultAlarmClass")) {
|
||||
throw new IllegalNameException("alarm", "DuplicateAlarmClass", (Object[])new String[]{string});
|
||||
}
|
||||
this.alarmClassDisplayNames.clear();
|
||||
}
|
||||
super.checkRename(property, string, context);
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
if (property.equals((Object)capacity)) {
|
||||
if (this.alarmDb != null) {
|
||||
try {
|
||||
this.updateDbCapacity(this.alarmDb);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
logger.error("Cannot change database capacity to " + this.getCapacity() + '.', (Throwable)exception);
|
||||
}
|
||||
}
|
||||
} else if (property.getName().equals("displayNames")) {
|
||||
this.alarmClassDisplayNames.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void added(Property property, Context context) {
|
||||
if (property.getName().equals("displayNames")) {
|
||||
this.alarmClassDisplayNames.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void removed(Property property, BValue bValue, Context context) {
|
||||
if (property.getName().equals("displayNames")) {
|
||||
this.alarmClassDisplayNames.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public AgentList getAgents(Context context) {
|
||||
AgentList agentList = super.getAgents(context);
|
||||
agentList.toTop("wiresheet:WireSheet");
|
||||
return agentList;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public final Object fw(int n, Object object, Object object2, Object object3, Object object4) {
|
||||
switch (n) {
|
||||
case 11: {
|
||||
this.add(null, (BValue)new BLink(this.getEscalationTimeTrigger().getOrdInSession(), "fireTrigger", "escalateAlarms", true), 6);
|
||||
break;
|
||||
}
|
||||
case 21: {
|
||||
if (this.alarmDb == null) break;
|
||||
this.alarmDb.fw(n, object, object2, object3, object4);
|
||||
break;
|
||||
}
|
||||
case 601: {
|
||||
return this.alarmQueue;
|
||||
}
|
||||
}
|
||||
return super.fw(n, object, object2, object3, object4);
|
||||
}
|
||||
|
||||
public void spy(SpyWriter spyWriter) throws Exception {
|
||||
super.spy(spyWriter);
|
||||
spyWriter.startProps();
|
||||
spyWriter.trTitle((Object)"BAlarmService", 2);
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
int n = 0;
|
||||
if (this.alarmQueue != null) {
|
||||
n = this.alarmQueue.size();
|
||||
}
|
||||
spyWriter.prop((Object)"workInAlarmQueue", (Object)stringBuffer.append(n).toString());
|
||||
spyWriter.endProps();
|
||||
if (this.alarmWorker != null) {
|
||||
this.alarmWorker.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());
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.alarmClassDisplayNames = new HashMap();
|
||||
this.remoteVersion = null;
|
||||
this.listener = new PlatformServiceListener();
|
||||
this.alarmQueue = new CoalesceQueue();
|
||||
this.saveListener = new Station.SaveListener(){
|
||||
|
||||
public final void stationSave() {
|
||||
try {
|
||||
BAlarmService.this.getAlarmDb().save();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BAlarmDatabase.log.error("Alarm database save failed.", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
public final void stationSaveOk() {
|
||||
}
|
||||
|
||||
public final void stationSaveFail(String string) {
|
||||
}
|
||||
|
||||
public final String toString() {
|
||||
return "AlarmService " + BAlarmService.this.getNavOrd();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public BAlarmService() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$BAlarmService;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAlarmService = BAlarmService.class("[Ljavax.baja.alarm.BAlarmService;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
serviceTypes = new Type[]{TYPE};
|
||||
icon = BIcon.std((String)"alarm.png");
|
||||
logger = Log.getLog((String)"alarm");
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class PlatformServiceListener
|
||||
implements PlatformServiceAlarmListener {
|
||||
public void platformServiceAlarm(BPlatformServiceAlarmRecord bPlatformServiceAlarmRecord) {
|
||||
BSourceState bSourceState;
|
||||
BPlatformServiceSourceState bPlatformServiceSourceState = bPlatformServiceAlarmRecord.getSourceState();
|
||||
if (bPlatformServiceSourceState == BPlatformServiceSourceState.normal) {
|
||||
this.platformServiceToNormal(bPlatformServiceAlarmRecord);
|
||||
return;
|
||||
}
|
||||
if (bPlatformServiceSourceState == BPlatformServiceSourceState.offnormal) {
|
||||
bSourceState = BSourceState.offnormal;
|
||||
} else if (bPlatformServiceSourceState == BPlatformServiceSourceState.fault) {
|
||||
bSourceState = BSourceState.fault;
|
||||
} else if (bPlatformServiceSourceState == BPlatformServiceSourceState.alert) {
|
||||
bSourceState = BSourceState.alert;
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
BAlarmRecord bAlarmRecord = null;
|
||||
try {
|
||||
bAlarmRecord = BAlarmService.this.getAlarmDb().getRecord(bPlatformServiceAlarmRecord.getUuid());
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
if (bAlarmRecord == null) {
|
||||
bAlarmRecord = new BAlarmRecord(bPlatformServiceAlarmRecord.getSource(), bPlatformServiceAlarmRecord.getAlarmClass(), bPlatformServiceAlarmRecord.getAlarmData());
|
||||
bAlarmRecord.setUuid(bPlatformServiceAlarmRecord.getUuid());
|
||||
bAlarmRecord.setTimestamp(bPlatformServiceAlarmRecord.getTimestamp());
|
||||
}
|
||||
bAlarmRecord.setSourceState(bSourceState);
|
||||
bAlarmRecord.setAlarmTransition(bSourceState);
|
||||
BAlarmService.this.routeAlarm(bAlarmRecord);
|
||||
}
|
||||
|
||||
public void platformServiceToNormal(BPlatformServiceAlarmRecord bPlatformServiceAlarmRecord) {
|
||||
try {
|
||||
Cursor cursor = BAlarmService.this.getAlarmDb().getAlarmsForSource(BOrdList.make((BOrd)bPlatformServiceAlarmRecord.getSource()));
|
||||
while (cursor.next()) {
|
||||
BAlarmRecord bAlarmRecord = (BAlarmRecord)cursor.get();
|
||||
if (bAlarmRecord.isNormal()) continue;
|
||||
bAlarmRecord.setAlarmClass(bPlatformServiceAlarmRecord.getAlarmClass());
|
||||
bAlarmRecord.setAlarmData(BFacets.make((BFacets)bAlarmRecord.getAlarmData(), (BFacets)bPlatformServiceAlarmRecord.getAlarmData()));
|
||||
bAlarmRecord.setNormalTime(bPlatformServiceAlarmRecord.getTimestamp());
|
||||
bAlarmRecord.setSourceState(BSourceState.normal);
|
||||
BAlarmService.this.routeAlarm((BAlarmRecord)bAlarmRecord.newCopy());
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
logger.error("Unable to generate toNormal PlatformServiceAlarm for: " + bPlatformServiceAlarmRecord.getSource(), (Throwable)exception);
|
||||
}
|
||||
}
|
||||
|
||||
PlatformServiceListener() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.naming.BOrdList
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import java.util.Comparator;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.naming.BOrdList;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BAlarmSource
|
||||
extends BObject {
|
||||
public static final Type TYPE;
|
||||
private BOrdList sourceOrdList;
|
||||
private BAlarmRecord currentAlarm;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmSource;
|
||||
|
||||
public BOrdList getSourceOrdList() {
|
||||
return this.sourceOrdList;
|
||||
}
|
||||
|
||||
public BAlarmRecord getCurrentAlarm() {
|
||||
return this.currentAlarm;
|
||||
}
|
||||
|
||||
public void setCurrentAlarm(BAlarmRecord bAlarmRecord) {
|
||||
this.currentAlarm = bAlarmRecord;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.sourceOrdList.hashCode();
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (!(object instanceof BAlarmSource)) {
|
||||
return false;
|
||||
}
|
||||
return ((BAlarmSource)((Object)object)).sourceOrdList.equals((Object)this.sourceOrdList);
|
||||
}
|
||||
|
||||
public String toString(Context context) {
|
||||
return this.currentAlarm.toString(context);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BAlarmSource(BOrdList bOrdList, BAlarmRecord bAlarmRecord) {
|
||||
this.sourceOrdList = bOrdList;
|
||||
this.currentAlarm = bAlarmRecord;
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$BAlarmSource;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAlarmSource = BAlarmSource.class("[Ljavax.baja.alarm.BAlarmSource;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
|
||||
public static class SourceComparator
|
||||
implements Comparator {
|
||||
public int compare(Object object, Object object2) {
|
||||
return ((BAlarmSource)((Object)object)).getCurrentAlarm().getTimestamp().compareTo((Object)((BAlarmSource)((Object)object2)).getCurrentAlarm().getTimestamp());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.BFormat
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import java.util.HashMap;
|
||||
import javax.baja.alarm.BAlarmInstructions;
|
||||
import javax.baja.alarm.BSourceState;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.BFormat;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BAlarmSourceInfo
|
||||
extends BComponent {
|
||||
public static final Property alarmClass = BAlarmSourceInfo.newProperty((int)0, (String)"defaultAlarmClass", (BFacets)BFacets.make((String)"fieldEditor", (BIDataValue)BString.make((String)"alarm:AlarmClassFE")));
|
||||
public static final Property sourceName = BAlarmSourceInfo.newProperty((int)0, (BValue)BFormat.make((String)"%parent.displayName%"), null);
|
||||
public static final Property toFaultText = BAlarmSourceInfo.newProperty((int)0, (BValue)BFormat.make((String)""), null);
|
||||
public static final Property toOffnormalText = BAlarmSourceInfo.newProperty((int)0, (BValue)BFormat.make((String)""), null);
|
||||
public static final Property toNormalText = BAlarmSourceInfo.newProperty((int)0, (BValue)BFormat.make((String)""), null);
|
||||
public static final Property hyperlinkOrd = BAlarmSourceInfo.newProperty((int)0, (BValue)BOrd.NULL, (BFacets)BFacets.make((String)"ordRelativize", (BIDataValue)BBoolean.FALSE, (String)"chooseView", (BIDataValue)BBoolean.TRUE));
|
||||
public static final Property soundFile = BAlarmSourceInfo.newProperty((int)0, (BValue)BOrd.NULL, (BFacets)BFacets.make((String)"targetType", (BIDataValue)BString.make((String)"file:AudioFile")));
|
||||
public static final Property alarmIcon = BAlarmSourceInfo.newProperty((int)0, (BValue)BOrd.NULL, (BFacets)BFacets.make((String)"targetType", (BIDataValue)BString.make((String)"file:ImageFile")));
|
||||
public static final Property alarmInstructions = BAlarmSourceInfo.newProperty((int)0, (BValue)BAlarmInstructions.make(""), null);
|
||||
public static final Property metaData = BAlarmSourceInfo.newProperty((int)0, (BValue)BFacets.DEFAULT, null);
|
||||
public static final Type TYPE;
|
||||
private static final BIcon icon;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmSourceInfo;
|
||||
|
||||
public String getAlarmClass() {
|
||||
return this.getString(alarmClass);
|
||||
}
|
||||
|
||||
public void setAlarmClass(String string) {
|
||||
this.setString(alarmClass, string, null);
|
||||
}
|
||||
|
||||
public BFormat getSourceName() {
|
||||
return (BFormat)this.get(sourceName);
|
||||
}
|
||||
|
||||
public void setSourceName(BFormat bFormat) {
|
||||
this.set(sourceName, (BValue)bFormat, null);
|
||||
}
|
||||
|
||||
public BFormat getToFaultText() {
|
||||
return (BFormat)this.get(toFaultText);
|
||||
}
|
||||
|
||||
public void setToFaultText(BFormat bFormat) {
|
||||
this.set(toFaultText, (BValue)bFormat, null);
|
||||
}
|
||||
|
||||
public BFormat getToOffnormalText() {
|
||||
return (BFormat)this.get(toOffnormalText);
|
||||
}
|
||||
|
||||
public void setToOffnormalText(BFormat bFormat) {
|
||||
this.set(toOffnormalText, (BValue)bFormat, null);
|
||||
}
|
||||
|
||||
public BFormat getToNormalText() {
|
||||
return (BFormat)this.get(toNormalText);
|
||||
}
|
||||
|
||||
public void setToNormalText(BFormat bFormat) {
|
||||
this.set(toNormalText, (BValue)bFormat, null);
|
||||
}
|
||||
|
||||
public BOrd getHyperlinkOrd() {
|
||||
return (BOrd)this.get(hyperlinkOrd);
|
||||
}
|
||||
|
||||
public void setHyperlinkOrd(BOrd bOrd) {
|
||||
this.set(hyperlinkOrd, (BValue)bOrd, null);
|
||||
}
|
||||
|
||||
public BOrd getSoundFile() {
|
||||
return (BOrd)this.get(soundFile);
|
||||
}
|
||||
|
||||
public void setSoundFile(BOrd bOrd) {
|
||||
this.set(soundFile, (BValue)bOrd, null);
|
||||
}
|
||||
|
||||
public BOrd getAlarmIcon() {
|
||||
return (BOrd)this.get(alarmIcon);
|
||||
}
|
||||
|
||||
public void setAlarmIcon(BOrd bOrd) {
|
||||
this.set(alarmIcon, (BValue)bOrd, null);
|
||||
}
|
||||
|
||||
public BAlarmInstructions getAlarmInstructions() {
|
||||
return (BAlarmInstructions)this.get(alarmInstructions);
|
||||
}
|
||||
|
||||
public void setAlarmInstructions(BAlarmInstructions bAlarmInstructions) {
|
||||
this.set(alarmInstructions, (BValue)bAlarmInstructions, null);
|
||||
}
|
||||
|
||||
public BFacets getMetaData() {
|
||||
return (BFacets)this.get(metaData);
|
||||
}
|
||||
|
||||
public void setMetaData(BFacets bFacets) {
|
||||
this.set(metaData, (BValue)bFacets, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BFacets makeAlarmData(BSourceState bSourceState) {
|
||||
HashMap<String, Object> hashMap = new HashMap<String, Object>();
|
||||
if (!this.getSourceName().toString().equals("")) {
|
||||
hashMap.put("sourceName", BString.make((String)this.getSourceName().format((Object)this)));
|
||||
}
|
||||
String string = "";
|
||||
if (bSourceState == BSourceState.offnormal) {
|
||||
string = this.getToOffnormalText().toString();
|
||||
} else if (bSourceState == BSourceState.fault) {
|
||||
string = this.getToFaultText().toString();
|
||||
} else if (bSourceState == BSourceState.normal) {
|
||||
string = this.getToNormalText().toString();
|
||||
} else if (bSourceState == BSourceState.alert) {
|
||||
string = this.getToOffnormalText().toString();
|
||||
}
|
||||
if (!string.equals("")) {
|
||||
hashMap.put("msgText", BString.make((String)string));
|
||||
}
|
||||
if (this.getHyperlinkOrd() != BOrd.NULL) {
|
||||
hashMap.put("hyperlinkOrd", BString.make((String)this.getHyperlinkOrd().toString()));
|
||||
}
|
||||
if (this.getSoundFile() != BOrd.NULL) {
|
||||
hashMap.put("soundFile", BString.make((String)this.getSoundFile().toString()));
|
||||
}
|
||||
if (this.getAlarmIcon() != BOrd.NULL) {
|
||||
hashMap.put("icon", BString.make((String)this.getAlarmIcon().toString()));
|
||||
}
|
||||
try {
|
||||
if (!this.getAlarmInstructions().equals((Object)BAlarmInstructions.NULL)) {
|
||||
hashMap.put("instructions", BString.make((String)this.getAlarmInstructions().encodeToString()));
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
Log.getLog((String)"alarm").error("Could not encode Alarm Instructions", (Throwable)exception);
|
||||
}
|
||||
String[] stringArray = this.getMetaData().list();
|
||||
int n = 0;
|
||||
while (n < stringArray.length) {
|
||||
hashMap.put(stringArray[n], this.getMetaData().get(stringArray[n]));
|
||||
++n;
|
||||
}
|
||||
return BFacets.make(hashMap);
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
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$alarm$BAlarmSourceInfo;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAlarmSourceInfo = BAlarmSourceInfo.class("[Ljavax.baja.alarm.BAlarmSourceInfo;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
icon = BIcon.std((String)"alarm.png");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BBitString
|
||||
* javax.baja.sys.BBitString$Support
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import javax.baja.alarm.BSourceState;
|
||||
import javax.baja.sys.BBitString;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BAlarmTransitionBits
|
||||
extends BBitString {
|
||||
public static final int TO_OFFNORMAL = 1;
|
||||
public static final int TO_FAULT = 2;
|
||||
public static final int TO_NORMAL = 4;
|
||||
public static final int TO_ALERT = 8;
|
||||
public static final BAlarmTransitionBits toOffnormal = new BAlarmTransitionBits(1);
|
||||
public static final BAlarmTransitionBits toFault = new BAlarmTransitionBits(2);
|
||||
public static final BAlarmTransitionBits toNormal = new BAlarmTransitionBits(4);
|
||||
public static final BAlarmTransitionBits toAlert = new BAlarmTransitionBits(8);
|
||||
public static final String SHOW_OFF_NORMAL = "showOffNormal";
|
||||
public static final String SHOW_NORMAL = "showNormal";
|
||||
public static final String SHOW_FAULT = "showFault";
|
||||
public static final String SHOW_ALERT = "showAlert";
|
||||
public static final BAlarmTransitionBits DEFAULT = new BAlarmTransitionBits(15);
|
||||
public static final BAlarmTransitionBits EMPTY = new BAlarmTransitionBits(0);
|
||||
public static final BAlarmTransitionBits ALL = DEFAULT;
|
||||
private static BBitString.Support support = new BBitString.Support((BBitString)DEFAULT);
|
||||
public static final Type TYPE;
|
||||
private int bits;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmTransitionBits;
|
||||
|
||||
public static final BAlarmTransitionBits make(boolean bl) {
|
||||
if (bl) {
|
||||
return ALL;
|
||||
}
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
public static final BAlarmTransitionBits make(int n) {
|
||||
if (n == BAlarmTransitionBits.ALL.bits) {
|
||||
return ALL;
|
||||
}
|
||||
if (n == BAlarmTransitionBits.EMPTY.bits) {
|
||||
return EMPTY;
|
||||
}
|
||||
return new BAlarmTransitionBits(n);
|
||||
}
|
||||
|
||||
public static final BAlarmTransitionBits make(BAlarmTransitionBits bAlarmTransitionBits, BAlarmTransitionBits bAlarmTransitionBits2, boolean bl) {
|
||||
if (bl) {
|
||||
return new BAlarmTransitionBits(bAlarmTransitionBits.getBits() | bAlarmTransitionBits2.getBits());
|
||||
}
|
||||
return new BAlarmTransitionBits(bAlarmTransitionBits.getBits() & ~bAlarmTransitionBits2.getBits());
|
||||
}
|
||||
|
||||
public final int getBits() {
|
||||
return this.bits;
|
||||
}
|
||||
|
||||
public final boolean includes(BSourceState bSourceState) {
|
||||
if (bSourceState == BSourceState.offnormal) {
|
||||
return this.isToOffnormal();
|
||||
}
|
||||
if (bSourceState == BSourceState.fault) {
|
||||
return this.isToFault();
|
||||
}
|
||||
if (bSourceState == BSourceState.normal) {
|
||||
return this.isToNormal();
|
||||
}
|
||||
if (bSourceState == BSourceState.alert) {
|
||||
return this.isToAlert();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public final boolean isToOffnormal() {
|
||||
boolean bl = false;
|
||||
if ((this.bits & 1) != 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final boolean isToFault() {
|
||||
boolean bl = false;
|
||||
if ((this.bits & 2) != 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final boolean isToNormal() {
|
||||
boolean bl = false;
|
||||
if ((this.bits & 4) != 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final boolean isToAlert() {
|
||||
boolean bl = false;
|
||||
if ((this.bits & 8) != 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final boolean getBit(int n) {
|
||||
boolean bl = false;
|
||||
if ((this.bits & n) != 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final boolean getBit(String string) {
|
||||
return this.getBit(this.tagToOrdinal(string));
|
||||
}
|
||||
|
||||
public final int[] getOrdinals() {
|
||||
return support.getOrdinals();
|
||||
}
|
||||
|
||||
public final boolean isOrdinal(int n) {
|
||||
return support.isOrdinal(n);
|
||||
}
|
||||
|
||||
public final String getTag(int n) {
|
||||
return support.getTag(n);
|
||||
}
|
||||
|
||||
public final String getDisplayTag(int n, Context context) {
|
||||
return support.getDisplayTag(n, context);
|
||||
}
|
||||
|
||||
public final BBitString getInstance(int[] nArray) {
|
||||
int n = 0;
|
||||
int n2 = 0;
|
||||
while (n2 < nArray.length) {
|
||||
n |= nArray[n2];
|
||||
++n2;
|
||||
}
|
||||
return BAlarmTransitionBits.make(n);
|
||||
}
|
||||
|
||||
public final boolean isTag(String string) {
|
||||
return support.isTag(string);
|
||||
}
|
||||
|
||||
public final int tagToOrdinal(String string) {
|
||||
return support.tagToOrdinal(string);
|
||||
}
|
||||
|
||||
public final boolean isEmpty() {
|
||||
boolean bl = false;
|
||||
if (this.bits == 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final String getEmptyTag() {
|
||||
return "none";
|
||||
}
|
||||
|
||||
public final boolean isNull() {
|
||||
boolean bl = false;
|
||||
if (this.bits == 0) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final int hashCode() {
|
||||
return this.bits;
|
||||
}
|
||||
|
||||
public final boolean equals(Object object) {
|
||||
if (object instanceof BAlarmTransitionBits) {
|
||||
boolean bl = false;
|
||||
if (((BAlarmTransitionBits)((Object)object)).bits == this.bits) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public final String toString(Context context) {
|
||||
BFacets bFacets = null;
|
||||
if (context != null) {
|
||||
bFacets = context.getFacets();
|
||||
}
|
||||
if (this.bits == 0) {
|
||||
return "{}";
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append('{');
|
||||
if (this.isToAlert() && (bFacets == null || bFacets.getb(SHOW_ALERT, true))) {
|
||||
stringBuffer.append("alert ");
|
||||
}
|
||||
if (this.isToOffnormal() && (bFacets == null || bFacets.getb(SHOW_OFF_NORMAL, true))) {
|
||||
stringBuffer.append("toOffnormal ");
|
||||
}
|
||||
if (this.isToFault() && (bFacets == null || bFacets.getb(SHOW_FAULT, true))) {
|
||||
stringBuffer.append("toFault ");
|
||||
}
|
||||
if (this.isToNormal() && (bFacets == null || bFacets.getb(SHOW_NORMAL, true))) {
|
||||
stringBuffer.append("toNormal ");
|
||||
}
|
||||
stringBuffer.setCharAt(stringBuffer.length() - 1, '}');
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public final void encode(DataOutput dataOutput) throws IOException {
|
||||
dataOutput.writeInt(this.bits);
|
||||
}
|
||||
|
||||
public final BObject decode(DataInput dataInput) throws IOException {
|
||||
return BAlarmTransitionBits.make(dataInput.readInt());
|
||||
}
|
||||
|
||||
public final String encodeToString() {
|
||||
return Integer.toHexString(this.bits);
|
||||
}
|
||||
|
||||
public final BObject decodeFromString(String string) throws IOException {
|
||||
try {
|
||||
return BAlarmTransitionBits.make(Integer.parseInt(string, 16));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new IOException("Invalid bits: " + string);
|
||||
}
|
||||
}
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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 BAlarmTransitionBits(int n) {
|
||||
this.bits = n;
|
||||
}
|
||||
|
||||
static {
|
||||
support.add(1, "toOffnormal");
|
||||
support.add(2, "toFault");
|
||||
support.add(4, "toNormal");
|
||||
support.add(8, "toAlert");
|
||||
Class clazz = class$javax$baja$alarm$BAlarmTransitionBits;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BAlarmTransitionBits = BAlarmTransitionBits.class("[Ljavax.baja.alarm.BAlarmTransitionBits;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BInterface
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import javax.baja.sys.BInterface;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIAlarmClassFolder
|
||||
extends BInterface {
|
||||
public static final Type TYPE;
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$javax$baja$alarm$BIAlarmClassFolder;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$javax$baja$alarm$BIAlarmClassFolder = 1.class("[Ljavax.baja.alarm.BIAlarmClassFolder;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BInterface
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BInterface;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIAlarmSource
|
||||
extends BInterface {
|
||||
public static final Type TYPE;
|
||||
|
||||
public BBoolean ackAlarm(BAlarmRecord var1);
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$javax$baja$alarm$BIAlarmSource;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$javax$baja$alarm$BIAlarmSource = 1.class("[Ljavax.baja.alarm.BIAlarmSource;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BInterface
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.sys.BInterface;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIRemoteAlarmRecipient
|
||||
extends BInterface {
|
||||
public static final Type TYPE;
|
||||
|
||||
public void routeAlarm(BAlarmRecord var1) throws Exception;
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$javax$baja$alarm$BIRemoteAlarmRecipient;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$javax$baja$alarm$BIRemoteAlarmRecipient = 1.class("[Ljavax.baja.alarm.BIRemoteAlarmRecipient;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import javax.baja.alarm.BIAlarmSource;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIRemoteAlarmSource
|
||||
extends BIAlarmSource {
|
||||
public static final Type TYPE;
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$javax$baja$alarm$BIRemoteAlarmSource;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$javax$baja$alarm$BIRemoteAlarmSource = 1.class("[Ljavax.baja.alarm.BIRemoteAlarmSource;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,442 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.file.BDirectory
|
||||
* javax.baja.file.BFileSystem
|
||||
* javax.baja.file.BLocalFileStore
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.io.ValueDocDecoder
|
||||
* javax.baja.io.ValueDocEncoder
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.spy.SpyWriter
|
||||
* javax.baja.status.BIStatus
|
||||
* javax.baja.status.BStatus
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BLink
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.SlotCursor
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.Queue
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import javax.baja.alarm.BAlarmClass;
|
||||
import javax.baja.alarm.BAlarmRecipient;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.BLocalFileStore;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.io.ValueDocDecoder;
|
||||
import javax.baja.io.ValueDocEncoder;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.status.BIStatus;
|
||||
import javax.baja.status.BStatus;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BLink;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.SlotCursor;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.Queue;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BRecoverableRecipient
|
||||
extends BAlarmRecipient
|
||||
implements BIStatus {
|
||||
public static final Property status = BRecoverableRecipient.newProperty((int)1, (BValue)BStatus.DEFAULT, null);
|
||||
public static final Property lastSendTime = BRecoverableRecipient.newProperty((int)1, (BValue)BAbsTime.NULL, (BFacets)BFacets.make((String)"showMilliseconds", (BIDataValue)BBoolean.TRUE));
|
||||
public static final Property lastAckSendTime = BRecoverableRecipient.newProperty((int)4, (BValue)BAbsTime.NULL, null);
|
||||
public static final Property lastFailureTime = BRecoverableRecipient.newProperty((int)1, (BValue)BAbsTime.NULL, (BFacets)BFacets.make((String)"showMilliseconds", (BIDataValue)BBoolean.TRUE));
|
||||
public static final Property lastFailureCause = BRecoverableRecipient.newProperty((int)1, (String)"", null);
|
||||
public static final Property retryInterval = BRecoverableRecipient.newProperty((int)0, (BValue)BRelTime.make((long)15000L), null);
|
||||
public static final Property queuedAlarmCount = BRecoverableRecipient.newProperty((int)3, (int)0, null);
|
||||
public static final Property persistent = BRecoverableRecipient.newProperty((int)0, (boolean)true, null);
|
||||
public static final Action clearAlarmQueue = BRecoverableRecipient.newAction((int)0, null);
|
||||
public static final Type TYPE;
|
||||
private static final BIcon icon;
|
||||
public static final Log logger;
|
||||
private RetryThread retryThread;
|
||||
Queue q;
|
||||
BOrd persistenceDirectory;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BRecoverableRecipient;
|
||||
static /* synthetic */ Class class$javax$baja$sys$BLink;
|
||||
|
||||
public BStatus getStatus() {
|
||||
return (BStatus)this.get(status);
|
||||
}
|
||||
|
||||
public void setStatus(BStatus bStatus) {
|
||||
this.set(status, (BValue)bStatus, null);
|
||||
}
|
||||
|
||||
public BAbsTime getLastSendTime() {
|
||||
return (BAbsTime)this.get(lastSendTime);
|
||||
}
|
||||
|
||||
public void setLastSendTime(BAbsTime bAbsTime) {
|
||||
this.set(lastSendTime, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public BAbsTime getLastAckSendTime() {
|
||||
return (BAbsTime)this.get(lastAckSendTime);
|
||||
}
|
||||
|
||||
public void setLastAckSendTime(BAbsTime bAbsTime) {
|
||||
this.set(lastAckSendTime, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public BAbsTime getLastFailureTime() {
|
||||
return (BAbsTime)this.get(lastFailureTime);
|
||||
}
|
||||
|
||||
public void setLastFailureTime(BAbsTime bAbsTime) {
|
||||
this.set(lastFailureTime, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public String getLastFailureCause() {
|
||||
return this.getString(lastFailureCause);
|
||||
}
|
||||
|
||||
public void setLastFailureCause(String string) {
|
||||
this.setString(lastFailureCause, string, null);
|
||||
}
|
||||
|
||||
public BRelTime getRetryInterval() {
|
||||
return (BRelTime)this.get(retryInterval);
|
||||
}
|
||||
|
||||
public void setRetryInterval(BRelTime bRelTime) {
|
||||
this.set(retryInterval, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public int getQueuedAlarmCount() {
|
||||
return this.getInt(queuedAlarmCount);
|
||||
}
|
||||
|
||||
public void setQueuedAlarmCount(int n) {
|
||||
this.setInt(queuedAlarmCount, n, null);
|
||||
}
|
||||
|
||||
public boolean getPersistent() {
|
||||
return this.getBoolean(persistent);
|
||||
}
|
||||
|
||||
public void setPersistent(boolean bl) {
|
||||
this.setBoolean(persistent, bl, null);
|
||||
}
|
||||
|
||||
public void clearAlarmQueue() {
|
||||
this.invoke(clearAlarmQueue, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void started() throws Exception {
|
||||
this.persistenceDirectory = BOrd.make((String)("file:^alarm/" + this.getName() + "AlarmQueue"));
|
||||
this.retryThread = new RetryThread();
|
||||
this.retryThread.start();
|
||||
}
|
||||
|
||||
public void stopped() throws Exception {
|
||||
if (this.retryThread != null) {
|
||||
this.retryThread.kill();
|
||||
this.retryThread = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void spy(SpyWriter spyWriter) throws Exception {
|
||||
spyWriter.startProps("RecoverableRecipient");
|
||||
spyWriter.prop((Object)"persistenceDirectory", (Object)("" + this.persistenceDirectory));
|
||||
spyWriter.endProps();
|
||||
super.spy(spyWriter);
|
||||
}
|
||||
|
||||
private final void poll() {
|
||||
try {
|
||||
if (this.getPersistent() && this.getQueuedAlarmCount() > 0) {
|
||||
this.dequeueDisk();
|
||||
} else {
|
||||
this.dequeueMemory();
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
if (this.getQueuedAlarmCount() == 0) {
|
||||
this.retryThread.kill();
|
||||
this.retryThread = null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void handleAlarm(BAlarmRecord bAlarmRecord) {
|
||||
logger.trace("BRecoverableRecipient.handleAlarm " + bAlarmRecord.getTimestamp());
|
||||
try {
|
||||
logger.trace(" sending ... " + bAlarmRecord.getTimestamp());
|
||||
boolean bl = this.sendAlarm(bAlarmRecord);
|
||||
if (!bl) {
|
||||
return;
|
||||
}
|
||||
this.setLastSendTime(BAbsTime.make());
|
||||
logger.trace(" sent @ " + this.getLastSendTime());
|
||||
this.setStatus(BStatus.ok);
|
||||
return;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.setStatus(BStatus.fault);
|
||||
this.setLastFailureTime(BAbsTime.make());
|
||||
if (exception instanceof BajaRuntimeException) {
|
||||
this.setLastFailureCause(((BajaRuntimeException)exception).getCause().toString());
|
||||
} else {
|
||||
this.setLastFailureCause(exception.toString());
|
||||
}
|
||||
logger.trace(" failed @ " + this.getLastFailureTime() + " -> " + this.getLastFailureCause());
|
||||
if (this.getPersistent()) {
|
||||
try {
|
||||
File file = null;
|
||||
BRecoverableRecipient bRecoverableRecipient = this;
|
||||
synchronized (bRecoverableRecipient) {
|
||||
file = new File(this.dirFile(), bAlarmRecord.getUuid().toString() + ".xml");
|
||||
}
|
||||
ValueDocEncoder valueDocEncoder = new ValueDocEncoder(file);
|
||||
valueDocEncoder.encodeDocument((BValue)bAlarmRecord);
|
||||
valueDocEncoder.close();
|
||||
this.setQueuedAlarmCount(this.dirFile().listFiles().length);
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
iOException.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
this.q.enqueue((Object)bAlarmRecord);
|
||||
this.setQueuedAlarmCount(this.q.size());
|
||||
}
|
||||
if (this.retryThread != null) return;
|
||||
this.retryThread = new RetryThread();
|
||||
this.retryThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
public void doClearAlarmQueue() {
|
||||
if (this.getPersistent() && this.getQueuedAlarmCount() > 0) {
|
||||
try {
|
||||
File file = this.dirFile();
|
||||
File[] fileArray = file.listFiles();
|
||||
int n = 0;
|
||||
while (n < fileArray.length) {
|
||||
fileArray[n].delete();
|
||||
this.setQueuedAlarmCount(this.getQueuedAlarmCount() - 1);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return;
|
||||
}
|
||||
this.setQueuedAlarmCount(0);
|
||||
} else {
|
||||
this.q.clear();
|
||||
this.setQueuedAlarmCount(0);
|
||||
}
|
||||
}
|
||||
|
||||
private final File dirFile() throws IOException {
|
||||
BFileSystem bFileSystem = BFileSystem.INSTANCE;
|
||||
FilePath filePath = (FilePath)this.persistenceDirectory.parse()[0];
|
||||
BDirectory bDirectory = bFileSystem.makeDir(filePath);
|
||||
return ((BLocalFileStore)bDirectory.getStore()).getLocalFile();
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
private final void dequeueMemory() throws Exception {
|
||||
int n = this.q.size();
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
Object var4_3;
|
||||
try {
|
||||
this.handleAlarm((BAlarmRecord)((Object)this.q.dequeue()));
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
var4_3 = null;
|
||||
this.setQueuedAlarmCount(this.q.size());
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
var4_3 = null;
|
||||
this.setQueuedAlarmCount(this.q.size());
|
||||
++n2;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private final void dequeueDisk() throws Exception {
|
||||
File file = this.dirFile();
|
||||
File[] fileArray = file.listFiles();
|
||||
Arrays.sort(fileArray, new Comparator(){
|
||||
|
||||
public final int compare(Object object, Object object2) {
|
||||
File file = (File)object;
|
||||
File file2 = (File)object2;
|
||||
return (int)(file.lastModified() - file2.lastModified());
|
||||
}
|
||||
});
|
||||
try {
|
||||
int n = 0;
|
||||
while (n < fileArray.length) {
|
||||
BAlarmRecord bAlarmRecord = (BAlarmRecord)new ValueDocDecoder(fileArray[n]).decodeDocument();
|
||||
this.handleAlarm(bAlarmRecord);
|
||||
fileArray[n].delete();
|
||||
++n;
|
||||
}
|
||||
this.setQueuedAlarmCount(0);
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
}
|
||||
|
||||
protected abstract boolean sendAlarm(BAlarmRecord var1) throws Exception;
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public String[] getSubscribedAlarmClasses() {
|
||||
ArrayList<String> arrayList = new ArrayList<String>();
|
||||
try {
|
||||
SlotCursor slotCursor = this.getProperties();
|
||||
while (true) {
|
||||
Class clazz;
|
||||
if ((clazz = class$javax$baja$sys$BLink) == null) {
|
||||
clazz = BRecoverableRecipient.class("[Ljavax.baja.sys.BLink;", false);
|
||||
}
|
||||
if (!slotCursor.next(clazz)) {
|
||||
return arrayList.toArray(new String[arrayList.size()]);
|
||||
}
|
||||
BLink bLink = (BLink)slotCursor.get();
|
||||
if (!(bLink.getSourceComponent() instanceof BAlarmClass)) continue;
|
||||
arrayList.add(bLink.getSourceComponent().getName());
|
||||
}
|
||||
}
|
||||
catch (NullPointerException nullPointerException) {}
|
||||
return arrayList.toArray(new String[arrayList.size()]);
|
||||
}
|
||||
|
||||
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.q = new Queue();
|
||||
}
|
||||
|
||||
public BRecoverableRecipient() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$BRecoverableRecipient;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BRecoverableRecipient = BRecoverableRecipient.class("[Ljavax.baja.alarm.BRecoverableRecipient;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
icon = BIcon.std((String)"alarm.png");
|
||||
logger = Log.getLog((String)"alarm");
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class RetryThread
|
||||
extends Thread {
|
||||
private boolean alive;
|
||||
|
||||
void kill() {
|
||||
this.alive = false;
|
||||
this.interrupt();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
this.alive = true;
|
||||
while (this.alive) {
|
||||
try {
|
||||
RetryThread.sleep(Math.max(BRecoverableRecipient.this.getRetryInterval().getMillis(), 1000L));
|
||||
}
|
||||
catch (InterruptedException interruptedException) {
|
||||
this.alive = false;
|
||||
break;
|
||||
}
|
||||
try {
|
||||
BRecoverableRecipient.this.poll();
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
return this.alive;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.alive = false;
|
||||
}
|
||||
|
||||
public RetryThread() {
|
||||
super("alarm:RecipRetryThread");
|
||||
this.this();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BFrozenEnum
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm;
|
||||
|
||||
import javax.baja.alarm.BAlarmTransitionBits;
|
||||
import javax.baja.sys.BFrozenEnum;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BSourceState
|
||||
extends BFrozenEnum {
|
||||
public static final int NORMAL = 0;
|
||||
public static final int OFFNORMAL = 1;
|
||||
public static final int FAULT = 2;
|
||||
public static final int ALERT = 3;
|
||||
public static final BSourceState normal = new BSourceState(0);
|
||||
public static final BSourceState offnormal = new BSourceState(1);
|
||||
public static final BSourceState fault = new BSourceState(2);
|
||||
public static final BSourceState alert = new BSourceState(3);
|
||||
public static final Type TYPE;
|
||||
public static final BSourceState DEFAULT;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BSourceState;
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static final BSourceState make(int n) {
|
||||
return (BSourceState)normal.getRange().get(n, false);
|
||||
}
|
||||
|
||||
public static final BSourceState make(String string) {
|
||||
return (BSourceState)normal.getRange().get(string);
|
||||
}
|
||||
|
||||
public final BAlarmTransitionBits getAlarmTransitionBits() {
|
||||
switch (this.getOrdinal()) {
|
||||
case 0: {
|
||||
return BAlarmTransitionBits.toNormal;
|
||||
}
|
||||
case 1: {
|
||||
return BAlarmTransitionBits.toOffnormal;
|
||||
}
|
||||
case 2: {
|
||||
return BAlarmTransitionBits.toFault;
|
||||
}
|
||||
case 3: {
|
||||
return BAlarmTransitionBits.toAlert;
|
||||
}
|
||||
}
|
||||
return BAlarmTransitionBits.DEFAULT;
|
||||
}
|
||||
|
||||
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 BSourceState(int n) {
|
||||
super(n);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$BSourceState;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$BSourceState = BSourceState.class("[Ljavax.baja.alarm.BSourceState;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
DEFAULT = normal;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.control.BControlPoint
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext;
|
||||
|
||||
import javax.baja.alarm.ext.BAlarmSourceExt;
|
||||
import javax.baja.control.BControlPoint;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BAlarmAlgorithm
|
||||
extends BComponent {
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$BAlarmAlgorithm;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public final BAlarmSourceExt getParentExt() {
|
||||
BComplex bComplex = this.getParent();
|
||||
if (bComplex instanceof BAlarmSourceExt) {
|
||||
return (BAlarmSourceExt)bComplex;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public final BControlPoint getParentPoint() {
|
||||
BAlarmSourceExt bAlarmSourceExt = this.getParentExt();
|
||||
if (bAlarmSourceExt != null) {
|
||||
return bAlarmSourceExt.getParentPoint();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void executePoint() {
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
BControlPoint bControlPoint = this.getParentPoint();
|
||||
if (bControlPoint != null) {
|
||||
bControlPoint.execute();
|
||||
}
|
||||
}
|
||||
|
||||
public final BFacets getPointFacets() {
|
||||
try {
|
||||
return this.getParentPoint().getFacets();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return BFacets.NULL;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isParentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BAlarmSourceExt;
|
||||
}
|
||||
|
||||
public boolean isGrandparentLegal(BComponent bComponent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
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$alarm$ext$BAlarmAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$BAlarmAlgorithm = BAlarmAlgorithm.class("[Ljavax.baja.alarm.ext.BAlarmAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,829 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.control.BControlPoint
|
||||
* javax.baja.control.BDiscretePoint
|
||||
* javax.baja.control.BPointExtension
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.BOrdList
|
||||
* javax.baja.status.BStatus
|
||||
* javax.baja.status.BStatusBoolean
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BInteger
|
||||
* javax.baja.sys.BModule
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Clock$Ticket
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.ServiceNotFoundException
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Topic
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.util.BFormat
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package javax.baja.alarm.ext;
|
||||
|
||||
import java.util.HashMap;
|
||||
import javax.baja.alarm.AlarmSupport;
|
||||
import javax.baja.alarm.BAlarmInstructions;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.alarm.BAlarmTransitionBits;
|
||||
import javax.baja.alarm.BIAlarmSource;
|
||||
import javax.baja.alarm.BSourceState;
|
||||
import javax.baja.alarm.ext.BAlarmState;
|
||||
import javax.baja.alarm.ext.BAlarmTimestamps;
|
||||
import javax.baja.alarm.ext.BFaultAlgorithm;
|
||||
import javax.baja.alarm.ext.BOffnormalAlgorithm;
|
||||
import javax.baja.control.BControlPoint;
|
||||
import javax.baja.control.BDiscretePoint;
|
||||
import javax.baja.control.BPointExtension;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.BOrdList;
|
||||
import javax.baja.status.BStatus;
|
||||
import javax.baja.status.BStatusBoolean;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BModule;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.ServiceNotFoundException;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Topic;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.BFormat;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BAlarmSourceExt
|
||||
extends BPointExtension
|
||||
implements BIAlarmSource {
|
||||
public static final Property alarmInhibit = BAlarmSourceExt.newProperty((int)0, (BValue)new BStatusBoolean(false), null);
|
||||
public static final Property inhibitTime = BAlarmSourceExt.newProperty((int)0, (BValue)BRelTime.DEFAULT, (BFacets)BFacets.make((String)"min", (BIDataValue)BRelTime.make((long)0L)));
|
||||
public static final Property alarmState = BAlarmSourceExt.newProperty((int)1, (BValue)BAlarmState.normal, null);
|
||||
public static final Property timeDelay = BAlarmSourceExt.newProperty((int)0, (BValue)BRelTime.DEFAULT, (BFacets)BFacets.make((String)"min", (BIDataValue)BRelTime.make((long)0L)));
|
||||
public static final Property timeDelayToNormal = BAlarmSourceExt.newProperty((int)0, (BValue)BRelTime.DEFAULT, (BFacets)BFacets.make((String)"min", (BIDataValue)BRelTime.make((long)0L)));
|
||||
public static final Property alarmEnable = BAlarmSourceExt.newProperty((int)0, (BValue)BAlarmTransitionBits.DEFAULT, (BFacets)BFacets.make((String[])new String[]{"showNormal", "showAlert"}, (BIDataValue[])new BBoolean[]{BBoolean.FALSE, BBoolean.FALSE}));
|
||||
public static final Property ackedTransitions = BAlarmSourceExt.newProperty((int)5, (BValue)BAlarmTransitionBits.ALL, null);
|
||||
public static final Property toOffnormalTimes = BAlarmSourceExt.newProperty((int)1, (BValue)new BAlarmTimestamps(), null);
|
||||
public static final Property toFaultTimes = BAlarmSourceExt.newProperty((int)1, (BValue)new BAlarmTimestamps(), null);
|
||||
public static final Property timeInCurrentState = BAlarmSourceExt.newProperty((int)3, (BValue)BRelTime.DEFAULT, null);
|
||||
public static final Property sourceName = BAlarmSourceExt.newProperty((int)0, (BValue)BFormat.make((String)"%parent.displayName%"), null);
|
||||
public static final Property toFaultText = BAlarmSourceExt.newProperty((int)0, (BValue)BFormat.make((String)""), (BFacets)BFacets.make((String)"multiLine", (BIDataValue)BBoolean.TRUE));
|
||||
public static final Property toOffnormalText = BAlarmSourceExt.newProperty((int)0, (BValue)BFormat.make((String)""), (BFacets)BFacets.make((String)"multiLine", (BIDataValue)BBoolean.TRUE));
|
||||
public static final Property toNormalText = BAlarmSourceExt.newProperty((int)0, (BValue)BFormat.make((String)""), (BFacets)BFacets.make((String)"multiLine", (BIDataValue)BBoolean.TRUE));
|
||||
public static final Property hyperlinkOrd = BAlarmSourceExt.newProperty((int)0, (BValue)BOrd.NULL, (BFacets)BFacets.make((String)"ordRelativize", (BIDataValue)BBoolean.FALSE, (String)"chooseView", (BIDataValue)BBoolean.TRUE));
|
||||
public static final Property soundFile = BAlarmSourceExt.newProperty((int)0, (BValue)BOrd.NULL, (BFacets)BFacets.make((String)"targetType", (BIDataValue)BString.make((String)"file:AudioFile")));
|
||||
public static final Property alarmIcon = BAlarmSourceExt.newProperty((int)0, (BValue)BOrd.NULL, (BFacets)BFacets.make((String)"targetType", (BIDataValue)BString.make((String)"file:ImageFile")));
|
||||
public static final Property alarmInstructions = BAlarmSourceExt.newProperty((int)0, (BValue)BAlarmInstructions.DEFAULT, (BFacets)BFacets.make((String)"fieldEditor", (BIDataValue)BString.make((String)"alarm:InstructionsFE")));
|
||||
public static final Property faultAlgorithm = BAlarmSourceExt.newProperty((int)0, (BValue)new BFaultAlgorithm(), null);
|
||||
public static final Property offnormalAlgorithm = BAlarmSourceExt.newProperty((int)0, (BValue)new BOffnormalAlgorithm(), null);
|
||||
public static final Property alarmClass = BAlarmSourceExt.newProperty((int)0, (String)"defaultAlarmClass", (BFacets)BFacets.make((String)"fieldEditor", (BIDataValue)BString.make((String)"alarm:AlarmClassFE")));
|
||||
public static final Property metaData = BAlarmSourceExt.newProperty((int)0, (BValue)BFacets.DEFAULT, null);
|
||||
public static final Property status = BAlarmSourceExt.newProperty((int)7, (BValue)BStatus.DEFAULT, null);
|
||||
public static final Action timerExpired = BAlarmSourceExt.newAction((int)4, null);
|
||||
public static final Action inhibitTimerExpired = BAlarmSourceExt.newAction((int)4, null);
|
||||
public static final Action ackAlarm = BAlarmSourceExt.newAction((int)4, (BValue)new BAlarmRecord(), null);
|
||||
public static final Topic toOffnormal = BAlarmSourceExt.newTopic((int)0, null);
|
||||
public static final Topic toFault = BAlarmSourceExt.newTopic((int)0, null);
|
||||
public static final Topic toNormal = BAlarmSourceExt.newTopic((int)0, null);
|
||||
public static final Type TYPE;
|
||||
private static final BIcon icon;
|
||||
private static final int NON_ALARM_BITS = -139;
|
||||
private static Log log;
|
||||
private Clock.Ticket ticket;
|
||||
private Clock.Ticket inhibitTicket;
|
||||
private long timeOfLastStateChange;
|
||||
private AlarmSupport support;
|
||||
private boolean unackedAlarm;
|
||||
private BAbsTime lastOffnormalTime;
|
||||
private BAbsTime lastFaultTime;
|
||||
private BAbsTime lastToNormalTime;
|
||||
private BAbsTime lastAckTime;
|
||||
private boolean atSteadyState;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$BAlarmSourceExt;
|
||||
|
||||
public BStatusBoolean getAlarmInhibit() {
|
||||
return (BStatusBoolean)this.get(alarmInhibit);
|
||||
}
|
||||
|
||||
public void setAlarmInhibit(BStatusBoolean bStatusBoolean) {
|
||||
this.set(alarmInhibit, (BValue)bStatusBoolean, null);
|
||||
}
|
||||
|
||||
public BRelTime getInhibitTime() {
|
||||
return (BRelTime)this.get(inhibitTime);
|
||||
}
|
||||
|
||||
public void setInhibitTime(BRelTime bRelTime) {
|
||||
this.set(inhibitTime, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public BAlarmState getAlarmState() {
|
||||
return (BAlarmState)this.get(alarmState);
|
||||
}
|
||||
|
||||
public void setAlarmState(BAlarmState bAlarmState) {
|
||||
this.set(alarmState, (BValue)bAlarmState, null);
|
||||
}
|
||||
|
||||
public BRelTime getTimeDelay() {
|
||||
return (BRelTime)this.get(timeDelay);
|
||||
}
|
||||
|
||||
public void setTimeDelay(BRelTime bRelTime) {
|
||||
this.set(timeDelay, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public BRelTime getTimeDelayToNormal() {
|
||||
return (BRelTime)this.get(timeDelayToNormal);
|
||||
}
|
||||
|
||||
public void setTimeDelayToNormal(BRelTime bRelTime) {
|
||||
this.set(timeDelayToNormal, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public BAlarmTransitionBits getAlarmEnable() {
|
||||
return (BAlarmTransitionBits)this.get(alarmEnable);
|
||||
}
|
||||
|
||||
public void setAlarmEnable(BAlarmTransitionBits bAlarmTransitionBits) {
|
||||
this.set(alarmEnable, (BValue)bAlarmTransitionBits, null);
|
||||
}
|
||||
|
||||
public BAlarmTransitionBits getAckedTransitions() {
|
||||
return (BAlarmTransitionBits)this.get(ackedTransitions);
|
||||
}
|
||||
|
||||
public void setAckedTransitions(BAlarmTransitionBits bAlarmTransitionBits) {
|
||||
this.set(ackedTransitions, (BValue)bAlarmTransitionBits, null);
|
||||
}
|
||||
|
||||
public BAlarmTimestamps getToOffnormalTimes() {
|
||||
return (BAlarmTimestamps)this.get(toOffnormalTimes);
|
||||
}
|
||||
|
||||
public void setToOffnormalTimes(BAlarmTimestamps bAlarmTimestamps) {
|
||||
this.set(toOffnormalTimes, (BValue)bAlarmTimestamps, null);
|
||||
}
|
||||
|
||||
public BAlarmTimestamps getToFaultTimes() {
|
||||
return (BAlarmTimestamps)this.get(toFaultTimes);
|
||||
}
|
||||
|
||||
public void setToFaultTimes(BAlarmTimestamps bAlarmTimestamps) {
|
||||
this.set(toFaultTimes, (BValue)bAlarmTimestamps, null);
|
||||
}
|
||||
|
||||
public BRelTime getTimeInCurrentState() {
|
||||
return (BRelTime)this.get(timeInCurrentState);
|
||||
}
|
||||
|
||||
public void setTimeInCurrentState(BRelTime bRelTime) {
|
||||
this.set(timeInCurrentState, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public BFormat getSourceName() {
|
||||
return (BFormat)this.get(sourceName);
|
||||
}
|
||||
|
||||
public void setSourceName(BFormat bFormat) {
|
||||
this.set(sourceName, (BValue)bFormat, null);
|
||||
}
|
||||
|
||||
public BFormat getToFaultText() {
|
||||
return (BFormat)this.get(toFaultText);
|
||||
}
|
||||
|
||||
public void setToFaultText(BFormat bFormat) {
|
||||
this.set(toFaultText, (BValue)bFormat, null);
|
||||
}
|
||||
|
||||
public BFormat getToOffnormalText() {
|
||||
return (BFormat)this.get(toOffnormalText);
|
||||
}
|
||||
|
||||
public void setToOffnormalText(BFormat bFormat) {
|
||||
this.set(toOffnormalText, (BValue)bFormat, null);
|
||||
}
|
||||
|
||||
public BFormat getToNormalText() {
|
||||
return (BFormat)this.get(toNormalText);
|
||||
}
|
||||
|
||||
public void setToNormalText(BFormat bFormat) {
|
||||
this.set(toNormalText, (BValue)bFormat, null);
|
||||
}
|
||||
|
||||
public BOrd getHyperlinkOrd() {
|
||||
return (BOrd)this.get(hyperlinkOrd);
|
||||
}
|
||||
|
||||
public void setHyperlinkOrd(BOrd bOrd) {
|
||||
this.set(hyperlinkOrd, (BValue)bOrd, null);
|
||||
}
|
||||
|
||||
public BOrd getSoundFile() {
|
||||
return (BOrd)this.get(soundFile);
|
||||
}
|
||||
|
||||
public void setSoundFile(BOrd bOrd) {
|
||||
this.set(soundFile, (BValue)bOrd, null);
|
||||
}
|
||||
|
||||
public BOrd getAlarmIcon() {
|
||||
return (BOrd)this.get(alarmIcon);
|
||||
}
|
||||
|
||||
public void setAlarmIcon(BOrd bOrd) {
|
||||
this.set(alarmIcon, (BValue)bOrd, null);
|
||||
}
|
||||
|
||||
public BAlarmInstructions getAlarmInstructions() {
|
||||
return (BAlarmInstructions)this.get(alarmInstructions);
|
||||
}
|
||||
|
||||
public void setAlarmInstructions(BAlarmInstructions bAlarmInstructions) {
|
||||
this.set(alarmInstructions, (BValue)bAlarmInstructions, null);
|
||||
}
|
||||
|
||||
public BFaultAlgorithm getFaultAlgorithm() {
|
||||
return (BFaultAlgorithm)this.get(faultAlgorithm);
|
||||
}
|
||||
|
||||
public void setFaultAlgorithm(BFaultAlgorithm bFaultAlgorithm) {
|
||||
this.set(faultAlgorithm, (BValue)bFaultAlgorithm, null);
|
||||
}
|
||||
|
||||
public BOffnormalAlgorithm getOffnormalAlgorithm() {
|
||||
return (BOffnormalAlgorithm)this.get(offnormalAlgorithm);
|
||||
}
|
||||
|
||||
public void setOffnormalAlgorithm(BOffnormalAlgorithm bOffnormalAlgorithm) {
|
||||
this.set(offnormalAlgorithm, (BValue)bOffnormalAlgorithm, null);
|
||||
}
|
||||
|
||||
public String getAlarmClass() {
|
||||
return this.getString(alarmClass);
|
||||
}
|
||||
|
||||
public void setAlarmClass(String string) {
|
||||
this.setString(alarmClass, string, null);
|
||||
}
|
||||
|
||||
public BFacets getMetaData() {
|
||||
return (BFacets)this.get(metaData);
|
||||
}
|
||||
|
||||
public void setMetaData(BFacets bFacets) {
|
||||
this.set(metaData, (BValue)bFacets, null);
|
||||
}
|
||||
|
||||
public BStatus getStatus() {
|
||||
return (BStatus)this.get(status);
|
||||
}
|
||||
|
||||
public void setStatus(BStatus bStatus) {
|
||||
this.set(status, (BValue)bStatus, null);
|
||||
}
|
||||
|
||||
public void timerExpired() {
|
||||
this.invoke(timerExpired, null, null);
|
||||
}
|
||||
|
||||
public void inhibitTimerExpired() {
|
||||
this.invoke(inhibitTimerExpired, null, null);
|
||||
}
|
||||
|
||||
public BBoolean ackAlarm(BAlarmRecord bAlarmRecord) {
|
||||
return (BBoolean)this.invoke(ackAlarm, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public void fireToOffnormal(BAlarmRecord bAlarmRecord) {
|
||||
this.fire(toOffnormal, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public void fireToFault(BAlarmRecord bAlarmRecord) {
|
||||
this.fire(toFault, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void started() throws Exception {
|
||||
super.started();
|
||||
this.support = new AlarmSupport((BIAlarmSource)this, this.getAlarmClass());
|
||||
this.timeOfLastStateChange = Clock.ticks();
|
||||
this.initScheduler();
|
||||
if (Sys.atSteadyState()) {
|
||||
this.atSteadyState = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void atSteadyState() throws Exception {
|
||||
this.atSteadyState = true;
|
||||
this.executePoint();
|
||||
}
|
||||
|
||||
public boolean requiresPointSubscription() {
|
||||
return this.getAlarmEnable().isToOffnormal() || this.getAlarmEnable().isToFault();
|
||||
}
|
||||
|
||||
public void checkPointSubscription() {
|
||||
BControlPoint bControlPoint = this.getParentPoint();
|
||||
if (bControlPoint != null) {
|
||||
bControlPoint.checkExtensionsRequireSubscription();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isParentLegal(BComponent bComponent) {
|
||||
if (bComponent instanceof BControlPoint) {
|
||||
if (!this.getOffnormalAlgorithm().isGrandparentLegal(bComponent)) {
|
||||
return false;
|
||||
}
|
||||
return this.getFaultAlgorithm().isGrandparentLegal(bComponent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isSiblingLegal(BComponent bComponent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private final void initScheduler() {
|
||||
if (this.ticket != null) {
|
||||
this.ticket.cancel();
|
||||
}
|
||||
this.ticket = Clock.schedulePeriodically((BComponent)this, (BRelTime)BRelTime.make((long)10000L), (Action)timerExpired, null);
|
||||
}
|
||||
|
||||
public BOrdList getSourceOrd() {
|
||||
return this.support.getSourceOrd();
|
||||
}
|
||||
|
||||
public void doTimerExpired() {
|
||||
this.setTimeInCurrentState(BRelTime.make((long)(Clock.ticks() - this.timeOfLastStateChange)));
|
||||
}
|
||||
|
||||
public void doInhibitTimerExpired() {
|
||||
this.inhibitTicket = null;
|
||||
this.checkPointSubscription();
|
||||
this.executePoint();
|
||||
}
|
||||
|
||||
public BBoolean doAckAlarm(BAlarmRecord bAlarmRecord) {
|
||||
if (!this.isRunning()) {
|
||||
return BBoolean.make((boolean)false);
|
||||
}
|
||||
try {
|
||||
boolean bl = this.support.ackAlarm(bAlarmRecord);
|
||||
this.lastAckTime = bAlarmRecord.getAckTime();
|
||||
BSourceState bSourceState = bAlarmRecord.getAlarmTransition();
|
||||
if (bl) {
|
||||
BAlarmTransitionBits bAlarmTransitionBits = this.getAckedTransitions();
|
||||
this.setAckedTransitions(BAlarmTransitionBits.make(bAlarmTransitionBits, bSourceState.getAlarmTransitionBits(), true));
|
||||
bAlarmTransitionBits = this.getAckedTransitions();
|
||||
bSourceState = bAlarmRecord.getSourceState();
|
||||
if (bSourceState == BSourceState.normal) {
|
||||
this.setAckedTransitions(BAlarmTransitionBits.make(bAlarmTransitionBits, bSourceState.getAlarmTransitionBits(), true));
|
||||
}
|
||||
BAlarmTimestamps bAlarmTimestamps = null;
|
||||
BSourceState bSourceState2 = bAlarmRecord.getAlarmTransition();
|
||||
if (bSourceState2 == BSourceState.offnormal) {
|
||||
bAlarmTimestamps = this.getToOffnormalTimes();
|
||||
} else if (bSourceState2 == BSourceState.fault) {
|
||||
bAlarmTimestamps = this.getToFaultTimes();
|
||||
}
|
||||
if (bAlarmTimestamps != null && !bAlarmTimestamps.getAlarmTime().isNull()) {
|
||||
bAlarmTimestamps.setAckTime(bAlarmRecord.getAckTime());
|
||||
}
|
||||
}
|
||||
if (bl && this.getStatus().isUnackedAlarm()) {
|
||||
this.setStatus(BStatus.makeUnackedAlarm((BStatus)this.getStatus(), (boolean)false));
|
||||
}
|
||||
this.executePoint();
|
||||
return BBoolean.make((boolean)bl);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return BBoolean.make((boolean)false);
|
||||
}
|
||||
}
|
||||
|
||||
public void onExecute(BStatusValue bStatusValue, Context context) {
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
if (!this.atSteadyState) {
|
||||
return;
|
||||
}
|
||||
boolean bl = bStatusValue.getStatus().isAlarm();
|
||||
boolean bl2 = bStatusValue.getStatus().isFault();
|
||||
this.checkAlarms(bStatusValue);
|
||||
String string = Lexicon.make((BModule)TYPE.getModule(), (Context)context).getText("alarm.alarmInhibit.facet");
|
||||
BStatus bStatus = bStatusValue.getStatus();
|
||||
if (this.inhibitTicket == null || this.inhibitTicket.isExpired()) {
|
||||
if (this.getAlarmInhibit().getBoolean() || this.isTimerActive()) {
|
||||
this.setStatus(BStatus.make((BStatus)this.getStatus(), (String)string, (boolean)true));
|
||||
} else {
|
||||
this.setStatus(BStatus.make((int)this.getStatus().getBits(), (BFacets)BFacets.makeRemove((BFacets)this.getStatus().getFacets(), (String)string)));
|
||||
}
|
||||
} else if (this.getAlarmInhibit().getBoolean() || this.isTimerActive()) {
|
||||
this.setStatus(BStatus.make((int)this.getStatus().getBits(), (BFacets)BFacets.makeRemove((BFacets)this.getStatus().getFacets(), (String)string)));
|
||||
} else {
|
||||
this.setStatus(BStatus.make((BStatus)this.getStatus(), (String)string, (boolean)true));
|
||||
}
|
||||
BControlPoint bControlPoint = this.getParentPoint();
|
||||
Class clazz = class$javax$baja$alarm$ext$BAlarmSourceExt;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$BAlarmSourceExt = BAlarmSourceExt.class("[Ljavax.baja.alarm.ext.BAlarmSourceExt;", false);
|
||||
}
|
||||
BAlarmSourceExt[] bAlarmSourceExtArray = (BAlarmSourceExt[])bControlPoint.getChildren(clazz);
|
||||
int n = bStatusValue.getStatus().getBits() & 0xFFFFFF75;
|
||||
boolean bl3 = false;
|
||||
int n2 = 0;
|
||||
while (n2 < bAlarmSourceExtArray.length) {
|
||||
n |= bAlarmSourceExtArray[n2].getStatus().getBits();
|
||||
if (bAlarmSourceExtArray[n2].getStatus().getb(string, false)) {
|
||||
bl3 = true;
|
||||
}
|
||||
if (bAlarmSourceExtArray[n2] == this) break;
|
||||
++n2;
|
||||
}
|
||||
if (bl3) {
|
||||
bStatusValue.setStatus(BStatus.make((int)n, (BFacets)BFacets.make((BFacets)bStatusValue.getStatus().getFacets(), (String)string, (BIDataValue)BBoolean.TRUE)));
|
||||
} else {
|
||||
bStatusValue.setStatus(BStatus.make((int)n, (BFacets)BFacets.makeRemove((BFacets)bStatusValue.getStatus().getFacets(), (String)string)));
|
||||
}
|
||||
if (bl) {
|
||||
bStatusValue.setStatusInAlarm(true);
|
||||
}
|
||||
if (bl2) {
|
||||
bStatusValue.setStatusFault(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
if (property.equals((Object)alarmClass) && this.support != null) {
|
||||
this.support.setAlarmClass(this.getAlarmClass());
|
||||
} else if (property.equals((Object)timeDelay)) {
|
||||
this.executePoint();
|
||||
} else if (property.equals((Object)alarmInhibit)) {
|
||||
this.checkPointSubscription();
|
||||
if (this.getInhibitTime().getMillis() > 0L) {
|
||||
if (this.inhibitTicket != null) {
|
||||
this.inhibitTicket.cancel();
|
||||
}
|
||||
if (!this.getAlarmInhibit().getBoolean()) {
|
||||
this.inhibitTicket = Clock.schedule((BComponent)this, (BRelTime)this.getInhibitTime(), (Action)inhibitTimerExpired, null);
|
||||
} else if (this.getParent() instanceof BDiscretePoint) {
|
||||
this.inhibitTicket = Clock.schedule((BComponent)this, (BRelTime)BRelTime.make((long)(this.getInhibitTime().getMillis() * (long)3)), (Action)inhibitTimerExpired, null);
|
||||
}
|
||||
} else {
|
||||
this.executePoint();
|
||||
}
|
||||
} else if (property.equals((Object)alarmEnable)) {
|
||||
this.checkPointSubscription();
|
||||
this.executePoint();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isTimerActive() {
|
||||
try {
|
||||
return this.getOffnormalAlgorithm().isTimerExpired() ^ true;
|
||||
}
|
||||
catch (IllegalStateException illegalStateException) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isInhibitTimerActive() {
|
||||
try {
|
||||
boolean bl = false;
|
||||
if (this.inhibitTicket != null && !this.inhibitTicket.isExpired()) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
catch (IllegalStateException illegalStateException) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkAlarms(BStatusValue bStatusValue) {
|
||||
boolean bl;
|
||||
BAlarmState bAlarmState = null;
|
||||
BAlarmState bAlarmState2 = this.getAlarmState();
|
||||
if ((BAlarmService)Sys.getService((Type)BAlarmService.TYPE) == null) {
|
||||
return;
|
||||
}
|
||||
if (bStatusValue.getStatus().isDisabled() || bStatusValue.getStatus().isStale()) {
|
||||
return;
|
||||
}
|
||||
boolean bl2 = false;
|
||||
if (this.getInhibitTime().getMillis() == 0L && this.getAlarmInhibit().getBoolean() || (this.inhibitTicket == null || this.inhibitTicket.isExpired()) && this.getAlarmInhibit().getBoolean() || this.inhibitTicket != null && !this.inhibitTicket.isExpired() && !this.getAlarmInhibit().getBoolean()) {
|
||||
bl2 = true;
|
||||
}
|
||||
if (bl = bl2) {
|
||||
if (bAlarmState2 != BAlarmState.normal) {
|
||||
bAlarmState = BAlarmState.normal;
|
||||
}
|
||||
} else {
|
||||
if (this.getAlarmEnable().isToFault()) {
|
||||
bAlarmState = this.getFaultAlgorithm().checkFault(bStatusValue);
|
||||
}
|
||||
if (bAlarmState2 == BAlarmState.fault && !this.getAlarmEnable().isToFault()) {
|
||||
bAlarmState = BAlarmState.normal;
|
||||
}
|
||||
if (bAlarmState != BAlarmState.fault && this.getAlarmEnable().isToOffnormal()) {
|
||||
if (bAlarmState == null) {
|
||||
if (bAlarmState2 != BAlarmState.fault) {
|
||||
bAlarmState = this.getOffnormalAlgorithm().checkAlarmState(bStatusValue, this.getTimeDelay().getMillis(), this.getTimeDelayToNormal().getMillis());
|
||||
}
|
||||
} else if (bAlarmState == BAlarmState.normal && (bAlarmState = this.getOffnormalAlgorithm().checkAlarmState(bStatusValue, this.getTimeDelay().getMillis(), this.getTimeDelayToNormal().getMillis())) == null) {
|
||||
bAlarmState = BAlarmState.normal;
|
||||
}
|
||||
}
|
||||
if (bAlarmState2.isOffnormal() && !this.getAlarmEnable().isToOffnormal()) {
|
||||
bAlarmState = BAlarmState.normal;
|
||||
}
|
||||
}
|
||||
boolean bl3 = true;
|
||||
if (bAlarmState != null) {
|
||||
if (this.getAlarmEnable().isToOffnormal() && bAlarmState.isInAlarm()) {
|
||||
this.setStatus(BStatus.makeAlarm((BStatus)this.getStatus(), (boolean)true));
|
||||
} else if (!bAlarmState.isInAlarm()) {
|
||||
this.setStatus(BStatus.makeAlarm((BStatus)this.getStatus(), (boolean)false));
|
||||
}
|
||||
if (this.getAlarmEnable().isToFault() && bAlarmState == BAlarmState.fault) {
|
||||
this.setStatus(BStatus.makeFault((BStatus)this.getStatus(), (boolean)true));
|
||||
} else if (bAlarmState != BAlarmState.fault) {
|
||||
this.setStatus(BStatus.makeFault((BStatus)this.getStatus(), (boolean)false));
|
||||
}
|
||||
if (bAlarmState == BAlarmState.normal) {
|
||||
bl3 = this.alarmStateTransition(BSourceState.normal, BAlarmState.normal, bStatusValue);
|
||||
if (bAlarmState2.isOffnormal()) {
|
||||
boolean bl4 = false;
|
||||
if (bl3 || this.support.isAckRequired(BSourceState.offnormal)) {
|
||||
bl4 = true;
|
||||
}
|
||||
bl3 = bl4;
|
||||
} else if (bAlarmState2.isInAlarm()) {
|
||||
boolean bl5 = false;
|
||||
if (bl3 || this.support.isAckRequired(BSourceState.fault)) {
|
||||
bl5 = true;
|
||||
}
|
||||
bl3 = bl5;
|
||||
}
|
||||
} else {
|
||||
bl3 = bAlarmState == BAlarmState.fault ? this.alarmStateTransition(BSourceState.fault, BAlarmState.fault, bStatusValue) : this.alarmStateTransition(BSourceState.offnormal, bAlarmState, bStatusValue);
|
||||
}
|
||||
this.setAlarmState(bAlarmState);
|
||||
this.timeOfLastStateChange = Clock.ticks();
|
||||
this.setTimeInCurrentState(BRelTime.DEFAULT);
|
||||
this.unackedAlarm = bl3;
|
||||
} else {
|
||||
if (this.getAlarmEnable().isToOffnormal()) {
|
||||
this.setStatus(BStatus.makeAlarm((BStatus)this.getStatus(), (boolean)bAlarmState2.isInAlarm()));
|
||||
}
|
||||
if (this.getAlarmEnable().isToFault()) {
|
||||
BStatus bStatus = this.getStatus();
|
||||
boolean bl6 = false;
|
||||
if (bAlarmState2 == BAlarmState.fault) {
|
||||
bl6 = true;
|
||||
}
|
||||
this.setStatus(BStatus.makeFault((BStatus)bStatus, (boolean)bl6));
|
||||
}
|
||||
this.setTimeInCurrentState(BRelTime.make((long)(Clock.ticks() - this.timeOfLastStateChange)));
|
||||
}
|
||||
BAlarmTransitionBits bAlarmTransitionBits = this.getAckedTransitions();
|
||||
if (this.getAlarmEnable().isToOffnormal() || this.getAlarmEnable().isToFault()) {
|
||||
if (!(bAlarmTransitionBits.isToOffnormal() && bAlarmTransitionBits.isToFault() && bAlarmTransitionBits.isToNormal() || !bl3)) {
|
||||
this.setStatus(BStatus.makeUnackedAlarm((BStatus)this.getStatus(), (boolean)true));
|
||||
} else {
|
||||
this.setStatus(BStatus.makeUnackedAlarm((BStatus)this.getStatus(), (boolean)false));
|
||||
}
|
||||
}
|
||||
if ((bAlarmState2 == BAlarmState.lowLimit || bAlarmState2 == BAlarmState.highLimit) && bAlarmState == BAlarmState.normal) {
|
||||
this.checkAlarms(bStatusValue);
|
||||
}
|
||||
}
|
||||
|
||||
private final boolean alarmStateTransition(BSourceState bSourceState, BAlarmState bAlarmState, BStatusValue bStatusValue) {
|
||||
HashMap<String, Object> hashMap = new HashMap<String, Object>();
|
||||
Object var5_5 = null;
|
||||
BOrd bOrd = BOrd.NULL;
|
||||
Property property = null;
|
||||
boolean bl = false;
|
||||
bOrd = this.getHyperlinkOrd();
|
||||
if (bSourceState == BSourceState.offnormal) {
|
||||
hashMap.put("offnormalValue", BString.make((String)bStatusValue.valueToString((Context)this.getPointFacets())));
|
||||
hashMap.put("alarmValue", bStatusValue.getValueValue());
|
||||
} else if (bSourceState == BSourceState.fault) {
|
||||
hashMap.put("faultValue", BString.make((String)bStatusValue.valueToString((Context)this.getPointFacets())));
|
||||
hashMap.put("alarmValue", bStatusValue.getValueValue());
|
||||
}
|
||||
hashMap.put("presentValue", BString.make((String)bStatusValue.valueToString((Context)this.getPointFacets())));
|
||||
hashMap.put("fromState", BString.make((String)this.getAlarmState().getTag()));
|
||||
hashMap.put("toState", BString.make((String)bAlarmState.getTag()));
|
||||
hashMap.put("sourceName", BString.make((String)this.getSourceName().format((Object)this)));
|
||||
if (!bOrd.isNull()) {
|
||||
hashMap.put("hyperlinkOrd", BString.make((String)bOrd.toString()));
|
||||
}
|
||||
if (!this.getSoundFile().isNull()) {
|
||||
hashMap.put("soundFile", BString.make((String)this.getSoundFile().toString()));
|
||||
}
|
||||
if (!this.getAlarmIcon().isNull()) {
|
||||
hashMap.put("icon", BString.make((String)this.getAlarmIcon().toString()));
|
||||
}
|
||||
try {
|
||||
if (!this.getAlarmInstructions().equals((Object)BAlarmInstructions.NULL)) {
|
||||
hashMap.put("instructions", BString.make((String)this.getAlarmInstructions().encodeToString()));
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("Could not encode Alarm Instructions", (Throwable)exception);
|
||||
}
|
||||
BFacets bFacets = this.getMetaData();
|
||||
String[] stringArray = bFacets.list();
|
||||
boolean bl2 = false;
|
||||
while (bl2 < stringArray.length) {
|
||||
hashMap.put(stringArray[bl2], bFacets.get(stringArray[bl2]));
|
||||
bl2 += 1;
|
||||
}
|
||||
if (bSourceState == BSourceState.normal) {
|
||||
hashMap.put("msgText", BString.make((String)this.getToNormalText().getFormat()));
|
||||
if (this.getAlarmState().isInAlarm()) {
|
||||
this.getOffnormalAlgorithm().writeAlarmData(bStatusValue, hashMap);
|
||||
} else {
|
||||
this.getFaultAlgorithm().writeAlarmData(bStatusValue, hashMap);
|
||||
}
|
||||
} else if (bSourceState == BSourceState.offnormal) {
|
||||
hashMap.put("msgText", BString.make((String)this.getToOffnormalText().getFormat()));
|
||||
hashMap.put(BAlarmTimestamps.count.getDefaultDisplayName(null), BInteger.make((int)(this.getToOffnormalTimes().getCount() + 1)));
|
||||
this.getOffnormalAlgorithm().writeAlarmData(bStatusValue, hashMap);
|
||||
property = toOffnormalTimes;
|
||||
} else if (bSourceState == BSourceState.fault) {
|
||||
hashMap.put("msgText", BString.make((String)this.getToFaultText().getFormat()));
|
||||
hashMap.put(BAlarmTimestamps.count.getDefaultDisplayName(null), BInteger.make((int)(this.getToFaultTimes().getCount() + 1)));
|
||||
this.getFaultAlgorithm().writeAlarmData(bStatusValue, hashMap);
|
||||
property = toFaultTimes;
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
bl2 = false;
|
||||
try {
|
||||
Object object;
|
||||
bl2 = this.support.isAckRequired(bSourceState);
|
||||
BAlarmRecord bAlarmRecord = null;
|
||||
if (bSourceState == BSourceState.normal) {
|
||||
this.support.toNormal(BFacets.make(hashMap), null);
|
||||
} else if (bSourceState == BSourceState.offnormal) {
|
||||
bAlarmRecord = this.support.newOffnormalAlarm(BFacets.make(hashMap));
|
||||
this.lastOffnormalTime = bAlarmRecord.getTimestamp();
|
||||
this.fireToOffnormal(bAlarmRecord);
|
||||
} else if (bSourceState == BSourceState.fault) {
|
||||
bAlarmRecord = this.support.newFaultAlarm(BFacets.make(hashMap));
|
||||
this.lastFaultTime = bAlarmRecord.getTimestamp();
|
||||
this.fireToFault(bAlarmRecord);
|
||||
}
|
||||
if (bAlarmRecord != null) {
|
||||
if (bSourceState == BSourceState.normal) {
|
||||
object = this.getToOffnormalTimes();
|
||||
if (!((BAlarmTimestamps)((Object)object)).getAlarmTime().isNull()) {
|
||||
((BAlarmTimestamps)((Object)object)).setNormalTime(bAlarmRecord.getNormalTime());
|
||||
}
|
||||
if (!((BAlarmTimestamps)((Object)(object = this.getToFaultTimes()))).getAlarmTime().isNull()) {
|
||||
((BAlarmTimestamps)((Object)object)).setNormalTime(bAlarmRecord.getNormalTime());
|
||||
}
|
||||
}
|
||||
if (property != null) {
|
||||
object = (BAlarmTimestamps)this.get(property);
|
||||
((BAlarmTimestamps)((Object)object)).setAlarmTime(bAlarmRecord.getTimestamp());
|
||||
((BAlarmTimestamps)((Object)object)).setAckTime(BAbsTime.NULL);
|
||||
((BAlarmTimestamps)((Object)object)).setNormalTime(BAbsTime.NULL);
|
||||
((BAlarmTimestamps)((Object)object)).setCount(((BAlarmTimestamps)((Object)object)).getCount() + 1);
|
||||
}
|
||||
}
|
||||
if (bl2) {
|
||||
object = this.getAckedTransitions();
|
||||
this.setAckedTransitions(BAlarmTransitionBits.make(object, bSourceState.getAlarmTransitionBits(), false));
|
||||
}
|
||||
}
|
||||
catch (ServiceNotFoundException serviceNotFoundException) {
|
||||
log.error("AlarmState Transition Failed - AlarmService not found.");
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("AlarmState Transition Failed: " + exception, (Throwable)exception);
|
||||
}
|
||||
return bl2;
|
||||
}
|
||||
|
||||
public void fireToNormal(BAlarmRecord bAlarmRecord) {
|
||||
this.lastToNormalTime = bAlarmRecord.getNormalTime();
|
||||
if (bAlarmRecord.getSourceState().getOrdinal() == 0) {
|
||||
BAlarmTimestamps bAlarmTimestamps = this.getToOffnormalTimes();
|
||||
if (!bAlarmTimestamps.getAlarmTime().isNull()) {
|
||||
bAlarmTimestamps.setNormalTime(bAlarmRecord.getNormalTime());
|
||||
}
|
||||
if (!(bAlarmTimestamps = this.getToFaultTimes()).getAlarmTime().isNull()) {
|
||||
bAlarmTimestamps.setNormalTime(bAlarmRecord.getNormalTime());
|
||||
}
|
||||
}
|
||||
this.fire(toNormal, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public BAbsTime getLastOffnormalTime() {
|
||||
return this.lastOffnormalTime;
|
||||
}
|
||||
|
||||
public BAbsTime getLastFaultTime() {
|
||||
return this.lastFaultTime;
|
||||
}
|
||||
|
||||
public BAbsTime getLastToNormalTime() {
|
||||
return this.lastToNormalTime;
|
||||
}
|
||||
|
||||
public BAbsTime getLastAckTime() {
|
||||
return this.lastAckTime;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
private static final void dump(String string) {
|
||||
System.out.println(string);
|
||||
}
|
||||
|
||||
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.timeOfLastStateChange = 0L;
|
||||
this.unackedAlarm = false;
|
||||
this.lastOffnormalTime = BAbsTime.NULL;
|
||||
this.lastFaultTime = BAbsTime.NULL;
|
||||
this.lastToNormalTime = BAbsTime.NULL;
|
||||
this.lastAckTime = BAbsTime.NULL;
|
||||
this.atSteadyState = false;
|
||||
}
|
||||
|
||||
public BAlarmSourceExt() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$ext$BAlarmSourceExt;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$BAlarmSourceExt = BAlarmSourceExt.class("[Ljavax.baja.alarm.ext.BAlarmSourceExt;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
icon = BIcon.make((BIcon)BIcon.std((String)"control/controlExtension.png"), (BIcon)BIcon.std((String)"badges/alarm.png"));
|
||||
log = Log.getLog((String)"alarm");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BFrozenEnum
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext;
|
||||
|
||||
import javax.baja.sys.BFrozenEnum;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BAlarmState
|
||||
extends BFrozenEnum {
|
||||
public static final int NORMAL = 0;
|
||||
public static final int FAULT = 1;
|
||||
public static final int OFFNORMAL = 2;
|
||||
public static final int HIGH_LIMIT = 3;
|
||||
public static final int LOW_LIMIT = 4;
|
||||
public static final BAlarmState normal = new BAlarmState(0);
|
||||
public static final BAlarmState fault = new BAlarmState(1);
|
||||
public static final BAlarmState offnormal = new BAlarmState(2);
|
||||
public static final BAlarmState highLimit = new BAlarmState(3);
|
||||
public static final BAlarmState lowLimit = new BAlarmState(4);
|
||||
public static final Type TYPE;
|
||||
public static final BAlarmState DEFAULT;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$BAlarmState;
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static final BAlarmState make(int n) {
|
||||
return (BAlarmState)normal.getRange().get(n, false);
|
||||
}
|
||||
|
||||
public static final BAlarmState make(String string) {
|
||||
return (BAlarmState)normal.getRange().get(string);
|
||||
}
|
||||
|
||||
public final boolean isInAlarm() {
|
||||
boolean bl = false;
|
||||
if (this != normal) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public final boolean isOffnormal() {
|
||||
boolean bl = false;
|
||||
if (this != normal && this != fault) {
|
||||
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 BAlarmState(int n) {
|
||||
super(n);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$ext$BAlarmState;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$BAlarmState = BAlarmState.class("[Ljavax.baja.alarm.ext.BAlarmState;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
DEFAULT = normal;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BStruct
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext;
|
||||
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BStruct;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BAlarmTimestamps
|
||||
extends BStruct {
|
||||
public static final Property alarmTime = BAlarmTimestamps.newProperty((int)65, (BValue)BAbsTime.NULL, null);
|
||||
public static final Property ackTime = BAlarmTimestamps.newProperty((int)65, (BValue)BAbsTime.NULL, null);
|
||||
public static final Property normalTime = BAlarmTimestamps.newProperty((int)65, (BValue)BAbsTime.NULL, null);
|
||||
public static final Property count = BAlarmTimestamps.newProperty((int)65, (int)0, null);
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$BAlarmTimestamps;
|
||||
|
||||
public BAbsTime getAlarmTime() {
|
||||
return (BAbsTime)this.get(alarmTime);
|
||||
}
|
||||
|
||||
public void setAlarmTime(BAbsTime bAbsTime) {
|
||||
this.set(alarmTime, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public BAbsTime getAckTime() {
|
||||
return (BAbsTime)this.get(ackTime);
|
||||
}
|
||||
|
||||
public void setAckTime(BAbsTime bAbsTime) {
|
||||
this.set(ackTime, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public BAbsTime getNormalTime() {
|
||||
return (BAbsTime)this.get(normalTime);
|
||||
}
|
||||
|
||||
public void setNormalTime(BAbsTime bAbsTime) {
|
||||
this.set(normalTime, (BValue)bAbsTime, null);
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return this.getInt(count);
|
||||
}
|
||||
|
||||
public void setCount(int n) {
|
||||
this.setInt(count, n, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
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$alarm$ext$BAlarmTimestamps;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$BAlarmTimestamps = BAlarmTimestamps.class("[Ljavax.baja.alarm.ext.BAlarmTimestamps;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.baja.alarm.ext.BAlarmAlgorithm;
|
||||
import javax.baja.alarm.ext.BAlarmSourceExt;
|
||||
import javax.baja.alarm.ext.BAlarmState;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BFaultAlgorithm
|
||||
extends BAlarmAlgorithm {
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$BFaultAlgorithm;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean isParentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BAlarmSourceExt;
|
||||
}
|
||||
|
||||
public boolean isGrandparentLegal(BComponent bComponent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BAlarmState checkFault(BStatusValue bStatusValue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final BAlarmState checkAlarmState(BStatusValue bStatusValue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void writeAlarmData(BStatusValue bStatusValue, Map map) {
|
||||
}
|
||||
|
||||
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$alarm$ext$BFaultAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$BFaultAlgorithm = BFaultAlgorithm.class("[Ljavax.baja.alarm.ext.BFaultAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BStruct
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext;
|
||||
|
||||
import javax.baja.sys.BStruct;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BLimitEnable
|
||||
extends BStruct {
|
||||
public static final Property lowLimitEnable = BLimitEnable.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property highLimitEnable = BLimitEnable.newProperty((int)0, (boolean)false, null);
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$BLimitEnable;
|
||||
|
||||
public boolean getLowLimitEnable() {
|
||||
return this.getBoolean(lowLimitEnable);
|
||||
}
|
||||
|
||||
public void setLowLimitEnable(boolean bl) {
|
||||
this.setBoolean(lowLimitEnable, bl, null);
|
||||
}
|
||||
|
||||
public boolean getHighLimitEnable() {
|
||||
return this.getBoolean(highLimitEnable);
|
||||
}
|
||||
|
||||
public void setHighLimitEnable(boolean bl) {
|
||||
this.setBoolean(highLimitEnable, bl, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean isHighLimitEnabled() {
|
||||
return this.getHighLimitEnable();
|
||||
}
|
||||
|
||||
public boolean isLowLimitEnabled() {
|
||||
return this.getLowLimitEnable();
|
||||
}
|
||||
|
||||
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$alarm$ext$BLimitEnable;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$BLimitEnable = BLimitEnable.class("[Ljavax.baja.alarm.ext.BLimitEnable;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BFrozenEnum
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext;
|
||||
|
||||
import javax.baja.sys.BFrozenEnum;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BNotifyType
|
||||
extends BFrozenEnum {
|
||||
public static final int ALARM = 0;
|
||||
public static final int ALERT = 1;
|
||||
public static final int ACK_NOTIFICATION = 2;
|
||||
public static final BNotifyType alarm = new BNotifyType(0);
|
||||
public static final BNotifyType alert = new BNotifyType(1);
|
||||
public static final BNotifyType ackNotification = new BNotifyType(2);
|
||||
public static final Type TYPE;
|
||||
public static final BNotifyType DEFAULT;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$BNotifyType;
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static final BNotifyType make(int n) {
|
||||
return (BNotifyType)alarm.getRange().get(n, false);
|
||||
}
|
||||
|
||||
public static final BNotifyType make(String string) {
|
||||
return (BNotifyType)alarm.getRange().get(string);
|
||||
}
|
||||
|
||||
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 BNotifyType(int n) {
|
||||
super(n);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$ext$BNotifyType;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$BNotifyType = BNotifyType.class("[Ljavax.baja.alarm.ext.BNotifyType;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
DEFAULT = alarm;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.control.BControlPoint
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Clock$Ticket
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.baja.alarm.ext.BAlarmAlgorithm;
|
||||
import javax.baja.alarm.ext.BAlarmSourceExt;
|
||||
import javax.baja.alarm.ext.BAlarmState;
|
||||
import javax.baja.control.BControlPoint;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BOffnormalAlgorithm
|
||||
extends BAlarmAlgorithm {
|
||||
public static final Type TYPE;
|
||||
protected static Log log;
|
||||
long endTime;
|
||||
Clock.Ticket ticket;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$BOffnormalAlgorithm;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean isParentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BAlarmSourceExt;
|
||||
}
|
||||
|
||||
public boolean isGrandparentLegal(BComponent bComponent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public final BAlarmState checkAlarmState(BStatusValue bStatusValue, long l, long l2) {
|
||||
return this.checkAlarms(bStatusValue, l, l2);
|
||||
}
|
||||
|
||||
public final BAlarmState checkAlarmState(BStatusValue bStatusValue, long l) {
|
||||
return this.checkAlarms(bStatusValue, l, l);
|
||||
}
|
||||
|
||||
public BAlarmState checkAlarms(BStatusValue bStatusValue, long l) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public BAlarmState checkAlarms(BStatusValue bStatusValue, long l, long l2) {
|
||||
return this.checkAlarms(bStatusValue, l);
|
||||
}
|
||||
|
||||
public void writeAlarmData(BStatusValue bStatusValue, Map map) {
|
||||
}
|
||||
|
||||
protected void startTimer(long l) {
|
||||
this.endTime = Clock.ticks() + l;
|
||||
BControlPoint bControlPoint = this.getParentPoint();
|
||||
if (bControlPoint != null && this.isRunning()) {
|
||||
this.ticket = Clock.schedule((BComponent)bControlPoint, (BRelTime)BRelTime.make((long)l), (Action)BControlPoint.execute, null);
|
||||
}
|
||||
}
|
||||
|
||||
protected void cancelTimer() {
|
||||
this.endTime = -1;
|
||||
if (this.ticket != null) {
|
||||
this.ticket.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isTimerExpired() {
|
||||
long l = Clock.ticks();
|
||||
if (this.endTime == (long)-1) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return l >= this.endTime;
|
||||
}
|
||||
|
||||
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$alarm$ext$BOffnormalAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$BOffnormalAlgorithm = BOffnormalAlgorithm.class("[Ljavax.baja.alarm.ext.BOffnormalAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
log = Log.getLog((String)"control");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.control.BEnumPoint
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.status.BStatusEnum
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BDynamicEnum
|
||||
* javax.baja.sys.BEnumRange
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BInteger
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext.fault;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.baja.alarm.ext.fault.BTwoStateFaultAlgorithm;
|
||||
import javax.baja.control.BEnumPoint;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.status.BStatusEnum;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BDynamicEnum;
|
||||
import javax.baja.sys.BEnumRange;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BEnumFaultAlgorithm
|
||||
extends BTwoStateFaultAlgorithm {
|
||||
public static final Property validValues = BEnumFaultAlgorithm.newProperty((int)0, (BValue)BEnumRange.make((String[])new String[]{"INITIAL_VALUE"}), (BFacets)BFacets.make((String)"fieldEditor", (BIDataValue)BString.make((String)"alarm:EnumAlarmRangeFE")));
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$fault$BEnumFaultAlgorithm;
|
||||
|
||||
public BEnumRange getValidValues() {
|
||||
return (BEnumRange)this.get(validValues);
|
||||
}
|
||||
|
||||
public void setValidValues(BEnumRange bEnumRange) {
|
||||
this.set(validValues, (BValue)bEnumRange, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean isGrandparentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BEnumPoint;
|
||||
}
|
||||
|
||||
public BFacets getSlotFacets(Slot slot) {
|
||||
if (slot == validValues) {
|
||||
return BFacets.make((BFacets)this.getPointFacets(), (BFacets)super.getSlotFacets(slot));
|
||||
}
|
||||
return super.getSlotFacets(slot);
|
||||
}
|
||||
|
||||
public void started() {
|
||||
if (this.getValidValues().equals((Object)BEnumRange.make((String[])new String[]{"INITIAL_VALUE"}))) {
|
||||
this.setValidValues((BEnumRange)this.getPointFacets().get("range"));
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isNormal(BStatusValue bStatusValue) {
|
||||
BStatusEnum bStatusEnum = (BStatusEnum)bStatusValue;
|
||||
BDynamicEnum bDynamicEnum = bStatusEnum.getValue();
|
||||
int n = bDynamicEnum.getOrdinal();
|
||||
int[] nArray = this.getValidValues().getOrdinals();
|
||||
int n2 = 0;
|
||||
while (n2 < nArray.length) {
|
||||
if (n == nArray[n2]) {
|
||||
return true;
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void writeAlarmData(BStatusValue bStatusValue, Map map) {
|
||||
map.put("status", BString.make((String)bStatusValue.getStatus().toString(null)));
|
||||
map.put("numericValue", BInteger.make((int)((BStatusEnum)bStatusValue).getValue().getOrdinal()));
|
||||
}
|
||||
|
||||
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$alarm$ext$fault$BEnumFaultAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$fault$BEnumFaultAlgorithm = BEnumFaultAlgorithm.class("[Ljavax.baja.alarm.ext.fault.BEnumFaultAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,454 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.control.BNumericPoint
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.status.BStatusNumeric
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BDouble
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BFloat
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.units.BUnit
|
||||
* javax.baja.util.BFormat
|
||||
*/
|
||||
package javax.baja.alarm.ext.fault;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.baja.alarm.ext.BAlarmSourceExt;
|
||||
import javax.baja.alarm.ext.BAlarmState;
|
||||
import javax.baja.alarm.ext.BFaultAlgorithm;
|
||||
import javax.baja.alarm.ext.BLimitEnable;
|
||||
import javax.baja.control.BNumericPoint;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.status.BStatusNumeric;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BDouble;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BFloat;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.units.BUnit;
|
||||
import javax.baja.util.BFormat;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BOutOfRangeFaultAlgorithm
|
||||
extends BFaultAlgorithm {
|
||||
public static final Property highLimit = BOutOfRangeFaultAlgorithm.newProperty((int)0, (int)0, null);
|
||||
public static final Property lowLimit = BOutOfRangeFaultAlgorithm.newProperty((int)0, (int)0, null);
|
||||
public static final Property deadband = BOutOfRangeFaultAlgorithm.newProperty((int)0, (int)0, (BFacets)BFacets.make((String)"min", (BIDataValue)BFloat.make((float)0.0f)));
|
||||
public static final Property highLimitText = BOutOfRangeFaultAlgorithm.newProperty((int)0, (BValue)BFormat.DEFAULT, (BFacets)BFacets.make((String)"multiLine", (BIDataValue)BBoolean.TRUE));
|
||||
public static final Property lowLimitText = BOutOfRangeFaultAlgorithm.newProperty((int)0, (BValue)BFormat.DEFAULT, (BFacets)BFacets.make((String)"multiLine", (BIDataValue)BBoolean.TRUE));
|
||||
public static final Property limitEnable = BOutOfRangeFaultAlgorithm.newProperty((int)0, (BValue)new BLimitEnable(), null);
|
||||
public static final Property inHighState = BOutOfRangeFaultAlgorithm.newProperty((int)4, (boolean)false, null);
|
||||
public static final Property inLowState = BOutOfRangeFaultAlgorithm.newProperty((int)4, (boolean)false, null);
|
||||
public static final Type TYPE;
|
||||
OutOfRangeState current;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$fault$BOutOfRangeFaultAlgorithm;
|
||||
|
||||
public double getHighLimit() {
|
||||
return this.getDouble(highLimit);
|
||||
}
|
||||
|
||||
public void setHighLimit(double d) {
|
||||
this.setDouble(highLimit, d, null);
|
||||
}
|
||||
|
||||
public double getLowLimit() {
|
||||
return this.getDouble(lowLimit);
|
||||
}
|
||||
|
||||
public void setLowLimit(double d) {
|
||||
this.setDouble(lowLimit, d, null);
|
||||
}
|
||||
|
||||
public double getDeadband() {
|
||||
return this.getDouble(deadband);
|
||||
}
|
||||
|
||||
public void setDeadband(double d) {
|
||||
this.setDouble(deadband, d, null);
|
||||
}
|
||||
|
||||
public BFormat getHighLimitText() {
|
||||
return (BFormat)this.get(highLimitText);
|
||||
}
|
||||
|
||||
public void setHighLimitText(BFormat bFormat) {
|
||||
this.set(highLimitText, (BValue)bFormat, null);
|
||||
}
|
||||
|
||||
public BFormat getLowLimitText() {
|
||||
return (BFormat)this.get(lowLimitText);
|
||||
}
|
||||
|
||||
public void setLowLimitText(BFormat bFormat) {
|
||||
this.set(lowLimitText, (BValue)bFormat, null);
|
||||
}
|
||||
|
||||
public BLimitEnable getLimitEnable() {
|
||||
return (BLimitEnable)this.get(limitEnable);
|
||||
}
|
||||
|
||||
public void setLimitEnable(BLimitEnable bLimitEnable) {
|
||||
this.set(limitEnable, (BValue)bLimitEnable, null);
|
||||
}
|
||||
|
||||
public boolean getInHighState() {
|
||||
return this.getBoolean(inHighState);
|
||||
}
|
||||
|
||||
public void setInHighState(boolean bl) {
|
||||
this.setBoolean(inHighState, bl, null);
|
||||
}
|
||||
|
||||
public boolean getInLowState() {
|
||||
return this.getBoolean(inLowState);
|
||||
}
|
||||
|
||||
public void setInLowState(boolean bl) {
|
||||
this.setBoolean(inLowState, bl, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
private final boolean isHighLimitEnabled() {
|
||||
return this.getLimitEnable().isHighLimitEnabled();
|
||||
}
|
||||
|
||||
private final boolean isLowLimitEnabled() {
|
||||
return this.getLimitEnable().isLowLimitEnabled();
|
||||
}
|
||||
|
||||
public void started() {
|
||||
BAlarmState bAlarmState = ((BAlarmSourceExt)this.getParent()).getAlarmState();
|
||||
if (bAlarmState == BAlarmState.fault) {
|
||||
if (this.getInHighState()) {
|
||||
this.current = new HighAlarmState();
|
||||
} else if (this.getInLowState()) {
|
||||
this.current = new LowAlarmState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isGrandparentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BNumericPoint;
|
||||
}
|
||||
|
||||
public BFacets getSlotFacets(Slot slot) {
|
||||
if (slot == highLimit || slot == lowLimit) {
|
||||
return this.getPointFacets();
|
||||
}
|
||||
if (slot == deadband) {
|
||||
BFacets bFacets = this.getPointFacets();
|
||||
BUnit bUnit = (BUnit)bFacets.getFacet("units");
|
||||
if (bUnit != null) {
|
||||
bFacets = BFacets.make((BFacets)bFacets, (String)"units", (BIDataValue)bUnit.getDifferentialUnit());
|
||||
}
|
||||
return BFacets.make((BFacets)bFacets, (BFacets)super.getSlotFacets((Slot)deadband));
|
||||
}
|
||||
return super.getSlotFacets(slot);
|
||||
}
|
||||
|
||||
public BAlarmState checkFault(BStatusValue bStatusValue) {
|
||||
BStatusNumeric bStatusNumeric = (BStatusNumeric)bStatusValue;
|
||||
return this.evaluate(bStatusNumeric.getValue());
|
||||
}
|
||||
|
||||
private final BAlarmState evaluate(double d) {
|
||||
BAlarmState bAlarmState = ((BAlarmSourceExt)this.getParent()).getAlarmState();
|
||||
if (bAlarmState == BAlarmState.fault) {
|
||||
if (this.getInHighState()) {
|
||||
this.current = new HighAlarmState();
|
||||
} else if (this.getInLowState()) {
|
||||
this.current = new LowAlarmState();
|
||||
}
|
||||
} else {
|
||||
this.current = new NormalState();
|
||||
}
|
||||
return this.current.evaluate(d);
|
||||
}
|
||||
|
||||
public void writeAlarmData(BStatusValue bStatusValue, Map map) {
|
||||
BFacets bFacets = this.getPointFacets();
|
||||
map.put("status", BString.make((String)bStatusValue.getStatus().toString(null)));
|
||||
map.put("deadband", BString.make((String)BDouble.toString((double)this.getDeadband(), (Context)bFacets)));
|
||||
if (this.current instanceof HighAlarmState) {
|
||||
if (!this.getHighLimitText().equals((Object)BFormat.DEFAULT)) {
|
||||
map.put("msgText", BString.make((String)this.getHighLimitText().getFormat()));
|
||||
}
|
||||
map.put("highLimit", BString.make((String)BDouble.toString((double)this.getHighLimit(), (Context)bFacets)));
|
||||
if (this.isLowLimitEnabled()) {
|
||||
map.put("lowLimit", BString.make((String)BDouble.toString((double)this.getLowLimit(), (Context)bFacets)));
|
||||
}
|
||||
} else if (this.current instanceof LowAlarmState) {
|
||||
if (!this.getLowLimitText().equals((Object)BFormat.DEFAULT)) {
|
||||
map.put("msgText", BString.make((String)this.getLowLimitText().getFormat()));
|
||||
}
|
||||
if (this.isHighLimitEnabled()) {
|
||||
map.put("highLimit", BString.make((String)BDouble.toString((double)this.getHighLimit(), (Context)bFacets)));
|
||||
}
|
||||
map.put("lowLimit", BString.make((String)BDouble.toString((double)this.getLowLimit(), (Context)bFacets)));
|
||||
}
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
this.executePoint();
|
||||
}
|
||||
|
||||
void transition(OutOfRangeState outOfRangeState) {
|
||||
this.current = outOfRangeState;
|
||||
}
|
||||
|
||||
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.current = new NormalState();
|
||||
}
|
||||
|
||||
public BOutOfRangeFaultAlgorithm() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$ext$fault$BOutOfRangeFaultAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$fault$BOutOfRangeFaultAlgorithm = BOutOfRangeFaultAlgorithm.class("[Ljavax.baja.alarm.ext.fault.BOutOfRangeFaultAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class HighAlarmState
|
||||
extends OutOfRangeState {
|
||||
public String tag() {
|
||||
return "HighAlarmState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(double d) {
|
||||
if (!(d >= BOutOfRangeFaultAlgorithm.this.getHighLimit() - BOutOfRangeFaultAlgorithm.this.getDeadband())) {
|
||||
if (d < BOutOfRangeFaultAlgorithm.this.getLowLimit() && BOutOfRangeFaultAlgorithm.this.isLowLimitEnabled()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new LowAlarmState());
|
||||
return BAlarmState.fault;
|
||||
}
|
||||
if (d < BOutOfRangeFaultAlgorithm.this.getHighLimit() - BOutOfRangeFaultAlgorithm.this.getDeadband()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public HighAlarmState() {
|
||||
BOutOfRangeFaultAlgorithm.this.setInHighState(true);
|
||||
BOutOfRangeFaultAlgorithm.this.setInLowState(false);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class LowAlarmState
|
||||
extends OutOfRangeState {
|
||||
public String tag() {
|
||||
return "LowAlarmState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(double d) {
|
||||
if (!(d <= BOutOfRangeFaultAlgorithm.this.getLowLimit() + BOutOfRangeFaultAlgorithm.this.getDeadband())) {
|
||||
if (d > BOutOfRangeFaultAlgorithm.this.getHighLimit() && BOutOfRangeFaultAlgorithm.this.isHighLimitEnabled()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new HighAlarmState());
|
||||
return BAlarmState.fault;
|
||||
}
|
||||
if (d > BOutOfRangeFaultAlgorithm.this.getLowLimit() + BOutOfRangeFaultAlgorithm.this.getDeadband()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public LowAlarmState() {
|
||||
BOutOfRangeFaultAlgorithm.this.setInHighState(false);
|
||||
BOutOfRangeFaultAlgorithm.this.setInLowState(true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class NormalState
|
||||
extends OutOfRangeState {
|
||||
public String tag() {
|
||||
return "Normal";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(double d) {
|
||||
if (d < BOutOfRangeFaultAlgorithm.this.getLowLimit() && BOutOfRangeFaultAlgorithm.this.isLowLimitEnabled()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new LowAlarmState());
|
||||
return BAlarmState.fault;
|
||||
}
|
||||
if ((!(d >= BOutOfRangeFaultAlgorithm.this.getLowLimit()) || !(d <= BOutOfRangeFaultAlgorithm.this.getHighLimit())) && d > BOutOfRangeFaultAlgorithm.this.getHighLimit() && BOutOfRangeFaultAlgorithm.this.isHighLimitEnabled()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new HighAlarmState());
|
||||
return BAlarmState.fault;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public NormalState() {
|
||||
BOutOfRangeFaultAlgorithm.this.setInHighState(false);
|
||||
BOutOfRangeFaultAlgorithm.this.setInLowState(false);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private abstract class OutOfRangeState {
|
||||
public abstract String tag();
|
||||
|
||||
public abstract BAlarmState evaluate(double var1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class ValidateReturnFromLowState
|
||||
extends OutOfRangeState {
|
||||
public String tag() {
|
||||
return "ValidateReturnFromLowState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(double d) {
|
||||
if (d <= BOutOfRangeFaultAlgorithm.this.getLowLimit() + BOutOfRangeFaultAlgorithm.this.getDeadband() && BOutOfRangeFaultAlgorithm.this.isLowLimitEnabled()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new LowAlarmState());
|
||||
} else {
|
||||
if (d > BOutOfRangeFaultAlgorithm.this.getHighLimit() && BOutOfRangeFaultAlgorithm.this.isHighLimitEnabled()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new HighAlarmState());
|
||||
return BAlarmState.fault;
|
||||
}
|
||||
if (d > BOutOfRangeFaultAlgorithm.this.getLowLimit() + BOutOfRangeFaultAlgorithm.this.getDeadband()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class ValidateLowAlarmState
|
||||
extends OutOfRangeState {
|
||||
public String tag() {
|
||||
return "ValidateLowAlarmState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(double d) {
|
||||
if (d < BOutOfRangeFaultAlgorithm.this.getLowLimit() && BOutOfRangeFaultAlgorithm.this.isLowLimitEnabled()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new LowAlarmState());
|
||||
return BAlarmState.fault;
|
||||
}
|
||||
if (d > BOutOfRangeFaultAlgorithm.this.getHighLimit() && BOutOfRangeFaultAlgorithm.this.isHighLimitEnabled()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new HighAlarmState());
|
||||
return BAlarmState.fault;
|
||||
}
|
||||
if (d >= BOutOfRangeFaultAlgorithm.this.getLowLimit()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class ValidateReturnFromHighState
|
||||
extends OutOfRangeState {
|
||||
public String tag() {
|
||||
return "ValidateReturnFromHighState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(double d) {
|
||||
if (d > BOutOfRangeFaultAlgorithm.this.getHighLimit() - BOutOfRangeFaultAlgorithm.this.getDeadband() && BOutOfRangeFaultAlgorithm.this.isHighLimitEnabled()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new HighAlarmState());
|
||||
return BAlarmState.fault;
|
||||
}
|
||||
if (d < BOutOfRangeFaultAlgorithm.this.getLowLimit() && BOutOfRangeFaultAlgorithm.this.isLowLimitEnabled()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new LowAlarmState());
|
||||
return BAlarmState.fault;
|
||||
}
|
||||
if (d < BOutOfRangeFaultAlgorithm.this.getHighLimit() - BOutOfRangeFaultAlgorithm.this.getDeadband()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class ValidateHighAlarmState
|
||||
extends OutOfRangeState {
|
||||
public String tag() {
|
||||
return "ValidateHighAlarmState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(double d) {
|
||||
if (d < BOutOfRangeFaultAlgorithm.this.getLowLimit() && BOutOfRangeFaultAlgorithm.this.isLowLimitEnabled()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new LowAlarmState());
|
||||
return BAlarmState.fault;
|
||||
}
|
||||
if (d > BOutOfRangeFaultAlgorithm.this.getHighLimit() && BOutOfRangeFaultAlgorithm.this.isHighLimitEnabled()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new HighAlarmState());
|
||||
return BAlarmState.fault;
|
||||
}
|
||||
if (d <= BOutOfRangeFaultAlgorithm.this.getHighLimit()) {
|
||||
BOutOfRangeFaultAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.status.BStatus
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.BInteger
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext.fault;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.baja.alarm.ext.fault.BTwoStateFaultAlgorithm;
|
||||
import javax.baja.status.BStatus;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BString;
|
||||
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;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BStatusFaultAlgorithm
|
||||
extends BTwoStateFaultAlgorithm {
|
||||
public static final Property faultValues = BStatusFaultAlgorithm.newProperty((int)0, (BValue)BStatus.ok, null);
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$fault$BStatusFaultAlgorithm;
|
||||
|
||||
public BStatus getFaultValues() {
|
||||
return (BStatus)this.get(faultValues);
|
||||
}
|
||||
|
||||
public void setFaultValues(BStatus bStatus) {
|
||||
this.set(faultValues, (BValue)bStatus, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
this.executePoint();
|
||||
}
|
||||
|
||||
public void writeAlarmData(BStatusValue bStatusValue, Map map) {
|
||||
map.put("status", BString.make((String)bStatusValue.getStatus().toString(null)));
|
||||
if (!this.isNormal(bStatusValue)) {
|
||||
map.put("faultValue", BString.make((String)bStatusValue.getStatus().toString(null)));
|
||||
}
|
||||
map.put("numericValue", BInteger.make((int)bStatusValue.getStatus().getBits()));
|
||||
map.put("presentValue", BString.make((String)bStatusValue.getStatus().toString(null)));
|
||||
}
|
||||
|
||||
protected boolean isNormal(BStatusValue bStatusValue) {
|
||||
boolean bl = false;
|
||||
if ((bStatusValue.getStatus().getBits() & this.getFaultValues().getBits()) == 0) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$ext$fault$BStatusFaultAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$fault$BStatusFaultAlgorithm = BStatusFaultAlgorithm.class("[Ljavax.baja.alarm.ext.fault.BStatusFaultAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext.fault;
|
||||
|
||||
import javax.baja.alarm.ext.BAlarmSourceExt;
|
||||
import javax.baja.alarm.ext.BAlarmState;
|
||||
import javax.baja.alarm.ext.BFaultAlgorithm;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BTwoStateFaultAlgorithm
|
||||
extends BFaultAlgorithm {
|
||||
public static final Type TYPE;
|
||||
TwoState current;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$fault$BTwoStateFaultAlgorithm;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void started() {
|
||||
BAlarmState bAlarmState = ((BAlarmSourceExt)this.getParent()).getAlarmState();
|
||||
if (bAlarmState == BAlarmState.fault) {
|
||||
this.current = new FaultState();
|
||||
}
|
||||
}
|
||||
|
||||
public BAlarmState checkFault(BStatusValue bStatusValue) {
|
||||
BAlarmState bAlarmState = ((BAlarmSourceExt)this.getParent()).getAlarmState();
|
||||
this.current = bAlarmState == BAlarmState.fault ? new FaultState() : new NormalState();
|
||||
boolean bl = this.isNormal(bStatusValue);
|
||||
return this.current.evaluate(bl);
|
||||
}
|
||||
|
||||
protected abstract boolean isNormal(BStatusValue var1);
|
||||
|
||||
protected boolean isCurrentFault() {
|
||||
return this.current instanceof FaultState;
|
||||
}
|
||||
|
||||
private final void transition(TwoState twoState) {
|
||||
this.current = twoState;
|
||||
}
|
||||
|
||||
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.current = new NormalState();
|
||||
}
|
||||
|
||||
public BTwoStateFaultAlgorithm() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$ext$fault$BTwoStateFaultAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$fault$BTwoStateFaultAlgorithm = BTwoStateFaultAlgorithm.class("[Ljavax.baja.alarm.ext.fault.BTwoStateFaultAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class FaultState
|
||||
extends TwoState {
|
||||
public String tag() {
|
||||
return "FaultState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(boolean bl) {
|
||||
if (bl) {
|
||||
BTwoStateFaultAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private FaultState() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class NormalState
|
||||
extends TwoState {
|
||||
public String tag() {
|
||||
return "Normal";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(boolean bl) {
|
||||
if (!bl) {
|
||||
BTwoStateFaultAlgorithm.this.transition(new FaultState());
|
||||
return BAlarmState.fault;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private NormalState() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private abstract class TwoState {
|
||||
public abstract String tag();
|
||||
|
||||
public abstract BAlarmState evaluate(boolean var1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class ValidateReturnFromFaultState
|
||||
extends TwoState {
|
||||
public String tag() {
|
||||
return "ValidateReturnFromFaultState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(boolean bl) {
|
||||
if (bl) {
|
||||
BTwoStateFaultAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
BTwoStateFaultAlgorithm.this.transition(new FaultState());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class ValidateFaultState
|
||||
extends TwoState {
|
||||
public String tag() {
|
||||
return "ValidateFaultState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(boolean bl) {
|
||||
if (bl) {
|
||||
BTwoStateFaultAlgorithm.this.transition(new NormalState());
|
||||
return null;
|
||||
}
|
||||
BTwoStateFaultAlgorithm.this.transition(new FaultState());
|
||||
return BAlarmState.fault;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.control.BBooleanPoint
|
||||
* javax.baja.status.BStatusBoolean
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BInteger
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext.offnormal;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.baja.alarm.ext.offnormal.BTwoStateAlgorithm;
|
||||
import javax.baja.control.BBooleanPoint;
|
||||
import javax.baja.status.BStatusBoolean;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BBooleanChangeOfStateAlgorithm
|
||||
extends BTwoStateAlgorithm {
|
||||
public static final Property alarmValue = BBooleanChangeOfStateAlgorithm.newProperty((int)0, (boolean)true, null);
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$offnormal$BBooleanChangeOfStateAlgorithm;
|
||||
|
||||
public boolean getAlarmValue() {
|
||||
return this.getBoolean(alarmValue);
|
||||
}
|
||||
|
||||
public void setAlarmValue(boolean bl) {
|
||||
this.setBoolean(alarmValue, bl, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean isGrandparentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BBooleanPoint;
|
||||
}
|
||||
|
||||
public BFacets getSlotFacets(Slot slot) {
|
||||
if (slot == alarmValue) {
|
||||
return this.getPointFacets();
|
||||
}
|
||||
return super.getSlotFacets(slot);
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
this.executePoint();
|
||||
}
|
||||
|
||||
protected boolean isNormal(BStatusValue bStatusValue) {
|
||||
BStatusBoolean bStatusBoolean = (BStatusBoolean)bStatusValue;
|
||||
if (bStatusBoolean.getStatus().isNull()) {
|
||||
return true;
|
||||
}
|
||||
return bStatusBoolean.getValue() ^ this.getAlarmValue();
|
||||
}
|
||||
|
||||
public void writeAlarmData(BStatusValue bStatusValue, Map map) {
|
||||
map.put("status", BString.make((String)bStatusValue.getStatus().toString(null)));
|
||||
map.put("numericValue", BInteger.make((int)((BStatusBoolean)bStatusValue).getEnum().getOrdinal()));
|
||||
}
|
||||
|
||||
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$alarm$ext$offnormal$BBooleanChangeOfStateAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$offnormal$BBooleanChangeOfStateAlgorithm = BBooleanChangeOfStateAlgorithm.class("[Ljavax.baja.alarm.ext.offnormal.BBooleanChangeOfStateAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.control.BBooleanPoint
|
||||
* javax.baja.status.BStatusBoolean
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BInteger
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext.offnormal;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.baja.alarm.ext.offnormal.BTwoStateAlgorithm;
|
||||
import javax.baja.control.BBooleanPoint;
|
||||
import javax.baja.status.BStatusBoolean;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BString;
|
||||
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;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BBooleanCommandFailureAlgorithm
|
||||
extends BTwoStateAlgorithm {
|
||||
public static final Property feedbackValue = BBooleanCommandFailureAlgorithm.newProperty((int)8, (BValue)new BStatusBoolean(), null);
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$offnormal$BBooleanCommandFailureAlgorithm;
|
||||
|
||||
public BStatusBoolean getFeedbackValue() {
|
||||
return (BStatusBoolean)this.get(feedbackValue);
|
||||
}
|
||||
|
||||
public void setFeedbackValue(BStatusBoolean bStatusBoolean) {
|
||||
this.set(feedbackValue, (BValue)bStatusBoolean, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean isGrandparentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BBooleanPoint;
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
if (property == feedbackValue) {
|
||||
this.executePoint();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isNormal(BStatusValue bStatusValue) {
|
||||
BStatusBoolean bStatusBoolean = (BStatusBoolean)bStatusValue;
|
||||
return bStatusBoolean.getValue() ^ this.getFeedbackValue().getValue() ^ true;
|
||||
}
|
||||
|
||||
public void writeAlarmData(BStatusValue bStatusValue, Map map) {
|
||||
map.put("status", BString.make((String)bStatusValue.getStatus().toString(null)));
|
||||
map.put("numericValue", BInteger.make((int)((BStatusBoolean)bStatusValue).getEnum().getOrdinal()));
|
||||
map.put("feedbackValue", BString.make((String)this.getFeedbackValue().valueToString((Context)this.getPointFacets())));
|
||||
map.put("feedbackNumeric", BInteger.make((int)this.getFeedbackValue().getEnum().getOrdinal()));
|
||||
}
|
||||
|
||||
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$alarm$ext$offnormal$BBooleanCommandFailureAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$offnormal$BBooleanCommandFailureAlgorithm = BBooleanCommandFailureAlgorithm.class("[Ljavax.baja.alarm.ext.offnormal.BBooleanCommandFailureAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.control.BEnumPoint
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.status.BStatusEnum
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BDynamicEnum
|
||||
* javax.baja.sys.BEnumRange
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BInteger
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext.offnormal;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.baja.alarm.ext.offnormal.BTwoStateAlgorithm;
|
||||
import javax.baja.control.BEnumPoint;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.status.BStatusEnum;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BDynamicEnum;
|
||||
import javax.baja.sys.BEnumRange;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BEnumChangeOfStateAlgorithm
|
||||
extends BTwoStateAlgorithm {
|
||||
public static final Property alarmValues = BEnumChangeOfStateAlgorithm.newProperty((int)0, (BValue)BEnumRange.DEFAULT, (BFacets)BFacets.make((String)"fieldEditor", (BIDataValue)BString.make((String)"alarm:EnumAlarmRangeFE")));
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$offnormal$BEnumChangeOfStateAlgorithm;
|
||||
|
||||
public BEnumRange getAlarmValues() {
|
||||
return (BEnumRange)this.get(alarmValues);
|
||||
}
|
||||
|
||||
public void setAlarmValues(BEnumRange bEnumRange) {
|
||||
this.set(alarmValues, (BValue)bEnumRange, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean isGrandparentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BEnumPoint;
|
||||
}
|
||||
|
||||
public BFacets getSlotFacets(Slot slot) {
|
||||
if (slot == alarmValues) {
|
||||
return BFacets.make((BFacets)this.getPointFacets(), (BFacets)super.getSlotFacets(slot));
|
||||
}
|
||||
return super.getSlotFacets(slot);
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
this.executePoint();
|
||||
}
|
||||
|
||||
protected boolean isNormal(BStatusValue bStatusValue) {
|
||||
BStatusEnum bStatusEnum = (BStatusEnum)bStatusValue;
|
||||
BDynamicEnum bDynamicEnum = bStatusEnum.getValue();
|
||||
int n = bDynamicEnum.getOrdinal();
|
||||
int[] nArray = this.getAlarmValues().getOrdinals();
|
||||
int n2 = 0;
|
||||
while (n2 < nArray.length) {
|
||||
if (n == nArray[n2]) {
|
||||
return false;
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writeAlarmData(BStatusValue bStatusValue, Map map) {
|
||||
map.put("status", BString.make((String)bStatusValue.getStatus().toString(null)));
|
||||
map.put("numericValue", BInteger.make((int)((BStatusEnum)bStatusValue).getValue().getOrdinal()));
|
||||
}
|
||||
|
||||
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$alarm$ext$offnormal$BEnumChangeOfStateAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$offnormal$BEnumChangeOfStateAlgorithm = BEnumChangeOfStateAlgorithm.class("[Ljavax.baja.alarm.ext.offnormal.BEnumChangeOfStateAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.control.BEnumPoint
|
||||
* javax.baja.status.BStatusEnum
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BDynamicEnum
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BInteger
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext.offnormal;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.baja.alarm.ext.offnormal.BTwoStateAlgorithm;
|
||||
import javax.baja.control.BEnumPoint;
|
||||
import javax.baja.status.BStatusEnum;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BDynamicEnum;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BEnumCommandFailureAlgorithm
|
||||
extends BTwoStateAlgorithm {
|
||||
public static final Property feedbackValue = BEnumCommandFailureAlgorithm.newProperty((int)8, (BValue)new BStatusEnum(), null);
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$offnormal$BEnumCommandFailureAlgorithm;
|
||||
|
||||
public BStatusEnum getFeedbackValue() {
|
||||
return (BStatusEnum)this.get(feedbackValue);
|
||||
}
|
||||
|
||||
public void setFeedbackValue(BStatusEnum bStatusEnum) {
|
||||
this.set(feedbackValue, (BValue)bStatusEnum, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean isGrandparentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BEnumPoint;
|
||||
}
|
||||
|
||||
public BFacets getSlotFacets(Slot slot) {
|
||||
if (slot == feedbackValue) {
|
||||
return this.getPointFacets();
|
||||
}
|
||||
return super.getSlotFacets(slot);
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
if (property == feedbackValue) {
|
||||
this.executePoint();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isNormal(BStatusValue bStatusValue) {
|
||||
BStatusEnum bStatusEnum = (BStatusEnum)bStatusValue;
|
||||
BDynamicEnum bDynamicEnum = bStatusEnum.getValue();
|
||||
BDynamicEnum bDynamicEnum2 = this.getFeedbackValue().getValue();
|
||||
boolean bl = false;
|
||||
if (bDynamicEnum.getOrdinal() == bDynamicEnum2.getOrdinal()) {
|
||||
bl = true;
|
||||
}
|
||||
boolean bl2 = bl;
|
||||
return bl2;
|
||||
}
|
||||
|
||||
public void writeAlarmData(BStatusValue bStatusValue, Map map) {
|
||||
map.put("status", BString.make((String)bStatusValue.getStatus().toString(null)));
|
||||
map.put("numericValue", BInteger.make((int)((BStatusEnum)bStatusValue).getValue().getOrdinal()));
|
||||
map.put("feedbackValue", BString.make((String)this.getFeedbackValue().valueToString((Context)this.getPointFacets())));
|
||||
map.put("feedbackNumeric", BInteger.make((int)this.getFeedbackValue().getEnum().getOrdinal()));
|
||||
}
|
||||
|
||||
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$alarm$ext$offnormal$BEnumCommandFailureAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$offnormal$BEnumCommandFailureAlgorithm = BEnumCommandFailureAlgorithm.class("[Ljavax.baja.alarm.ext.offnormal.BEnumCommandFailureAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,473 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.control.BNumericPoint
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.status.BStatusNumeric
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BDouble
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BFloat
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.units.BUnit
|
||||
* javax.baja.util.BFormat
|
||||
*/
|
||||
package javax.baja.alarm.ext.offnormal;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.baja.alarm.ext.BAlarmSourceExt;
|
||||
import javax.baja.alarm.ext.BAlarmState;
|
||||
import javax.baja.alarm.ext.BLimitEnable;
|
||||
import javax.baja.alarm.ext.BOffnormalAlgorithm;
|
||||
import javax.baja.control.BNumericPoint;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.status.BStatusNumeric;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BDouble;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BFloat;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.units.BUnit;
|
||||
import javax.baja.util.BFormat;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BOutOfRangeAlgorithm
|
||||
extends BOffnormalAlgorithm {
|
||||
public static final Property highLimit = BOutOfRangeAlgorithm.newProperty((int)0, (int)0, null);
|
||||
public static final Property lowLimit = BOutOfRangeAlgorithm.newProperty((int)0, (int)0, null);
|
||||
public static final Property deadband = BOutOfRangeAlgorithm.newProperty((int)0, (int)0, (BFacets)BFacets.make((String)"min", (BIDataValue)BFloat.make((float)0.0f)));
|
||||
public static final Property highLimitText = BOutOfRangeAlgorithm.newProperty((int)0, (BValue)BFormat.DEFAULT, (BFacets)BFacets.make((String)"multiLine", (BIDataValue)BBoolean.TRUE));
|
||||
public static final Property lowLimitText = BOutOfRangeAlgorithm.newProperty((int)0, (BValue)BFormat.DEFAULT, (BFacets)BFacets.make((String)"multiLine", (BIDataValue)BBoolean.TRUE));
|
||||
public static final Property limitEnable = BOutOfRangeAlgorithm.newProperty((int)0, (BValue)new BLimitEnable(), null);
|
||||
public static final Type TYPE;
|
||||
OutOfRangeState current;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$offnormal$BOutOfRangeAlgorithm;
|
||||
|
||||
public double getHighLimit() {
|
||||
return this.getDouble(highLimit);
|
||||
}
|
||||
|
||||
public void setHighLimit(double d) {
|
||||
this.setDouble(highLimit, d, null);
|
||||
}
|
||||
|
||||
public double getLowLimit() {
|
||||
return this.getDouble(lowLimit);
|
||||
}
|
||||
|
||||
public void setLowLimit(double d) {
|
||||
this.setDouble(lowLimit, d, null);
|
||||
}
|
||||
|
||||
public double getDeadband() {
|
||||
return this.getDouble(deadband);
|
||||
}
|
||||
|
||||
public void setDeadband(double d) {
|
||||
this.setDouble(deadband, d, null);
|
||||
}
|
||||
|
||||
public BFormat getHighLimitText() {
|
||||
return (BFormat)this.get(highLimitText);
|
||||
}
|
||||
|
||||
public void setHighLimitText(BFormat bFormat) {
|
||||
this.set(highLimitText, (BValue)bFormat, null);
|
||||
}
|
||||
|
||||
public BFormat getLowLimitText() {
|
||||
return (BFormat)this.get(lowLimitText);
|
||||
}
|
||||
|
||||
public void setLowLimitText(BFormat bFormat) {
|
||||
this.set(lowLimitText, (BValue)bFormat, null);
|
||||
}
|
||||
|
||||
public BLimitEnable getLimitEnable() {
|
||||
return (BLimitEnable)this.get(limitEnable);
|
||||
}
|
||||
|
||||
public void setLimitEnable(BLimitEnable bLimitEnable) {
|
||||
this.set(limitEnable, (BValue)bLimitEnable, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
private final boolean isHighLimitEnabled() {
|
||||
return this.getLimitEnable().isHighLimitEnabled();
|
||||
}
|
||||
|
||||
private final boolean isLowLimitEnabled() {
|
||||
return this.getLimitEnable().isLowLimitEnabled();
|
||||
}
|
||||
|
||||
public void started() {
|
||||
BAlarmState bAlarmState = ((BAlarmSourceExt)this.getParent()).getAlarmState();
|
||||
if (bAlarmState == BAlarmState.highLimit) {
|
||||
this.current = new HighAlarmState();
|
||||
}
|
||||
if (bAlarmState == BAlarmState.lowLimit) {
|
||||
this.current = new LowAlarmState();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isGrandparentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BNumericPoint;
|
||||
}
|
||||
|
||||
public BFacets getSlotFacets(Slot slot) {
|
||||
if (slot == highLimit || slot == lowLimit) {
|
||||
return this.getPointFacets();
|
||||
}
|
||||
if (slot == deadband) {
|
||||
BFacets bFacets = this.getPointFacets();
|
||||
BUnit bUnit = (BUnit)bFacets.getFacet("units");
|
||||
if (bUnit != null) {
|
||||
bFacets = BFacets.make((BFacets)bFacets, (String)"units", (BIDataValue)bUnit.getDifferentialUnit());
|
||||
}
|
||||
return BFacets.make((BFacets)bFacets, (BFacets)super.getSlotFacets((Slot)deadband));
|
||||
}
|
||||
return super.getSlotFacets(slot);
|
||||
}
|
||||
|
||||
public BAlarmState checkAlarms(BStatusValue bStatusValue, long l, long l2) {
|
||||
BStatusNumeric bStatusNumeric = (BStatusNumeric)bStatusValue;
|
||||
if (bStatusNumeric.getStatus().isNull()) {
|
||||
if (this.current instanceof NormalState) {
|
||||
return null;
|
||||
}
|
||||
if (l2 > 0L && this.current instanceof HighAlarmState) {
|
||||
this.current = new ValidateReturnFromHighState(l2);
|
||||
} else if (l2 > 0L && this.current instanceof LowAlarmState) {
|
||||
this.current = new ValidateReturnFromLowState(l2);
|
||||
} else {
|
||||
this.current = new NormalState();
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return this.evaluate(bStatusNumeric.getValue(), l, l2);
|
||||
}
|
||||
|
||||
private final BAlarmState evaluate(double d, long l, long l2) {
|
||||
BAlarmState bAlarmState = ((BAlarmSourceExt)this.getParent()).getAlarmState();
|
||||
if (!(this.current instanceof ValidationState)) {
|
||||
this.current = bAlarmState == BAlarmState.highLimit ? new HighAlarmState() : (bAlarmState == BAlarmState.lowLimit ? new LowAlarmState() : new NormalState());
|
||||
}
|
||||
return this.current.evaluate(d, l, l2);
|
||||
}
|
||||
|
||||
public void writeAlarmData(BStatusValue bStatusValue, Map map) {
|
||||
BFacets bFacets = this.getPointFacets();
|
||||
map.put("status", BString.make((String)bStatusValue.getStatus().toString(null)));
|
||||
map.put("deadband", BString.make((String)BDouble.toString((double)this.getDeadband(), (Context)bFacets)));
|
||||
if (this.current instanceof HighAlarmState) {
|
||||
if (!this.getHighLimitText().equals((Object)BFormat.DEFAULT)) {
|
||||
map.put("msgText", BString.make((String)this.getHighLimitText().getFormat()));
|
||||
}
|
||||
map.put("highLimit", BString.make((String)BDouble.toString((double)this.getHighLimit(), (Context)bFacets)));
|
||||
if (this.isLowLimitEnabled()) {
|
||||
map.put("lowLimit", BString.make((String)BDouble.toString((double)this.getLowLimit(), (Context)bFacets)));
|
||||
}
|
||||
} else if (this.current instanceof LowAlarmState) {
|
||||
if (!this.getLowLimitText().equals((Object)BFormat.DEFAULT)) {
|
||||
map.put("msgText", BString.make((String)this.getLowLimitText().getFormat()));
|
||||
}
|
||||
if (this.isHighLimitEnabled()) {
|
||||
map.put("highLimit", BString.make((String)BDouble.toString((double)this.getHighLimit(), (Context)bFacets)));
|
||||
}
|
||||
map.put("lowLimit", BString.make((String)BDouble.toString((double)this.getLowLimit(), (Context)bFacets)));
|
||||
}
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
this.executePoint();
|
||||
}
|
||||
|
||||
void transition(OutOfRangeState outOfRangeState) {
|
||||
this.current = outOfRangeState;
|
||||
}
|
||||
|
||||
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.current = new NormalState();
|
||||
}
|
||||
|
||||
public BOutOfRangeAlgorithm() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$ext$offnormal$BOutOfRangeAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$offnormal$BOutOfRangeAlgorithm = BOutOfRangeAlgorithm.class("[Ljavax.baja.alarm.ext.offnormal.BOutOfRangeAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class HighAlarmState
|
||||
extends OutOfRangeState {
|
||||
public String tag() {
|
||||
return "HighAlarmState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(double d, long l, long l2) {
|
||||
if (d >= BOutOfRangeAlgorithm.this.getHighLimit() - BOutOfRangeAlgorithm.this.getDeadband()) {
|
||||
if (!BOutOfRangeAlgorithm.this.isHighLimitEnabled()) {
|
||||
BOutOfRangeAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
} else if (d < BOutOfRangeAlgorithm.this.getLowLimit() && BOutOfRangeAlgorithm.this.isLowLimitEnabled()) {
|
||||
if (l == 0L) {
|
||||
BOutOfRangeAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
BOutOfRangeAlgorithm.this.transition(new ValidateReturnFromHighState(l));
|
||||
} else if (d < BOutOfRangeAlgorithm.this.getHighLimit() - BOutOfRangeAlgorithm.this.getDeadband()) {
|
||||
if (l2 == 0L) {
|
||||
BOutOfRangeAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
BOutOfRangeAlgorithm.this.transition(new ValidateReturnFromHighState(l2));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class LowAlarmState
|
||||
extends OutOfRangeState {
|
||||
public String tag() {
|
||||
return "LowAlarmState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(double d, long l, long l2) {
|
||||
if (d <= BOutOfRangeAlgorithm.this.getLowLimit() + BOutOfRangeAlgorithm.this.getDeadband()) {
|
||||
if (!BOutOfRangeAlgorithm.this.isLowLimitEnabled()) {
|
||||
BOutOfRangeAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
} else if (d > BOutOfRangeAlgorithm.this.getHighLimit() && BOutOfRangeAlgorithm.this.isHighLimitEnabled()) {
|
||||
if (l2 == 0L) {
|
||||
BOutOfRangeAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
BOutOfRangeAlgorithm.this.transition(new ValidateReturnFromLowState(l2));
|
||||
} else if (d > BOutOfRangeAlgorithm.this.getLowLimit() + BOutOfRangeAlgorithm.this.getDeadband()) {
|
||||
if (l2 == 0L) {
|
||||
BOutOfRangeAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
BOutOfRangeAlgorithm.this.transition(new ValidateReturnFromLowState(l2));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class NormalState
|
||||
extends OutOfRangeState {
|
||||
public String tag() {
|
||||
return "Normal";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(double d, long l, long l2) {
|
||||
if (d < BOutOfRangeAlgorithm.this.getLowLimit() && BOutOfRangeAlgorithm.this.isLowLimitEnabled()) {
|
||||
if (l == 0L) {
|
||||
BOutOfRangeAlgorithm.this.transition(new LowAlarmState());
|
||||
return BAlarmState.lowLimit;
|
||||
}
|
||||
BOutOfRangeAlgorithm.this.transition(new ValidateLowAlarmState(l));
|
||||
} else if ((!(d >= BOutOfRangeAlgorithm.this.getLowLimit()) || !(d <= BOutOfRangeAlgorithm.this.getHighLimit())) && d > BOutOfRangeAlgorithm.this.getHighLimit() && BOutOfRangeAlgorithm.this.isHighLimitEnabled()) {
|
||||
if (l == 0L) {
|
||||
BOutOfRangeAlgorithm.this.transition(new HighAlarmState());
|
||||
return BAlarmState.highLimit;
|
||||
}
|
||||
BOutOfRangeAlgorithm.this.transition(new ValidateHighAlarmState(l));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class ValidateReturnFromHighState
|
||||
extends ValidationState {
|
||||
public String tag() {
|
||||
return "ValidateReturnFromHighState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(double d, long l, long l2) {
|
||||
if (l2 > 0L && !BOutOfRangeAlgorithm.this.isTimerExpired()) {
|
||||
return null;
|
||||
}
|
||||
if (d > BOutOfRangeAlgorithm.this.getHighLimit() - BOutOfRangeAlgorithm.this.getDeadband() && BOutOfRangeAlgorithm.this.isHighLimitEnabled()) {
|
||||
BOutOfRangeAlgorithm.this.transition(new HighAlarmState());
|
||||
} else if (d < BOutOfRangeAlgorithm.this.getHighLimit() - BOutOfRangeAlgorithm.this.getDeadband() && BOutOfRangeAlgorithm.this.isTimerExpired()) {
|
||||
BOutOfRangeAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ValidateReturnFromHighState(long l) {
|
||||
BOutOfRangeAlgorithm.this.startTimer(l);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class ValidateReturnFromLowState
|
||||
extends ValidationState {
|
||||
public String tag() {
|
||||
return "ValidateReturnFromLowState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(double d, long l, long l2) {
|
||||
if (d <= BOutOfRangeAlgorithm.this.getLowLimit() + BOutOfRangeAlgorithm.this.getDeadband() && BOutOfRangeAlgorithm.this.isLowLimitEnabled()) {
|
||||
BOutOfRangeAlgorithm.this.transition(new LowAlarmState());
|
||||
} else if (d > BOutOfRangeAlgorithm.this.getLowLimit() + BOutOfRangeAlgorithm.this.getDeadband() && BOutOfRangeAlgorithm.this.isTimerExpired()) {
|
||||
BOutOfRangeAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ValidateReturnFromLowState(long l) {
|
||||
BOutOfRangeAlgorithm.this.startTimer(l);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private abstract class ValidationState
|
||||
extends OutOfRangeState {
|
||||
private ValidationState() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private abstract class OutOfRangeState {
|
||||
public abstract String tag();
|
||||
|
||||
public abstract BAlarmState evaluate(double var1, long var3, long var5);
|
||||
|
||||
public OutOfRangeState() {
|
||||
BOutOfRangeAlgorithm.this.cancelTimer();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class ValidateLowAlarmState
|
||||
extends ValidationState {
|
||||
public String tag() {
|
||||
return "ValidateLowAlarmState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(double d, long l, long l2) {
|
||||
if (d < BOutOfRangeAlgorithm.this.getLowLimit() && BOutOfRangeAlgorithm.this.isLowLimitEnabled()) {
|
||||
if (BOutOfRangeAlgorithm.this.isTimerExpired()) {
|
||||
BOutOfRangeAlgorithm.this.transition(new LowAlarmState());
|
||||
return BAlarmState.lowLimit;
|
||||
}
|
||||
} else if (d > BOutOfRangeAlgorithm.this.getHighLimit() && BOutOfRangeAlgorithm.this.isHighLimitEnabled()) {
|
||||
if (l == 0L) {
|
||||
BOutOfRangeAlgorithm.this.transition(new HighAlarmState());
|
||||
return BAlarmState.highLimit;
|
||||
}
|
||||
BOutOfRangeAlgorithm.this.transition(new ValidateHighAlarmState(l));
|
||||
} else if (d >= BOutOfRangeAlgorithm.this.getLowLimit()) {
|
||||
BOutOfRangeAlgorithm.this.transition(new NormalState());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ValidateLowAlarmState(long l) {
|
||||
BOutOfRangeAlgorithm.this.startTimer(l);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class ValidateHighAlarmState
|
||||
extends ValidationState {
|
||||
public String tag() {
|
||||
return "ValidateHighAlarmState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(double d, long l, long l2) {
|
||||
if (d < BOutOfRangeAlgorithm.this.getLowLimit() && BOutOfRangeAlgorithm.this.isLowLimitEnabled()) {
|
||||
if (l == 0L) {
|
||||
BOutOfRangeAlgorithm.this.transition(new LowAlarmState());
|
||||
return BAlarmState.lowLimit;
|
||||
}
|
||||
BOutOfRangeAlgorithm.this.transition(new ValidateLowAlarmState(l));
|
||||
} else if (d > BOutOfRangeAlgorithm.this.getHighLimit() && BOutOfRangeAlgorithm.this.isHighLimitEnabled()) {
|
||||
if (BOutOfRangeAlgorithm.this.isTimerExpired()) {
|
||||
BOutOfRangeAlgorithm.this.transition(new HighAlarmState());
|
||||
return BAlarmState.highLimit;
|
||||
}
|
||||
} else if (d <= BOutOfRangeAlgorithm.this.getHighLimit()) {
|
||||
BOutOfRangeAlgorithm.this.transition(new NormalState());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ValidateHighAlarmState(long l) {
|
||||
BOutOfRangeAlgorithm.this.startTimer(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.status.BStatus
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.BInteger
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext.offnormal;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.baja.alarm.ext.offnormal.BTwoStateAlgorithm;
|
||||
import javax.baja.status.BStatus;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BString;
|
||||
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;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BStatusAlgorithm
|
||||
extends BTwoStateAlgorithm {
|
||||
public static final Property alarmValues = BStatusAlgorithm.newProperty((int)0, (BValue)BStatus.ok, null);
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$offnormal$BStatusAlgorithm;
|
||||
|
||||
public BStatus getAlarmValues() {
|
||||
return (BStatus)this.get(alarmValues);
|
||||
}
|
||||
|
||||
public void setAlarmValues(BStatus bStatus) {
|
||||
this.set(alarmValues, (BValue)bStatus, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
this.executePoint();
|
||||
}
|
||||
|
||||
public void writeAlarmData(BStatusValue bStatusValue, Map map) {
|
||||
map.put("status", BString.make((String)bStatusValue.getStatus().toString(null)));
|
||||
if (!this.isNormal(bStatusValue)) {
|
||||
map.put("offnormalValue", BString.make((String)bStatusValue.getStatus().toString(null)));
|
||||
}
|
||||
map.put("numericValue", BInteger.make((int)bStatusValue.getStatus().getBits()));
|
||||
map.put("presentValue", BString.make((String)bStatusValue.getStatus().toString(null)));
|
||||
}
|
||||
|
||||
protected boolean isNormal(BStatusValue bStatusValue) {
|
||||
boolean bl = false;
|
||||
if ((bStatusValue.getStatus().getBits() & this.getAlarmValues().getBits()) == 0) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$ext$offnormal$BStatusAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$offnormal$BStatusAlgorithm = BStatusAlgorithm.class("[Ljavax.baja.alarm.ext.offnormal.BStatusAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.control.BStringPoint
|
||||
* javax.baja.status.BStatusString
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* org.apache.oro.text.regex.MalformedPatternException
|
||||
* org.apache.oro.text.regex.Pattern
|
||||
* org.apache.oro.text.regex.PatternMatcher
|
||||
* org.apache.oro.text.regex.Perl5Compiler
|
||||
* org.apache.oro.text.regex.Perl5Matcher
|
||||
*/
|
||||
package javax.baja.alarm.ext.offnormal;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.baja.alarm.ext.offnormal.BTwoStateAlgorithm;
|
||||
import javax.baja.control.BStringPoint;
|
||||
import javax.baja.status.BStatusString;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import org.apache.oro.text.regex.MalformedPatternException;
|
||||
import org.apache.oro.text.regex.Pattern;
|
||||
import org.apache.oro.text.regex.PatternMatcher;
|
||||
import org.apache.oro.text.regex.Perl5Compiler;
|
||||
import org.apache.oro.text.regex.Perl5Matcher;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BStringChangeOfStateAlgorithm
|
||||
extends BTwoStateAlgorithm {
|
||||
public static final Property expression = BStringChangeOfStateAlgorithm.newProperty((int)0, (String)".*", null);
|
||||
public static final Property normalOnMatch = BStringChangeOfStateAlgorithm.newProperty((int)0, (boolean)true, null);
|
||||
public static final Property caseSensitive = BStringChangeOfStateAlgorithm.newProperty((int)0, (boolean)true, null);
|
||||
public static final Type TYPE;
|
||||
private PatternMatcher matcher;
|
||||
private Pattern pattern;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$offnormal$BStringChangeOfStateAlgorithm;
|
||||
|
||||
public String getExpression() {
|
||||
return this.getString(expression);
|
||||
}
|
||||
|
||||
public void setExpression(String string) {
|
||||
this.setString(expression, string, null);
|
||||
}
|
||||
|
||||
public boolean getNormalOnMatch() {
|
||||
return this.getBoolean(normalOnMatch);
|
||||
}
|
||||
|
||||
public void setNormalOnMatch(boolean bl) {
|
||||
this.setBoolean(normalOnMatch, bl, null);
|
||||
}
|
||||
|
||||
public boolean getCaseSensitive() {
|
||||
return this.getBoolean(caseSensitive);
|
||||
}
|
||||
|
||||
public void setCaseSensitive(boolean bl) {
|
||||
this.setBoolean(caseSensitive, bl, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean isGrandparentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BStringPoint;
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
if (property.equals((Object)expression) || property.equals((Object)caseSensitive)) {
|
||||
this.init();
|
||||
}
|
||||
this.executePoint();
|
||||
}
|
||||
|
||||
public void started() {
|
||||
this.init();
|
||||
super.started();
|
||||
}
|
||||
|
||||
private final void init() {
|
||||
this.matcher = new Perl5Matcher();
|
||||
Perl5Compiler perl5Compiler = new Perl5Compiler();
|
||||
int n = 16;
|
||||
if (!this.getCaseSensitive()) {
|
||||
n |= 1;
|
||||
}
|
||||
try {
|
||||
this.pattern = perl5Compiler.compile(this.getExpression(), n);
|
||||
}
|
||||
catch (MalformedPatternException malformedPatternException) {
|
||||
log.error("Invalid expression: '" + this.getExpression() + '\'', (Throwable)malformedPatternException);
|
||||
this.pattern = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isNormal(BStatusValue bStatusValue) {
|
||||
BStatusString bStatusString = (BStatusString)bStatusValue;
|
||||
if (bStatusString.getStatus().isNull()) {
|
||||
return true;
|
||||
}
|
||||
if (this.pattern == null) {
|
||||
return true;
|
||||
}
|
||||
if (this.getNormalOnMatch()) {
|
||||
return this.matcher.contains(bStatusString.getValue().toString(), this.pattern);
|
||||
}
|
||||
return this.matcher.contains(bStatusString.getValue().toString(), this.pattern) ^ true;
|
||||
}
|
||||
|
||||
public void writeAlarmData(BStatusValue bStatusValue, Map map) {
|
||||
map.put("status", BString.make((String)bStatusValue.getStatus().toString(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());
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.matcher = new Perl5Matcher();
|
||||
}
|
||||
|
||||
public BStringChangeOfStateAlgorithm() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$ext$offnormal$BStringChangeOfStateAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$offnormal$BStringChangeOfStateAlgorithm = BStringChangeOfStateAlgorithm.class("[Ljavax.baja.alarm.ext.offnormal.BStringChangeOfStateAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
}
|
||||
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.control.BStringPoint
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.status.BStatusString
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* org.apache.oro.text.regex.MalformedPatternException
|
||||
* org.apache.oro.text.regex.Pattern
|
||||
* org.apache.oro.text.regex.PatternMatcher
|
||||
* org.apache.oro.text.regex.Perl5Compiler
|
||||
* org.apache.oro.text.regex.Perl5Matcher
|
||||
*/
|
||||
package javax.baja.alarm.ext.offnormal;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.baja.alarm.ext.fault.BTwoStateFaultAlgorithm;
|
||||
import javax.baja.control.BStringPoint;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.status.BStatusString;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import org.apache.oro.text.regex.MalformedPatternException;
|
||||
import org.apache.oro.text.regex.Pattern;
|
||||
import org.apache.oro.text.regex.PatternMatcher;
|
||||
import org.apache.oro.text.regex.Perl5Compiler;
|
||||
import org.apache.oro.text.regex.Perl5Matcher;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BStringChangeOfStateFaultAlgorithm
|
||||
extends BTwoStateFaultAlgorithm {
|
||||
public static final Property expression = BStringChangeOfStateFaultAlgorithm.newProperty((int)0, (String)".*", null);
|
||||
public static final Property normalOnMatch = BStringChangeOfStateFaultAlgorithm.newProperty((int)0, (boolean)true, null);
|
||||
public static final Property caseSensitive = BStringChangeOfStateFaultAlgorithm.newProperty((int)0, (boolean)true, null);
|
||||
public static final Type TYPE;
|
||||
protected static Log log;
|
||||
private PatternMatcher matcher;
|
||||
private Pattern pattern;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$offnormal$BStringChangeOfStateFaultAlgorithm;
|
||||
|
||||
public String getExpression() {
|
||||
return this.getString(expression);
|
||||
}
|
||||
|
||||
public void setExpression(String string) {
|
||||
this.setString(expression, string, null);
|
||||
}
|
||||
|
||||
public boolean getNormalOnMatch() {
|
||||
return this.getBoolean(normalOnMatch);
|
||||
}
|
||||
|
||||
public void setNormalOnMatch(boolean bl) {
|
||||
this.setBoolean(normalOnMatch, bl, null);
|
||||
}
|
||||
|
||||
public boolean getCaseSensitive() {
|
||||
return this.getBoolean(caseSensitive);
|
||||
}
|
||||
|
||||
public void setCaseSensitive(boolean bl) {
|
||||
this.setBoolean(caseSensitive, bl, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean isGrandparentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BStringPoint;
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
super.changed(property, context);
|
||||
if (!this.isRunning()) {
|
||||
return;
|
||||
}
|
||||
if (property.equals((Object)expression) || property.equals((Object)caseSensitive)) {
|
||||
this.init();
|
||||
}
|
||||
this.executePoint();
|
||||
}
|
||||
|
||||
public void started() {
|
||||
this.init();
|
||||
super.started();
|
||||
}
|
||||
|
||||
private final void init() {
|
||||
this.matcher = new Perl5Matcher();
|
||||
Perl5Compiler perl5Compiler = new Perl5Compiler();
|
||||
int n = 16;
|
||||
if (!this.getCaseSensitive()) {
|
||||
n |= 1;
|
||||
}
|
||||
try {
|
||||
this.pattern = perl5Compiler.compile(this.getExpression(), n);
|
||||
}
|
||||
catch (MalformedPatternException malformedPatternException) {
|
||||
log.error("Invalid expression: '" + this.getExpression() + '\'', (Throwable)malformedPatternException);
|
||||
this.pattern = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isNormal(BStatusValue bStatusValue) {
|
||||
BStatusString bStatusString = (BStatusString)bStatusValue;
|
||||
if (bStatusString.getStatus().isNull()) {
|
||||
return true;
|
||||
}
|
||||
if (this.pattern == null) {
|
||||
return true;
|
||||
}
|
||||
if (this.getNormalOnMatch()) {
|
||||
return this.matcher.contains(bStatusString.getValue().toString(), this.pattern);
|
||||
}
|
||||
return this.matcher.contains(bStatusString.getValue().toString(), this.pattern) ^ true;
|
||||
}
|
||||
|
||||
public void writeAlarmData(BStatusValue bStatusValue, Map map) {
|
||||
map.put("status", BString.make((String)bStatusValue.getStatus().toString(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());
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.matcher = new Perl5Matcher();
|
||||
}
|
||||
|
||||
public BStringChangeOfStateFaultAlgorithm() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$ext$offnormal$BStringChangeOfStateFaultAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$offnormal$BStringChangeOfStateFaultAlgorithm = BStringChangeOfStateFaultAlgorithm.class("[Ljavax.baja.alarm.ext.offnormal.BStringChangeOfStateFaultAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
log = Log.getLog((String)"control");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.status.BStatusValue
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package javax.baja.alarm.ext.offnormal;
|
||||
|
||||
import javax.baja.alarm.ext.BAlarmSourceExt;
|
||||
import javax.baja.alarm.ext.BAlarmState;
|
||||
import javax.baja.alarm.ext.BOffnormalAlgorithm;
|
||||
import javax.baja.status.BStatusValue;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BTwoStateAlgorithm
|
||||
extends BOffnormalAlgorithm {
|
||||
public static final Type TYPE;
|
||||
TwoState current;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$ext$offnormal$BTwoStateAlgorithm;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void started() {
|
||||
BAlarmState bAlarmState = ((BAlarmSourceExt)this.getParent()).getAlarmState();
|
||||
if (bAlarmState == BAlarmState.offnormal) {
|
||||
this.current = new OffnormalState();
|
||||
}
|
||||
}
|
||||
|
||||
public BAlarmState checkAlarms(BStatusValue bStatusValue, long l, long l2) {
|
||||
BAlarmState bAlarmState = ((BAlarmSourceExt)this.getParent()).getAlarmState();
|
||||
if (this.current instanceof ValidateOffnormalState) {
|
||||
return this.current.evaluate(this.isNormal(bStatusValue), l);
|
||||
}
|
||||
if (this.current instanceof ValidateReturnFromOffnormalState) {
|
||||
return this.current.evaluate(this.isNormal(bStatusValue), l2);
|
||||
}
|
||||
if (bAlarmState == BAlarmState.offnormal) {
|
||||
this.current = new OffnormalState();
|
||||
return this.current.evaluate(this.isNormal(bStatusValue), l2);
|
||||
}
|
||||
this.current = new NormalState();
|
||||
return this.current.evaluate(this.isNormal(bStatusValue), l);
|
||||
}
|
||||
|
||||
protected abstract boolean isNormal(BStatusValue var1);
|
||||
|
||||
protected boolean isCurrentOffnormal() {
|
||||
return this.current instanceof OffnormalState;
|
||||
}
|
||||
|
||||
private final void transition(TwoState twoState) {
|
||||
this.current = twoState;
|
||||
}
|
||||
|
||||
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.current = new NormalState();
|
||||
}
|
||||
|
||||
public BTwoStateAlgorithm() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$alarm$ext$offnormal$BTwoStateAlgorithm;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$alarm$ext$offnormal$BTwoStateAlgorithm = BTwoStateAlgorithm.class("[Ljavax.baja.alarm.ext.offnormal.BTwoStateAlgorithm;", false);
|
||||
}
|
||||
TYPE = Sys.loadType((Class)clazz);
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class OffnormalState
|
||||
extends TwoState {
|
||||
public String tag() {
|
||||
return "OffnormalState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(boolean bl, long l) {
|
||||
if (bl) {
|
||||
if (l == 0L) {
|
||||
BTwoStateAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
BTwoStateAlgorithm.this.transition(new ValidateReturnFromOffnormalState(l));
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private OffnormalState() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class ValidateOffnormalState
|
||||
extends ValidateState {
|
||||
public String tag() {
|
||||
return "ValidateOffnormalState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(boolean bl, long l) {
|
||||
if (bl) {
|
||||
BTwoStateAlgorithm.this.transition(new NormalState());
|
||||
return null;
|
||||
}
|
||||
if (BTwoStateAlgorithm.this.isTimerExpired()) {
|
||||
BTwoStateAlgorithm.this.transition(new OffnormalState());
|
||||
return BAlarmState.offnormal;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ValidateOffnormalState(long l) {
|
||||
BTwoStateAlgorithm.this.startTimer(l);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private abstract class TwoState {
|
||||
public abstract String tag();
|
||||
|
||||
public abstract BAlarmState evaluate(boolean var1, long var2);
|
||||
|
||||
public TwoState() {
|
||||
BTwoStateAlgorithm.this.cancelTimer();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class ValidateReturnFromOffnormalState
|
||||
extends ValidateState {
|
||||
public String tag() {
|
||||
return "ValidateReturnFromOffnormalState";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(boolean bl, long l) {
|
||||
if (bl) {
|
||||
if (BTwoStateAlgorithm.this.isTimerExpired()) {
|
||||
BTwoStateAlgorithm.this.transition(new NormalState());
|
||||
return BAlarmState.normal;
|
||||
}
|
||||
} else {
|
||||
BTwoStateAlgorithm.this.transition(new OffnormalState());
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ValidateReturnFromOffnormalState(long l) {
|
||||
BTwoStateAlgorithm.this.startTimer(l);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private class NormalState
|
||||
extends TwoState {
|
||||
public String tag() {
|
||||
return "Normal";
|
||||
}
|
||||
|
||||
public BAlarmState evaluate(boolean bl, long l) {
|
||||
if (!bl) {
|
||||
if (l == 0L) {
|
||||
BTwoStateAlgorithm.this.transition(new OffnormalState());
|
||||
return BAlarmState.offnormal;
|
||||
}
|
||||
BTwoStateAlgorithm.this.transition(new ValidateOffnormalState(l));
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private NormalState() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
private abstract class ValidateState
|
||||
extends TwoState {
|
||||
private ValidateState() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user