link start!

This commit is contained in:
cherubin
2026-03-17 13:31:18 -07:00
commit 08abe87cfb
5910 changed files with 386288 additions and 0 deletions
@@ -0,0 +1,147 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.agent;
import javax.baja.agent.AgentInfo;
import javax.baja.registry.TypeInfo;
import javax.baja.security.BPermissions;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public abstract class AgentFilter {
public abstract boolean include(AgentInfo var1);
public static AgentFilter is(String string) {
return AgentFilter.is(Sys.getRegistry().getType(string));
}
public static AgentFilter is(Type type) {
return AgentFilter.is(type.getTypeInfo());
}
public static AgentFilter is(TypeInfo typeInfo) {
return new IsFilter(typeInfo);
}
public static AgentFilter not(AgentFilter agentFilter) {
return new NotFilter(agentFilter);
}
public static AgentFilter has(BPermissions bPermissions) {
return new HasFilter(bPermissions);
}
public static AgentFilter and(AgentFilter agentFilter, AgentFilter agentFilter2) {
return new AndFilter(agentFilter, agentFilter2);
}
public static AgentFilter and(AgentFilter agentFilter, BPermissions bPermissions) {
return AgentFilter.and(agentFilter, AgentFilter.has(bPermissions));
}
public static AgentFilter or(AgentFilter agentFilter, AgentFilter agentFilter2) {
return new OrFilter(agentFilter, agentFilter2, null, null);
}
public static AgentFilter or(AgentFilter agentFilter, AgentFilter agentFilter2, AgentFilter agentFilter3) {
return new OrFilter(agentFilter, agentFilter2, agentFilter3, null);
}
public static AgentFilter or(AgentFilter agentFilter, AgentFilter agentFilter2, AgentFilter agentFilter3, AgentFilter agentFilter4) {
return new OrFilter(agentFilter, agentFilter2, agentFilter3, agentFilter4);
}
static class IsFilter
extends AgentFilter {
TypeInfo t;
public final boolean include(AgentInfo agentInfo) {
return agentInfo.getAgentType().is(this.t);
}
IsFilter(TypeInfo typeInfo) {
this.t = typeInfo;
}
}
static class NotFilter
extends AgentFilter {
AgentFilter f;
public final boolean include(AgentInfo agentInfo) {
return this.f.include(agentInfo) ^ true;
}
NotFilter(AgentFilter agentFilter) {
this.f = agentFilter;
}
}
static class HasFilter
extends AgentFilter {
BPermissions p;
public final boolean include(AgentInfo agentInfo) {
try {
return this.p.has(agentInfo.getRequiredPermissions());
}
catch (Exception exception) {
exception.printStackTrace();
return false;
}
}
HasFilter(BPermissions bPermissions) {
this.p = bPermissions;
}
}
static class AndFilter
extends AgentFilter {
AgentFilter f1;
AgentFilter f2;
public final boolean include(AgentInfo agentInfo) {
boolean bl = false;
if (this.f1.include(agentInfo) && this.f2.include(agentInfo)) {
bl = true;
}
return bl;
}
AndFilter(AgentFilter agentFilter, AgentFilter agentFilter2) {
this.f1 = agentFilter;
this.f2 = agentFilter2;
}
}
static class OrFilter
extends AgentFilter {
AgentFilter f1;
AgentFilter f2;
AgentFilter f3;
AgentFilter f4;
public final boolean include(AgentInfo agentInfo) {
if (this.f1 != null && this.f1.include(agentInfo)) {
return true;
}
if (this.f2 != null && this.f2.include(agentInfo)) {
return true;
}
if (this.f3 != null && this.f3.include(agentInfo)) {
return true;
}
return this.f4 != null && this.f4.include(agentInfo);
}
OrFilter(AgentFilter agentFilter, AgentFilter agentFilter2, AgentFilter agentFilter3, AgentFilter agentFilter4) {
this.f1 = agentFilter;
this.f2 = agentFilter2;
this.f3 = agentFilter3;
this.f4 = agentFilter4;
}
}
}
@@ -0,0 +1,29 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.agent;
import javax.baja.registry.TypeInfo;
import javax.baja.security.BPermissions;
import javax.baja.sys.BIcon;
import javax.baja.sys.BObject;
import javax.baja.sys.Context;
public interface AgentInfo {
public BObject getInstance();
public String getAgentId();
public TypeInfo getAgentType();
public String getAppName();
public TypeInfo[] getAgentOn();
public String getDisplayName(Context var1);
public BIcon getIcon(Context var1);
public BPermissions getRequiredPermissions();
}
@@ -0,0 +1,58 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.agent;
import javax.baja.agent.AgentFilter;
import javax.baja.agent.AgentInfo;
public interface AgentList {
public int size();
public AgentInfo getDefault();
public AgentInfo get(int var1);
public AgentInfo get(String var1);
public AgentInfo[] list();
public int indexOf(String var1);
public int indexOf(AgentInfo var1);
public Object clone();
public AgentList filter(AgentFilter var1);
public void add(String var1);
public void add(AgentInfo var1);
public void add(int var1, String var2);
public void add(int var1, AgentInfo var2);
public void remove(String var1);
public void remove(AgentInfo var1);
public void remove(int var1);
public void remove(AgentList var1);
public void toTop(String var1);
public void toTop(AgentInfo var1);
public void toTop(int var1);
public void toBottom(String var1);
public void toBottom(AgentInfo var1);
public void toBottom(int var1);
public void swap(int var1, int var2);
}
@@ -0,0 +1,118 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.agent;
import javax.baja.agent.AgentInfo;
import javax.baja.agent.BIAgent;
import javax.baja.registry.TypeInfo;
import javax.baja.security.BPermissions;
import javax.baja.sys.BFacets;
import javax.baja.sys.BIcon;
import javax.baja.sys.BObject;
import javax.baja.sys.BStruct;
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;
import javax.baja.util.BTypeSpec;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BAbstractPxView
extends BStruct
implements AgentInfo,
BIAgent {
public static final Property icon = BAbstractPxView.newProperty(0, BIcon.std("views/view.png"), null);
public static final Property requiredPermissions = BAbstractPxView.newProperty(0, BPermissions.operatorRead, null);
public static final Property media = BAbstractPxView.newProperty(0, BTypeSpec.make("workbench:WbPxMedia"), BFacets.make("targetType", "bajaui:PxMedia"));
public static final Type TYPE;
static TypeInfo[] emptyTypeInfo;
static /* synthetic */ Class class$javax$baja$agent$BAbstractPxView;
public BIcon getIcon() {
return (BIcon)this.get(icon);
}
public void setIcon(BIcon bIcon) {
this.set(icon, (BValue)bIcon, null);
}
public BPermissions getRequiredPermissions() {
return (BPermissions)this.get(requiredPermissions);
}
public void setRequiredPermissions(BPermissions bPermissions) {
this.set(requiredPermissions, (BValue)bPermissions, null);
}
public BTypeSpec getMedia() {
return (BTypeSpec)this.get(media);
}
public void setMedia(BTypeSpec bTypeSpec) {
this.set(media, (BValue)bTypeSpec, null);
}
public Type getType() {
return TYPE;
}
public BObject getInstance() {
return this;
}
public String getAgentId() {
return this.getName();
}
public TypeInfo getAgentType() {
return this.getType().getTypeInfo();
}
public String getAppName() {
return null;
}
public TypeInfo[] getAgentOn() {
return emptyTypeInfo;
}
public BIcon getIcon(Context context) {
return this.getIcon();
}
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 BAbstractPxView(BIcon bIcon, BPermissions bPermissions, BTypeSpec bTypeSpec) {
this.setIcon(bIcon);
this.setRequiredPermissions(bPermissions);
this.setMedia(bTypeSpec);
}
public BAbstractPxView() {
}
static {
Class clazz = class$javax$baja$agent$BAbstractPxView;
if (clazz == null) {
clazz = class$javax$baja$agent$BAbstractPxView = BAbstractPxView.class("[Ljavax.baja.agent.BAbstractPxView;", false);
}
TYPE = Sys.loadType(clazz);
emptyTypeInfo = new TypeInfo[0];
}
}
@@ -0,0 +1,61 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.agent;
import javax.baja.agent.BAbstractPxView;
import javax.baja.naming.OrdTarget;
import javax.baja.security.BPermissions;
import javax.baja.sys.BIcon;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.BTypeSpec;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BDynamicPxView
extends BAbstractPxView {
public static final Type TYPE;
static /* synthetic */ Class class$javax$baja$agent$BDynamicPxView;
public Type getType() {
return TYPE;
}
public abstract String generateXml(Object var1, Context var2);
public String getUniqueId(OrdTarget ordTarget) {
return ordTarget.getOrd().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 BDynamicPxView(BIcon bIcon, BPermissions bPermissions, BTypeSpec bTypeSpec) {
super(bIcon, bPermissions, bTypeSpec);
}
public BDynamicPxView() {
}
static {
Class clazz = class$javax$baja$agent$BDynamicPxView;
if (clazz == null) {
clazz = class$javax$baja$agent$BDynamicPxView = BDynamicPxView.class("[Ljavax.baja.agent.BDynamicPxView;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,22 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.agent;
import javax.baja.sys.BInterface;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIAgent
extends BInterface {
public static final Type TYPE;
static {
Class clazz = 1.class$javax$baja$agent$BIAgent;
if (clazz == null) {
clazz = 1.class$javax$baja$agent$BIAgent = 1.class("[Ljavax.baja.agent.BIAgent;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,71 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.agent;
import javax.baja.agent.BAbstractPxView;
import javax.baja.naming.BOrd;
import javax.baja.security.BPermissions;
import javax.baja.sys.BFacets;
import javax.baja.sys.BIcon;
import javax.baja.sys.BValue;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.BTypeSpec;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPxView
extends BAbstractPxView {
public static final Property pxFile = BPxView.newProperty(0, BOrd.NULL, BFacets.make("targetType", "file:PxFile"));
public static final Type TYPE;
static /* synthetic */ Class class$javax$baja$agent$BPxView;
public BOrd getPxFile() {
return (BOrd)this.get(pxFile);
}
public void setPxFile(BOrd bOrd) {
this.set(pxFile, (BValue)bOrd, 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());
}
}
public BPxView(BIcon bIcon, BOrd bOrd, BPermissions bPermissions, BTypeSpec bTypeSpec) {
super(bIcon, bPermissions, bTypeSpec);
this.setPxFile(bOrd);
}
public BPxView(BOrd bOrd) {
this.setPxFile(bOrd);
}
public BPxView() {
}
static {
Class clazz = class$javax$baja$agent$BPxView;
if (clazz == null) {
clazz = class$javax$baja$agent$BPxView = BPxView.class("[Ljavax.baja.agent.BPxView;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,25 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.agent;
import javax.baja.sys.BajaRuntimeException;
public class NoSuchAgentException
extends BajaRuntimeException {
public NoSuchAgentException(String string, Throwable throwable) {
super(string, throwable);
}
public NoSuchAgentException(String string) {
super(string);
}
public NoSuchAgentException(Throwable throwable) {
super(throwable);
}
public NoSuchAgentException() {
}
}
@@ -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;
}
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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() {
}
}
}
@@ -0,0 +1,109 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.category;
import javax.baja.category.BCategoryMode;
import javax.baja.category.BCategoryService;
import javax.baja.status.BIStatus;
import javax.baja.status.BStatus;
import javax.baja.sys.BComponent;
import javax.baja.sys.BFacets;
import javax.baja.sys.BIcon;
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 final class BCategory
extends BComponent
implements BIStatus {
public static final Property status = BCategory.newProperty(3, BStatus.disabled, null);
public static final Property index = BCategory.newProperty(64, 0, BFacets.makeInt(0, 100));
public static final Property mode = BCategory.newProperty(0, BCategoryMode.union, null);
public static final Property faultCause = BCategory.newProperty(3, "", null);
public static final Type TYPE;
private static final BIcon icon;
static /* synthetic */ Class class$javax$baja$category$BCategory;
public final BStatus getStatus() {
return (BStatus)this.get(status);
}
public final void setStatus(BStatus bStatus) {
this.set(status, (BValue)bStatus, null);
}
public final int getIndex() {
return this.getInt(index);
}
public final void setIndex(int n) {
this.setInt(index, n, null);
}
public final BCategoryMode getMode() {
return (BCategoryMode)this.get(mode);
}
public final void setMode(BCategoryMode bCategoryMode) {
this.set(mode, (BValue)bCategoryMode, null);
}
public final String getFaultCause() {
return this.getString(faultCause);
}
public final void setFaultCause(String string) {
this.setString(faultCause, string, null);
}
public final Type getType() {
return TYPE;
}
public final void changed(Property property, Context context) {
super.changed(property, context);
if (!this.isRunning()) {
return;
}
if (property == index && this.getParent() instanceof BCategoryService) {
((BCategoryService)this.getParent()).rebuildLookup();
}
}
public final String toString(Context context) {
return this.getDisplayName(context) + '[' + this.getIndex() + ']';
}
public final 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$category$BCategory;
if (clazz == null) {
clazz = class$javax$baja$category$BCategory = BCategory.class("[Ljavax.baja.category.BCategory;", false);
}
TYPE = Sys.loadType(clazz);
icon = BIcon.std("category.png");
}
}
@@ -0,0 +1,345 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.category;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.HashMap;
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;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public final class BCategoryMask
extends BSimple {
static HashMap cache = new HashMap();
public static final BCategoryMask NULL = new BCategoryMask("");
public static final BCategoryMask WILDCARD;
public static final BCategoryMask DEFAULT;
public static final Type TYPE;
private String hex;
static /* synthetic */ Class class$javax$baja$category$BCategoryMask;
public static final BCategoryMask or(BCategoryMask bCategoryMask, BCategoryMask bCategoryMask2) {
int n;
String string;
int n2;
String string2;
if (bCategoryMask == WILDCARD || bCategoryMask2 == WILDCARD) {
return WILDCARD;
}
if (bCategoryMask == bCategoryMask2) {
return bCategoryMask;
}
String string3 = bCategoryMask.hex;
String string4 = bCategoryMask2.hex;
int n3 = string3.length();
int n4 = string4.length();
if (n3 == 0) {
return bCategoryMask2;
}
if (n4 == 0) {
return bCategoryMask;
}
if (n3 < n4) {
string2 = string3;
n2 = n3;
string = string4;
n = n4;
} else {
string2 = string4;
n2 = n4;
string = string3;
n = n3;
}
char[] cArray = new char[n];
int n5 = 0;
int n6 = n - n2;
int n7 = 0;
while (n7 < n6) {
cArray[n5++] = string.charAt(n7);
++n7;
}
n7 = 0;
while (n7 < n2) {
int n8 = string2.charAt(n7);
n8 = n8 <= 57 ? n8 - 48 : n8 - 97 + 10;
int n9 = string.charAt(n7 + n6);
n9 = n9 <= 57 ? n9 - 48 : n9 - 97 + 10;
int n10 = n8 | n9;
cArray[n5++] = n10 < 10 ? (char)(48 + n10) : (char)(97 + n10 - 10);
++n7;
}
return BCategoryMask.make(new String(cArray));
}
public static final BCategoryMask and(BCategoryMask bCategoryMask, BCategoryMask bCategoryMask2) {
int n;
String string;
int n2;
String string2;
if (bCategoryMask == WILDCARD) {
return bCategoryMask2;
}
if (bCategoryMask2 == WILDCARD) {
return bCategoryMask;
}
if (bCategoryMask == bCategoryMask2) {
return bCategoryMask;
}
String string3 = bCategoryMask.hex;
String string4 = bCategoryMask2.hex;
int n3 = string3.length();
int n4 = string4.length();
if (n3 == 0) {
return NULL;
}
if (n4 == 0) {
return NULL;
}
if (n3 < n4) {
string2 = string3;
n2 = n3;
string = string4;
n = n4;
} else {
string2 = string4;
n2 = n4;
string = string3;
n = n3;
}
char[] cArray = new char[n2];
int n5 = 0;
int n6 = n - n2;
int n7 = 0;
while (n7 < n2) {
int n8 = string2.charAt(n7);
n8 = n8 <= 57 ? n8 - 48 : n8 - 97 + 10;
int n9 = string.charAt(n7 + n6);
n9 = n9 <= 57 ? n9 - 48 : n9 - 97 + 10;
int n10 = n8 & n9;
cArray[n5++] = n10 < 10 ? (char)(48 + n10) : (char)(97 + n10 - 10);
++n7;
}
n7 = 0;
while (n7 < cArray.length && cArray[n7] == '0') {
++n7;
}
return BCategoryMask.make(new String(cArray, n7, cArray.length - n7));
}
public static final BCategoryMask make(int[] nArray) {
int n;
int n2 = nArray.length;
if (n2 == 0) {
return NULL;
}
int n3 = 0;
int n4 = 0;
while (n4 < n2) {
n = nArray[n4];
if (n < 1) {
throw new IllegalArgumentException("index < 1");
}
n3 = Math.max(n3, (n - 1) / 4);
++n4;
}
char[] cArray = new char[n3 + 1];
n = 0;
while (n < cArray.length) {
cArray[n] = 48;
++n;
}
n = 0;
while (n < n2) {
int n5 = nArray[n];
int n6 = --n5 / 4;
int n7 = n5 % 4;
int n8 = n3 - n6;
char c = cArray[n8];
int n9 = c <= '9' ? c - 48 : c - 97 + 10;
cArray[n8] = (n9 |= 1 << n7) < 10 ? (char)(48 + n9) : (char)(97 + n9 - 10);
++n;
}
return BCategoryMask.make(new String(cArray));
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public static final BCategoryMask make(String string) {
int n = string.length();
if (n == 0) {
return NULL;
}
if (n == 1 && string.charAt(0) == '*') {
return WILDCARD;
}
HashMap hashMap = cache;
synchronized (hashMap) {
BCategoryMask bCategoryMask = (BCategoryMask)cache.get(string);
if (bCategoryMask != null) {
return bCategoryMask;
}
if (n == 0) {
throw new IllegalArgumentException("Length cannot be 0");
}
if (string.charAt(0) == '0') {
throw new IllegalArgumentException("No leading zero allowed");
}
int n2 = 0;
while (n2 < n) {
if (!BCategoryMask.isValid(string.charAt(n2))) {
throw new IllegalArgumentException("Invalid char " + string.charAt(n2));
}
++n2;
}
bCategoryMask = new BCategoryMask(string);
cache.put(string, bCategoryMask);
return bCategoryMask;
}
}
static final boolean isValid(int n) {
boolean bl = false;
if (48 <= n && n <= 57 || 97 <= n && n <= 102) {
bl = true;
}
return bl;
}
public final boolean isNull() {
boolean bl = false;
if (this == NULL) {
bl = true;
}
return bl;
}
public final boolean isWildcard() {
boolean bl = false;
if (this == WILDCARD) {
bl = true;
}
return bl;
}
public final int size() {
int n = this.hex.length() * 4;
if (n > 0) {
int n2;
char c = this.hex.charAt(0);
int n3 = n2 = c <= '9' ? c - 48 : c - 97 + 10;
if ((n2 & 8) != 0) {
return n;
}
if ((n2 & 4) != 0) {
return n - 1;
}
if ((n2 & 2) != 0) {
return n - 2;
}
if ((n2 & 1) != 0) {
return n - 3;
}
}
return n;
}
public final boolean get(int n) {
if (n < 1) {
throw new IllegalArgumentException("index < 1");
}
if (this == WILDCARD) {
return true;
}
int n2 = --n / 4;
int n3 = n % 4;
int n4 = this.hex.length();
if (n2 >= n4) {
return false;
}
char c = this.hex.charAt(n4 - n2 - 1);
int n5 = c <= '9' ? c - 48 : c - 97 + 10;
boolean bl = false;
if ((n5 & 1 << n3) != 0) {
bl = true;
}
return bl;
}
public final int hashCode() {
return System.identityHashCode(this);
}
public final boolean equals(Object object) {
boolean bl = false;
if (this == object) {
bl = true;
}
return bl;
}
public final String toString(Context context) {
return this.hex;
}
public final void encode(DataOutput dataOutput) throws IOException {
dataOutput.writeUTF(this.hex);
}
public final BObject decode(DataInput dataInput) throws IOException {
return BCategoryMask.make(dataInput.readUTF());
}
public final String encodeToString() {
return this.hex;
}
public final BObject decodeFromString(String string) throws IOException {
return BCategoryMask.make(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 BCategoryMask(String string) {
this.hex = string;
}
static {
cache.put("", NULL);
WILDCARD = new BCategoryMask("*");
cache.put("*", WILDCARD);
DEFAULT = NULL;
Class clazz = class$javax$baja$category$BCategoryMask;
if (clazz == null) {
clazz = class$javax$baja$category$BCategoryMask = BCategoryMask.class("[Ljavax.baja.category.BCategoryMask;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,61 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.category;
import javax.baja.sys.BFrozenEnum;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public final class BCategoryMode
extends BFrozenEnum {
public static final int UNION = 0;
public static final int INTERSECTION = 1;
public static final BCategoryMode union = new BCategoryMode(0);
public static final BCategoryMode intersection = new BCategoryMode(1);
public static final Type TYPE;
public static final BCategoryMode DEFAULT;
static /* synthetic */ Class class$javax$baja$category$BCategoryMode;
public final Type getType() {
return TYPE;
}
public static final BCategoryMode make(int n) {
return (BCategoryMode)union.getRange().get(n, false);
}
public static final BCategoryMode make(String string) {
return (BCategoryMode)union.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 BCategoryMode(int n) {
super(n);
}
static {
Class clazz = class$javax$baja$category$BCategoryMode;
if (clazz == null) {
clazz = class$javax$baja$category$BCategoryMode = BCategoryMode.class("[Ljavax.baja.category.BCategoryMode;", false);
}
TYPE = Sys.loadType(clazz);
DEFAULT = union;
}
}
@@ -0,0 +1,327 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.Array
*/
package javax.baja.category;
import com.tridium.sys.schema.ComponentSlotMap;
import javax.baja.category.BCategory;
import javax.baja.category.BCategoryMask;
import javax.baja.category.BOrdToCategoryMap;
import javax.baja.naming.BOrd;
import javax.baja.nre.util.Array;
import javax.baja.spy.SpyWriter;
import javax.baja.status.BStatus;
import javax.baja.sys.Action;
import javax.baja.sys.BComponent;
import javax.baja.sys.BIService;
import javax.baja.sys.BIcon;
import javax.baja.sys.BObject;
import javax.baja.sys.BRelTime;
import javax.baja.sys.BValue;
import javax.baja.sys.Clock;
import javax.baja.sys.Context;
import javax.baja.sys.NotRunningException;
import javax.baja.sys.Property;
import javax.baja.sys.SlotCursor;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public final class BCategoryService
extends BComponent
implements BIService {
public static final Property ordMap = BCategoryService.newProperty(5, BOrdToCategoryMap.NULL, null);
public static final Property updatePeriod = BCategoryService.newProperty(0, BRelTime.make(60000L), null);
public static final Action update = BCategoryService.newAction(0, null);
public static final Type TYPE;
private static Type[] serviceTypes;
private static final BIcon icon;
static final BCategoryMask DEFAULT_MASK;
BCategory[] lookup;
UpdateThread thread;
long lastUpdateTicks;
long lastUpdateDuration;
static /* synthetic */ Class class$javax$baja$category$BCategoryService;
static /* synthetic */ Class class$javax$baja$category$BCategory;
public final BOrdToCategoryMap getOrdMap() {
return (BOrdToCategoryMap)this.get(ordMap);
}
public final void setOrdMap(BOrdToCategoryMap bOrdToCategoryMap) {
this.set(ordMap, (BValue)bOrdToCategoryMap, null);
}
public final BRelTime getUpdatePeriod() {
return (BRelTime)this.get(updatePeriod);
}
public final void setUpdatePeriod(BRelTime bRelTime) {
this.set(updatePeriod, (BValue)bRelTime, null);
}
public final void update() {
this.invoke(update, null, null);
}
public final Type getType() {
return TYPE;
}
public static final BCategoryService getService() {
return (BCategoryService)Sys.getService(TYPE);
}
public final BCategory[] getCategories() {
Class clazz = class$javax$baja$category$BCategory;
if (clazz == null) {
clazz = class$javax$baja$category$BCategory = BCategoryService.class("[Ljavax.baja.category.BCategory;", false);
}
return (BCategory[])this.getChildren(clazz);
}
public final int getMaxCategoryIndex() {
if (!this.isRunning()) {
throw new NotRunningException();
}
int n = this.lookup.length - 1;
while (n > 0) {
if (this.lookup[n] != null) {
return n;
}
--n;
}
return 0;
}
public final BCategory getCategory(int n) {
if (!this.isRunning()) {
throw new NotRunningException();
}
if (n >= this.lookup.length) {
return null;
}
return this.lookup[n];
}
public final BCategory[] getCategories(BCategoryMask bCategoryMask) {
if (!this.isRunning()) {
throw new NotRunningException();
}
int n = Math.min(bCategoryMask.size(), this.lookup.length) + 1;
Class clazz = class$javax$baja$category$BCategory;
if (clazz == null) {
clazz = class$javax$baja$category$BCategory = BCategoryService.class("[Ljavax.baja.category.BCategory;", false);
}
Array array = new Array(clazz, n);
int n2 = 1;
while (n2 < n) {
if (bCategoryMask.get(n2) && this.lookup[n2] != null) {
array.add((Object)this.lookup[n2]);
}
++n2;
}
return (BCategory[])array.trim();
}
public final BCategoryMask getCategoryMask(BOrd bOrd) {
BCategoryMask bCategoryMask;
if (bOrd != null && !bOrd.isNull() && (bCategoryMask = this.getOrdMap().getCategoryMask(bOrd)) != null) {
return bCategoryMask;
}
return DEFAULT_MASK;
}
public final BCategoryMask getAppliedCategoryMask(BOrd bOrd) {
BCategoryMask bCategoryMask;
if (bOrd != null && !bOrd.isNull() && (bCategoryMask = this.getOrdMap().getAppliedCategoryMask(bOrd)) != null) {
return bCategoryMask;
}
return DEFAULT_MASK;
}
public final Type[] getServiceTypes() {
return serviceTypes;
}
public final void serviceStarted() throws Exception {
}
public final void serviceStopped() throws Exception {
}
public final void started() throws Exception {
this.rebuildLookup();
this.thread = new UpdateThread();
this.thread.start();
}
public final void stopped() throws Exception {
this.lookup = null;
if (this.thread != null) {
this.thread.kill();
}
this.thread = null;
}
public final void added(Property property, Context context) {
super.added(property, context);
if (this.isRunning()) {
this.rebuildLookup();
}
}
public final void removed(Property property, BValue bValue, Context context) {
super.removed(property, bValue, context);
if (this.isRunning()) {
this.rebuildLookup();
}
}
final void rebuildLookup() {
BCategory[] bCategoryArray = new BCategory[16];
SlotCursor slotCursor = this.getProperties();
while (slotCursor.nextComponent()) {
BObject bObject = slotCursor.get();
if (!(bObject instanceof BCategory)) continue;
BCategory bCategory = (BCategory)bObject;
int n = bCategory.getIndex();
if (n <= 0) {
bCategory.setStatus(BStatus.disabled);
bCategory.setFaultCause("");
continue;
}
if (bCategoryArray.length <= n) {
int n2 = Math.max(bCategoryArray.length * 2, n + 1);
if (n2 < 10) {
n2 = 10;
}
BCategory[] bCategoryArray2 = new BCategory[n2];
System.arraycopy(bCategoryArray, 0, bCategoryArray2, 0, bCategoryArray.length);
bCategoryArray = bCategoryArray2;
}
if (bCategoryArray[n] != null) {
bCategory.setStatus(BStatus.fault);
bCategory.setFaultCause("Duplicate index with " + bCategoryArray[n].getName());
continue;
}
bCategory.setStatus(BStatus.ok);
bCategory.setFaultCause("");
bCategoryArray[n] = bCategory;
}
this.lookup = bCategoryArray;
}
public final void doUpdate() {
long l;
long l2 = Clock.ticks();
BCategoryMask[] bCategoryMaskArray = new BCategoryMask[256];
int n = 0;
while (n < bCategoryMaskArray.length) {
bCategoryMaskArray[n] = BCategoryMask.NULL;
++n;
}
ComponentSlotMap componentSlotMap = (ComponentSlotMap)Sys.getStation().fw(1);
componentSlotMap.updateDeepOr(bCategoryMaskArray, 0);
this.lastUpdateTicks = l = Clock.ticks();
this.lastUpdateDuration = l - l2;
}
public final BIcon getIcon() {
return icon;
}
public final void spy(SpyWriter spyWriter) throws Exception {
if (this.lookup != null) {
spyWriter.startProps("CategoryService");
spyWriter.prop((Object)"lastUpdateTicks", BRelTime.toString(Clock.ticks() - this.lastUpdateTicks));
spyWriter.prop((Object)"lastUpdateDuration", BRelTime.toString(this.lastUpdateDuration));
spyWriter.endProps();
spyWriter.startTable(true);
spyWriter.trTitle("Lookup Table [" + this.lookup.length + ']', 2);
int n = 0;
while (n < this.lookup.length) {
if (this.lookup[n] != null) {
spyWriter.tr("" + n, this.lookup[n].getName());
}
++n;
}
spyWriter.endTable();
}
super.spy(spyWriter);
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
static {
Class clazz = class$javax$baja$category$BCategoryService;
if (clazz == null) {
clazz = class$javax$baja$category$BCategoryService = BCategoryService.class("[Ljavax.baja.category.BCategoryService;", false);
}
TYPE = Sys.loadType(clazz);
serviceTypes = new Type[]{TYPE};
icon = BIcon.std("category.png");
DEFAULT_MASK = BCategoryMask.make("1");
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
class UpdateThread
extends Thread {
boolean alive;
public void kill() {
this.alive = false;
this.interrupt();
}
public void run() {
while (this.alive) {
try {
Thread.sleep(5000L);
long l = BCategoryService.this.getUpdatePeriod().getMillis();
if (l == 0L) continue;
if (l < 1000L) {
l = 1000L;
}
if (Clock.ticks() - BCategoryService.this.lastUpdateTicks < l) continue;
BCategoryService.this.doUpdate();
}
catch (InterruptedException interruptedException) {
}
catch (Exception exception) {
exception.printStackTrace();
}
}
}
private final /* synthetic */ void this() {
this.alive = true;
}
UpdateThread() {
super("CategoryService:Update");
this.this();
this.setDaemon(true);
this.setPriority(this.getPriority() - 1);
}
}
}
@@ -0,0 +1,27 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.category;
import javax.baja.category.BCategoryMask;
import javax.baja.sys.BInterface;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BICategorizable
extends BInterface {
public static final Type TYPE;
public BCategoryMask getAppliedCategoryMask();
public BCategoryMask getCategoryMask();
static {
Class clazz = 1.class$javax$baja$category$BICategorizable;
if (clazz == null) {
clazz = 1.class$javax$baja$category$BICategorizable = 1.class("[Ljavax.baja.category.BICategorizable;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,318 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.SortUtil
* javax.baja.nre.util.TextUtil
*/
package javax.baja.category;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.Comparator;
import javax.baja.category.BCategoryMask;
import javax.baja.naming.BOrd;
import javax.baja.naming.NullOrdException;
import javax.baja.naming.OrdQuery;
import javax.baja.nre.util.SortUtil;
import javax.baja.nre.util.TextUtil;
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 BOrdToCategoryMap
extends BSimple {
static final Comparator comparator = new Comparator(){
public final int compare(Object object, Object object2) {
int n;
int n2 = object.toString().length();
if (n2 == (n = object2.toString().length())) {
return 0;
}
if (n2 < n) {
return 1;
}
return -1;
}
};
public static final BOrdToCategoryMap NULL;
public static final BOrdToCategoryMap DEFAULT;
public static final Type TYPE;
private BOrd[] ords;
private String[] ordStrings;
private String[] ordSlashes;
private BCategoryMask[] cats;
private String string;
private int hashCode;
static /* synthetic */ Class class$javax$baja$category$BOrdToCategoryMap;
public static final BOrdToCategoryMap make(BOrd[] bOrdArray, BCategoryMask[] bCategoryMaskArray) {
if (bOrdArray.length != bCategoryMaskArray.length) {
throw new IllegalArgumentException("ords.length != masks.length");
}
if (bOrdArray.length == 0) {
return NULL;
}
bOrdArray = (BOrd[])bOrdArray.clone();
bCategoryMaskArray = (BCategoryMask[])bCategoryMaskArray.clone();
int n = 0;
while (n < bOrdArray.length) {
BOrd bOrd = bOrdArray[n];
if (bOrd.isNull()) {
throw new NullOrdException();
}
OrdQuery ordQuery = bOrd.parse()[0];
if (ordQuery.isHost()) {
throw new IllegalArgumentException("Cannot use host absolute ord: " + bOrd);
}
if (ordQuery.isSession()) {
throw new IllegalArgumentException("Cannot use session absolute ord: " + bOrd);
}
++n;
}
SortUtil.sort((Object[])bOrdArray, (Object[])bCategoryMaskArray, (Comparator)comparator);
return (BOrdToCategoryMap)new BOrdToCategoryMap(bOrdArray, bCategoryMaskArray, null).intern();
}
public final BOrdToCategoryMap setCategoryMask(BOrd bOrd, BCategoryMask bCategoryMask) {
int n = -1;
String string = TextUtil.toLowerCase((String)bOrd.relativizeToSession().toString());
int n2 = this.ordStrings.length;
int n3 = 0;
while (n3 < n2) {
if (string.equals(this.ordStrings[n3])) {
n = n3;
break;
}
++n3;
}
BOrd[] bOrdArray = null;
BCategoryMask[] bCategoryMaskArray = null;
if (n != -1) {
if (bCategoryMask == null || bCategoryMask.isNull()) {
bOrdArray = (BOrd[])this.removeElement(this.ords, new BOrd[this.ords.length - 1], n);
bCategoryMaskArray = (BCategoryMask[])this.removeElement(this.cats, new BCategoryMask[this.cats.length - 1], n);
} else {
if (this.cats[n].equals(bCategoryMask)) {
return this;
}
bOrdArray = new BOrd[this.ords.length];
System.arraycopy(this.ords, 0, bOrdArray, 0, this.ords.length);
bOrdArray[n] = bOrd;
bCategoryMaskArray = new BCategoryMask[this.cats.length];
System.arraycopy(this.cats, 0, bCategoryMaskArray, 0, this.cats.length);
bCategoryMaskArray[n] = bCategoryMask;
}
return (BOrdToCategoryMap)new BOrdToCategoryMap(bOrdArray, bCategoryMaskArray, null).intern();
}
if (bCategoryMask != null && !bCategoryMask.isNull()) {
bOrdArray = new BOrd[this.ords.length + 1];
System.arraycopy(this.ords, 0, bOrdArray, 0, this.ords.length);
bOrdArray[this.ords.length] = bOrd;
bCategoryMaskArray = new BCategoryMask[this.cats.length + 1];
System.arraycopy(this.cats, 0, bCategoryMaskArray, 0, this.cats.length);
bCategoryMaskArray[this.cats.length] = bCategoryMask;
return BOrdToCategoryMap.make(bOrdArray, bCategoryMaskArray);
}
return this;
}
private final Object[] removeElement(Object[] objectArray, Object[] objectArray2, int n) {
if (n == -1) {
throw new ArrayIndexOutOfBoundsException("-1 is not a valid array index");
}
if (n == 0) {
System.arraycopy(objectArray, 1, objectArray2, 0, objectArray.length - 1);
} else if (n == objectArray.length - 1) {
System.arraycopy(objectArray, 0, objectArray2, 0, objectArray.length - 1);
} else {
System.arraycopy(objectArray, 0, objectArray2, 0, n);
System.arraycopy(objectArray, n + 1, objectArray2, n, objectArray.length - (n + 1));
}
return objectArray2;
}
public final boolean isNull() {
boolean bl = false;
if (this == NULL) {
bl = true;
}
return bl;
}
public final int size() {
return this.ords.length;
}
public final BOrd getOrd(int n) {
return this.ords[n];
}
public final BCategoryMask getCategoryMask(int n) {
return this.cats[n];
}
public final BCategoryMask getCategoryMask(BOrd bOrd) {
String string = TextUtil.toLowerCase((String)bOrd.relativizeToSession().toString());
int n = this.ordStrings.length;
int n2 = 0;
while (n2 < n) {
if (string.equals(this.ordStrings[n2])) {
return this.cats[n2];
}
++n2;
}
return null;
}
public final BCategoryMask getAppliedCategoryMask(BOrd bOrd) {
String string = TextUtil.toLowerCase((String)bOrd.relativizeToSession().toString());
int n = this.ordSlashes.length;
int n2 = 0;
while (n2 < n) {
if (string.equals(this.ordStrings[n2])) {
return this.cats[n2];
}
if (string.startsWith(this.ordSlashes[n2])) {
return this.cats[n2];
}
++n2;
}
return null;
}
public final int hashCode() {
try {
if (this.hashCode == -1) {
this.hashCode = this.encodeToString().hashCode();
}
return this.hashCode;
}
catch (Exception exception) {
return System.identityHashCode(this);
}
}
public final boolean equals(Object object) {
if (object instanceof BOrdToCategoryMap) {
BOrdToCategoryMap bOrdToCategoryMap = (BOrdToCategoryMap)object;
if (this.ords.length != bOrdToCategoryMap.ords.length) {
return false;
}
int n = 0;
while (n < this.ords.length) {
if (!this.ords[n].equals(bOrdToCategoryMap.ords[n])) {
return false;
}
if (!this.cats[n].equals(bOrdToCategoryMap.cats[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() {
if (this.string == null) {
StringBuffer stringBuffer = new StringBuffer();
int n = 0;
while (n < this.ords.length) {
if (n > 0) {
stringBuffer.append('\n');
}
stringBuffer.append(this.ords[n].encodeToString()).append('=').append(this.cats[n]);
++n;
}
this.string = stringBuffer.toString();
}
return this.string;
}
public final BObject decodeFromString(String string) throws IOException {
String[] stringArray = TextUtil.split((String)string, (char)'\n');
int n = stringArray.length;
if (n == 0) {
return NULL;
}
BOrd[] bOrdArray = new BOrd[n];
BCategoryMask[] bCategoryMaskArray = new BCategoryMask[n];
int n2 = 0;
while (n2 < stringArray.length) {
String string2 = stringArray[n2];
int n3 = string2.lastIndexOf(61);
bOrdArray[n2] = BOrd.make(string2.substring(0, n3));
bCategoryMaskArray[n2] = BCategoryMask.make(string2.substring(n3 + 1));
++n2;
}
return (BOrdToCategoryMap)new BOrdToCategoryMap(bOrdArray, bCategoryMaskArray, string).intern();
}
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;
}
BOrdToCategoryMap(BOrd[] bOrdArray, BCategoryMask[] bCategoryMaskArray, String string) {
this.this();
this.ords = bOrdArray;
this.cats = bCategoryMaskArray;
this.string = string;
int n = Integer.MAX_VALUE;
this.ordStrings = new String[bOrdArray.length];
this.ordSlashes = new String[bOrdArray.length];
int n2 = 0;
while (n2 < bOrdArray.length) {
String string2;
this.ordStrings[n2] = string2 = TextUtil.toLowerCase((String)bOrdArray[n2].encodeToString());
this.ordSlashes[n2] = string2.endsWith("/") || string2.endsWith("^") || string2.endsWith("!") ? string2 : string2 + '/';
int n3 = string2.length();
if (n3 > n) {
throw new IllegalStateException();
}
n = n3;
++n2;
}
}
static {
DEFAULT = NULL = new BOrdToCategoryMap(new BOrd[0], new BCategoryMask[0], null);
Class clazz = class$javax$baja$category$BOrdToCategoryMap;
if (clazz == null) {
clazz = class$javax$baja$category$BOrdToCategoryMap = BOrdToCategoryMap.class("[Ljavax.baja.category.BOrdToCategoryMap;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,34 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.collection;
import javax.baja.collection.BIList;
import javax.baja.collection.BITable;
import javax.baja.sys.BInterface;
import javax.baja.sys.Cursor;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.IFilter;
public interface BICollection
extends BInterface {
public static final Type TYPE;
public Cursor cursor();
public BIList toList() throws UnsupportedOperationException;
public BITable toTable() throws UnsupportedOperationException;
public BICollection filter(IFilter var1);
static {
Class clazz = 1.class$javax$baja$collection$BICollection;
if (clazz == null) {
clazz = 1.class$javax$baja$collection$BICollection = 1.class("[Ljavax.baja.collection.BICollection;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,31 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.collection;
import javax.baja.collection.BICollection;
import javax.baja.sys.BObject;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIList
extends BICollection {
public static final Type TYPE;
public int size();
public BObject[] list();
public BObject[] list(BObject[] var1);
public BObject get(int var1);
static {
Class clazz = 1.class$javax$baja$collection$BIList;
if (clazz == null) {
clazz = 1.class$javax$baja$collection$BIList = 1.class("[Ljavax.baja.collection.BIList;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,48 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.collection;
import javax.baja.collection.BIList;
import javax.baja.collection.Column;
import javax.baja.collection.ColumnList;
import javax.baja.sys.BFacets;
import javax.baja.sys.BObject;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BITable
extends BIList {
public static final Type TYPE;
public ColumnList getColumns();
public BObject get(int var1, Column var2);
public String getString(int var1, Column var2);
public float getFloat(int var1, Column var2);
public double getDouble(int var1, Column var2);
public int getInt(int var1, Column var2);
public long getLong(int var1, Column var2);
public boolean getBoolean(int var1, Column var2);
public int getFlags(int var1, Column var2);
public BFacets getFacets(int var1, Column var2);
public BFacets getTableFacets();
static {
Class clazz = 1.class$javax$baja$collection$BITable;
if (clazz == null) {
clazz = 1.class$javax$baja$collection$BITable = 1.class("[Ljavax.baja.collection.BITable;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,21 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.collection;
import javax.baja.sys.BFacets;
import javax.baja.sys.Context;
import javax.baja.sys.Type;
public interface Column {
public String getName();
public String getDisplayName(Context var1);
public Type getType();
public int getFlags();
public BFacets getFacets();
}
@@ -0,0 +1,19 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.collection;
import javax.baja.collection.Column;
public interface ColumnList {
public int size();
public Column get(int var1);
public Column get(String var1);
public int indexOf(String var1);
public Column[] list();
}
@@ -0,0 +1,34 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.collection;
import javax.baja.collection.BITable;
import javax.baja.collection.Column;
import javax.baja.sys.BFacets;
import javax.baja.sys.BObject;
import javax.baja.sys.Cursor;
public interface TableCursor
extends Cursor {
public BITable getTable();
public BObject get(Column var1);
public String getString(Column var1);
public float getFloat(Column var1);
public double getDouble(Column var1);
public int getInt(Column var1);
public long getLong(Column var1);
public boolean getBoolean(Column var1);
public int getFlags(Column var1);
public BFacets getFacets(Column var1);
}
@@ -0,0 +1,22 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.data;
import javax.baja.collection.BITable;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIDataTable
extends BITable {
public static final Type TYPE;
static {
Class clazz = 1.class$javax$baja$data$BIDataTable;
if (clazz == null) {
clazz = 1.class$javax$baja$data$BIDataTable = 1.class("[Ljavax.baja.data.BIDataTable;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,22 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.data;
import javax.baja.io.BIEncodable;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIDataValue
extends BIEncodable {
public static final Type TYPE;
static {
Class clazz = 1.class$javax$baja$data$BIDataValue;
if (clazz == null) {
clazz = 1.class$javax$baja$data$BIDataValue = 1.class("[Ljavax.baja.data.BIDataValue;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,22 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.data;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Type;
public class DataTypeException
extends BajaRuntimeException {
private Type badType;
public Type getInvalidType() {
return this.badType;
}
public DataTypeException(Type type) {
super(type.getTypeSpec().toString() + " is not a valid DataType.");
this.badType = type;
}
}
@@ -0,0 +1,56 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.data;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BDouble;
import javax.baja.sys.BDynamicEnum;
import javax.baja.sys.BEnumRange;
import javax.baja.sys.BFloat;
import javax.baja.sys.BInteger;
import javax.baja.sys.BLong;
import javax.baja.sys.BRelTime;
import javax.baja.sys.BString;
import javax.baja.sys.Type;
import javax.baja.timezone.BTimeZone;
import javax.baja.units.BUnit;
public class DataTypes {
public static final Type BOOLEAN = BBoolean.TYPE;
public static final Type INTEGER = BInteger.TYPE;
public static final Type LONG = BLong.TYPE;
public static final Type FLOAT = BFloat.TYPE;
public static final Type DOUBLE = BDouble.TYPE;
public static final Type STRING = BString.TYPE;
public static final Type ENUM = BDynamicEnum.TYPE;
public static final Type ENUM_RANGE = BEnumRange.TYPE;
public static final Type ABS_TIME = BAbsTime.TYPE;
public static final Type REL_TIME = BRelTime.TYPE;
public static final Type UNIT = BUnit.TYPE;
public static final Type TIME_ZONE = BTimeZone.TYPE;
private static final Type[] TYPES = new Type[]{BOOLEAN, INTEGER, LONG, FLOAT, DOUBLE, STRING, ENUM, ENUM_RANGE, ABS_TIME, REL_TIME, UNIT, TIME_ZONE};
private static final Type[] bySymbol = new Type[128];
public static Type[] getTypes() {
return (Type[])TYPES.clone();
}
public static Type getBySymbol(char c) {
if (c < '\u0080') {
return bySymbol[c];
}
return null;
}
static {
int n = 0;
while (n < TYPES.length) {
Type type;
DataTypes.bySymbol[type.getDataTypeSymbol()] = type = TYPES[n];
++n;
}
}
}
@@ -0,0 +1,50 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.data;
import java.io.IOException;
import javax.baja.data.DataTypes;
import javax.baja.naming.SlotPath;
import javax.baja.sys.BObject;
import javax.baja.sys.BSimple;
import javax.baja.sys.BString;
import javax.baja.sys.Type;
public class DataUtil {
public static String marshal(BObject bObject) throws IOException {
if (bObject == null) {
return "null";
}
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(bObject.getType().getDataTypeSymbol());
stringBuffer.append(':');
if (bObject instanceof BString) {
stringBuffer.append(SlotPath.escape(bObject.toString()));
} else {
stringBuffer.append(((BSimple)bObject).encodeToString());
}
return stringBuffer.toString();
}
public static BObject unmarshal(String string) throws IOException {
if (string.equals("null")) {
return null;
}
char c = string.charAt(0);
if (string.charAt(1) != ':') {
throw new IOException("Expecting colon " + string);
}
String string2 = string.substring(2);
Type type = DataTypes.getBySymbol(c);
if (type == null) {
throw new IOException("Unknown symbol " + c);
}
if (type == BString.TYPE) {
return BString.make(SlotPath.unescape(string2));
}
BSimple bSimple = (BSimple)type.getInstance();
return bSimple.decodeFromString(string2);
}
}
@@ -0,0 +1,28 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.data;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Type;
public class TypeMismatchException
extends BajaRuntimeException {
private Type expected;
private Type actual;
public Type getExpectedType() {
return this.expected;
}
public Type getActualType() {
return this.actual;
}
public TypeMismatchException(Type type, Type type2) {
super("Expected " + type + " instead of " + type2 + '.');
this.expected = type;
this.actual = type2;
}
}
@@ -0,0 +1,47 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.dataRecovery;
import javax.baja.dataRecovery.BIDataRecoverySource;
import javax.baja.io.BIEncodable;
import javax.baja.sys.BIService;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIDataRecoveryService
extends BIService {
public static final Type TYPE;
public boolean isEnabled();
public boolean append(BIDataRecoverySource var1, BIEncodable var2, byte[] var3, int var4, int var5) throws BajaRuntimeException;
public boolean append(BIDataRecoverySource var1, BIEncodable var2, byte[] var3) throws BajaRuntimeException;
public boolean update(BIDataRecoverySource var1, BIEncodable var2, byte[] var3, int var4, int var5) throws BajaRuntimeException;
public boolean update(BIDataRecoverySource var1, BIEncodable var2, byte[] var3) throws BajaRuntimeException;
public boolean hasRecoveryData() throws BajaRuntimeException;
public void saveStarted() throws BajaRuntimeException;
public void saveFinished() throws BajaRuntimeException;
public void saveFailed(Throwable var1);
public void shutdownStarted() throws BajaRuntimeException;
public String checkForStationFault();
static {
Class clazz = 1.class$javax$baja$dataRecovery$BIDataRecoveryService;
if (clazz == null) {
clazz = 1.class$javax$baja$dataRecovery$BIDataRecoveryService = 1.class("[Ljavax.baja.dataRecovery.BIDataRecoveryService;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,34 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.dataRecovery;
import java.util.Iterator;
import javax.baja.dataRecovery.IDataRecoveryRecord;
import javax.baja.naming.BOrd;
import javax.baja.spy.SpyWriter;
import javax.baja.sys.BInterface;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIDataRecoverySource
extends BInterface {
public static final Type TYPE;
public BOrd getOrdInSession() throws Exception;
public boolean dataRecoveryRestore(IDataRecoveryRecord var1) throws Exception;
public void dataRecoveryRestoreComplete();
public void dataRecoverySpy(SpyWriter var1, Iterator var2) throws Exception;
static {
Class clazz = 1.class$javax$baja$dataRecovery$BIDataRecoverySource;
if (clazz == null) {
clazz = 1.class$javax$baja$dataRecovery$BIDataRecoverySource = 1.class("[Ljavax.baja.dataRecovery.BIDataRecoverySource;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,25 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.dataRecovery;
import javax.baja.dataRecovery.BIDataRecoveryService;
import javax.baja.sys.BIService;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIDataRecoverySourceService
extends BIService {
public static final Type TYPE;
public void initDataRecoverySource(BIDataRecoveryService var1);
static {
Class clazz = 1.class$javax$baja$dataRecovery$BIDataRecoverySourceService;
if (clazz == null) {
clazz = 1.class$javax$baja$dataRecovery$BIDataRecoverySourceService = 1.class("[Ljavax.baja.dataRecovery.BIDataRecoverySourceService;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,25 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.dataRecovery;
import javax.baja.sys.BajaRuntimeException;
public class DataRecoveryException
extends BajaRuntimeException {
public DataRecoveryException(String string, Throwable throwable) {
super(string, throwable);
}
public DataRecoveryException(Throwable throwable) {
super(throwable);
}
public DataRecoveryException(String string) {
super(string);
}
public DataRecoveryException() {
}
}
@@ -0,0 +1,17 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.dataRecovery;
import javax.baja.dataRecovery.DataRecoveryException;
public class DataRecoveryInvalidKeyException
extends DataRecoveryException {
public DataRecoveryInvalidKeyException() {
}
public DataRecoveryInvalidKeyException(String string) {
super(string);
}
}
@@ -0,0 +1,21 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.dataRecovery;
import javax.baja.dataRecovery.DataRecoveryException;
public class DataRecoveryServiceInFaultException
extends DataRecoveryException {
public DataRecoveryServiceInFaultException() {
}
public DataRecoveryServiceInFaultException(String string) {
super(string);
}
public DataRecoveryServiceInFaultException(String string, Throwable throwable) {
super(string, throwable);
}
}
@@ -0,0 +1,34 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.dataRecovery;
import javax.baja.dataRecovery.DataRecoveryException;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class DataRecoveryTooLargeException
extends DataRecoveryException {
public int attemptedSize;
public int maxSize;
private final /* synthetic */ void this() {
this.attemptedSize = 0;
this.maxSize = 0;
}
public DataRecoveryTooLargeException(int n, int n2) {
this.this();
this.attemptedSize = n;
this.maxSize = n2;
}
public DataRecoveryTooLargeException(int n, int n2, String string) {
super(string);
this.this();
this.attemptedSize = n;
this.maxSize = n2;
}
}
@@ -0,0 +1,13 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.dataRecovery;
public interface IDataRecoveryRecord {
public byte[] getData();
public byte[] getKey();
public byte getDataRecoverySourceIdentifier();
}
@@ -0,0 +1,379 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.baja.category.BCategoryMask;
import javax.baja.category.BCategoryService;
import javax.baja.file.BAbstractFileStore;
import javax.baja.file.BFileSpace;
import javax.baja.file.BFileSystem;
import javax.baja.file.BIFile;
import javax.baja.file.BIFileStore;
import javax.baja.file.FilePath;
import javax.baja.naming.BHost;
import javax.baja.naming.BISession;
import javax.baja.naming.BOrd;
import javax.baja.naming.OrdTarget;
import javax.baja.naming.UnresolvedException;
import javax.baja.nav.BINavNode;
import javax.baja.security.BPermissions;
import javax.baja.space.BSpace;
import javax.baja.spy.SpyWriter;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BIcon;
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 abstract class BAbstractFile
extends BObject
implements BIFile {
private static final BIcon icon = BIcon.std("file.png");
public static final Type TYPE;
private BIFileStore store;
private boolean pendingMove;
static /* synthetic */ Class class$javax$baja$file$BAbstractFile;
public BIFileStore getStore() {
return this.store;
}
public void setStore(BIFileStore bIFileStore) {
if (bIFileStore == null) {
throw new NullPointerException("null store");
}
this.store = bIFileStore;
}
public BFileSpace getFileSpace() {
return this.getStore().getFileSpace();
}
public FilePath getFilePath() {
return this.getStore().getFilePath();
}
public String getFileName() {
return this.getStore().getFileName();
}
public String getExtension() {
return this.getStore().getExtension();
}
public boolean isDirectory() {
return this.getStore().isDirectory();
}
public long getSize() {
return this.getStore().getSize();
}
public BAbsTime getLastModified() {
return this.getStore().getLastModified();
}
public boolean setLastModified(BAbsTime bAbsTime) throws IOException {
if (this.getStore() instanceof BAbstractFileStore) {
return ((BAbstractFileStore)this.getStore()).setLastModified(bAbsTime);
}
throw new UnsupportedOperationException();
}
public boolean isReadonly() {
return this.getStore().isReadonly();
}
public InputStream getInputStream() throws IOException {
return this.getStore().getInputStream();
}
public byte[] read() throws IOException {
return this.getStore().read();
}
public void delete() throws IOException {
this.getFileSpace().delete(this.getFilePath());
}
public OutputStream getOutputStream() throws IOException {
return this.getStore().getOutputStream();
}
public void write(byte[] byArray) throws IOException {
this.getStore().write(byArray);
}
public String getMimeType() {
return "application/octet-stream";
}
public long getCrc() throws IOException {
if (this.getStore() instanceof BAbstractFileStore) {
return ((BAbstractFileStore)this.getStore()).getCrc();
}
throw new UnsupportedOperationException();
}
public boolean isMounted() {
BFileSpace bFileSpace = this.getFileSpace();
boolean bl = false;
if (bFileSpace != null && bFileSpace.isMounted()) {
bl = true;
}
return bl;
}
public BHost getHost() {
BFileSpace bFileSpace = this.getFileSpace();
if (bFileSpace == null) {
return null;
}
return bFileSpace.getHost();
}
public BISession getSession() {
BFileSpace bFileSpace = this.getFileSpace();
if (bFileSpace == null) {
return null;
}
return bFileSpace.getSession();
}
public BSpace getSpace() {
return this.getFileSpace();
}
public BOrd getAbsoluteOrd() {
BFileSpace bFileSpace = this.getFileSpace();
if (bFileSpace == null) {
return null;
}
return bFileSpace.getAbsoluteOrd(this.getFilePath());
}
public BOrd getOrdInHost() {
BFileSpace bFileSpace = this.getFileSpace();
if (bFileSpace == null) {
return null;
}
return bFileSpace.getOrdInHost(this.getFilePath());
}
public BOrd getOrdInSession() {
BFileSpace bFileSpace = this.getFileSpace();
if (bFileSpace == null) {
return null;
}
return bFileSpace.getOrdInSession(this.getFilePath());
}
public BOrd getOrdInSpace() {
return this.getOrdInSession();
}
public boolean isPendingMove() {
return this.pendingMove;
}
public void setPendingMove(boolean bl) {
this.pendingMove = bl;
}
public String getNavName() {
return this.getFileName();
}
public String getNavDisplayName(Context context) {
return this.getNavName();
}
public BINavNode getNavParent() {
FilePath filePath = this.getFilePath().getParent();
if (filePath != null) {
return this.getFileSpace().findFile(filePath);
}
return this.getFileSpace();
}
public BINavNode resolveNavChild(String string) {
BINavNode bINavNode = this.getNavChild(string);
if (bINavNode == null) {
throw new UnresolvedException(string);
}
return bINavNode;
}
public BOrd getNavOrd() {
return this.getAbsoluteOrd();
}
public BIcon getNavIcon() {
return this.getIcon();
}
public BCategoryMask getCategoryMask() {
return BCategoryService.getService().getCategoryMask(this.getNavOrd());
}
public BCategoryMask getAppliedCategoryMask() {
return BCategoryService.getService().getAppliedCategoryMask(this.getNavOrd());
}
public BPermissions getPermissions(Context context) {
return this.getStore().getPermissions(this, context);
}
public boolean canRead(OrdTarget ordTarget) {
return ordTarget.getPermissionsForTarget().has(1);
}
public boolean canWrite(OrdTarget ordTarget) {
return ordTarget.getPermissionsForTarget().has(2);
}
public boolean canInvoke(OrdTarget ordTarget) {
return ordTarget.getPermissionsForTarget().has(4);
}
public String toPathString() {
BOrd bOrd = this.getOrdInSession();
if (bOrd != null) {
return bOrd.toString();
}
return "?" + this.getType() + '?';
}
public int compareTo(Object object) {
BIFile bIFile = (BIFile)object;
if (this.isDirectory()) {
if (!bIFile.isDirectory()) {
return -1;
}
return this.getFileName().compareToIgnoreCase(bIFile.getFileName());
}
if (bIFile.isDirectory()) {
return 1;
}
return this.getFileName().compareToIgnoreCase(bIFile.getFileName());
}
public String toString(Context context) {
if (this.getStore() == null) {
return super.toString(context);
}
return this.getStore().toString(context);
}
public int hashCode() {
return this.getStore().hashCode();
}
public boolean equals(Object object) {
if (object instanceof BIFile) {
BIFile bIFile = (BIFile)object;
return this.getStore().equals(bIFile.getStore());
}
return false;
}
public BIcon getIcon() {
return icon;
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void spy(SpyWriter spyWriter) throws Exception {
try {
BFileSystem.threadLocalContext.set(spyWriter.getContext());
super.spy(spyWriter);
spyWriter.startProps();
spyWriter.trTitle("File", 2);
spyWriter.prop((Object)"fileName", this.getFileName());
spyWriter.prop((Object)"store.type", this.getStore().getType());
spyWriter.prop((Object)"store.toString", this.getStore().toString());
spyWriter.prop((Object)"isDirectory", this.isDirectory());
spyWriter.prop((Object)"readonly", this.isReadonly());
spyWriter.prop((Object)"size", "" + this.getSize());
spyWriter.prop((Object)"lastModified", this.getLastModified());
spyWriter.trTitle("SpaceNode", 2);
spyWriter.prop((Object)"isMounted", this.isMounted());
spyWriter.prop((Object)"host", this.getHost());
spyWriter.prop((Object)"session", this.getSession());
spyWriter.prop((Object)"space", this.getSpace());
spyWriter.prop((Object)"absoluteOrd", this.getAbsoluteOrd());
spyWriter.prop((Object)"ordInHost", this.getOrdInHost());
spyWriter.prop((Object)"ordInSession", this.getOrdInSession());
spyWriter.prop((Object)"ordInSpace", this.getOrdInSpace());
spyWriter.prop((Object)"navOrd", this.getNavOrd());
spyWriter.prop((Object)"permissions", this.getPermissions(null));
if (this.getStore() instanceof BAbstractFileStore) {
spyWriter.prop((Object)"crc", String.valueOf(this.getCrc()));
}
spyWriter.endProps();
BINavNode[] bINavNodeArray = this.getNavChildren();
if (bINavNodeArray != null && bINavNodeArray.length > 0) {
spyWriter.startTable(false);
spyWriter.trTitle("Children", 1);
int n = 0;
while (n < bINavNodeArray.length) {
spyWriter.tr("<a href='" + bINavNodeArray[n].getNavName() + "'>" + bINavNodeArray[n].toString() + "</a>");
++n;
}
spyWriter.endTable();
}
Object var3_6 = null;
BFileSystem.threadLocalContext.set(null);
return;
}
catch (Throwable throwable) {
Object var3_5 = null;
BFileSystem.threadLocalContext.set(null);
throw throwable;
}
}
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 BAbstractFile(BIFileStore bIFileStore) {
this.setStore(bIFileStore);
}
public BAbstractFile() {
}
static {
Class clazz = class$javax$baja$file$BAbstractFile;
if (clazz == null) {
clazz = class$javax$baja$file$BAbstractFile = BAbstractFile.class("[Ljavax.baja.file.BAbstractFile;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,139 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import com.tridium.util.BRestrictedFileSpace;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.baja.file.BFileSpace;
import javax.baja.file.BIFile;
import javax.baja.file.BIFileStore;
import javax.baja.file.FilePath;
import javax.baja.file.FileUtil;
import javax.baja.security.BPermissions;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BModule;
import javax.baja.sys.BObject;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.user.BUser;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BAbstractFileStore
extends BObject
implements BIFileStore {
private static final int READONLY_MASK = -35;
public static final Type TYPE;
private BFileSpace space;
private FilePath path;
static /* synthetic */ Class class$javax$baja$file$BAbstractFileStore;
public BFileSpace getFileSpace() {
return this.space;
}
public FilePath getFilePath() {
return this.path;
}
public String getFileName() {
return this.getFilePath().getName();
}
public String getExtension() {
return FileUtil.getExtension(this.getFileName());
}
public boolean isDirectory() {
return false;
}
public long getSize() {
return -1;
}
public BAbsTime getLastModified() {
return BAbsTime.NULL;
}
public final boolean setLastModified(BAbsTime bAbsTime) throws IOException {
bAbsTime = BAbsTime.make(bAbsTime.getYear(), bAbsTime.getMonth(), bAbsTime.getDay(), bAbsTime.getHour(), bAbsTime.getMinute(), bAbsTime.getSecond(), 0, bAbsTime.getTimeZone());
return this.doSetLastModified(bAbsTime);
}
protected boolean doSetLastModified(BAbsTime bAbsTime) throws IOException {
throw new IOException();
}
public InputStream getInputStream() throws IOException {
throw new IOException();
}
public byte[] read() throws IOException {
return FileUtil.read(this);
}
public OutputStream getOutputStream() throws IOException {
throw new IOException();
}
public void write(byte[] byArray) throws IOException {
FileUtil.write(this, byArray);
}
public BPermissions getPermissions(BIFile bIFile, Context context) {
BPermissions bPermissions = BPermissions.all;
if (context != null && context.getUser() != null) {
BUser bUser = context.getUser();
bPermissions = this.space instanceof BModule ? BPermissions.operatorRead : (!bUser.getPermissions().isSuperUser() && this.path.getAbsoluteMode() != 4 || BRestrictedFileSpace.INSTANCE.isBlacklistedForUser(bUser, bIFile) ? BPermissions.none : context.getUser().getPermissionsFor(bIFile));
}
if (this.isReadonly()) {
bPermissions = BPermissions.make(bPermissions.getMask() & 0xFFFFFFDD);
}
return bPermissions;
}
public String toString(Context context) {
return String.valueOf(this.path);
}
public long getCrc() throws IOException {
return -1;
}
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 BAbstractFileStore(BFileSpace bFileSpace, FilePath filePath) {
this.space = bFileSpace;
this.path = filePath;
}
static {
Class clazz = class$javax$baja$file$BAbstractFileStore;
if (clazz == null) {
clazz = class$javax$baja$file$BAbstractFileStore = BAbstractFileStore.class("[Ljavax.baja.file.BAbstractFileStore;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,86 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import javax.baja.agent.AgentList;
import javax.baja.file.BAbstractFile;
import javax.baja.file.BIDataFile;
import javax.baja.file.BIFileStore;
import javax.baja.nav.BINavNode;
import javax.baja.sys.BIcon;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BDataFile
extends BAbstractFile
implements BIDataFile {
private static final BIcon icon = BIcon.std("file.png");
public static final Type TYPE;
static final BINavNode[] NO_NAV_NODES;
static /* synthetic */ Class class$javax$baja$file$BDataFile;
public String getNavDescription(Context context) {
return this.getSize() / 1024L + "kb " + this.getLastModified();
}
public boolean hasNavChildren() {
return false;
}
public BINavNode getNavChild(String string) {
return null;
}
public BINavNode[] getNavChildren() {
return NO_NAV_NODES;
}
public AgentList getAgents(Context context) {
AgentList agentList = super.getAgents(context);
agentList.toTop("web:FileDownloadView");
return agentList;
}
public BIcon getIcon() {
return icon;
}
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 BDataFile(BIFileStore bIFileStore) {
super(bIFileStore);
}
public BDataFile() {
}
static {
Class clazz = class$javax$baja$file$BDataFile;
if (clazz == null) {
clazz = class$javax$baja$file$BDataFile = BDataFile.class("[Ljavax.baja.file.BDataFile;", false);
}
TYPE = Sys.loadType(clazz);
NO_NAV_NODES = new BINavNode[0];
}
}
@@ -0,0 +1,137 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import javax.baja.agent.AgentList;
import javax.baja.file.BAbstractFile;
import javax.baja.file.BIDirectory;
import javax.baja.file.BIFile;
import javax.baja.file.BIFileStore;
import javax.baja.nav.BINavNode;
import javax.baja.sys.BIcon;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.Lexicon;
import javax.baja.util.LexiconText;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BDirectory
extends BAbstractFile
implements BIDirectory {
private static final BIcon defaultIcon = BIcon.std("folder.png");
public static final Type TYPE;
private LexiconText lexText;
BIcon icon;
BINavNode navParent;
static /* synthetic */ Class class$javax$baja$file$BDirectory;
public BIFile[] listFiles() {
return this.getFileSpace().getChildren(this);
}
public String getMimeType() {
return "application/x-baja-directory";
}
public LexiconText getLexiconText() {
return this.lexText;
}
public void setLexiconText(LexiconText lexiconText) {
this.lexText = lexiconText;
}
public String getNavDisplayName(Context context) {
if (this.lexText != null) {
return this.lexText.getText(context);
}
return this.getNavName();
}
public String getNavDescription(Context context) {
if (this.lexText != null) {
return Lexicon.make(this.lexText.module, context).get(this.lexText.key + ".description", null);
}
return null;
}
public BINavNode getNavParent() {
if (this.navParent != null) {
return this.navParent;
}
return super.getNavParent();
}
public boolean hasNavChildren() {
return true;
}
public BINavNode getNavChild(String string) {
return this.getFileSpace().getChild(this, string);
}
public BINavNode[] getNavChildren() {
return this.getFileSpace().getChildren(this);
}
public BIcon getIcon() {
if (this.icon != null) {
return this.icon;
}
return defaultIcon;
}
public void setIcon(BIcon bIcon) {
this.icon = bIcon;
}
public AgentList getAgents(Context context) {
AgentList agentList = super.getAgents(context);
agentList.toTop("workbench:DirectoryList");
agentList.toTop("hx:HxDirectoryView");
agentList.toBottom("web:FileUploadView");
return agentList;
}
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 BDirectory(BIFileStore bIFileStore, LexiconText lexiconText) {
super(bIFileStore);
this.lexText = lexiconText;
}
public BDirectory(BIFileStore bIFileStore) {
super(bIFileStore);
}
public BDirectory() {
}
static {
Class clazz = class$javax$baja$file$BDirectory;
if (clazz == null) {
clazz = class$javax$baja$file$BDirectory = BDirectory.class("[Ljavax.baja.file.BDirectory;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,58 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import javax.baja.agent.BIAgent;
import javax.baja.file.BIFile;
import javax.baja.file.ExportOp;
import javax.baja.registry.TypeInfo;
import javax.baja.sys.BComponent;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BExporter
extends BComponent
implements BIAgent {
public static final Type TYPE;
static /* synthetic */ Class class$javax$baja$file$BExporter;
public Type getType() {
return TYPE;
}
public abstract TypeInfo getFileType();
public abstract String getFileExtension();
public final String getFileMimeType() {
return ((BIFile)((Object)this.getFileType().getInstance())).getMimeType();
}
public abstract void export(ExportOp var1) throws Exception;
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$file$BExporter;
if (clazz == null) {
clazz = class$javax$baja$file$BExporter = BExporter.class("[Ljavax.baja.file.BExporter;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,78 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import com.tridium.util.BRestrictedFileSpace;
import javax.baja.file.BFileSpace;
import javax.baja.file.BFileSystem;
import javax.baja.file.FilePath;
import javax.baja.naming.OrdQuery;
import javax.baja.naming.OrdTarget;
import javax.baja.space.BSpace;
import javax.baja.space.BSpaceScheme;
import javax.baja.sys.BObject;
import javax.baja.sys.BString;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BFileScheme
extends BSpaceScheme {
public static final BFileScheme INSTANCE = new BFileScheme("file");
public static final Type TYPE;
static /* synthetic */ Class class$javax$baja$file$BFileScheme;
public OrdQuery parse(String string) {
return new FilePath(this.getId(), string);
}
public Type getSpaceType() {
return BFileSpace.TYPE;
}
public OrdTarget resolve(OrdTarget ordTarget, OrdQuery ordQuery, BSpace bSpace) {
String string;
FilePath filePath = (FilePath)ordQuery;
BFileSpace bFileSpace = (BFileSpace)bSpace;
if (bFileSpace == BFileSystem.INSTANCE && ordTarget != null && (ordTarget.getUser() != null || ordTarget.getFacet("username") instanceof BString)) {
bFileSpace = BRestrictedFileSpace.INSTANCE;
}
if ((string = filePath.getBody()).equals("") || string.equals("/")) {
return new OrdTarget(ordTarget, bFileSpace);
}
return new OrdTarget(ordTarget, (BObject)((Object)bFileSpace.resolveFile(filePath)));
}
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());
}
}
protected BFileScheme(String string) {
super(string);
}
static {
Class clazz = class$javax$baja$file$BFileScheme;
if (clazz == null) {
clazz = class$javax$baja$file$BFileScheme = BFileScheme.class("[Ljavax.baja.file.BFileScheme;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,236 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import java.io.File;
import java.io.IOException;
import javax.baja.agent.AgentList;
import javax.baja.category.BCategoryMask;
import javax.baja.category.BCategoryService;
import javax.baja.category.BICategorizable;
import javax.baja.file.BDataFile;
import javax.baja.file.BDirectory;
import javax.baja.file.BIDirectory;
import javax.baja.file.BIFile;
import javax.baja.file.BIFileStore;
import javax.baja.file.BLocalFileStore;
import javax.baja.file.FilePath;
import javax.baja.file.FileUtil;
import javax.baja.naming.BOrd;
import javax.baja.naming.OrdTarget;
import javax.baja.naming.UnresolvedException;
import javax.baja.registry.TypeInfo;
import javax.baja.security.BIProtected;
import javax.baja.security.BPermissions;
import javax.baja.security.PermissionException;
import javax.baja.space.BSpace;
import javax.baja.sys.BIcon;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.LexiconText;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BFileSpace
extends BSpace
implements BIDirectory,
BICategorizable,
BIProtected {
public static final Type TYPE;
private static final BIcon icon;
static final BIFile[] NO_FILES;
static /* synthetic */ Class class$javax$baja$file$BFileSpace;
public Type getType() {
return TYPE;
}
public abstract BDirectory makeDir(FilePath var1, Context var2) throws IOException;
public final BDirectory makeDir(FilePath filePath) throws IOException {
return this.makeDir(filePath, null);
}
public abstract BIFile makeFile(FilePath var1, Context var2) throws IOException;
public final BIFile makeFile(FilePath filePath) throws IOException {
return this.makeFile(filePath, null);
}
public abstract void move(FilePath var1, FilePath var2, Context var3) throws IOException;
public final void move(FilePath filePath, FilePath filePath2) throws IOException {
this.move(filePath, filePath2, null);
}
public abstract void delete(FilePath var1, Context var2) throws IOException;
public final void delete(FilePath filePath) throws IOException {
this.delete(filePath, null);
}
public BOrd getAbsoluteOrd(FilePath filePath) {
return this.appendFilePathToOrd(this.getAbsoluteOrd(), filePath);
}
public BOrd getOrdInHost(FilePath filePath) {
return this.appendFilePathToOrd(this.getOrdInHost(), filePath);
}
public BOrd getOrdInSession(FilePath filePath) {
return this.appendFilePathToOrd(this.getOrdInSession(), filePath);
}
protected BOrd appendFilePathToOrd(BOrd bOrd, FilePath filePath) {
if (bOrd == null) {
return null;
}
if (bOrd.toString().length() == 0) {
return BOrd.make(filePath);
}
return BOrd.make(bOrd.toString() + filePath.getBody());
}
public BIFile findFile(FilePath filePath) {
BIFileStore bIFileStore = this.findStore(filePath);
if (bIFileStore != null) {
return this.makeFile(bIFileStore);
}
return null;
}
public abstract BIFileStore findStore(FilePath var1);
public BIFile resolveFile(FilePath filePath) {
BIFile bIFile = this.findFile(filePath);
if (bIFile == null) {
throw new UnresolvedException("" + filePath);
}
return bIFile;
}
public abstract BIFile getChild(BIFile var1, String var2);
public abstract BIFile[] getChildren(BIFile var1);
public BIFile makeFile(BIFileStore bIFileStore) {
if (bIFileStore.isDirectory()) {
return new BDirectory(bIFileStore);
}
String string = bIFileStore.getExtension();
if (string != null && string.length() > 0) {
TypeInfo typeInfo = Sys.getRegistry().getFileTypeForExtension(string);
try {
BIFile bIFile = (BIFile)((Object)typeInfo.getInstance());
bIFile.setStore(bIFileStore);
return bIFile;
}
catch (Throwable throwable) {
FileUtil.log.error("Cannot create file " + typeInfo + " for ext " + string, throwable);
}
}
return new BDataFile(bIFileStore);
}
public BPermissions getPermissionsFor(FilePath filePath, Context context) {
BPermissions bPermissions = BPermissions.all;
if (context == null || context.getUser() == null) {
return bPermissions;
}
try {
BLocalFileStore bLocalFileStore = new BLocalFileStore(this, filePath, new File("dummy"));
BDataFile bDataFile = new BDataFile(bLocalFileStore);
return context.getUser().getPermissionsFor(bDataFile);
}
catch (Exception exception) {
exception.printStackTrace();
return bPermissions;
}
}
public void checkReadPermission(FilePath filePath, Context context) {
if (!this.getPermissionsFor(filePath, context).hasOperatorRead()) {
throw new PermissionException("Missing operator read");
}
}
public void checkWritePermission(FilePath filePath, Context context) {
if (!this.getPermissionsFor(filePath, context).hasOperatorWrite()) {
throw new PermissionException("Missing operator write");
}
}
public BCategoryMask getCategoryMask() {
return BCategoryService.getService().getCategoryMask(this.getNavOrd());
}
public BCategoryMask getAppliedCategoryMask() {
return BCategoryService.getService().getAppliedCategoryMask(this.getNavOrd());
}
public BPermissions getPermissions(Context context) {
if (context != null && context.getUser() != null) {
return context.getUser().getPermissionsFor(this);
}
return BPermissions.all;
}
public boolean canRead(OrdTarget ordTarget) {
return ordTarget.getPermissionsForTarget().hasOperatorRead();
}
public boolean canWrite(OrdTarget ordTarget) {
return ordTarget.getPermissionsForTarget().hasOperatorWrite();
}
public boolean canInvoke(OrdTarget ordTarget) {
return ordTarget.getPermissionsForTarget().hasOperatorInvoke();
}
public AgentList getAgents(Context context) {
AgentList agentList = super.getAgents(context);
agentList.toTop("workbench:DirectoryList");
agentList.toTop("hx:HxDirectoryView");
agentList.toBottom("web:FileUploadView");
return agentList;
}
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());
}
}
public BFileSpace(String string, LexiconText lexiconText) {
super(string, lexiconText);
}
public BFileSpace(String string) {
super(string);
}
static {
Class clazz = class$javax$baja$file$BFileSpace;
if (clazz == null) {
clazz = class$javax$baja$file$BFileSpace = BFileSpace.class("[Ljavax.baja.file.BFileSpace;", false);
}
TYPE = Sys.loadType(clazz);
icon = BIcon.std("drive.png");
NO_FILES = new BIFile[0];
}
}
@@ -0,0 +1,537 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.SortUtil
* javax.baja.nre.util.TextUtil
*/
package javax.baja.file;
import com.tridium.sys.Nre;
import com.tridium.util.ArrayUtil;
import com.tridium.util.BRestrictedFileSpace;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import javax.baja.file.BAbstractFileStore;
import javax.baja.file.BDirectory;
import javax.baja.file.BFileSpace;
import javax.baja.file.BIFile;
import javax.baja.file.BIFileStore;
import javax.baja.file.BLocalFileStore;
import javax.baja.file.FilePath;
import javax.baja.file.FileUtil;
import javax.baja.log.Log;
import javax.baja.naming.BLocalHost;
import javax.baja.naming.BOrd;
import javax.baja.naming.UnresolvedException;
import javax.baja.nav.BINavNode;
import javax.baja.nav.BNavRoot;
import javax.baja.nav.NavEvent;
import javax.baja.nre.util.SortUtil;
import javax.baja.nre.util.TextUtil;
import javax.baja.spy.SpyWriter;
import javax.baja.sys.BIcon;
import javax.baja.sys.BString;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.LexiconText;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BFileSystem
extends BFileSpace {
public static final Type TYPE;
public static final BFileSystem INSTANCE;
static final Log log;
static ThreadLocal threadLocalContext;
private BOrd ordInHost;
private BOrd ordInSession;
private HashMap specials;
private BDirectory[] roots;
private String baseOrdSysHome;
private String baseOrdStationHome;
private String baseOrdStationToSysHome;
private BDirectory sysHome;
private BDirectory stationHome;
static /* synthetic */ Class class$javax$baja$file$BFileSystem;
public Type getType() {
return TYPE;
}
private final void init() {
Object object;
this.ordInHost = this.ordInSession = BOrd.make("file:");
ArrayList<BDirectory> arrayList = new ArrayList<BDirectory>();
this.specials = new HashMap();
File file = Sys.getBajaHome();
BLocalFileStore bLocalFileStore = new BLocalFileStore(this, new FilePath("!"), file);
this.sysHome = new BDirectory(bLocalFileStore, LexiconText.make("baja", "nav.sysHome"));
this.sysHome.icon = BIcon.std("home.png");
arrayList.add(this.sysHome);
this.specials.put("!", this.sysHome);
this.baseOrdSysHome = this.localFileToOrd(file).toString();
File file2 = Sys.getStationHome();
if (file2 != null) {
object = new BLocalFileStore(this, new FilePath("^"), file2);
this.stationHome = new BDirectory((BIFileStore)object, LexiconText.make("baja", "nav.stationHome"));
this.stationHome.icon = BIcon.std("database.png");
arrayList.add(this.stationHome);
this.specials.put("^", this.stationHome);
String string = file2.getPath().substring(file.getPath().length() + 1);
string = string.replace('\\', '/');
this.baseOrdStationHome = this.localFileToOrd(file2).toString();
this.baseOrdStationToSysHome = "local:|file:!" + string;
}
if (((File[])(object = File.listRoots())).length == 1 && object[0].getPath().equals("/")) {
object = object[0].listFiles();
}
int n = 0;
while (n < ((File[])object).length) {
BDirectory bDirectory = this.toRoot(object[n]);
bDirectory.icon = this.getIcon();
bDirectory.navParent = this;
arrayList.add(bDirectory);
this.specials.put("/" + TextUtil.toLowerCase((String)bDirectory.getFileName()), bDirectory);
++n;
}
this.roots = arrayList.toArray(new BDirectory[arrayList.size()]);
}
private final BDirectory toRoot(File file) {
try {
String string = file.getPath();
string = string.replace('\\', '/');
if (string.endsWith("/")) {
string = string.substring(0, string.length() - 1);
}
if (!string.startsWith("/")) {
string = "/" + string;
}
FilePath filePath = new FilePath(string);
BLocalFileStore bLocalFileStore = new BLocalFileStore(this, filePath, file);
return new BDirectory(bLocalFileStore);
}
catch (Exception exception) {
FileUtil.log.error("Cannot create root " + file, exception);
return null;
}
}
private final void syncRoots() {
File[] fileArray = File.listRoots();
if (fileArray.length == 1 && fileArray[0].getPath().equals("/")) {
fileArray = fileArray[0].listFiles();
}
BDirectory[] bDirectoryArray = new BDirectory[fileArray.length];
int n = 0;
while (n < fileArray.length) {
bDirectoryArray[n] = this.toRoot(fileArray[n]);
++n;
}
Object[] objectArray = this.specials.keySet().toArray();
int n2 = 0;
while (n2 < objectArray.length) {
BDirectory bDirectory = (BDirectory)this.specials.get(objectArray[n2]);
boolean bl = false;
int n3 = 0;
while (n3 < bDirectoryArray.length) {
if (bDirectoryArray[n3].equals(bDirectory)) {
bl = true;
break;
}
++n3;
}
if (!bl && !objectArray[n2].equals("!")) {
this.roots = (BDirectory[])ArrayUtil.removeOne((Object[])this.roots, bDirectory);
this.specials.remove(objectArray[n2]);
this.fireNavEvent(NavEvent.makeRemoved(this, bDirectory.getFileName(), null));
}
++n2;
}
n2 = 0;
while (n2 < bDirectoryArray.length) {
if (this.specials.get("/" + TextUtil.toLowerCase((String)bDirectoryArray[n2].getFileName())) == null) {
bDirectoryArray[n2].icon = this.getIcon();
bDirectoryArray[n2].navParent = this;
this.roots = (BDirectory[])ArrayUtil.addOne(this.roots, bDirectoryArray[n2]);
this.specials.put("/" + TextUtil.toLowerCase((String)bDirectoryArray[n2].getFileName()), bDirectoryArray[n2]);
this.fireNavEvent(NavEvent.makeAdded(this, bDirectoryArray[n2].getFileName(), null));
}
++n2;
}
}
public BDirectory getSysHome() {
return this.sysHome;
}
public BDirectory getStationHome() {
return this.stationHome;
}
public BDirectory makeDir(FilePath filePath, Context context) throws IOException {
this.checkWritePermission(filePath, context);
File file = this.pathToLocalFile(filePath);
NavEvent navEvent = this.precheckAddEvent(file);
if (file.exists()) {
if (!file.isDirectory()) {
throw new IOException("Exists as file: " + filePath.getBody());
}
} else {
file.mkdirs();
}
if (navEvent != null) {
this.fireNavEvent(navEvent);
}
return new BDirectory(new BLocalFileStore(INSTANCE, filePath, file));
}
public BIFile makeFile(FilePath filePath, Context context) throws IOException {
Object object;
this.checkWritePermission(filePath, context);
File file = this.pathToLocalFile(filePath);
NavEvent navEvent = this.precheckAddEvent(file);
if (file.exists()) {
if (file.isDirectory()) {
throw new IllegalArgumentException("Exists as dir: " + filePath.getBody());
}
} else {
object = new File(file.getParent());
if (!((File)object).exists()) {
((File)object).mkdirs();
}
}
if (!file.exists()) {
object = new FileOutputStream(file);
((FileOutputStream)object).close();
}
if (navEvent != null) {
this.fireNavEvent(navEvent);
}
return this.makeFile(new BLocalFileStore(INSTANCE, filePath, file));
}
public void move(FilePath filePath, FilePath filePath2, Context context) throws IOException {
File file;
File file2;
boolean bl;
this.checkWritePermission(filePath, context);
this.checkWritePermission(filePath2, context);
boolean bl2 = false;
if (filePath2.getBody().indexOf(47) < 0) {
bl2 = bl = true;
}
if (filePath2.isRelative()) {
filePath2 = filePath.getParent().merge(filePath2);
}
if (!(file2 = this.pathToLocalFile(filePath)).renameTo(file = this.pathToLocalFile(filePath2))) {
throw new IOException("Move: " + file2 + " -> " + file);
}
if (bl) {
BOrd bOrd = BOrd.make("local:|" + filePath.getParent());
this.fireNavEvent(NavEvent.makeRenamed(bOrd, filePath.getName(), filePath2.getName(), null));
} else {
BOrd bOrd = BOrd.make("local:|" + filePath.getParent());
this.fireNavEvent(NavEvent.makeRemoved(bOrd, filePath.getName(), null));
BOrd bOrd2 = BOrd.make("local:|" + filePath2.getParent());
this.fireNavEvent(NavEvent.makeAdded(bOrd2, filePath2.getName(), null));
}
}
public void delete(FilePath filePath, Context context) throws IOException {
this.checkWritePermission(filePath, context);
BIFile bIFile = this.findFile(filePath);
if (bIFile == null) {
return;
}
BLocalFileStore bLocalFileStore = (BLocalFileStore)bIFile.getStore();
File file = bLocalFileStore.getLocalFile();
FileUtil.delete(file);
File file2 = new File(file.getParent());
FilePath filePath2 = bIFile.getFilePath().getParent();
BDirectory bDirectory = new BDirectory(new BLocalFileStore(this, filePath2, file2));
NavEvent navEvent = NavEvent.makeRemoved(bDirectory.getNavOrd(), bIFile.getFileName(), null);
this.fireNavEvent(navEvent);
}
private final NavEvent precheckAddEvent(File file) {
if (file.exists()) {
return null;
}
File file2 = file;
File file3 = null;
while (!file2.exists()) {
file3 = file2;
file2 = new File(file2.getParent());
}
BOrd bOrd = this.localFileToOrd(file2);
String string = file3.getName();
return NavEvent.makeAdded(bOrd, string, null);
}
protected void fireNavEvent(NavEvent navEvent) {
BNavRoot.INSTANCE.fireNavEvent(navEvent);
String string = navEvent.getParentOrd().toString();
if (this.baseOrdStationHome != null) {
if (string.startsWith("local:|file:^")) {
String string2 = string.substring("local:|file:^".length());
if (string2.length() > 0) {
string2 = "/" + string2;
}
BOrd bOrd = BOrd.make(this.baseOrdStationHome + string2);
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd));
BOrd bOrd2 = BOrd.make(this.baseOrdStationToSysHome + string2);
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd2));
return;
}
if (string.startsWith(this.baseOrdStationToSysHome)) {
BOrd bOrd = BOrd.make(this.baseOrdSysHome + '/' + string.substring("local:|file:!".length()));
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd));
BOrd bOrd3 = string.length() == this.baseOrdStationToSysHome.length() ? BOrd.make("local:|file:^") : BOrd.make("local:|file:^" + string.substring(this.baseOrdStationToSysHome.length() + 1));
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd3));
return;
}
if (string.startsWith(this.baseOrdStationHome)) {
BOrd bOrd = string.length() == this.baseOrdStationHome.length() ? BOrd.make("local:|file:^") : BOrd.make("local:|file:^" + string.substring(this.baseOrdStationHome.length() + 1));
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd));
BOrd bOrd4 = BOrd.make("local:|file:!" + string.substring(this.baseOrdSysHome.length() + 1));
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd4));
return;
}
}
if (string.startsWith("local:|file:!")) {
String string3 = string.substring("local:|file:!".length());
if (string3.length() > 0) {
string3 = "/" + string3;
}
BOrd bOrd = BOrd.make(this.baseOrdSysHome + string3);
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd));
return;
}
if (string.startsWith(this.baseOrdSysHome)) {
BOrd bOrd = string.length() == this.baseOrdSysHome.length() ? BOrd.make("local:|file:!") : BOrd.make("local:|file:!" + string.substring(this.baseOrdSysHome.length() + 1));
BNavRoot.INSTANCE.fireNavEvent(NavEvent.make(navEvent, bOrd));
return;
}
}
public BIFile[] listFiles() {
return (BIFile[])this.roots.clone();
}
public File pathToLocalFile(FilePath filePath) {
String string = filePath.getBody();
if (filePath.isSysHomeAbsolute()) {
return new File(Sys.getBajaHome(), string.substring(1));
}
if (filePath.isStationHomeAbsolute()) {
File file = Sys.getStationHome();
if (file == null) {
throw new UnresolvedException("Not a station VM");
}
return new File(file, string.substring(1));
}
if (filePath.isLocalAbsolute()) {
if (filePath.depth() == 1) {
String string2 = filePath.nameAt(0);
int n = 0;
while (n < this.roots.length) {
if (this.roots[n].getFileName().equalsIgnoreCase(string2)) {
return ((BLocalFileStore)this.roots[n].getStore()).getLocalFile();
}
++n;
}
}
return new File(string);
}
throw new UnresolvedException("Relative path: " + string);
}
public FilePath localFileToPath(File file) {
try {
String string = file.getCanonicalPath();
string = string.replace('\\', '/');
if (string.endsWith("/")) {
string = string.substring(0, string.length() - 1);
}
if (!string.startsWith("/")) {
string = "/" + string;
}
return new FilePath(string);
}
catch (Exception exception) {
throw new UnresolvedException("Cannot map to path: " + file, exception);
}
}
public BOrd localFileToOrd(File file) {
return BOrd.make("local:|file:" + this.localFileToPath(file).getBody());
}
public BIFile findFile(FilePath filePath) {
BIFile bIFile = (BIFile)this.specials.get(TextUtil.toLowerCase((String)filePath.getBody()));
if (bIFile != null) {
return bIFile;
}
return super.findFile(filePath);
}
public BIFileStore findStore(FilePath filePath) {
File file = this.pathToLocalFile(filePath);
if (file.exists()) {
return new BLocalFileStore(this, filePath, file);
}
return null;
}
public BIFile getChild(BIFile bIFile, String string) {
File file;
BLocalFileStore bLocalFileStore = (BLocalFileStore)bIFile.getStore();
if (bLocalFileStore.isDirectory() && (file = new File(bLocalFileStore.getLocalFile(), string)).exists()) {
FilePath filePath = bLocalFileStore.getFilePath().merge(string);
return this.makeFile(new BLocalFileStore(this, filePath, file));
}
return null;
}
public BIFile[] getChildren(BIFile bIFile) {
Object object;
BRestrictedFileSpace bRestrictedFileSpace = null;
try {
object = (Context)threadLocalContext.get();
if (object != null && (object.getUser() != null || object.getFacet("username") instanceof BString)) {
bRestrictedFileSpace = BRestrictedFileSpace.INSTANCE;
}
}
catch (Throwable throwable) {}
object = (BLocalFileStore)bIFile.getStore();
File[] fileArray = ((BLocalFileStore)object).getLocalFile().listFiles();
if (fileArray == null || fileArray.length == 0) {
return NO_FILES;
}
ArrayList<BIFile> arrayList = new ArrayList<BIFile>(fileArray.length);
int n = 0;
while (n < fileArray.length) {
File file = fileArray[n];
String string = fileArray[n].getName();
if (!FilePath.isValidName(string)) {
log.warning("Unsupported file name \"" + string + '\"');
} else {
FilePath filePath = ((BAbstractFileStore)object).getFilePath().merge(string);
if (bRestrictedFileSpace == null || bRestrictedFileSpace.inScope(filePath)) {
arrayList.add(this.makeFile(new BLocalFileStore(this, filePath, file)));
}
}
++n;
}
Object[] objectArray = arrayList.toArray(new BIFile[arrayList.size()]);
SortUtil.sort((Object[])objectArray);
return objectArray;
}
public boolean hasNavChildren() {
return true;
}
public BINavNode getNavChild(String string) {
int n = 0;
while (n < this.roots.length) {
if (this.roots[n].getFileName().equals(string)) {
return this.roots[n];
}
++n;
}
return null;
}
public BINavNode[] getNavChildren() {
this.syncRoots();
try {
Context context = (Context)threadLocalContext.get();
if (context != null && (context.getUser() != null || context.getFacet("username") instanceof BString)) {
return new BINavNode[]{this.sysHome, this.stationHome};
}
}
catch (Throwable throwable) {}
return (BINavNode[])this.roots.clone();
}
public BOrd getOrdInHost() {
return this.ordInHost;
}
public BOrd getOrdInSession() {
return this.ordInSession;
}
/*
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void spy(SpyWriter spyWriter) throws Exception {
try {
threadLocalContext.set(spyWriter.getContext());
if (INSTANCE == this) {
BRestrictedFileSpace.INSTANCE.spy(spyWriter);
Object var3_2 = null;
threadLocalContext.set(null);
return;
}
super.spy(spyWriter);
spyWriter.startProps("FileSystem");
spyWriter.prop((Object)"sysHome", ((BLocalFileStore)this.getSysHome().getStore()).getLocalFile());
spyWriter.prop((Object)"stationHome", this.stationHome == null ? "null" : "" + ((BLocalFileStore)this.getStationHome().getStore()).getLocalFile());
spyWriter.prop((Object)"isFlash", Nre.getPlatform().isFlashFileSystem());
spyWriter.endProps();
}
catch (Throwable throwable) {
Object var3_3 = null;
threadLocalContext.set(null);
throw throwable;
}
{
Object var3_4 = null;
threadLocalContext.set(null);
return;
}
}
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 BFileSystem() {
super("file", LexiconText.make("baja", "nav.fileSystem"));
this.init();
}
static {
Class clazz = class$javax$baja$file$BFileSystem;
if (clazz == null) {
clazz = class$javax$baja$file$BFileSystem = BFileSystem.class("[Ljavax.baja.file.BFileSystem;", false);
}
TYPE = Sys.loadType(clazz);
INSTANCE = new BFileSystem();
BLocalHost.INSTANCE.addNavChild(INSTANCE);
log = Log.getLog("sys.file");
threadLocalContext = new ThreadLocal();
}
}
@@ -0,0 +1,25 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import javax.baja.file.BIFile;
import javax.baja.space.Mark;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIComponentFile
extends BIFile {
public static final Type TYPE;
public Mark readComponents() throws Exception;
static {
Class clazz = 1.class$javax$baja$file$BIComponentFile;
if (clazz == null) {
clazz = 1.class$javax$baja$file$BIComponentFile = 1.class("[Ljavax.baja.file.BIComponentFile;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,22 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import javax.baja.file.BIFile;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIDataFile
extends BIFile {
public static final Type TYPE;
static {
Class clazz = 1.class$javax$baja$file$BIDataFile;
if (clazz == null) {
clazz = 1.class$javax$baja$file$BIDataFile = 1.class("[Ljavax.baja.file.BIDataFile;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,25 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import javax.baja.file.BIFile;
import javax.baja.nav.BINavNode;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIDirectory
extends BINavNode {
public static final Type TYPE;
public BIFile[] listFiles();
static {
Class clazz = 1.class$javax$baja$file$BIDirectory;
if (clazz == null) {
clazz = 1.class$javax$baja$file$BIDirectory = 1.class("[Ljavax.baja.file.BIDirectory;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,71 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.baja.category.BICategorizable;
import javax.baja.file.BFileSpace;
import javax.baja.file.BIFileStore;
import javax.baja.file.FilePath;
import javax.baja.nav.BINavNode;
import javax.baja.security.BIProtected;
import javax.baja.space.BISpaceNode;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BIComparable;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIFile
extends BINavNode,
BISpaceNode,
BIComparable,
BICategorizable,
BIProtected {
public static final Type TYPE;
public BIFileStore getStore();
public void setStore(BIFileStore var1);
public BFileSpace getFileSpace();
public FilePath getFilePath();
public String getFileName();
public String getExtension();
public boolean isDirectory();
public String getMimeType();
public long getSize();
public BAbsTime getLastModified();
public boolean isReadonly();
public InputStream getInputStream() throws IOException;
public byte[] read() throws IOException;
public void delete() throws IOException;
public OutputStream getOutputStream() throws IOException;
public void write(byte[] var1) throws IOException;
public boolean equals(Object var1);
static {
Class clazz = 1.class$javax$baja$file$BIFile;
if (clazz == null) {
clazz = 1.class$javax$baja$file$BIFile = 1.class("[Ljavax.baja.file.BIFile;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,57 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.baja.file.BFileSpace;
import javax.baja.file.BIFile;
import javax.baja.file.FilePath;
import javax.baja.security.BPermissions;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BInterface;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIFileStore
extends BInterface {
public static final Type TYPE;
public BFileSpace getFileSpace();
public FilePath getFilePath();
public String getFileName();
public String getExtension();
public boolean isDirectory();
public long getSize();
public BAbsTime getLastModified();
public boolean isReadonly();
public BPermissions getPermissions(BIFile var1, Context var2);
public InputStream getInputStream() throws IOException;
public byte[] read() throws IOException;
public OutputStream getOutputStream() throws IOException;
public void write(byte[] var1) throws IOException;
static {
Class clazz = 1.class$javax$baja$file$BIFileStore;
if (clazz == null) {
clazz = 1.class$javax$baja$file$BIFileStore = 1.class("[Ljavax.baja.file.BIFileStore;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,163 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.baja.file.BAbstractFileStore;
import javax.baja.file.BFileSpace;
import javax.baja.file.FilePath;
import javax.baja.file.FileUtil;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BLocalFileStore
extends BAbstractFileStore {
public static final Type TYPE;
File file;
boolean initialized;
boolean isDirectory;
boolean isReadonly;
boolean isRemovable;
int hashCode;
static /* synthetic */ Class class$javax$baja$file$BLocalFileStore;
public File getLocalFile() {
return this.file;
}
public boolean isDirectory() {
if (!this.initialized) {
this.initialize();
}
return this.isDirectory;
}
public boolean isReadonly() {
if (!this.initialized) {
this.initialize();
}
return this.isReadonly;
}
public long getSize() {
if (!this.initialized) {
this.initialize();
}
if (this.isDirectory) {
return -1;
}
return this.file.length();
}
public BAbsTime getLastModified() {
if (!this.initialized) {
this.initialize();
}
if (this.isRemovable) {
return BAbsTime.NULL;
}
return BAbsTime.make(this.file.lastModified());
}
protected boolean doSetLastModified(BAbsTime bAbsTime) throws IOException {
if (!this.initialized) {
this.initialize();
}
return this.file.setLastModified(bAbsTime.getMillis());
}
public InputStream getInputStream() throws IOException {
return new FileInputStream(this.file);
}
public OutputStream getOutputStream() throws IOException {
return new FileOutputStream(this.file);
}
public void delete() throws IOException {
try {
FileUtil.delete(this.file);
}
catch (Exception exception) {
throw new IOException("Cannot delete: " + this.file);
}
}
public long getCrc() throws IOException {
if (this.isDirectory()) {
return -1;
}
return FileUtil.getCrc(this.getInputStream());
}
public int hashCode() {
if (!this.initialized) {
this.initialize();
}
return this.hashCode;
}
public boolean equals(Object object) {
if (object instanceof BLocalFileStore) {
BLocalFileStore bLocalFileStore = (BLocalFileStore)object;
return this.file.equals(bLocalFileStore.file);
}
return false;
}
private final void initialize() {
if (!this.initialized) {
this.initialized = true;
this.isRemovable = this.file.getPath().equals("A:\\");
if (this.isRemovable) {
this.isDirectory = true;
this.isReadonly = false;
} else {
this.isDirectory = this.file.isDirectory();
this.isReadonly = this.file.canWrite() ^ true;
}
this.hashCode = this.file.hashCode();
}
}
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 BLocalFileStore(BFileSpace bFileSpace, FilePath filePath, File file) {
super(bFileSpace, filePath);
this.file = file;
}
static {
Class clazz = class$javax$baja$file$BLocalFileStore;
if (clazz == null) {
clazz = class$javax$baja$file$BLocalFileStore = BLocalFileStore.class("[Ljavax.baja.file.BLocalFileStore;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,100 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.baja.file.BAbstractFileStore;
import javax.baja.file.BFileSpace;
import javax.baja.file.FilePath;
import javax.baja.io.ByteBuffer;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BMemoryFileStore
extends BAbstractFileStore {
public static final Type TYPE;
BAbsTime lastModified;
ByteBuffer buffer;
static /* synthetic */ Class class$javax$baja$file$BMemoryFileStore;
public boolean isDirectory() {
return false;
}
public boolean isReadonly() {
return false;
}
public long getSize() {
return this.buffer.getLength();
}
public BAbsTime getLastModified() {
return this.lastModified;
}
public byte[] read() throws IOException {
return this.buffer.toByteArray();
}
public final InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(this.read());
}
public final OutputStream getOutputStream() throws IOException {
this.lastModified = BAbsTime.make();
this.buffer = new ByteBuffer();
return this.buffer.getOutputStream();
}
public boolean equals(Object object) {
boolean bl = false;
if (this == object) {
bl = true;
}
return bl;
}
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.buffer = new ByteBuffer();
}
public BMemoryFileStore(BFileSpace bFileSpace, FilePath filePath) {
super(bFileSpace, filePath);
this.this();
}
static {
Class clazz = class$javax$baja$file$BMemoryFileStore;
if (clazz == null) {
clazz = class$javax$baja$file$BMemoryFileStore = BMemoryFileStore.class("[Ljavax.baja.file.BMemoryFileStore;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,351 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.Array
*/
package javax.baja.file;
import com.tridium.sys.Nre;
import com.tridium.util.BRestrictedFileSpace;
import java.io.IOException;
import java.util.ArrayList;
import javax.baja.file.BDirectory;
import javax.baja.file.BFileSpace;
import javax.baja.file.BFileSystem;
import javax.baja.file.BIFile;
import javax.baja.file.BIFileStore;
import javax.baja.file.BLocalFileStore;
import javax.baja.file.FilePath;
import javax.baja.naming.BOrd;
import javax.baja.naming.UnresolvedException;
import javax.baja.nav.BINavNode;
import javax.baja.nre.util.Array;
import javax.baja.spy.SpyWriter;
import javax.baja.sys.BString;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.LexiconText;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BScopedFileSpace
extends BFileSpace {
public static final Type TYPE;
public static final BScopedFileSpace SYS_HOME;
public static final BScopedFileSpace STATION_HOME;
static final String FILE_OUT_OF_SCOPE_ERROR = "File path is out of scope: ";
private BOrd ordInHost;
private BOrd ordInSession;
private BIFile[] roots;
private boolean includeSysHome;
private boolean includeStationHome;
private BDirectory root;
private FilePath scope;
static /* synthetic */ Class class$javax$baja$file$BScopedFileSpace;
static /* synthetic */ Class class$javax$baja$file$BIFile;
public Type getType() {
return TYPE;
}
private final void init() {
if (this.root == null) {
BIFile bIFile = BFileSystem.INSTANCE.resolveFile(this.scope);
if (!bIFile.isDirectory()) {
throw new IllegalStateException("Illegal scope, not a directory: " + this.scope.getBody());
}
BDirectory bDirectory = (BDirectory)bIFile;
this.ordInHost = this.ordInSession = BOrd.make(this.scope);
ArrayList<BIFile> arrayList = new ArrayList<BIFile>();
this.includeSysHome = this.inDirectory(bDirectory, new FilePath("!"));
boolean bl = false;
if (this.includeSysHome || this.inDirectory(bDirectory, new FilePath("^"))) {
bl = this.includeStationHome = true;
}
if (this.includeSysHome) {
arrayList.add(BFileSystem.INSTANCE.getSysHome());
}
if (this.includeStationHome) {
arrayList.add(BFileSystem.INSTANCE.getStationHome());
}
BIFile[] bIFileArray = bDirectory.listFiles();
int n = 0;
while (n < bIFileArray.length) {
if (!this.isBlacklisted(bIFileArray[n])) {
arrayList.add(bIFileArray[n]);
}
++n;
}
this.roots = arrayList.toArray(new BIFile[arrayList.size()]);
this.root = bDirectory;
}
}
private final boolean inDirectory(BDirectory bDirectory, FilePath filePath) {
FilePath filePath2 = filePath;
BDirectory bDirectory2 = BFileSystem.INSTANCE.getSysHome();
BDirectory bDirectory3 = BFileSystem.INSTANCE.getStationHome();
boolean bl = false;
if (this.includeSysHome && bDirectory2 != null) {
bl = true;
}
boolean bl2 = bl;
boolean bl3 = false;
if (this.includeStationHome && bDirectory3 != null) {
bl3 = true;
}
boolean bl4 = bl3;
while (filePath2 != null) {
BIFile bIFile = null;
try {
bIFile = BFileSystem.INSTANCE.resolveFile(filePath2);
}
catch (Exception exception) {
bIFile = null;
}
if (bIFile != null) {
if (this.isBlacklisted(bIFile)) {
return false;
}
if (bDirectory.equals(bIFile) || bl2 && bDirectory2.equals(bIFile) || bl4 && bDirectory3.equals(bIFile)) {
return true;
}
filePath2 = bIFile.getFilePath().getParent();
continue;
}
filePath2 = filePath2.getParent();
}
return false;
}
public boolean inScope(FilePath filePath) {
this.init();
return this.inDirectory(this.root, filePath);
}
public boolean isBlacklisted(BIFile bIFile) {
return false;
}
protected FilePath scopedPathToAbsPath(FilePath filePath) {
switch (filePath.getAbsoluteMode()) {
case 0: {
return this.scope.merge(filePath);
}
case 2: {
return this.scope.merge(new FilePath(filePath.getScheme(), filePath.getBody().substring(1)));
}
case 3:
case 4: {
if (!this.inScope(filePath)) break;
return filePath;
}
}
return null;
}
public FilePath getScope() {
return this.scope;
}
public BDirectory makeDir(FilePath filePath, Context context) throws IOException {
FilePath filePath2 = this.scopedPathToAbsPath(filePath);
if (filePath2 == null || !this.inScope(filePath2)) {
throw new UnresolvedException(FILE_OUT_OF_SCOPE_ERROR + filePath.getBody());
}
return BFileSystem.INSTANCE.makeDir(filePath2, context);
}
public BIFile makeFile(FilePath filePath, Context context) throws IOException {
FilePath filePath2 = this.scopedPathToAbsPath(filePath);
if (filePath2 == null || !this.inScope(filePath2)) {
throw new UnresolvedException(FILE_OUT_OF_SCOPE_ERROR + filePath.getBody());
}
return BFileSystem.INSTANCE.makeFile(filePath2, context);
}
public void move(FilePath filePath, FilePath filePath2, Context context) throws IOException {
FilePath filePath3 = this.scopedPathToAbsPath(filePath);
if (filePath3 == null || !this.inScope(filePath3)) {
throw new UnresolvedException(FILE_OUT_OF_SCOPE_ERROR + filePath.getBody());
}
FilePath filePath4 = null;
if (filePath2.getBody().indexOf(47) < 0 || filePath2.isRelative()) {
filePath4 = filePath2;
} else {
filePath4 = this.scopedPathToAbsPath(filePath2);
if (filePath4 == null || !this.inScope(filePath4)) {
throw new UnresolvedException(FILE_OUT_OF_SCOPE_ERROR + filePath2.getBody());
}
}
BFileSystem.INSTANCE.move(filePath3, filePath4, context);
}
public void delete(FilePath filePath, Context context) throws IOException {
FilePath filePath2 = this.scopedPathToAbsPath(filePath);
if (filePath2 == null || !this.inScope(filePath2)) {
return;
}
BFileSystem.INSTANCE.delete(filePath2, context);
}
public BIFile[] listFiles() {
this.init();
return (BIFile[])this.roots.clone();
}
public BIFile findFile(FilePath filePath) {
FilePath filePath2 = this.scopedPathToAbsPath(filePath);
if (filePath2 == null || !this.inScope(filePath2)) {
return null;
}
return BFileSystem.INSTANCE.findFile(filePath2);
}
public BIFileStore findStore(FilePath filePath) {
FilePath filePath2 = this.scopedPathToAbsPath(filePath);
if (filePath2 == null || !this.inScope(filePath2)) {
return null;
}
return BFileSystem.INSTANCE.findStore(filePath2);
}
public BIFile getChild(BIFile bIFile, String string) {
FilePath filePath;
BIFile bIFile2 = BFileSystem.INSTANCE.getChild(bIFile, string);
if (bIFile2 != null && !this.inScope(filePath = bIFile2.getFilePath())) {
return null;
}
return bIFile2;
}
public BIFile[] getChildren(BIFile bIFile) {
int n;
FilePath filePath = bIFile.getFilePath();
if (!this.inScope(filePath)) {
return NO_FILES;
}
BIFile[] bIFileArray = BFileSystem.INSTANCE.getChildren(bIFile);
int n2 = 0;
if (bIFileArray != null) {
n2 = bIFileArray.length;
}
if ((n = n2) < 1) {
return bIFileArray;
}
Class clazz = class$javax$baja$file$BIFile;
if (clazz == null) {
clazz = class$javax$baja$file$BIFile = BScopedFileSpace.class("[Ljavax.baja.file.BIFile;", false);
}
Array array = new Array(clazz, n);
int n3 = 0;
while (n3 < n) {
if (!this.isBlacklisted(bIFileArray[n3])) {
array.add((Object)bIFileArray[n3]);
}
++n3;
}
return (BIFile[])array.trim();
}
public boolean hasNavChildren() {
return true;
}
public BINavNode getNavChild(String string) {
this.init();
int n = 0;
while (n < this.roots.length) {
if (this.roots[n].getFileName().equals(string)) {
return this.roots[n];
}
++n;
}
return null;
}
public BINavNode[] getNavChildren() {
this.init();
if (this == BRestrictedFileSpace.INSTANCE) {
try {
Context context = (Context)BFileSystem.threadLocalContext.get();
if (context != null && (context.getUser() != null || context.getFacet("username") instanceof BString)) {
return new BINavNode[]{BFileSystem.INSTANCE.getSysHome(), BFileSystem.INSTANCE.getStationHome()};
}
}
catch (Throwable throwable) {}
}
return (BINavNode[])this.roots.clone();
}
public BOrd getOrdInHost() {
this.init();
return this.ordInHost;
}
public BOrd getOrdInSession() {
this.init();
return this.ordInSession;
}
public void spy(SpyWriter spyWriter) throws Exception {
BDirectory bDirectory;
super.spy(spyWriter);
this.init();
spyWriter.startProps("ScopedFileSpace");
spyWriter.prop((Object)"scopeHome", ((BLocalFileStore)this.root.getStore()).getLocalFile());
if (this.includeSysHome) {
bDirectory = BFileSystem.INSTANCE.getSysHome();
spyWriter.prop((Object)"sysHome", bDirectory == null ? "null" : "" + ((BLocalFileStore)bDirectory.getStore()).getLocalFile());
}
if (this.includeStationHome) {
bDirectory = BFileSystem.INSTANCE.getStationHome();
spyWriter.prop((Object)"stationHome", bDirectory == null ? "null" : "" + ((BLocalFileStore)bDirectory.getStore()).getLocalFile());
}
spyWriter.prop((Object)"isFlash", Nre.getPlatform().isFlashFileSystem());
spyWriter.endProps();
}
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.includeSysHome = false;
this.includeStationHome = false;
this.root = null;
}
public BScopedFileSpace(FilePath filePath, String string, LexiconText lexiconText) {
super(string, lexiconText);
this.this();
this.scope = filePath;
try {
this.init();
}
catch (Exception exception) {}
}
static {
Class clazz = class$javax$baja$file$BScopedFileSpace;
if (clazz == null) {
clazz = class$javax$baja$file$BScopedFileSpace = BScopedFileSpace.class("[Ljavax.baja.file.BScopedFileSpace;", false);
}
TYPE = Sys.loadType(clazz);
SYS_HOME = new BScopedFileSpace(new FilePath("!"), "sysFileSpace", LexiconText.make("baja", "nav.sysHome"));
STATION_HOME = new BScopedFileSpace(new FilePath("^"), "stationFileSpace", LexiconText.make("baja", "nav.stationHome"));
}
}
@@ -0,0 +1,218 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import java.util.HashMap;
import javax.baja.file.BDataFile;
import javax.baja.file.BIFileStore;
import javax.baja.log.Log;
import javax.baja.naming.BOrd;
import javax.baja.nav.BINavNode;
import javax.baja.nav.BNavRoot;
import javax.baja.nav.NavEvent;
import javax.baja.space.BSpace;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BFacets;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BSubSpaceFile
extends BDataFile {
public static final Type TYPE;
public static final Log log;
private static HashMap cache;
static /* synthetic */ Class class$javax$baja$file$BSubSpaceFile;
public boolean isOpen() {
boolean bl = false;
if (cache.get(this.getAbsoluteOrd()) != null) {
bl = true;
}
return bl;
}
public BSpace getSubSpace() {
CacheItem cacheItem = (CacheItem)cache.get(this.getAbsoluteOrd());
return cacheItem != null ? cacheItem.space : null;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public static BSubSpaceFile[] listOpen() {
HashMap hashMap = cache;
synchronized (hashMap) {
CacheItem[] cacheItemArray = cache.values().toArray(new CacheItem[cache.size()]);
BSubSpaceFile[] bSubSpaceFileArray = new BSubSpaceFile[cacheItemArray.length];
int n = 0;
while (n < bSubSpaceFileArray.length) {
log.trace("ListIsOpen[" + n + "]: " + cacheItemArray[n].file.getAbsoluteOrd());
bSubSpaceFileArray[n] = cacheItemArray[n].file;
++n;
}
return bSubSpaceFileArray;
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public BSpace open() {
HashMap hashMap = cache;
synchronized (hashMap) {
BOrd bOrd = this.getAbsoluteOrd();
CacheItem cacheItem = (CacheItem)cache.get(bOrd);
if (cacheItem != null) {
if (cacheItem.openTimestamp == cacheItem.file.getLastModified().getMillis()) {
return cacheItem.space;
}
log.warning("File has been modified: " + cacheItem.file);
this.close(false);
}
log.trace("Open: " + bOrd);
cacheItem = new CacheItem();
cacheItem.space = this.doOpen();
cacheItem.file = this;
cacheItem.openTimestamp = this.getLastModified().getMillis();
cache.put(bOrd, cacheItem);
return cacheItem.space;
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void save() throws Exception {
block3: {
CacheItem cacheItem = null;
HashMap hashMap = cache;
synchronized (hashMap) {
BOrd bOrd = this.getAbsoluteOrd();
log.trace("Save: " + bOrd);
cacheItem = (CacheItem)cache.get(bOrd);
// MONITOREXIT @DISABLED, blocks:[0, 1] lbl8 : MonitorExitStatement: MONITOREXIT : var2_2
if (cacheItem == null) break block3;
}
cacheItem.file.doSave();
cacheItem.openTimestamp = cacheItem.file.getLastModified().getMillis();
}
}
public void reload() throws Exception {
this.close(false);
this.open();
}
public void close() {
this.close(true);
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
void close(boolean bl) {
block4: {
BOrd bOrd;
CacheItem cacheItem = null;
HashMap hashMap = cache;
synchronized (hashMap) {
bOrd = this.getAbsoluteOrd();
log.trace("Close: " + bOrd);
cacheItem = (CacheItem)cache.get(bOrd);
if (cacheItem != null) {
log.trace("isModified: " + cacheItem.file.isModified());
cacheItem.file.doClose();
cacheItem.openTimestamp = 0L;
cache.remove(bOrd);
}
// MONITOREXIT @DISABLED, blocks:[0, 1] lbl14 : MonitorExitStatement: MONITOREXIT : var3_3
if (cacheItem == null) break block4;
bOrd = cacheItem.file.getNavParent().getNavOrd();
}
String string = cacheItem.file.getFileName();
BFacets bFacets = bl ? BFacets.make("close", BBoolean.TRUE) : BFacets.NULL;
BNavRoot.INSTANCE.fireNavEvent(NavEvent.makeReplaced(bOrd, string, (Context)bFacets));
}
}
public abstract boolean isModified();
protected abstract BSpace doOpen();
protected abstract void doSave() throws Exception;
protected abstract void doClose();
public boolean hasNavChildren() {
return true;
}
public BINavNode getNavChild(String string) {
return this.open().getNavChild(string);
}
public BINavNode[] getNavChildren() {
return this.open().getNavChildren();
}
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 BSubSpaceFile(BIFileStore bIFileStore) {
super(bIFileStore);
}
public BSubSpaceFile() {
}
static {
Class clazz = class$javax$baja$file$BSubSpaceFile;
if (clazz == null) {
clazz = class$javax$baja$file$BSubSpaceFile = BSubSpaceFile.class("[Ljavax.baja.file.BSubSpaceFile;", false);
}
TYPE = Sys.loadType(clazz);
log = Log.getLog("subSpaceFile");
cache = new HashMap();
}
static class CacheItem {
public long openTimestamp;
public BSubSpaceFile file;
public BSpace space;
CacheItem() {
}
}
}
@@ -0,0 +1,35 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import java.io.OutputStream;
import javax.baja.naming.OrdTarget;
public abstract class ExportOp
extends OrdTarget {
public static ExportOp make(OrdTarget ordTarget, OutputStream outputStream) throws Exception {
return new BasicExportOp(ordTarget, outputStream);
}
public abstract OutputStream getOutputStream();
protected ExportOp(OrdTarget ordTarget) {
super(ordTarget);
}
static class BasicExportOp
extends ExportOp {
OutputStream out;
public OutputStream getOutputStream() {
return this.out;
}
BasicExportOp(OrdTarget ordTarget, OutputStream outputStream) {
super(ordTarget);
this.out = outputStream;
}
}
}
@@ -0,0 +1,496 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.TextUtil
*/
package javax.baja.file;
import javax.baja.naming.OrdQuery;
import javax.baja.naming.OrdQueryList;
import javax.baja.naming.Path;
import javax.baja.naming.SyntaxException;
import javax.baja.nre.util.TextUtil;
import javax.baja.sys.IllegalNameException;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class FilePath
implements OrdQuery,
Path,
Comparable {
public static final int RELATIVE = 0;
public static final int AUTHORITY_ABSOLUTE = 1;
public static final int LOCAL_ABSOLUTE = 2;
public static final int SYS_HOME_ABSOLUTE = 3;
public static final int STATION_HOME_ABSOLUTE = 4;
private static final String[] NO_NAMES = new String[0];
private String scheme;
private String body;
private int absMode;
private String authority;
private int backupDepth;
private String[] names;
private String fragment;
protected FilePath newInstance(String string) {
return new FilePath(this.getScheme(), string);
}
public boolean isAbsolute() {
boolean bl = false;
if (this.absMode != 0) {
bl = true;
}
return bl;
}
public boolean isRelative() {
boolean bl = false;
if (this.absMode == 0) {
bl = true;
}
return bl;
}
public int getAbsoluteMode() {
return this.absMode;
}
public boolean isAuthorityAbsolute() {
boolean bl = false;
if (this.absMode == 1) {
bl = true;
}
return bl;
}
public boolean isLocalAbsolute() {
boolean bl = false;
if (this.absMode == 2) {
bl = true;
}
return bl;
}
public boolean isSysHomeAbsolute() {
boolean bl = false;
if (this.absMode == 3) {
bl = true;
}
return bl;
}
public boolean isStationHomeAbsolute() {
boolean bl = false;
if (this.absMode == 4) {
bl = true;
}
return bl;
}
public String getAbsoluteBase() {
switch (this.absMode) {
case 0: {
return "";
}
case 1: {
return "//" + this.authority + '/';
}
case 2: {
return "/";
}
case 3: {
return "!";
}
case 4: {
return "^";
}
}
throw new IllegalStateException();
}
public String getAuthority() {
return this.authority;
}
public String getFragment() {
return this.fragment;
}
public String getName() {
if (this.names.length == 0) {
return this.getAbsoluteBase();
}
return this.names[this.names.length - 1];
}
public int getBackupDepth() {
return this.backupDepth;
}
public int depth() {
return this.names.length;
}
public String nameAt(int n) {
return this.names[n];
}
public String[] getNames() {
return (String[])this.names.clone();
}
public Path getParentPath() {
return this.getParent();
}
public FilePath getParent() {
int n;
if (this.names.length == 0) {
return null;
}
StringBuffer stringBuffer = new StringBuffer();
if (this.isAbsolute()) {
stringBuffer.append(this.getAbsoluteBase());
} else {
n = this.getBackupDepth();
int n2 = 0;
while (n2 < n) {
stringBuffer.append("../");
++n2;
}
}
n = 0;
while (n < this.names.length - 1) {
if (n > 0) {
stringBuffer.append('/');
}
stringBuffer.append(this.names[n]);
++n;
}
return this.newInstance(stringBuffer.toString());
}
public static boolean isValidName(String string) {
try {
int n = string.length();
if (n == 0) {
return false;
}
int n2 = 0;
while (n2 < n) {
char c = string.charAt(n2);
if (!FilePath.isName(c) || c == ':') {
return false;
}
++n2;
}
return true;
}
catch (Exception exception) {
return false;
}
}
public static void verifyValidName(String string) {
if (!FilePath.isValidName(string)) {
throw new IllegalNameException("baja", "IllegalNameException.name", new Object[]{string});
}
}
public String getScheme() {
return this.scheme;
}
public String getBody() {
return this.body;
}
public boolean isHost() {
return false;
}
public boolean isSession() {
return false;
}
public void normalize(OrdQueryList ordQueryList, int n) {
if (ordQueryList.isSameScheme(n, n + 1)) {
FilePath filePath = (FilePath)ordQueryList.get(n + 1);
ordQueryList.merge(n, this.merge(filePath));
}
ordQueryList.shiftToSession(n);
}
public FilePath merge(String string) {
return this.merge(this.newInstance(string));
}
public FilePath merge(FilePath filePath) {
if (filePath.isAbsolute()) {
if (this.isAuthorityAbsolute() && !filePath.isAuthorityAbsolute()) {
return this.newInstance("//" + this.authority + filePath.body);
}
return filePath;
}
if (this.isAbsolute() || filePath.getBackupDepth() < this.depth()) {
StringBuffer stringBuffer = new StringBuffer(this.getAbsoluteBase());
boolean bl = false;
int n = 0;
while (n < this.depth() - filePath.getBackupDepth()) {
if (bl) {
stringBuffer.append('/');
} else {
bl = true;
}
stringBuffer.append(this.nameAt(n));
++n;
}
n = 0;
while (n < filePath.depth()) {
if (bl) {
stringBuffer.append('/');
} else {
bl = true;
}
stringBuffer.append(filePath.nameAt(n));
++n;
}
if (filePath.fragment != null) {
stringBuffer.append('#').append(filePath.fragment);
}
return this.newInstance(stringBuffer.toString());
}
throw new SyntaxException("Invalid merge " + this + " + " + filePath);
}
public String toString() {
return this.scheme + ':' + this.body;
}
void parse() {
try {
if (this.body.length() == 0) {
return;
}
String string = this.body;
int n = this.body.indexOf(35);
if (n >= 0) {
this.fragment = this.body.substring(n + 1);
this.body = this.body.substring(0, n);
}
int n2 = this.parsePrefix();
this.parseNames(n2);
this.body = string;
}
catch (SyntaxException syntaxException) {
throw syntaxException;
}
catch (Throwable throwable) {
throw new SyntaxException(this.body, throwable);
}
}
int parsePrefix() {
String string = this.body;
int n = string.length();
int n2 = -1;
if (n > 0) {
n2 = string.charAt(0);
}
int n3 = -1;
if (n > 1) {
n3 = string.charAt(1);
}
if (n2 == 47) {
if (n3 == 47) {
this.absMode = 1;
int n4 = string.indexOf(47, 3);
if (n4 < 0) {
this.authority = string.substring(2, n);
this.checkAuthority(this.authority);
return n;
}
this.authority = string.substring(2, n4);
this.checkAuthority(this.authority);
return n4 + 1;
}
this.absMode = 2;
return this.skipSlash(string, 1);
}
if (n2 == 33) {
this.absMode = 3;
return 1;
}
if (n2 == 94) {
this.absMode = 4;
return 1;
}
if (n2 == 46) {
this.absMode = 0;
return this.parseBackup();
}
this.absMode = 0;
return 0;
}
int parseBackup() {
String string = this.body;
int n = string.length();
if (n == 1) {
throw new SyntaxException("Dot not supported: " + string);
}
char c = string.charAt(1);
if (c != '.') {
if (c == '/') {
throw new SyntaxException("Dot/ not supported: " + string);
}
return 0;
}
int n2 = 0;
while (n2 < n) {
int n3;
char c2 = string.charAt(n2);
int n4 = n2 + 1 < n ? (int)string.charAt(n2 + 1) : -1;
int n5 = n3 = n2 + 2 < n ? (int)string.charAt(n2 + 2) : 47;
if (c2 != '.') {
return n2;
}
if (n4 != 46) {
if (n4 == 47) {
throw new SyntaxException("Single dot unsupported: " + string);
}
return n2;
}
if (n3 != 47) {
throw new SyntaxException("Expecting ../ backup: " + string);
}
++this.backupDepth;
n2 += 3;
}
return n;
}
void parseNames(int n) {
String string;
String string2 = this.body;
int n2 = string2.length();
if (n >= n2) {
return;
}
if (string2.charAt(n2 - 1) == '/') {
throw new SyntaxException("Trailing slash: " + string2);
}
String[] stringArray = new String[64];
int n3 = 0;
int n4 = n;
while (n4 < n2) {
char c = string2.charAt(n4);
if (c == '/') {
if (n4 == n) {
throw new SyntaxException("Illegal double slashes: " + string2);
}
string = string2.substring(n, n4);
if (string.startsWith("..")) {
throw new SyntaxException("Illegal backup in path: " + string2);
}
stringArray[n3++] = string;
n = n4 + 1;
} else if (!FilePath.isName(c)) {
throw new SyntaxException("Illegal char '" + (char)c + "' in body: " + string2);
}
++n4;
}
string = string2.substring(n, n2);
if (string.startsWith("..")) {
throw new SyntaxException("Illegal backup in path: " + string2);
}
stringArray[n3++] = string;
this.names = new String[n3];
System.arraycopy(stringArray, 0, this.names, 0, n3);
}
int skipSlash(String string, int n) {
if (n >= string.length()) {
return n;
}
if (string.charAt(n) == '/') {
return n + 1;
}
return n;
}
void checkAuthority(String string) {
if (string.length() == 0) {
throw new SyntaxException("Missing authority name: " + this.body);
}
int n = 0;
while (n < string.length()) {
if (!FilePath.isAuthority(string.charAt(n))) {
throw new SyntaxException("Illegal char '" + string.charAt(n) + "' in authority: " + this.body);
}
++n;
}
}
public int hashCode() {
return (this.scheme + ':' + this.body).hashCode();
}
public boolean equals(Object object) {
if (!(object instanceof FilePath)) {
return false;
}
if (!this.body.equals(((FilePath)object).body)) {
return false;
}
return this.scheme.equals(((FilePath)object).scheme);
}
public int compareTo(Object object) {
if (!(object instanceof FilePath)) {
return 0;
}
if (!this.scheme.equals(((FilePath)object).scheme)) {
return this.scheme.compareTo(((FilePath)object).scheme);
}
return this.body.compareTo(((FilePath)object).body);
}
static boolean isName(int n) {
boolean bl = false;
if (n <= 31 || n == 127 || n == 34 || n == 92 || n == 60 || n == 62 || n == 63 || n == 42 || n == 47 || n == 124) {
bl = true;
}
return bl ^ true;
}
static boolean isAuthority(int n) {
boolean bl = false;
if (n >= 97 && n <= 122 || n >= 65 && n <= 90 || n >= 48 && n <= 57 || n == 95 || n == 46 || n == 45) {
bl = true;
}
return bl;
}
private final /* synthetic */ void this() {
this.names = NO_NAMES;
}
public FilePath(String string, String string2) throws SyntaxException {
this.this();
this.scheme = TextUtil.toLowerCase((String)string).trim();
this.body = string2.trim();
this.parse();
}
public FilePath(String string) throws SyntaxException {
this.this();
this.scheme = "file";
this.body = string.trim();
this.parse();
}
}
@@ -0,0 +1,507 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.SortUtil
*/
package javax.baja.file;
import java.io.BufferedReader;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.TimeZone;
import java.util.zip.CRC32;
import javax.baja.file.BIFile;
import javax.baja.file.BIFileStore;
import javax.baja.log.Log;
import javax.baja.nre.util.SortUtil;
public class FileUtil {
static Log log = Log.getLog("sys.file");
public static String getBase(String string) {
if (string == null) {
return null;
}
int n = string.lastIndexOf(46);
if (n >= 1) {
return string.substring(0, n);
}
return string;
}
public static String getExtension(String string) {
if (string == null) {
return null;
}
int n = string.lastIndexOf(46);
if (n >= 1) {
return string.substring(n + 1);
}
return null;
}
public static byte[] read(BIFileStore bIFileStore) throws IOException {
return FileUtil.read(bIFileStore.getInputStream(), bIFileStore.getSize());
}
public static byte[] read(InputStream inputStream, long l) throws IOException {
if (l < 0L || l > Integer.MAX_VALUE) {
throw new IOException("Invalid size " + l);
}
int n = (int)l;
byte[] byArray = new byte[n];
int n2 = 0;
while (n2 < n) {
int n3 = inputStream.read(byArray, n2, n - n2);
if (n3 < 0) {
throw new IOException("Unexpected EOF");
}
n2 += n3;
}
inputStream.close();
return byArray;
}
public static void write(BIFileStore bIFileStore, byte[] byArray) throws IOException {
OutputStream outputStream = bIFileStore.getOutputStream();
outputStream.write(byArray);
outputStream.close();
}
/*
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public static void pipe(BIFile bIFile, BIFile bIFile2) throws IOException {
InputStream inputStream = null;
OutputStream outputStream = null;
try {
inputStream = bIFile.getInputStream();
outputStream = bIFile2.getOutputStream();
long l = bIFile.getSize();
if (l >= 0L) {
FileUtil.pipe(inputStream, l, outputStream);
} else {
FileUtil.pipe(inputStream, outputStream);
}
}
catch (Throwable throwable) {
Object var5_6 = null;
try {
if (inputStream != null) {
inputStream.close();
}
}
catch (Exception exception) {}
try {
if (outputStream == null) throw throwable;
outputStream.close();
throw throwable;
}
catch (Exception exception) {}
throw throwable;
}
{
Object var5_7 = null;
}
try {}
catch (Exception exception) {}
if (inputStream != null) {
inputStream.close();
}
try {}
catch (Exception exception) {
return;
}
if (outputStream == null) return;
outputStream.close();
}
public static void pipe(InputStream inputStream, long l, OutputStream outputStream) throws IOException {
int n = 4096;
byte[] byArray = new byte[n];
while (l > 0L) {
int n2 = inputStream.read(byArray, 0, (int)Math.min(l, (long)n));
if (n2 <= 0) {
throw new IOException("Unexpected EOF");
}
outputStream.write(byArray, 0, n2);
l -= (long)n2;
}
}
public static void pipe(InputStream inputStream, OutputStream outputStream) throws IOException {
int n;
int n2 = 4096;
byte[] byArray = new byte[n2];
while ((n = inputStream.read(byArray, 0, n2)) >= 0) {
outputStream.write(byArray, 0, n);
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public static long getCrc(InputStream inputStream) throws IOException {
long l;
block3: {
try {
int n;
byte[] byArray = new byte[4096];
CRC32 cRC32 = new CRC32();
while ((n = inputStream.read(byArray)) > 0) {
cRC32.update(byArray, 0, n);
}
l = cRC32.getValue();
Object var2_5 = null;
if (inputStream == null) break block3;
}
catch (Throwable throwable) {
block4: {
Object var2_6 = null;
if (inputStream == null) break block4;
inputStream.close();
}
throw throwable;
}
inputStream.close();
}
return l;
}
public static File renameToBackup(File file, int n) {
try {
String string = file.getName();
String string2 = string.substring(0, string.indexOf(46));
File[] fileArray = FileUtil.getBackups(file.getParentFile(), string2);
int n2 = Math.max(0, n - 1);
while (n2 < fileArray.length) {
fileArray[n2].delete();
++n2;
}
if (n != 0) {
return FileUtil.renameToBackup(file);
}
}
catch (Throwable throwable) {
throwable.printStackTrace();
}
return null;
}
public static File renameToBackup(File file) throws Exception {
if (!file.exists()) {
return null;
}
File file2 = new File(file.getParent());
String string = file.getName();
String string2 = "";
int n = string.lastIndexOf(46);
if (n > 0) {
string2 = string.substring(n);
string = string.substring(0, n);
}
String string3 = "yyMMdd_HHmm";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(string3);
simpleDateFormat.setTimeZone(TimeZone.getDefault());
String string4 = simpleDateFormat.format(new Date(file.lastModified()));
File file3 = new File(file2, string + "_backup_" + string4 + string2);
int n2 = 1;
while (file3.exists()) {
file3 = new File(file2, string + "_backup_" + string4 + '_' + n2 + string2);
++n2;
}
if (!file.renameTo(file3)) {
throw new IOException("Cannot rename");
}
return file3;
}
public static File[] getBackups(File file, String string) {
Object[] objectArray;
ArrayList<Object[]> arrayList = new ArrayList<Object[]>();
File[] fileArray = file.listFiles();
int n = 0;
while (n < fileArray.length) {
objectArray = fileArray[n];
String string2 = objectArray.getName();
if (string2.startsWith(string) && string2.indexOf("_backup_") >= 0) {
arrayList.add(objectArray);
}
++n;
}
Object[] objectArray2 = arrayList.toArray(new File[arrayList.size()]);
objectArray = new Long[objectArray2.length];
int n2 = 0;
while (n2 < objectArray2.length) {
objectArray[n2] = new Long(((File)objectArray2[n2]).lastModified());
++n2;
}
SortUtil.rsort((Object[])objectArray, (Object[])objectArray2);
return objectArray2;
}
public static void move(File file, File file2) throws IOException {
log.trace("Move: " + file + " -> " + file2);
if (file2.exists()) {
throw new IOException("Cannot move to existing file: " + file2);
}
if (!file.renameTo(file2)) {
throw new IOException("Cannot move: " + file + " -> " + file2);
}
}
public static void copy(File file, File file2) throws IOException {
log.trace("Copy: " + file + " -> " + file2);
if (file2.exists()) {
throw new IOException("Cannot copy to existing file: " + file2);
}
if (file.isDirectory()) {
FileUtil.copyDir(file, file2);
} else {
FileUtil.copyFile(file, file2);
}
}
public static void copyDir(File file, File file2) throws IOException {
if (!file2.exists() && !file2.mkdirs()) {
throw new IOException("Cannot make dir: " + file2);
}
File[] fileArray = file.listFiles();
int n = 0;
while (n < fileArray.length) {
FileUtil.copy(fileArray[n], new File(file2, fileArray[n].getName()));
++n;
}
file2.setLastModified(file.lastModified());
}
/*
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public static void copyFile(File file, File file2) throws IOException {
FileOutputStream fileOutputStream;
block14: {
fileOutputStream = null;
FileInputStream fileInputStream = null;
try {
fileOutputStream = new FileOutputStream(file2);
fileInputStream = new FileInputStream(file);
byte[] byArray = new byte[4096];
long l = file.length();
long l2 = 0L;
while (l2 < l) {
int n = fileInputStream.read(byArray, 0, byArray.length);
if (n < 0) {
throw new EOFException();
}
fileOutputStream.write(byArray, 0, n);
l2 += (long)n;
}
}
catch (Throwable throwable) {
Object var5_9 = null;
if (fileInputStream != null) {
try {
fileInputStream.close();
}
catch (IOException iOException) {}
}
if (fileOutputStream == null) throw throwable;
try {
fileOutputStream.close();
throw throwable;
}
catch (IOException iOException) {}
throw throwable;
}
{
Object var5_10 = null;
if (fileInputStream == null) break block14;
}
try {}
catch (IOException iOException) {}
fileInputStream.close();
}
if (fileOutputStream != null) {
try {}
catch (IOException iOException) {}
fileOutputStream.close();
}
if (!file2.exists()) return;
file2.setLastModified(file.lastModified());
}
public static void delete(File file) throws IOException {
log.trace("Delete: " + file);
if (!file.exists()) {
return;
}
if (file.isDirectory()) {
File[] fileArray = file.listFiles();
int n = 0;
while (n < fileArray.length) {
FileUtil.delete(fileArray[n]);
++n;
}
}
if (!file.delete()) {
throw new IOException("Cannot delete: " + file);
}
}
public static boolean diff(BufferedReader bufferedReader, BufferedReader bufferedReader2) throws IOException {
int n = 1;
boolean bl = false;
String string = bufferedReader.readLine();
String string2 = bufferedReader2.readLine();
while (string != null || string2 != null) {
if (string == null || string2 == null || !string.equals(string2)) {
bl = true;
}
++n;
if (string != null) {
string = bufferedReader.readLine();
}
if (string2 == null) continue;
string2 = bufferedReader2.readLine();
}
return bl;
}
public static String readString(File file) throws IOException {
return FileUtil.readString(new FileReader(file));
}
public static String readString(BIFile bIFile) throws IOException {
return FileUtil.readString(new InputStreamReader(bIFile.getInputStream()));
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public static String readString(Reader reader) throws IOException {
String string;
try {
String string2;
StringBuffer stringBuffer = new StringBuffer();
BufferedReader bufferedReader = new BufferedReader(reader);
while ((string2 = bufferedReader.readLine()) != null) {
stringBuffer.append(string2).append("\n");
}
string = stringBuffer.toString();
Object var2_5 = null;
}
catch (Throwable throwable) {
Object var2_6 = null;
reader.close();
throw throwable;
}
reader.close();
return string;
}
public static String[] readLines(File file) throws IOException {
return FileUtil.readLines(new FileReader(file));
}
public static String[] readLines(BIFile bIFile) throws IOException {
return FileUtil.readLines(new InputStreamReader(bIFile.getInputStream()));
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public static String[] readLines(Reader reader) throws IOException {
String[] stringArray;
try {
String string;
ArrayList<String> arrayList = new ArrayList<String>();
BufferedReader bufferedReader = new BufferedReader(reader);
while ((string = bufferedReader.readLine()) != null) {
arrayList.add(string);
}
stringArray = arrayList.toArray(new String[arrayList.size()]);
Object var2_5 = null;
}
catch (Throwable throwable) {
Object var2_6 = null;
reader.close();
throw throwable;
}
reader.close();
return stringArray;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public static FileInfo getFileInfo(InputStream inputStream) throws IOException {
FileInfo fileInfo;
block3: {
FileInfo fileInfo2 = new FileInfo();
try {
int n;
byte[] byArray = new byte[4096];
CRC32 cRC32 = new CRC32();
while ((n = inputStream.read(byArray)) > 0) {
fileInfo2.size += (long)n;
cRC32.update(byArray, 0, n);
}
fileInfo2.crc = cRC32.getValue();
fileInfo = fileInfo2;
Object var3_6 = null;
if (inputStream == null) break block3;
}
catch (Throwable throwable) {
block4: {
Object var3_7 = null;
if (inputStream == null) break block4;
inputStream.close();
}
throw throwable;
}
inputStream.close();
}
return fileInfo;
}
public static void main(String[] stringArray) throws Exception {
System.out.println(FileUtil.diff(new BufferedReader(new FileReader(stringArray[0])), new BufferedReader(new FileReader(stringArray[1]))) ? "MISMATCH" : "match");
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public static class FileInfo {
public long size;
public long crc;
private final /* synthetic */ void this() {
this.size = 0L;
this.crc = 0L;
}
public FileInfo() {
this.this();
}
}
}
@@ -0,0 +1,37 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file;
import javax.baja.file.BIDirectory;
import javax.baja.file.BIFile;
import javax.baja.sys.Context;
import javax.baja.util.Lexicon;
public interface IFileFilter {
public static final IFileFilter directory = new IFileFilter(){
public final boolean accept(BIFile bIFile) {
return bIFile instanceof BIDirectory;
}
public final String getDescription(Context context) {
return Lexicon.make("baja", context).getText("fileFilter.dirOnly");
}
};
public static final IFileFilter all = new IFileFilter(){
public final boolean accept(BIFile bIFile) {
return true;
}
public final String getDescription(Context context) {
return Lexicon.make("baja", context).getText("fileFilter.all");
}
};
public boolean accept(BIFile var1);
public String getDescription(Context var1);
}
@@ -0,0 +1,118 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file.zip;
import javax.baja.file.BIFileStore;
import javax.baja.file.BLocalFileStore;
import javax.baja.file.BSubSpaceFile;
import javax.baja.file.zip.BZipSpace;
import javax.baja.naming.BOrd;
import javax.baja.space.BSpace;
import javax.baja.sys.BIcon;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BZipFile
extends BSubSpaceFile {
private static final BIcon icon = BIcon.std("files/zip.png");
public static final Type TYPE;
BZipSpace zipSpace;
static /* synthetic */ Class class$javax$baja$file$zip$BZipFile;
public boolean isModified() {
return false;
}
protected BSpace doOpen() {
if (this.zipSpace == null) {
this.zipSpace = new BZipSpace(this);
}
return this.zipSpace;
}
protected void doSave() throws Exception {
}
/*
* 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
*/
protected void doClose() {
if (this.zipSpace == null) return;
try {
this.zipSpace.close();
}
catch (Throwable throwable) {
Object var2_2 = null;
this.zipSpace = null;
throw throwable;
}
{
Object var2_3 = null;
this.zipSpace = null;
return;
}
}
public boolean hasNavChildren() {
return this.getStore() instanceof BLocalFileStore;
}
public BZipSpace getZipSpace() {
return (BZipSpace)this.getSubSpace();
}
public String getMimeType() {
return "application/zip";
}
public BOrd getNavOrd() {
if (this.getStore() instanceof BLocalFileStore) {
return BOrd.make(super.getNavOrd(), "zip:");
}
return super.getNavOrd();
}
public BIcon getIcon() {
return icon;
}
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 BZipFile(BIFileStore bIFileStore) {
super(bIFileStore);
}
public BZipFile() {
}
static {
Class clazz = class$javax$baja$file$zip$BZipFile;
if (clazz == null) {
clazz = class$javax$baja$file$zip$BZipFile = BZipFile.class("[Ljavax.baja.file.zip.BZipFile;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,100 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nre.util.SortUtil
*/
package javax.baja.file.zip;
import java.util.HashMap;
import javax.baja.file.BAbstractFileStore;
import javax.baja.file.BDirectory;
import javax.baja.file.BIFile;
import javax.baja.file.FilePath;
import javax.baja.file.zip.BZipSpace;
import javax.baja.nre.util.SortUtil;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BZipFileDirectory
extends BAbstractFileStore {
public static final Type TYPE;
private HashMap byName;
private BIFile[] byList;
static /* synthetic */ Class class$javax$baja$file$zip$BZipFileDirectory;
BDirectory getOrMakeDir(String string) {
BDirectory bDirectory = (BDirectory)this.byName.get(string);
if (bDirectory == null) {
BZipSpace bZipSpace = (BZipSpace)this.getFileSpace();
FilePath filePath = this.getFilePath().merge(string);
BZipFileDirectory bZipFileDirectory = new BZipFileDirectory(bZipSpace, filePath);
bDirectory = new BDirectory(bZipFileDirectory);
this.byName.put(string, bDirectory);
}
return bDirectory;
}
BIFile get(String string) {
return (BIFile)this.byName.get(string);
}
BIFile[] list() {
if (this.byList == null) {
this.byList = this.byName.values().toArray(new BIFile[this.byName.size()]);
SortUtil.sort((Object[])this.byList);
}
return this.byList;
}
void add(BIFile bIFile) {
this.byName.put(bIFile.getFileName(), bIFile);
}
public boolean isDirectory() {
return true;
}
public boolean isReadonly() {
return true;
}
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.byName = new HashMap();
this.byList = null;
}
public BZipFileDirectory(BZipSpace bZipSpace, FilePath filePath) {
super(bZipSpace, filePath);
this.this();
}
static {
Class clazz = class$javax$baja$file$zip$BZipFileDirectory;
if (clazz == null) {
clazz = class$javax$baja$file$zip$BZipFileDirectory = BZipFileDirectory.class("[Ljavax.baja.file.zip.BZipFileDirectory;", false);
}
TYPE = Sys.loadType(clazz);
}
}
@@ -0,0 +1,92 @@
/*
* Decompiled with CFR 0.152.
*/
package javax.baja.file.zip;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import javax.baja.file.BAbstractFileStore;
import javax.baja.file.FilePath;
import javax.baja.file.zip.BZipSpace;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BZipFileEntry
extends BAbstractFileStore {
public static final Type TYPE;
ZipEntry zipEntry;
BAbsTime modified;
static /* synthetic */ Class class$javax$baja$file$zip$BZipFileEntry;
public ZipEntry getZipEntry() {
return this.zipEntry;
}
public boolean isDirectory() {
return false;
}
public boolean isReadonly() {
return true;
}
public long getSize() {
return this.zipEntry.getSize();
}
public BAbsTime getLastModified() {
if (this.modified == null) {
this.modified = BAbsTime.make(this.zipEntry.getTime());
}
return this.modified;
}
public InputStream getInputStream() throws IOException {
BZipSpace bZipSpace = (BZipSpace)this.getFileSpace();
return bZipSpace.getZip().getInputStream(this.zipEntry);
}
public long getCrc() throws IOException {
return this.zipEntry.getCrc();
}
public int hashCode() {
return this.zipEntry.hashCode();
}
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 BZipFileEntry(BZipSpace bZipSpace, FilePath filePath, ZipEntry zipEntry) {
super(bZipSpace, filePath);
this.zipEntry = zipEntry;
}
static {
Class clazz = class$javax$baja$file$zip$BZipFileEntry;
if (clazz == null) {
clazz = class$javax$baja$file$zip$BZipFileEntry = BZipFileEntry.class("[Ljavax.baja.file.zip.BZipFileEntry;", false);
}
TYPE = Sys.loadType(clazz);
}
}

Some files were not shown because too many files have changed in this diff Show More